bool wxXmlSerializer::Contains(xsSerializable *object) const { if( m_pRoot ) { return _Contains(object, m_pRoot); } return false; }
/* Decoder callback that adds the vda frame to the queue in display order. */ static void vda_decoder_callback (void *vda_hw_ctx, CFDictionaryRef /*user_info*/, OSStatus /*status*/, uint32_t /*infoFlags*/, CVImageBufferRef image_buffer) { vda_context *vda_ctx = (vda_context*)vda_hw_ctx; if (!image_buffer) return; const auto fmt = CVPixelBufferGetPixelFormatType(image_buffer); if (!_Contains(cvpixfmts, fmt)) { qDebug() << "vda: not supported format!!"; return; } vda_ctx->cv_pix_fmt_type = fmt; vda_ctx->cv_buffer = CVPixelBufferRetain(image_buffer); }
bool wxXmlSerializer::_Contains(xsSerializable* object, xsSerializable* parent) const { wxASSERT(parent); if( !parent )return false; if( parent == object )return true; bool fFound = false; SerializableList::compatibility_iterator node = parent->GetChildrenList().GetFirst(); while(node) { fFound = _Contains(object, node->GetData()); if( fFound )break; node = node->GetNext(); } return fFound; }
int PreExec_Exec( PreExec* self, const char* programPath, uid_t uid, uid_t gid) { char path[PAL_MAX_PATH_SIZE]; char key[PAL_MAX_PATH_SIZE]; char uidBuf[11]; const char* uidStr; char gidBuf[11]; const char* gidStr; /* If no pre-exec program, nothing to do */ if (programPath == NULL) return 0; /* Form the UID string */ { size_t dummy; uidStr = Uint32ToStr(uidBuf, (PAL_Uint32)uid, &dummy); } /* Form the GID string */ { size_t dummy; gidStr = Uint32ToStr(gidBuf, (PAL_Uint32)gid, &dummy); } /* Form a hash key from PREEXEC+UID+GID */ { key[0] = '\0'; Strlcat(key, programPath, PAL_MAX_PATH_SIZE); Strlcat(key, "+", PAL_MAX_PATH_SIZE); Strlcat(key, uidStr, PAL_MAX_PATH_SIZE); Strlcat(key, "+", PAL_MAX_PATH_SIZE); Strlcat(key, gidStr, PAL_MAX_PATH_SIZE); } /* If key already in cache, then return without doing anything */ { static pthread_mutex_t s_mutex = PTHREAD_MUTEX_INITIALIZER; pthread_mutex_lock(&s_mutex); if (_Contains(&self->cache, key)) { pthread_mutex_unlock(&s_mutex); return 0; } /* Add key to cache */ _Insert(&self->cache, key); pthread_mutex_unlock(&s_mutex); } /* Form the full path of the pre-exec program */ { const char* bindir = OMI_GetPath(ID_BINDIR); path[0] = '\0'; if (bindir) { Strlcat(path, bindir, PAL_MAX_PATH_SIZE); Strlcat(path, "/", PAL_MAX_PATH_SIZE); } Strlcat(path, programPath, PAL_MAX_PATH_SIZE); } /* Execute and wait on the pre-exec program to exit */ _BlockSIGCHLD(); { pid_t pid = _Exec(path, uidStr, gidStr); if (pid == -1) { _UnblockSIGCHLD(); trace_PreExecFailed(path); return -1; } { pid_t r; int status; r = waitpid(pid, &status, 0); if (r != pid || WEXITSTATUS(status) != 0) { _UnblockSIGCHLD(); trace_PreExecFailed(path); return -1; } } } _UnblockSIGCHLD(); trace_PreExecOk(path); return 0; }