int checkTypePerLink(IndexNums *_Index, char *_src, char *_tar) { if(_src[_Index->pivot + _Index->firstShiftIndex + _Index->secondShiftIndex] == '\"') { _Index->secondShiftIndex += 1; while(_src[_Index->pivot + _Index->firstShiftIndex + _Index->secondShiftIndex] != '\"') { strcat(_tar, replaceCharacter(_src[_Index->pivot + _Index->firstShiftIndex + _Index->secondShiftIndex]).c_str()); _Index->secondShiftIndex++; _Index->tarIndex++; if(_Index->secondShiftIndex > 1024) break; } } else if(_src[_Index->pivot + _Index->firstShiftIndex + _Index->secondShiftIndex] == '\'') { _Index->secondShiftIndex += 1; while(_src[_Index->pivot + _Index->firstShiftIndex + _Index->secondShiftIndex] != '\'') { strcat(_tar, replaceCharacter(_src[_Index->pivot + _Index->firstShiftIndex + _Index->secondShiftIndex]).c_str()); _Index->secondShiftIndex++; _Index->tarIndex++; if(_Index->secondShiftIndex > 1024) break; } } else { while(_src[_Index->pivot + _Index->firstShiftIndex + _Index->secondShiftIndex] != '>') { strcat(_tar, replaceCharacter(_src[_Index->pivot + _Index->firstShiftIndex + _Index->secondShiftIndex]).c_str()); _Index->secondShiftIndex++; _Index->tarIndex++; if(_Index->secondShiftIndex > 1024) break; } } //cout << _tar.length() << " ) " << _tar << endl; return 1; }
void CLocalPlayer::SendSyncRequest() { if (time(0) - timesincerequest > 10) { RakNet::BitStream requestid; char* playerUsername = replaceCharacter(Config->client_username, '~', ' '); requestid.Write((MessageID)ID_REQUEST_SERVER_SYNC); requestid.Write(playerUsername); NetworkManager->client->Send(&requestid, HIGH_PRIORITY, RELIABLE_ORDERED, 0, RakNet::UNASSIGNED_SYSTEM_ADDRESS, true); player.ShowMessageAboveMap("Synchronizing with the server..."); timesincerequest = time(0); } }
unique_ptr<char[]> StringUtil::replaceAllSpaces(const char *str) { if (isNullChar(str)) return unique_ptr<char[]>(new char{'\0'}); int numOfSpaceChars = 0; int numOfOriginalChars = 0; countNumOfSpaces(str, &numOfSpaceChars, &numOfOriginalChars); int totalNumOfChars = numOfOriginalChars + 2 * numOfSpaceChars; unique_ptr<char[]> array(new char[totalNumOfChars + 1]); int lastNewCharIndex = totalNumOfChars - 1; int lastOriginalCharIndex = numOfOriginalChars -1; array.get()[lastNewCharIndex + 1] = '\0'; for (; lastOriginalCharIndex >= 0; lastOriginalCharIndex--, lastNewCharIndex--) replaceCharacter(array.get(), &lastNewCharIndex, str, lastOriginalCharIndex); return array; }
//============================================================================== JUCESplashScreen::JUCESplashScreen (Component& parent) { ignoreUnused (hasStartedFading); ignoreUnused (parent); #if JUCE_REPORT_APP_USAGE if (! appUsageReported) { const ScopedTryLock appUsageReportingLock (appUsageReporting); if (appUsageReportingLock.isLocked() && ! appUsageReported) { const auto deviceDescription = SystemStats::getDeviceDescription(); const auto deviceString = SystemStats::getDeviceIdentifiers().joinIntoString (":"); const auto deviceIdentifier = String::toHexString (deviceString.hashCode64()); const auto osName = SystemStats::getOperatingSystemName(); StringPairArray data; data.set ("v", "1"); data.set ("tid", "UA-19759318-3"); data.set ("cid", deviceIdentifier); data.set ("t", "event"); data.set ("ec", "info"); data.set ("ea", "appStarted"); data.set ("cd1", SystemStats::getJUCEVersion()); data.set ("cd2", osName); data.set ("cd3", deviceDescription); data.set ("cd4", deviceIdentifier); String appType, appName, appVersion, appManufacturer; #if defined(JucePlugin_Name) appType = "Plugin"; appName = JucePlugin_Name; appVersion = JucePlugin_VersionString; appManufacturer = JucePlugin_Manufacturer; #else if (JUCEApplicationBase::isStandaloneApp()) { appType = "Application"; if (auto* app = JUCEApplicationBase::getInstance()) { appName = app->getApplicationName(); appVersion = app->getApplicationVersion(); } } else { appType = "Library"; } #endif data.set ("cd5", appType); data.set ("cd6", appName); data.set ("cd7", appVersion); data.set ("cd8", appManufacturer); data.set ("an", appName); data.set ("av", appVersion); auto agentCPUVendor = SystemStats::getCpuVendor(); if (agentCPUVendor.isEmpty()) agentCPUVendor = "CPU"; auto agentOSName = osName.replaceCharacter ('.', '_') .replace ("iOS", "iPhone OS"); #if JUCE_IOS agentOSName << " like Mac OS X"; #endif String userAgent; userAgent << "Mozilla/5.0 (" << deviceDescription << ";" << agentCPUVendor << " " << agentOSName << ";" << SystemStats::getDisplayLanguage() << ")"; ReportingThreadContainer::getInstance()->sendReport ("https://www.google-analytics.com/collect", userAgent, data); appUsageReported = true; } } #else ignoreUnused (appUsageReported); #endif #if JUCE_DISPLAY_SPLASH_SCREEN if (splashDisplayTime == 0 || Time::getMillisecondCounter() < splashDisplayTime + (uint32) millisecondsToDisplaySplash) { content = getSplashScreenLogo(); setAlwaysOnTop (true); parent.addAndMakeVisible (this); } else #endif { startTimer (1); } }