void *vpx_mem_alloc(int id, size_t size, size_t align) { #if defined CHIP_DM642 || defined __uClinux__ void *mem = (void *)mem_alloc(id, size, align); if (!mem) { _P(fprintf(stderr, "\n" "*********************************************************\n" "WARNING: mem_alloc returned 0 for id=%p size=%u align=%u.\n" "*********************************************************\n", mem, size, align)); // should no longer need this. Softier says it's fixed. 2005-01-21 tjf //#if defined __uClinux__ //while(1)usleep(1000000); //#endif } #if defined __uClinux__ else if (mem == (void *)0xFFFFFFFF) { // out of memory/error mem = (void *)0; _P(fprintf(stderr, "\n" "******************************************************\n" "ERROR: mem_alloc id=%p size=%u align=%u OUT OF MEMORY.\n" "******************************************************\n", mem, size, align)); } #endif // __uClinux__ return mem; #else (void)id; (void)size; (void)align; return (void *)0; #endif }
static long double _yn ( int n, double* x ) { long double Sum1; long double Sum2; long double Fact1; long double Fact2; long double F1; long double F2; long double y; register int i; double xx; long double Xi; unsigned int My; if ( EXPD (x[0]) == 0 ) return -1./0.; /* ignore the gcc warning, this is intentional */ if ( (x[0] >= (n>=32 ? 25.8 : (n<8 ? 17.4+0.1*n : 16.2+0.3*n))) ) { Xi = x[0] - M_PI * (n*0.5+0.25); My = n*n << 2; return sqrt(M_2_PI / x[0]) * (_P(My,x) * sin(Xi) + _Q(My,x) * cos(Xi)); } Sum1 = Sum2 = F1 = F2 = 0; Fact1 = 1. / (xx = x[0] * 0.5 ); Fact2 = 1.; y = xx*xx; for ( i = 1; i < n; i++ ) Fact1 *= (n-i) / xx; for ( i = 1; i <= n; i++ ) { Sum1 += Fact1; if ( i == n ) break; Fact1 *= y/(i*(n-i)); } for (i=1; i<=n; i++) { Fact2 *= xx / i; F1 += 1. / i; } for ( i = 1; ; i++ ) { Sum2 += Fact2 * (F1+F2); Fact2 *= -y / (i*(n+i)); if ( EXPL (Sum2) - EXPL (Fact2) > 53 || !EXPL (Fact2) ) break; F1 += 1. / (n+i); F2 += 1. / i; } return M_1_PI * (2. * (M_C + log(xx)) * _jn (n, x) - Sum1 - Sum2); }
void CXMLElement::ToString(CString& strXML, BOOL bNewline) const { // strXML += '<' + m_sName; Optimized: strXML.AppendChar( L'<' ); strXML.Append( m_sName ); POSITION pos = GetAttributeIterator(); for ( ; pos; ) { strXML.AppendChar( L' ' ); const CXMLAttribute* pAttribute = GetNextAttribute( pos ); pAttribute->ToString( strXML ); } pos = GetElementIterator(); if ( pos == NULL && m_sValue.IsEmpty() ) { strXML.Append( _P( L"/>" ) ); if ( bNewline ) strXML.Append( _P( L"\r\n" ) ); return; } strXML.AppendChar( L'>' ); if ( bNewline && pos ) strXML.Append( _P( L"\r\n" ) ); while ( pos ) { const CXMLElement* pElement = GetNextElement( pos ); pElement->ToString( strXML, bNewline ); } strXML += Escape( m_sValue ); strXML.Append( _P( L"</" ) ); strXML.Append( m_sName ); strXML.AppendChar( L'>' ); if ( bNewline ) strXML.Append( _P( L"\r\n" ) ); }
static bool VerifyBuffer(const unsigned char* buffer, const unsigned int bufferLen, const unsigned char* signatureEncoded, const unsigned int signatureEncodedLen, const CStdString& appsPublicKeyFile) { unsigned char hash[SHA_DIGEST_LENGTH]; SHA_CTX context; FILE *fkey = NULL; RSA *rsa = NULL; bool bSuccedded = false; unsigned char* signature = NULL; int signatureLen = 0; SHA1_Init(&context); SHA1_Update(&context, buffer, bufferLen); SHA1_Final(hash, &context); #ifdef DEBUG dump_sha1(hash); #endif do { signatureLen = unbase64((unsigned char*)signatureEncoded, signatureEncodedLen, &signature); if(!signatureLen) { CLog::Log(LOGERROR, "CAppSecurity::%s - failed to decode signature [%s]", __func__, signatureEncoded); break; } fkey = fopen(_P(appsPublicKeyFile), "r"); if (!fkey) { CLog::Log(LOGERROR, "CAppSecurity::%s - failed to open publickey file [%s]", __func__, appsPublicKeyFile.c_str()); break; } PEM_read_RSA_PUBKEY(fkey, &rsa, NULL, NULL); if (!rsa) { CLog::Log(LOGERROR, "CAppSecurity::%s - failed to load rsa key from file [%s]", __func__, appsPublicKeyFile.c_str()); break; } bSuccedded = RSA_verify(NID_sha1, hash, SHA_DIGEST_LENGTH, signature, signatureLen, rsa); } while(false); if (rsa) RSA_free(rsa); if (fkey) fclose(fkey); if (signature) free(signature); return bSuccedded; }
FE_TMPL float FE_SYS::_P(int n,int m,float u){ if(n<0) return 0; if(n < -m || n > m) return 0; if(m<0){ return ((-m)%2==1?-1.f:1.f) * fac(n-m) / fac(n+m) * _P(n,-m,u); } float a = m%2==1 ? -1 : 1; for(int j = 1;j<=m;j++) a *= 2*j - 1; a *= std::pow(1-u*u,m/2.0f); return a; }
CAppDescriptor::AppDescriptorsMap CAppManager::GetInstalledApps() { m_installedApplications.clear(); CStdString appsPath = "special://home/apps/"; appsPath = _P(appsPath); GetInstalledAppsInternal(m_installedApplications, appsPath, "", false); RefreshAppsStats(); return m_installedApplications; }
void CWin32StorageProvider::GetLocalDrives(VECSOURCES &localDrives) { CMediaSource share; share.strPath = _P("special://home"); share.strName = g_localizeStrings.Get(21440); share.m_ignore = true; share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL; localDrives.push_back(share); CWIN32Util::GetDrivesByType(localDrives, LOCAL_DRIVES); }
int xbp_mkdir(const char *dirname) { CStdString strName = _P(dirname); /* // If the dir already exists, don't try to recreate it struct stat buf; if (stat(strName.c_str(), &buf) == 0 && S_ISDIR(buf.st_mode)) return 0; */ return mkdir(strName.c_str(), 0755); }
void CWin32StorageProvider::GetLocalDrives(VECSOURCES &localDrives) { #ifndef IS_JUKEBOX // Laureon: Added: Jukebox shouldn't show the home folder in file listings.. CMediaSource share; share.strPath = _P("special://home"); share.strName = g_localizeStrings.Get(21440); share.m_ignore = true; share.m_iDriveType = CMediaSource::SOURCE_TYPE_LOCAL; localDrives.push_back(share); #endif CWIN32Util::GetDrivesByType(localDrives, LOCAL_DRIVES); }
/** * Check for file and print an error if needed */ bool XBPython::FileExist(const char* strFile) { if (!strFile) return false; if (access(_P(strFile), 0) != 0) { CLog::Log(LOGERROR, "Python: Cannot find '%s'", strFile); return false; } return true; }
bool CAppManager::Launch(const CFileItem& item, bool bReportInstall) { m_launchedItem = item; if (item.GetPropertyBOOL("testapp") == true) { item.Dump(); CUtil::CopyDirRecursive(item.GetProperty("actual-path"),_P(item.GetProperty("app-localpath"))); } return Launch(item.m_strPath, bReportInstall); }
// FIXME: This function may not be required bool CAddonMgr::LoadAddonDescription(const CStdString &path, AddonPtr &addon) { cp_status_t status; cp_plugin_info_t *info = m_cpluff->load_plugin_descriptor(m_cp_context, _P(path).c_str(), &status); if (info) { addon = GetAddonFromDescriptor(info); m_cpluff->release_info(m_cp_context, info); return NULL != addon.get(); } return false; }
static void update_bdry_outflow(np_t *np, gl_t *gl, long lA, long lB, long lC, long theta, long thetasgn, bool BDRYDIRECFOUND, int ACCURACY){ double P,T; spec_t w; dim_t V; long spec,dim; bool ref_flag; assert_np(np[lA],is_node_resumed(np[lA])); P=_f_extrapol(ACCURACY,_P(np[lB],gl),_P(np[lC],gl)); T=_f_extrapol(ACCURACY,_T(np[lB],gl),_T(np[lC],gl)); for (spec=0; spec<ns; spec++){ w[spec]=_f_extrapol(ACCURACY,_w(np[lB],spec),_w(np[lC],spec)); } for (dim=0; dim<nd; dim++){ V[dim]=_f_extrapol(ACCURACY,_V(np[lB],dim),_V(np[lC],dim)); } reformat_w(gl,w,"_bdry",&ref_flag); find_U_2(np, lA, gl, w, V, P, T); }
void CHostBrowser::SendRequest() { if ( m_nProtocol != PROTOCOL_ED2K && m_nProtocol != PROTOCOL_DC ) { if ( ! IsValid() ) return; if ( m_bNewBrowse ) Write( _P("GET /gnutella/browse/v1 HTTP/1.1\r\n") ); else if ( Settings.Downloads.RequestHTTP11 ) Write( _P("GET / HTTP/1.1\r\n") ); else Write( _P("GET / HTTP/1.0\r\n") ); CString strHeader = Settings.SmartAgent(); if ( ! strHeader.IsEmpty() ) { Write( _P("User-Agent: ") ); Write( strHeader ); Write( _P("\r\n") ); } Write( _P("Accept: text/html, application/x-gnutella-packets, application/x-gnutella2\r\n") ); Write( _P("Accept-Encoding: deflate\r\n") ); // if ( ! m_sKey.IsEmpty() ) // ToDo: Proposed PrivateKey extension // Write( L"Authorization: :" + m_sKey + L"\r\n" ); Write( _P("Connection: close\r\n") ); strHeader.Format( L"Host: %s:%lu\r\n\r\n", (LPCTSTR)m_sAddress, htons( m_pHost.sin_port ) ); Write( strHeader ); LogOutgoing(); OnWrite(); m_nProtocol = PROTOCOL_ANY; } m_nState = hbsRequesting; m_bDeflate = FALSE; m_nLength = SIZE_UNKNOWN; m_bConnect = TRUE; m_mInput.pLimit = m_mOutput.pLimit = &Settings.Bandwidth.Downloads; theApp.Message( MSG_INFO, IDS_BROWSE_SENT_REQUEST, (LPCTSTR)m_sAddress ); }
void BlockLocalPositionEstimator::covPropagationLogic(Matrix<float, n_x, n_x> &dP) { for (int i = 0; i < n_x; i++) { if (_P(i, i) > P_MAX) { // if diagonal element greater than max, stop propagating dP(i, i) = 0; for (int j = 0; j < n_x; j++) { dP(i, j) = 0; dP(j, i) = 0; } } } }
static void update_bdry_inflow(np_t *np, gl_t *gl, long lA, long lB, long lC, long theta, long thetasgn, bool BDRYDIRECFOUND){ double P,T; spec_t w; dim_t V; long spec,dim; assert_np(np[lA],is_node_resumed(np[lA])); P=_P(np[lA],gl); T=_T(np[lA],gl); for (spec=0; spec<ns; spec++) w[spec]=_w(np[lA],spec); for (dim=0; dim<nd; dim++) V[dim]=_V(np[lA],dim); find_U_2(np, lA, gl, w, V, P, T); }
BOOL CDCNeighbour::OnValidateDenide() { // Bad user nick // $ValidateDenide[ Nick]| m_bNickValid = FALSE; m_sNick.Format( CLIENT_NAME_T _T("%04u"), GetRandomNum( 0u, 9999u ) ); if ( CHostCacheHostPtr pServer = HostCache.DC.Find( &m_pHost.sin_addr ) ) { pServer->m_sUser = m_sNick; } if ( CDCPacket* pPacket = CDCPacket::New() ) { pPacket->Write( _P("$ValidateNick ") ); pPacket->WriteString( m_sNick, FALSE ); pPacket->Write( _P("|") ); Send( pPacket ); } return TRUE; }
void IntConv_init(void) { register int i0; _mid = _register_module(&IntConv_md.md, NULL); { char *_mem, *_var; _mem = GC_malloc_atomic(_not_zero(4)+8); if (!_mem) _new_failed(_P(8281)); _var = _mem+8; ((_Type*)_var)[-1] = &ConvTypes__ScanDesc_td.td; i0 = (int)_var; } IntConv__S = (void*)i0; { char *_mem, *_var; _mem = GC_malloc_atomic(_not_zero(4)+8); if (!_mem) _new_failed(_P(8289)); _var = _mem+8; ((_Type*)_var)[-1] = &ConvTypes__ScanDesc_td.td; i0 = (int)_var; } IntConv__W = (void*)i0; { char *_mem, *_var; _mem = GC_malloc_atomic(_not_zero(4)+8); if (!_mem) _new_failed(_P(8297)); _var = _mem+8; ((_Type*)_var)[-1] = &ConvTypes__ScanDesc_td.td; i0 = (int)_var; } IntConv__SI = (void*)i0; i0 = (int)IntConv__S; *(void(**)(unsigned char, signed char *, ConvTypes__ScanState *))i0 = (void(*)(unsigned char, signed char *, ConvTypes__ScanState *))(int)&IntConv__SState; i0 = (int)IntConv__W; *(void(**)(unsigned char, signed char *, ConvTypes__ScanState *))i0 = (void(*)(unsigned char, signed char *, ConvTypes__ScanState *))(int)&IntConv__WState; i0 = (int)IntConv__SI; *(void(**)(unsigned char, signed char *, ConvTypes__ScanState *))i0 = (void(*)(unsigned char, signed char *, ConvTypes__ScanState *))(int)&IntConv__ScanInt; }
//-- Create ------------------------------------------------------------------- // Called once when the visualisation is created by XBMC. Do any setup here. //----------------------------------------------------------------------------- extern "C" void Create(void* pd3dDevice, int iPosX, int iPosY, int iWidth, int iHeight, const char* szVisualisationName, float fPixelRatio, const char *szSubModuleName) { strcpy(g_visName, szVisualisationName); m_vecSettings.clear(); m_uiVisElements = 0; /** Initialise Goom */ if (g_goom) { goom_close( g_goom ); g_goom = NULL; } g_goom = goom_init(g_tex_width, g_tex_height); if (!g_goom) return; g_goom_buffer = (unsigned char*)malloc(g_tex_width * g_tex_height * 4); goom_set_screenbuffer( g_goom, g_goom_buffer ); memset( g_audio_data, 0, sizeof(g_audio_data) ); g_window_width = iWidth; g_window_height = iHeight; g_window_xpos = iPosX; g_window_ypos = iPosY; #ifdef _WIN32 #ifndef _MINGW g_configFile = string(getenv("XBMC_PROFILE_USERDATA")) + "\\" + CONFIG_FILE; std::string presetsDir = string(getenv("XBMC_HOME")) + "\\" + PRESETS_DIR; #endif #else g_configFile = _P(CONFIG_FILE); std::string presetsDir = _P(PRESETS_DIR); #endif }
ParamPaths__Pattern ParamPaths__ParsePatterns_PatternList_NewPattern(const unsigned char* wildcard__ref, int wildcard_0d, unsigned char rcsIsEnabled) { register int i0, i1, i2, i3; unsigned char* wildcard; char* _old_top_vs = _top_vs; _push_value(int, wildcard, wildcard__ref, wildcard_0d); { char *_mem, *_var; _mem = GC_malloc(_not_zero(16)+8); if (!_mem) _new_failed(_P(7967)); _var = _mem+8; ((_Type*)_var)[-1] = &ParamPaths__PatternDesc_td.td; i0 = (int)_var; } *(void**)i0 = (void*)0; i2 = Strings__Length((const unsigned char*)(int)wildcard, wildcard_0d); i1 = i0 + 4; i2++; { char *_mem, *_var; int* _dim_ptr; if(i2 < 0) _invalid_length(i2, _P(8072)); _mem = GC_malloc_atomic(_not_zero(i2*1)+8); if (!_mem) _new_failed(_P(8020)); _var = _mem+8; _dim_ptr = (void*)(_var-4); *(--_dim_ptr) = i2; i2 = (int)_var; } *(void**)i1 = (void*)i2; i1 = (int)*(void**)i1; i2 = i0 + 8; i3 = *(int*)(i1-8); _string_copy(i1, (int)wildcard, i3); *(unsigned char*)i2 = rcsIsEnabled; _top_vs = _old_top_vs; return (void*)i0; }
bool CAppManager::InstallOrUpgradeAppIfNeeded(const CStdString& appId, bool bReportInstall) { CAppDescriptor::AppDescriptorsMap installedAppsDesc = GetInstalledApps(); // If the the application is not found -- install it if (installedAppsDesc.find(appId) == installedAppsDesc.end()) { InstallOrUpgradeAppBG* job = new InstallOrUpgradeAppBG(appId, true, false, bReportInstall); return (CUtil::RunInBG(job)==JOB_SUCCEEDED); } CAppDescriptor& appDesc = installedAppsDesc[appId]; // Do not automatically upgrade non boxee apps; /*if (!appDesc.IsBoxeeApp()) { return true; }*/ CAppDescriptor::AppDescriptorsMap availableAppsDesc = GetRepositories().GetAvailableApps(false, appDesc.IsBoxeeApp()); if (CUtil::VersionCompare(installedAppsDesc[appId].GetVersion(), availableAppsDesc[appId].GetVersion()) < 0) { InstallOrUpgradeAppBG* job = new InstallOrUpgradeAppBG(appId, false, true, bReportInstall); return (CUtil::RunInBG(job)==JOB_SUCCEEDED); } #ifdef HAS_EMBEDDED if(m_bVerifyAppStatus && appDesc.GetType() != "native") { CStdString sigFile = _P("special://home/apps/"); CUtil::AddFileToFolder(sigFile, appDesc.GetId(), sigFile); CUtil::AddFileToFolder(sigFile, "signature.xml", sigFile); CAppSecurity appSecurity("", sigFile, appDesc.GetId(), appDesc.GetVersion()); if(appSecurity.VerifySignature(FLAG_VERIFY_APP_STATUS_ONLY) == false) { CStdString dlMessage; dlMessage.Format(g_localizeStrings.Get(53846), appDesc.GetName().c_str()); g_application.m_guiDialogKaiToast.QueueNotification("", "", dlMessage, 10000); return false; } } m_bVerifyAppStatus = true; #endif return true; }
void xvpx_mem_free(int id, void *mem, size_t size, char *file, int line) { if (vpx_memory_tracker_remove((size_t)mem) == -2) { #if REMOVE_PRINTFS (void)file; (void)line; #endif _P(fprintf(stderr, "[vpx_mem][xvpx_mem_free] addr: %p (id=%p size=%u) " "not found in list; freed from file:%s" " line:%d\n", mem, id, size, file, line)); } vpx_mem_free(id, mem, size); }
void CLocalSearch::AddHitDC(CDCPacket* pPacket, CSchemaMap& /*pSchemas*/, CLibraryFile* pFile, int /*nIndex*/) { // Active user: // $SR Nick FileName<0x05>FileSize FreeSlots/TotalSlots<0x05>HubName (HubIP:HubPort)| // Passive user: // $SR Nick FileName<0x05>FileSize FreeSlots/TotalSlots<0x05>HubName (HubIP:HubPort)<0x05>User| if ( ! m_pSearch ) return; CUploadQueue* pQueue = UploadQueues.SelectQueue( PROTOCOL_DC, NULL, 0, CUploadQueue::ulqBoth, NULL ); int nTotalSlots = pQueue ? pQueue->m_nMaxTransfers : 0; int nActiveSlots = pQueue ? pQueue->GetActiveCount() : 0; int nFreeSlots = nTotalSlots > nActiveSlots ? ( nTotalSlots - nActiveSlots ) : 0; CString sHubName; if ( pFile->m_oTiger ) // It's TTH search sHubName = _T("TTH:") + pFile->m_oTiger.toString(); else sHubName = m_pSearch->m_sMyHub; CBuffer pAnswer; pAnswer.Add( _P("$SR ") ); pAnswer.Print( m_pSearch->m_sMyNick ); pAnswer.Add( _P(" ") ); pAnswer.Print( pFile->m_sName ); pAnswer.Add( _P("\x05") ); CString strSize; strSize.Format( _T("%I64u %d/%d"), pFile->m_nSize, nFreeSlots, nTotalSlots ); pAnswer.Print( strSize ); pAnswer.Add( _P("\x05") ); pAnswer.Print( sHubName ); pAnswer.Add( _P(" (") ); pAnswer.Print( HostToString( &m_pSearch->m_pMyHub ) ); pAnswer.Add( _P(")") ); if ( ! m_pSearch->m_bUDP ) { pAnswer.Add( _P("\x05") ); pAnswer.Print( m_pSearch->m_sUserNick ); } pAnswer.Add( _P("|") ); pPacket->Write( pAnswer.m_pBuffer, pAnswer.m_nLength ); }
PyObject* XBMC_TranslatePath(PyObject *self, PyObject *args) { PyObject *pObjectText; if (!PyArg_ParseTuple(args, "O", &pObjectText)) return NULL; CStdString strText; if (!PyGetUnicodeString(strText, pObjectText, 1)) return NULL; CStdString strPath; if (strText.Left(3).Equals("P:\\")) CUtil::AddFileToFolder(g_settings.GetProfileUserDataFolder(),strText.Mid(3),strText); strPath = _P(strText); return Py_BuildValue("s", strPath.c_str()); }
HANDLE xbp_FindFirstFile(LPCTSTR lpFileName, LPWIN32_FIND_DATA lpFindFileData) { char* p = strdup(lpFileName); CORRECT_SEP_STR(p); // change default \\*.* into \\* which the xbox is using char* e = strrchr(p, '.'); if (e != NULL && strlen(e) > 1 && e[1] == '*') { e[0] = '\0'; } HANDLE res = FindFirstFile(_P(p).c_str(), lpFindFileData); free(p); return res; }
void XBPython::Process() { /* 歌方: 1、 卦指: 1、 傍苧: 1、 */ if (m_bLogin) { m_bLogin = false; // autoexec.py - profile CStdString strAutoExecPy = _P("special://profile/autoexec.py"); if ( XFILE::CFile::Exists(strAutoExecPy) ) evalFile(strAutoExecPy,ADDON::AddonPtr()); else CLog::Log(LOGDEBUG, "%s - no profile autoexec.py (%s) found, skipping", __FUNCTION__, strAutoExecPy.c_str()); } CSingleLock lock(m_critSection); if (m_bInitialized) { PyList::iterator it = m_vecPyList.begin(); while (it != m_vecPyList.end()) { //delete scripts which are done if (it->bDone) { delete it->pyThread; it = m_vecPyList.erase(it); FinalizeScript(); } else ++it; } if(m_iDllScriptCounter == 0 && (XbmcThreads::SystemClockMillis() - m_endtime) > 10000 ) Finalize(); } }
bool WatchDog::IsPathAvailable(const CStdString &pathToCheck, bool bDefault) { #ifdef WATCHDOG_DONT_TEST_PATH return true; #else CStdString strPath = _P(pathToCheck); CFileItem item; item.m_strPath = strPath; if (item.IsApp()) return true; if (item.IsInternetStream()) return g_application.IsConnectedToNet(); CSingleLock lock(m_lock); CURI url1 (strPath); CStdString strUrl1; strUrl1 = url1.Get(); strUrl1 = BOXEE::BXUtils::RemoveSMBCredentials(strUrl1); strUrl1.ToLower(); CUtil::RemoveSlashAtEnd(strUrl1); for (std::map<CStdString, PathStatus>::iterator iter=m_mapPaths.begin(); iter != m_mapPaths.end(); iter++) { CURI url2(iter->first); CStdString strUrl2; strUrl2 = url2.Get(); strUrl2 = BOXEE::BXUtils::RemoveSMBCredentials(strUrl2); strUrl2.ToLower(); CUtil::RemoveSlashAtEnd(strUrl2); if(strUrl1.Find(strUrl2) >= 0) { if (iter->second == WD_UNKNOWN) { return bDefault; } return (iter->second == WD_AVAILABLE); } } return bDefault; // we dont know... #endif }
/** Calles when the user clicks on OK, i.e. all wiimotes are in discovery * mode. */ void WiimoteManager::WiimoteDialogListener::onConfirm() { GUIEngine::ModalDialog::dismiss(); wiimote_manager->launchDetection(5); int nb_wiimotes = wiimote_manager->getNumberOfWiimotes(); if(nb_wiimotes > 0) { new MessageDialog(_P("Found %d wiimote", "Found %d wiimotes", nb_wiimotes)); } else { new MessageDialog( _("Could not detect any wiimote :/") ); } } // WiimoteDialogListeneronConfirm
void BlockLocalPositionEstimator::publishEstimatorStatus() { _pub_est_status.get().timestamp = _timeStamp; for (int i = 0; i < n_x; i++) { _pub_est_status.get().states[i] = _x(i); _pub_est_status.get().covariances[i] = _P(i, i); } _pub_est_status.get().n_states = n_x; _pub_est_status.get().health_flags = _sensorFault; _pub_est_status.get().timeout_flags = _sensorTimeout; _pub_est_status.get().pos_horiz_accuracy = _pub_gpos.get().eph; _pub_est_status.get().pos_vert_accuracy = _pub_gpos.get().epv; _pub_est_status.update(); }
char* xbp_getcwd(char *buf, int size) { #ifdef __APPLE__ // Initialize thread local storage and local thread pointer. pthread_once(&keyOnce, MakeTlsKeys); if (xbp_cw_dir == 0) { printf("Initializing Python path...\n"); char* path = (char* )malloc(MAX_PATH); strcpy(path, _P("special://xbmc/system/python").c_str()); pthread_setspecific(tWorkingDir, (void*)path); } #endif if (buf == NULL) buf = (char *)malloc(size); strcpy(buf, xbp_cw_dir); return buf; }