ILBool _IL_Object_Equals(ILExecThread *thread, ILObject *_this, ILObject *obj) { ILClass *classInfo; ILUInt32 size; /* Handle the easy cases first */ if(_this == obj) { return 1; } else if(!obj) { return 0; } /* Check to see if both are value types with the same type */ classInfo = GetObjectClass(_this); if(classInfo != GetObjectClass(obj) || !ILClassIsValueType(classInfo)) { return 0; } /* Perform a bitwise comparison on the values */ size = ILSizeOfType(thread, ILClassToType(classInfo)); if(!size) { return 1; } else { return !ILMemCmp((void *)_this, (void *)obj, size); } }
/* * public static bool ClrSetTypedReference(TypedReference target, * Object value); */ ILBool _IL_TypedReference_ClrSetTypedReference(ILExecThread *_thread, ILTypedRef target, ILObject *value) { ILType *type; if(target.type == 0 || target.value == 0) { /* This is an invalid typed reference */ return 0; } type = ILClassToType(target.type); if(ILType_IsPrimitive(type) || ILType_IsValueType(type)) { if(!ILExecThreadUnbox(_thread, type, value, target.value)) { return 0; } return 1; } else if(ILTypeAssignCompatible (ILProgramItem_Image(_thread->method), (value ? ILClassToType(GetObjectClass(value)) : 0), type)) { *((ILObject **)(target.value)) = value; return 1; } else { return 0; } }
ILObject *_IL_Object_GetType(ILExecThread *thread, ILObject *_this) { ILObject *obj; /* Check if _this is Null. */ if(_this == 0) { ILExecThreadThrowSystem(thread, "System.NullReferenceException", (const char *)0); return 0; } /* Does the class already have a "ClrType" instance? */ if(GetObjectClassPrivate(_this)->clrType) { return GetObjectClassPrivate(_this)->clrType; } /* Create a new "ClrType" instance for the "ILClass" structure */ obj = _ILGetClrType(thread, GetObjectClass(_this)); if(!obj) { return 0; } /* Return the object to the caller */ return obj; }
ILObject *_IL_Object_MemberwiseClone(ILExecThread *thread, ILObject *_this) { ILObject *obj; /* Test for arrays, which must be cloned differently */ if(_ILIsSArray((System_Array *)_this)) { return _ILCloneSArray(thread, (System_Array *)_this); } #ifdef IL_CONFIG_NON_VECTOR_ARRAYS else if(_ILIsMArray((System_Array *)_this)) { return _ILCloneMArray(thread, (System_MArray *)_this); } #endif /* Allocate a new object of the same class */ obj = _ILEngineAllocObject(thread, GetObjectClass(_this)); if(!obj) { return 0; } /* Copy the contents of "this" into the new object */ if(GetObjectClassPrivate(_this)->size != 0) { ILMemCpy(obj, _this, GetObjectClassPrivate(_this)->size); } /* Return the cloned object to the caller */ return obj; }
nsIGlobalObject * GetNativeForGlobal(JSObject *obj) { MOZ_ASSERT(JS_IsGlobalObject(obj)); if (!MaybeGetObjectScope(obj)) return nullptr; // Every global needs to hold a native as its private or be a // WebIDL object with an nsISupports DOM object. MOZ_ASSERT((GetObjectClass(obj)->flags & (JSCLASS_PRIVATE_IS_NSISUPPORTS | JSCLASS_HAS_PRIVATE)) || dom::UnwrapDOMObjectToISupports(obj)); nsISupports *native = dom::UnwrapDOMObjectToISupports(obj); if (!native) { native = static_cast<nsISupports *>(js::GetObjectPrivate(obj)); MOZ_ASSERT(native); // In some cases (like for windows) it is a wrapped native, // in other cases (sandboxes, backstage passes) it's just // a direct pointer to the native. If it's a wrapped native // let's unwrap it first. if (nsCOMPtr<nsIXPConnectWrappedNative> wn = do_QueryInterface(native)) { native = wn->Native(); } } nsCOMPtr<nsIGlobalObject> global = do_QueryInterface(native); MOZ_ASSERT(global, "Native held by global needs to implement nsIGlobalObject!"); return global; }
/* * public RuntimeTypeHandle GetNextArgType(); */ void _IL_ArgIterator_GetNextArgType(ILExecThread *_thread, void *_result, void *_this) { ArgIterator *iter = (ArgIterator *)_this; ILObject *object; if(iter->un.argIter.args && iter->un.argIter.posn < ArrayLength(iter->un.argIter.args)) { /* Extract the next object and determine its type */ object = ((ILObject **)ArrayToBuffer(iter->un.argIter.args)) [iter->un.argIter.posn]; if(object) { *((ILClass **)_result) = GetObjectClass(object); } else { /* Points at a "null" object reference */ *((ILClass **)_result) = _thread->process->objectClass; } } else { /* We've reached the end of the argument list */ ILExecThreadThrowSystem(_thread, "System.InvalidOperationException", "Invalid_BadEnumeratorPosition"); *((ILClass **)_result) = _thread->process->objectClass; } }
NetCenter::NetCenter(JNIEnv* jni, jobject j_observer) :_run_flg(false), j_observer_global_(jni, j_observer), j_observer_class_(jni, GetObjectClass(jni, *j_observer_global_)) { loop_thread_ = std::make_shared<Thread>(); spcket_service_ = std::make_shared<PhysicalSocketServer>(); }
ActivityState* ActivityState::create(ANativeActivity* activity) { JOP_ASSERT(ns_instance == nullptr, "There must only be one ActivityState!"); ns_instance.reset(new ActivityState); ns_instance->nativeActivity = activity; ANativeActivity_setWindowFlags(activity, AWINDOW_FLAG_KEEP_SCREEN_ON, AWINDOW_FLAG_KEEP_SCREEN_ON); Thread::attachJavaThread(activity->vm, activity->env); // Get the screen size { auto env = Thread::getCurrentJavaEnv(); if (!env) { JOP_DEBUG_ERROR("No current java environment, function \"" << __func__ << "\""); return get(); } jclass activityClass = env->GetObjectClass(activity->clazz); jclass displayMetricsClass = env->FindClass("android/util/DisplayMetrics"); jmethodID displayMetricsInit = env->GetMethodID(displayMetricsClass, "<init>", "()V"); jobject displayMetricsObject = env->NewObject(displayMetricsClass, displayMetricsInit); jmethodID getWindowManagerMethod = env->GetMethodID(activityClass, "getWindowManager", "()Landroid/view/WindowManager;"); jobject windowManagerObject = env->CallObjectMethod(activity->clazz, getWindowManagerMethod); jclass windowManagerClass = env->FindClass("android/view/WindowManager"); jmethodID getDefaultDisplayMethod = env->GetMethodID(windowManagerClass, "getDefaultDisplay", "()Landroid/view/Display;"); jobject displayObject = env->CallObjectMethod(windowManagerObject, getDefaultDisplayMethod); jclass displayClass = env->FindClass("android/view/Display"); jmethodID getMetricsMethod = env->GetMethodID(displayClass, "getMetrics", "(Landroid/util/DisplayMetrics;)V"); env->CallVoidMethod(displayObject, getMetricsMethod, displayMetricsObject); jfieldID pixelsWidth = env->GetFieldID(displayMetricsClass, "widthPixels", "I"); jfieldID pixelsHeight = env->GetFieldID(displayMetricsClass, "heightPixels", "I"); ns_instance->screenSize.x = env->GetIntField(displayMetricsObject, pixelsWidth); ns_instance->screenSize.y = env->GetIntField(displayMetricsObject, pixelsHeight); //jmethodID getRefreshRateMethod = env->GetMethodID(displayClass, "getRefreshRate", "(Landroid/view/Display;)F"); ns_instance->screenRefreshRate = 60;//env->CallFloatMethod(displayObject, getRefreshRateMethod); env->DeleteLocalRef(activityClass); env->DeleteLocalRef(displayMetricsObject); env->DeleteLocalRef(windowManagerObject); env->DeleteLocalRef(windowManagerClass); env->DeleteLocalRef(displayObject); env->DeleteLocalRef(displayClass); } return get(); }
/* * Do the real delegate invokation. */ static void _DelegateInvoke(ILDelegateInvokeParams *params) { ILMethod *method; ILType *type; ILUInt32 size; PackDelegateUserData userData; /* If this is a multicast delegate, then execute "prev" first */ if(params->delegate->prev) { ILDelegateInvokeParams prevParams; prevParams.thread = params->thread; prevParams.cif = params->cif; prevParams.result = params->result; prevParams.args = params->args; prevParams.delegate = (System_Delegate *)(params->delegate->prev); ; _DelegateInvoke(&prevParams); if(_ILExecThreadHasException(params->thread)) { return; } } /* Extract the method from the delegate */ method = params->delegate->methodInfo; if(!method) { ILExecThreadThrowSystem(params->thread, "System.MissingMethodException", (const char *)0); return; } /* Call the method */ userData.args = params->args; userData.pinvokeInfo = (ILMethod *)ILTypeGetDelegateMethod (ILType_FromClass(GetObjectClass(params->delegate))); userData.needThis = 0; if(_ILCallMethod(params->thread, method, UnpackDelegateResult, params->result, 0, params->delegate->target, PackDelegateParams, &userData)) { /* An exception occurred, which is already stored in the thread */ type = ILMethod_Signature(method); type = ILTypeGetEnumType(ILTypeGetReturn(type)); if(type != ILType_Void) { /* Clear the native return value, because we cannot assume that the native caller knows how to handle exceptions */ size = ILSizeOfType(params->thread, type); ILMemZero(params->result, size); } } }
bool _isAvailable() { auto env = spjni::getJniEnv(); auto clipboard = spjni::getService(spjni::Service::Clipboard, env); auto clipboardClass = env->GetObjectClass(clipboard); auto method = spjni::getMethodID(env, clipboardClass, "isClipboardAvailable", "()Z"); if (method) { return env->CallBooleanMethod(clipboard, method); } return false; }
void _copyString(const std::string &value) { auto env = spjni::getJniEnv(); auto clipboard = spjni::getService(spjni::Service::Clipboard, env); auto clipboardClass = env->GetObjectClass(clipboard); auto method = spjni::getMethodID(env, clipboardClass, "copyStringToClipboard", "(Ljava/lang/String;)V"); if (method) { auto str = env->NewStringUTF(value.c_str()); env->CallVoidMethod(clipboard, method, str); env->DeleteLocalRef(str); } }
std::string _getString() { auto env = spjni::getJniEnv(); auto clipboard = spjni::getService(spjni::Service::Clipboard, env); auto clipboardClass = env->GetObjectClass(clipboard); auto method = spjni::getMethodID(env, clipboardClass, "getStringFromClipboard", "()Ljava/lang/String;"); if (method) { auto strObj = (jstring)env->CallObjectMethod(clipboard, method); if (strObj) { return spjni::jStringToStdString(env, strObj); } } return ""; }
void platformSetOrientation(int orientation) { auto env = gApp->activity->env; auto vm = gApp->activity->vm; auto obj = gApp->activity->clazz; vm->AttachCurrentThread( &env, NULL ); auto clazz = env->GetObjectClass(obj); jmethodID orientationID = env->GetMethodID(clazz, "setOrientation", "(I)V"); env->CallVoidMethod(obj, orientationID, orientation); vm->DetachCurrentThread(); }
uint32_t platformLanIP() { auto env = gApp->activity->env; auto vm = gApp->activity->vm; auto obj = gApp->activity->clazz; vm->AttachCurrentThread( &env, NULL ); auto clazz = env->GetObjectClass(obj); jmethodID methodID = env->GetMethodID(clazz, "getLanIp", "()I"); auto result = env->CallIntMethod(obj, methodID); vm->DetachCurrentThread(); return result; }
int platformVibrate(uint64_t milliseconds) { auto env = gApp->activity->env; auto vm = gApp->activity->vm; auto obj = gApp->activity->clazz; vm->AttachCurrentThread( &env, NULL ); auto clazz = env->GetObjectClass(obj); jmethodID vibrateID = env->GetMethodID(clazz, "vibrate", "(J)I"); auto result = env->CallIntMethod(obj, vibrateID, milliseconds); vm->DetachCurrentThread(); return result; }
/* * private static TypedReference ClrMakeTypedReference(Object target, * FieldInfo[] flds); */ ILTypedRef _IL_TypedReference_ClrMakeTypedReference(ILExecThread *_thread, ILObject *target, System_Array *flds) { ILClass *classInfo; ILInt32 index; ILUInt32 offset; ILTypedRef ref; ILField *field; /* Get the initial class and offset */ classInfo = GetObjectClass(target); offset = 0; /* Resolve the fields within the object, level by level */ for(index = 0; index < ArrayLength(flds); ++index) { field = *((ILField **)(((ILObject **)(ArrayToBuffer(flds)))[index])); if(!field) { ILExecThreadThrowSystem (_thread, "System.ArgumentException", "Arg_MakeTypedRefFields"); ref.type = 0; ref.value = 0; return ref; } offset += field->offset; classInfo = ILClassFromType (ILContextNextImage(_thread->process->context, 0), 0, ILField_Type(field), 0); classInfo = ILClassResolve(classInfo); if(!classInfo || (index < (ArrayLength(flds) - 1) && !ILClassIsValueType(classInfo))) { ILExecThreadThrowSystem (_thread, "System.ArgumentException", "Arg_MakeTypedRefFields"); ref.type = 0; ref.value = 0; return ref; } } /* Populate the typed reference */ ref.type = (void *)classInfo; ref.value = (void *)(((unsigned char *)target) + offset); return ref; }
JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM *pjvm, void *reserved) { ILOG("JNI_OnLoad"); gJvm = pjvm; // cache the JavaVM pointer auto env = getEnv(); //replace with one of your classes in the line below auto randomClass = env->FindClass("org/ppsspp/ppsspp/NativeActivity"); jclass classClass = env->GetObjectClass(randomClass); auto classLoaderClass = env->FindClass("java/lang/ClassLoader"); auto getClassLoaderMethod = env->GetMethodID(classClass, "getClassLoader", "()Ljava/lang/ClassLoader;"); gClassLoader = env->NewGlobalRef(env->CallObjectMethod(randomClass, getClassLoaderMethod)); gFindClassMethod = env->GetMethodID(classLoaderClass, "findClass", "(Ljava/lang/String;)Ljava/lang/Class;"); return JNI_VERSION_1_6; }
/* * public TypedReference GetNextArg(); */ ILTypedRef _IL_ArgIterator_GetNextArg_(ILExecThread *_thread, void *_this) { ArgIterator *iter = (ArgIterator *)_this; ILTypedRef ref; ILObject **object; ILClass *classInfo; if(iter->un.argIter.args && iter->un.argIter.posn < ArrayLength(iter->un.argIter.args)) { /* Extract the next object and unpack it */ object = &(((ILObject **)ArrayToBuffer(iter->un.argIter.args)) [(iter->un.argIter.posn)++]); if(*object) { /* Determine if this is an object or a value type */ classInfo = GetObjectClass(*object); if(!ILClassIsValueType(classInfo)) { /* Object reference */ ref.type = classInfo; ref.value = (void *)object; } else { /* Value type reference */ ref.type = classInfo; ref.value = (void *)(*object); } } else { /* Points at a "null" object reference */ ref.type = _thread->process->objectClass; ref.value = (void *)object; } } else { /* We've reached the end of the argument list */ ILExecThreadThrowSystem(_thread, "System.InvalidOperationException", "Invalid_BadEnumeratorPosition"); ref.type = 0; ref.value = 0; } return ref; }
ncaiError JNICALL ncaiGetThreadInfo(ncaiEnv *env, ncaiThread thread, ncaiThreadInfo *info_ptr) { TRACE2("ncai.thread", "ncaiGetThreadsInfo called"); SuspendEnabledChecker sec; if (env == NULL) return NCAI_ERROR_INVALID_ENVIRONMENT; if (info_ptr == NULL) return NCAI_ERROR_NULL_POINTER; if (thread == NULL) return NCAI_ERROR_INVALID_THREAD; hythread_t hythread = reinterpret_cast<hythread_t>(thread); if (!ncai_thread_is_alive(hythread)) return NCAI_ERROR_THREAD_NOT_ALIVE; jthread java_thread = jthread_get_java_thread(hythread); if (java_thread != NULL) { JNIEnv* jni_env = jthread_get_vm_thread(hythread)->jni_env; jclass cl = GetObjectClass(jni_env, java_thread); jmethodID id = jni_env->GetMethodID(cl, "getName","()Ljava/lang/String;"); jstring name = jni_env->CallObjectMethod(java_thread, id); info_ptr->name = (char *)jni_env->GetStringUTFChars(name, NULL); info_ptr->kind = NCAI_THREAD_JAVA; return NCAI_ERROR_NONE; } info_ptr->kind = NCAI_THREAD_VM_INTERNAL; const char* name_int = "native_0x"; size_t name_len = strlen(name_int) + 4 + 1; info_ptr->name = (char*)ncai_alloc(name_len); assert(info_ptr->name); sprintf(info_ptr->name, "%s%04X", name_int, hythread_get_id(hythread)); return NCAI_ERROR_NONE; }
ILClass *_ILGetClrClass(ILExecThread *thread, ILObject *type) { if(type) { /* Make sure that "type" is an instance of "ClrType" */ if(ILClassInheritsFrom(GetObjectClass(type), thread->process->clrTypeClass)) { return (ILClass *)(((System_Reflection *)type)->privateData); } else { return 0; } } else { return 0; } }
static void callJNIReturnString(const char* str, char* result) { auto env = gApp->activity->env; auto vm = gApp->activity->vm; auto obj = gApp->activity->clazz; vm->AttachCurrentThread( &env, NULL ); auto clazz = env->GetObjectClass(obj); jmethodID methodID = env->GetMethodID(clazz, str, "()[B"); auto array = (jbyteArray)env->CallObjectMethod(obj, methodID); auto ptr = env->GetByteArrayElements(array, 0); int len = env->GetArrayLength(array); memcpy(result, ptr, len); result[len] = '\0'; env->ReleaseByteArrayElements(array, ptr, JNI_ABORT); vm->DetachCurrentThread(); }
bool nuiSimpleContainer::DelChild(nuiWidgetPtr pChild) { CheckValid(); NGL_ASSERT(pChild->GetParent() == this) if (GetDebug()) { NGL_OUT(_T("[%s] Del Child 0x%x <--- 0x%x (%s)\n"), GetObjectClass().GetChars(), this, pChild); } nuiWidgetList::iterator it = mpChildren.begin(); nuiWidgetList::iterator end = mpChildren.end(); for ( ; it != end; ++it) { if (*it == pChild) { mpChildren.erase(it); if (!pChild->IsTrashed()) { nuiTopLevel* pRoot = GetTopLevel(); Trashed(); Invalidate(); if (pRoot) pRoot->AdviseObjectDeath(pChild); pChild->SetParent(NULL); } ChildDeleted(this, pChild); Invalidate(); InvalidateLayout(); DebugRefreshInfo(); pChild->Release(); return true; } } DebugRefreshInfo(); return false; }
bool nuiSimpleContainer::AddChild(nuiWidgetPtr pChild) { CheckValid(); if (GetDebug()) { NGL_OUT(_T("[%s] Add Child 0x%x <--- 0x%x\n"), GetObjectClass().GetChars(), this, pChild); } pChild->Acquire(); nuiContainer* pParent = pChild->GetParent(); NGL_ASSERT(pParent != this); uint32 capacity = mpChildren.capacity(); uint32 size = mpChildren.size(); if (size == capacity) { if (size < 128) { mpChildren.reserve(size * 2); } else { mpChildren.reserve(size + 128); } } mpChildren.push_back(pChild); if (pParent) pParent->DelChild(pChild); // Remove from previous parent... pChild->SetParent(this); ChildAdded(this, pChild); Invalidate(); InvalidateLayout(); DebugRefreshInfo(); return true; }
HRESULT SObject::DefAttributeProc(const SStringW & strAttribName,const SStringW & strValue, BOOL bLoading) { SLOGFMTW(L"warning!!! unhandled attribute %s in class %s, value = %s",strAttribName,GetObjectClass(),strValue); return E_FAIL; }
/* * Class: java_lang_VMClassRegistry * Method: getClass * Signature: (Ljava/lang/Object;)Ljava/lang/Class; */ JNIEXPORT jclass JNICALL Java_java_lang_VMClassRegistry_getClassNative (JNIEnv *jenv, jclass, jobject jobj) { // use JNI API function return GetObjectClass(jenv, jobj); }
static void* SyncThreadMain( void* ctx ) { int i_id, i_ret, i; char psz_id[9]; IXML_Document *actResult = NULL; char* psz_class = NULL; PZQSESSION p_session = ( PZQSESSION) ctx; PZDEVICE p_device = p_session->p_device; PCP_DEV_NODE dmsNode = NULL; ZError( DBG_MISC, "Sync thread start..." ); p_session->i_id = (int)p_session->sessThr; PZQSYNCEVENT p_event = NULL; /*step 1: notify event*/ p_session->status = SESSION_STARTED; p_session->startTime = (int)time(NULL); p_session->eventType = ZQSYNC_SESS_UNKNOWN; if ( p_event == NULL ) { p_event = (PZQSYNCEVENT)malloc( sizeof(ZQSYNCEVENT) ); p_event->p_session = p_session; p_event->message = NULL; } p_event->event = ZQSYNC_SESS_START; p_zqsync->eventHandle( p_event ); /*step 2: disassociation process*/ ZError( DBG_MISC, "Disassociated precess start..." ); if ( p_device->psz_disassociated && strlen(p_device->psz_disassociated)>0 ) { p_session->psz_disassociated = p_device->psz_disassociated; while ( GetNextDisassociatedID( p_session, &i_id ) ) { GetCurrentDMS( p_session, p_event ); sprintf(psz_id, "%d", i_id); p_event->event = ZQSYNC_SESS_PROGRESS; p_session->i_currDisassociated = i_id; p_session->step = ZQSYNC_STEP_1; //Add by wfu begin p_event->event= ZQSYNC_STEP_1; //Add by wfu end p_zqsync->eventHandle( p_event ); i_ret = DMCCDSBrowse(p_device->p_dmcHandle, dmsNode, psz_id, "BrowseMetadata", "*", 0, 0, NULL, &actResult); if ( i_ret == -1 || !actResult ) { ZError(DBG_MISC, "Can't perform browse for %d containerID", i_id); } else {//we do real disassociate now psz_class = GetObjectClass( actResult ); ixmlDocument_free(actResult); actResult = NULL; if ( psz_class && !strcmp(UPNP_PLAYLIST_CONTAINER_CLASS, psz_class) ) {//real disassociate local if (deleteLocalPlaylistContainer( p_device, psz_id )==0) DisassignContainer( p_session, psz_id ); free( psz_class ); psz_class = NULL; }//end real disassociate local else ZError(DBG_MISC, "%d is not a object of class %s.", i_id, UPNP_PLAYLIST_CONTAINER_CLASS); }//end real disassociate //TODO:invoke zqdevice to update disassociated checkEvent( p_session, p_event ); } } ZError( DBG_MISC, "Handle exist items precess start..." ); /*step 3: handle exist items in local*/ p_event->event = ZQSYNC_SESS_PROGRESS; p_session->step = ZQSYNC_STEP_2; //Add by wfu begin p_event->step = ZQSYNC_STEP_2; //Add by wfu end. i = 0; while ( 1 ) { i_ret = ZDBGetNextPlaylist( p_zqsync->zDBHandle, p_device->psz_dmsUDN, i, psz_id ); ZError( DBG_MISC, "ZDBGetNextPlaylist return %d...", i_ret ); if ( i_ret ) break; ZError( DBG_MISC, "Process local playlist %s...", psz_id ); p_event->i_checked = atoi( psz_id ); p_zqsync->eventHandle( p_event ); GetCurrentDMS( p_session, p_event ); i_ret = checkLocalPlaylistContainer( p_device, dmsNode, psz_id ); if ( i_ret<0 ) { ZError( DBG_MISC, "check local playlist failure." ); } i++; checkEvent( p_session, p_event ); } ZError( DBG_MISC, "Associated preccess start..." ); /*step 4: association process*/ if ( p_device->psz_associated && strlen(p_device->psz_associated)>0 ) { p_session->psz_associated = p_device->psz_associated; while ( GetNextAssociatedID( p_session, &i_id ) ) { ZError( DBG_MISC, "Associated playlist -> %d...", i_id ); GetCurrentDMS( p_session, p_event ); sprintf(psz_id, "%d", i_id); p_event->event = ZQSYNC_SESS_PROGRESS; p_session->i_currDisassociated = i_id; p_session->step = ZQSYNC_STEP_3; //Add by wfu begin p_event->step = ZQSYNC_STEP_3; //Add by wfu end p_zqsync->eventHandle( p_event ); ZError( DBG_MISC, "Get metadata for playlist -> %d...", i_id ); i_ret = DMCCDSBrowse(p_device->p_dmcHandle, dmsNode, psz_id, "BrowseMetadata", "*", 0, 0, NULL, &actResult); if ( i_ret == -1 || !actResult ) { ZError(DBG_MISC, "Can't perform browse for %d containerID", i_id); } else {//we do real associate now psz_class = GetObjectClass( actResult ); if ( psz_class && !strcmp(UPNP_PLAYLIST_CONTAINER_CLASS, psz_class) ) {//real associate local addLocalPlaylist( p_device, psz_id, actResult ); free( psz_class ); psz_class = NULL; ixmlDocument_free(actResult); actResult = NULL; while ( 1 ) { GetCurrentDMS( p_session, p_event ); i_ret = addLocalPlaylistItems( p_device, psz_id, dmsNode ); if ( i_ret < 0 ) goto funcOut; else if ( i_ret == 1 ) break; checkEvent( p_session, p_event ); }//end while }//end real associate local else ZError(DBG_MISC, "%d is not a object of class %s.", i_id, UPNP_PLAYLIST_CONTAINER_CLASS); }//end real associate checkEvent( p_session, p_event ); } } ZError( DBG_MISC, "Associated preccess complete..." ); p_event->event = ZQSYNC_SESS_STOP; p_zqsync->eventHandle( p_event ); ZUtilRemoveQ( &p_zqsync->sessQ, &p_session->node ); freeSession( &p_session ); checkIsolatedAlbum( p_zqsync->zDBHandle ); funcOut: ZError( DBG_MISC, "sync exit..." ); if ( p_event ) { if ( p_event->message ) free(p_event->message); free( p_event ); } if ( actResult ) { ixmlDocument_free(actResult); actResult = NULL; } if ( psz_class ) free( psz_class ); return NULL; }
nglString nuiDecoration::GetCSSDeclaration() const { nglString decl; decl.Add(_T("@")).Add(GetObjectClass()).Add(_T(" ")).Add(GetObjectName()).AddNewLine().Add(_T("{")).AddNewLine(); // build attributes list std::map<nglString, nuiAttribBase> attributes; GetAttributes(attributes); uint32 i = 0; std::map<nglString, nuiAttribBase>::const_iterator it_a = attributes.begin(); std::map<nglString, nuiAttribBase>::const_iterator end_a = attributes.end(); while (it_a != end_a) { nglString pname(it_a->first); if (!ShouldSkipAttrib(pname)) { //printf("\tattr: %ls\n", pname.GetChars()); nuiAttribBase Base = it_a->second; nglString value; switch (Base.GetDimension()) { case 0: Base.ToString(value); break; case 1: { nglString str; uint32 count = Base.GetIndexRange(0); for (uint32 i = 0; i < count; i++) { Base.ToString(i, str); value.Add(i).Add(_T(":")).Add(str).Add("\t"); } value.Trim(_T('\t')); } break; case 2: { nglString str; uint32 counti = Base.GetIndexRange(0); uint32 countj = Base.GetIndexRange(1); for (uint32 i = 0; i < MIN(10, counti); i++) { for (uint32 j = 0; j < MIN(10, countj); j++) { Base.ToString(i, j, str); value.Add(i).Add(",").Add(j).Add(_T(":")).Add(str).Add("\t"); } } value.Trim(_T('\t')); } } if (value.Find(' ') >= 0) value = nglString(_T("\"")).Add(value).Add(_T("\"")); if (value.IsEmpty()) value = _T("\"\""); decl.Add(_T(" ")).Add(Base.GetName()).Add(_T(" : ")).Add(value).Add(_T(";")).AddNewLine(); } ++it_a; i++; } decl.Add(_T("}")).AddNewLine().AddNewLine(); return decl; }