void CScraperParser::ReplaceBuffers(CStdString& strDest) { // insert buffers int iIndex; for (int i=MAX_SCRAPER_BUFFERS-1; i>=0; i--) { CStdString temp; iIndex = 0; temp.Format("$$%i",i+1); while ((size_t)(iIndex = strDest.find(temp,iIndex)) != CStdString::npos) // COPIED FROM CStdString WITH THE ADDITION OF $ ESCAPING { strDest.replace(strDest.begin()+iIndex,strDest.begin()+iIndex+temp.GetLength(),m_param[i]); iIndex += m_param[i].length(); } } // insert settings iIndex = 0; while ((size_t)(iIndex = strDest.find("$INFO[",iIndex)) != CStdString::npos) { int iEnd = strDest.Find("]",iIndex); CStdString strInfo = strDest.Mid(iIndex+6,iEnd-iIndex-6); CStdString strReplace; if (m_scraper) strReplace = m_scraper->GetSetting(strInfo); strDest.replace(strDest.begin()+iIndex,strDest.begin()+iEnd+1,strReplace); iIndex += strReplace.length(); } iIndex = 0; while ((size_t)(iIndex = strDest.find("\\n",iIndex)) != CStdString::npos) strDest.replace(strDest.begin()+iIndex,strDest.begin()+iIndex+2,"\n"); }
CStdString OfflineDocIDResolver::GetLibrary( const CStdString& sDocID ) const { int iPosStart = (x64_int_cast)sDocID.find( _T("//") ); int iPosEnd = (x64_int_cast)sDocID.find( _T('/'), iPosStart + 2 ); return sDocID.Mid(iPosStart + 2, iPosEnd - (iPosStart + 2)); }
void PathReadWriter::GetPathList(const CStdString& sPathList, std::vector<CStdString>& pathList) { pathList.clear(); pathList.reserve(std::count(sPathList.begin(), sPathList.end(), _T(';')) + 1); int nStartPos = 0; for (int nEndPos = (int) sPathList.find(_T(';')); nEndPos >= 0; nEndPos = (int) sPathList.find(_T(';'), nStartPos = nEndPos + 1)) { CStdString sSubPath = sPathList.Mid(nStartPos, nEndPos - nStartPos).Trim(); if (!sSubPath.IsEmpty()) { ::PathRemoveBackslash(sSubPath.GetBuffer(MAX_PATH)); sSubPath.ReleaseBuffer(); pathList.push_back(sSubPath); } } CStdString sSubPath = sPathList.Mid(nStartPos).Trim(); if (!sSubPath.IsEmpty()) { ::PathRemoveBackslash(sSubPath.GetBuffer(MAX_PATH)); sSubPath.ReleaseBuffer(); pathList.push_back(sSubPath); } }
WordVersions WordVersionChecker::ConvertNameToVersion(const CStdString& sVersionName) { CStdString sMajVersion = sVersionName; if (sVersionName.find(_T('.'))!=-1) { sMajVersion = sVersionName.Left(sVersionName.find(_T('.'))); } int iMajVer = _ttoi(sVersionName.c_str()); switch (iMajVer) { case 8: return WORD_97; case 9: return WORD_2K; case 10: return WORD_XP; case 11: return WORD_2003; case 12: return WORD_2007; case 14: return WORD_2010; default: return UNKNOWN_WORD_VERSION; } }
void PathHelper::RemoveFromPath(CStdString sPath) { CStdString sFullPath = GetProcessPath(); sFullPath.ToLower(); sPath.ToLower(); if ( sPath.Right(1) == _T("\\") ) { sPath = sPath.Left(sPath.length() - 1); } int nStart = (x64_int_cast)sFullPath.find(sPath); while (nStart >= 0) // there may be multiple copies { int nEnd = nStart + (x64_int_cast)sPath.length() + 1; sFullPath = sFullPath.Left(nStart) + sFullPath.Right(sFullPath.length() - nEnd ); sFullPath.TrimRight(); sFullPath.TrimLeft(); if (sFullPath.Left(1) == _T(";")) sFullPath = sFullPath.Mid(1); sFullPath.Replace(_T(";;"),_T(";")); nStart = (x64_int_cast)sFullPath.find(sPath); } SetProcessPath(sFullPath); }
// Splits the string input into pieces delimited by delimiter. // if 2 delimiters are in a row, it will include the empty string between them. // added MaxStrings parameter to restrict the number of returned substrings (like perl and python) int StringUtils::SplitString(const CStdString& input, const CStdString& delimiter, CStdStringArray &results, unsigned int iMaxStrings /* = 0 */) { size_t iPos = std::string::npos; size_t newPos = std::string::npos; size_t sizeS2 = delimiter.size(); size_t isize = input.size(); results.clear(); vector<unsigned int> positions; newPos = input.find(delimiter, 0); if (newPos == std::string::npos) { results.push_back(input); return 1; } while (newPos != std::string::npos) { positions.push_back(newPos); iPos = newPos; newPos = input.find(delimiter, iPos + sizeS2); } // numFound is the number of delimiters which is one less // than the number of substrings unsigned int numFound = positions.size(); if (iMaxStrings > 0 && numFound >= iMaxStrings) numFound = iMaxStrings - 1; for ( unsigned int i = 0; i <= numFound; i++ ) { CStdString s; if ( i == 0 ) { if ( i == numFound ) s = input; else s = input.substr(i, positions[i]); } else { size_t offset = positions[i - 1] + sizeS2; if ( offset < isize ) { if ( i == numFound ) s = input.substr(offset); else if ( i > 0 ) s = input.substr( positions[i - 1] + sizeS2, positions[i] - positions[i - 1] - sizeS2 ); } } results.push_back(s); } // return the number of substrings return results.size(); }
// returns the number of occurrences of strFind in strInput. int StringUtils::FindNumber(const CStdString& strInput, const CStdString &strFind) { size_t pos = strInput.find(strFind, 0); int numfound = 0; while (pos != std::string::npos) { numfound++; pos = strInput.find(strFind, pos + 1); } return numfound; }
void CGUIDialogAudioSubtitleSettings::AddAudioStreams(CSettingGroup *group, const std::string &settingId) { m_audioStreamStereoMode = false; if (group == NULL || settingId.empty()) return; m_audioStream = g_application.m_pPlayer->GetAudioStream(); if (m_audioStream < 0) m_audioStream = 0; // check if we have a single, stereo stream, and if so, allow us to split into // left, right or both if (g_application.m_pPlayer->GetAudioStreamCount() == 1) { CStdString strAudioInfo; g_application.m_pPlayer->GetAudioInfo(strAudioInfo); /* TODO:STRING_CLEANUP */ int iNumChannels = 0; size_t pos = strAudioInfo.find("chns:"); if (pos != std::string::npos) iNumChannels = static_cast<int>(strtol(strAudioInfo.substr(pos + 5).c_str(), NULL, 0)); std::string strAudioCodec; if (strAudioInfo.size() > 7) strAudioCodec = strAudioInfo.substr(7, strAudioInfo.find(") VBR") - 5); bool bDTS = strAudioCodec.find("DTS") != std::string::npos; bool bAC3 = strAudioCodec.find("AC3") != std::string::npos; if (iNumChannels == 2 && !(bDTS || bAC3)) { // ok, enable these options /* if (CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream == -1) { // default to stereo stream CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream = 0; }*/ StaticIntegerSettingOptions options; for (int i = 0; i < 3; ++i) options.push_back(make_pair(i, 13320 + i)); m_audioStream = -CMediaSettings::Get().GetCurrentVideoSettings().m_AudioStream - 1; m_audioStreamStereoMode = true; AddSpinner(group, settingId, 460, 0, m_audioStream, options); return; } } AddSpinner(group, settingId, 460, 0, m_audioStream, AudioStreamsOptionFiller); }
CStdString CMultiPathDirectory::GetFirstPath(const CStdString &strPath) { size_t pos = strPath.find("/", 12); if (pos != std::string::npos) return CURL::Decode(strPath.substr(12, pos - 12)); return ""; }
bool TestWindowActivate::GetWordPath(CStdString& csWordPath) { if( !m_csWordPath.IsEmpty() ) return true; TCHAR szValue[MAX_PATH]={0}; DWORD cbValue = MAX_PATH; DWORD wKeyType = REG_SZ; HKEY hStartKey = NULL; bool bRet = false; CStdString csPossibleResult; assertTest( RegOpenKey( HKEY_CLASSES_ROOT, _T("\\Word.Document.8\\shell\\Open\\command"), &hStartKey) == ERROR_SUCCESS ); assertTest( RegQueryValueEx(hStartKey, NULL, NULL, &wKeyType, (unsigned char*) szValue, &cbValue) == ERROR_SUCCESS); csPossibleResult = szValue; csPossibleResult.ToLower(); int iFind =(x64_int_cast) csPossibleResult.find( _T("winword.exe") ); if( iFind != CStdString::npos ) { m_csWordPath = csPossibleResult; bRet = true; } RegCloseKey(hStartKey); return bRet; }
bool CALSADirectSound::SoundDeviceExists(const CStdString& device) { void **hints, **n; char *name; CStdString strName; bool retval = false; if (snd_device_name_hint(-1, "pcm", &hints) == 0) { for (n = hints; *n; n++) { if ((name = snd_device_name_get_hint(*n, "NAME")) != NULL) { strName = name; if (strName.find(device) != string::npos) { retval = true; break; } free(name); } } snd_device_name_free_hint(hints); } return retval; }
static void ParseItem(CFileItem* item, SResources& resources, TiXmlElement* root, const CStdString& path) { for (TiXmlElement* child = root->FirstChildElement(); child; child = child->NextSiblingElement()) { CStdString name = child->Value(); CStdString xmlns; size_t pos = name.find(':'); if(pos != std::string::npos) { xmlns = name.substr(0, pos); name.erase(0, pos+1); } if (xmlns == "media") ParseItemMRSS (item, resources, child, name, xmlns, path); else if (xmlns == "itunes") ParseItemItunes (item, resources, child, name, xmlns, path); else if (xmlns == "voddler") ParseItemVoddler(item, resources, child, name, xmlns, path); else if (xmlns == "boxee") ParseItemBoxee (item, resources, child, name, xmlns, path); else if (xmlns == "zn") ParseItemZink (item, resources, child, name, xmlns, path); else if (xmlns == "svtplay") ParseItemSVT (item, resources, child, name, xmlns, path); else ParseItemRSS (item, resources, child, name, xmlns, path); } }
std::string CTsReader::TranslatePath(const char* pszFileName) { if (m_basePath.length() == 0) return pszFileName; CStdString sTimeshiftFile = pszFileName; size_t found = string::npos; if ((m_cardSettings) && (m_cardSettings->size() > 0)) { for (CCards::iterator it = m_cardSettings->begin(); it < m_cardSettings->end(); it++) { // Determine whether the first part of the timeshift file name is shared with this card found = sTimeshiftFile.find(it->TimeshiftingFolder); if (found != string::npos) { // Remove the original base path and replace it with the given path sTimeshiftFile = m_basePath + sTimeshiftFile.substr(it->TimeshiftingFolder.length()+1); break; } } XBMC->Log(LOG_DEBUG, "CTsReader:TranslatePath %s -> %s", pszFileName, sTimeshiftFile.c_str()); return sTimeshiftFile; } return pszFileName; }
bool CVideoReferenceClock::ParseNvSettings(int& RefreshRate) { double fRefreshRate; char Buff[255]; int ReturnV; struct lconv *Locale = localeconv(); FILE* NvSettings; const char* VendorPtr = (const char*)glGetString(GL_VENDOR); if (!VendorPtr) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: glGetString(GL_VENDOR) returned NULL, not using nvidia-settings"); return false; } CStdString Vendor = VendorPtr; Vendor.ToLower(); if (Vendor.find("nvidia") == std::string::npos) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: GL_VENDOR:%s, not using nvidia-settings", Vendor.c_str()); return false; } NvSettings = popen(NVSETTINGSCMD, "r"); if (!NvSettings) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: %s: %s", NVSETTINGSCMD, strerror(errno)); return false; } ReturnV = fscanf(NvSettings, "%254[^\n]", Buff); pclose(NvSettings); if (ReturnV != 1) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: %s produced no output", NVSETTINGSCMD); return false; } CLog::Log(LOGDEBUG, "CVideoReferenceClock: output of %s: %s", NVSETTINGSCMD, Buff); for (int i = 0; i < 255 && Buff[i]; i++) { //workaround for locale mismatch if (Buff[i] == '.' || Buff[i] == ',') Buff[i] = *Locale->decimal_point; } ReturnV = sscanf(Buff, "%lf", &fRefreshRate); if (ReturnV != 1 || fRefreshRate <= 0.0) { CLog::Log(LOGDEBUG, "CVideoReferenceClock: can't make sense of that"); return false; } RefreshRate = MathUtils::round_int(fRefreshRate); CLog::Log(LOGDEBUG, "CVideoReferenceClock: Detected refreshrate by nvidia-settings: %f hertz, rounding to %i hertz", fRefreshRate, RefreshRate); return true; }
void URIUtils::RemoveExtension(std::string& strFileName) { if(IsURL(strFileName)) { CURL url(strFileName); strFileName = url.GetFileName(); RemoveExtension(strFileName); url.SetFileName(strFileName); strFileName = url.Get(); return; } size_t period = strFileName.find_last_of("./\\"); if (period != string::npos && strFileName[period] == '.') { CStdString strExtension = strFileName.substr(period); StringUtils::ToLower(strExtension); strExtension += "|"; CStdString strFileMask; strFileMask = g_advancedSettings.m_pictureExtensions; strFileMask += "|" + g_advancedSettings.m_musicExtensions; strFileMask += "|" + g_advancedSettings.m_videoExtensions; strFileMask += "|" + g_advancedSettings.m_subtitlesExtensions; #if defined(TARGET_DARWIN) strFileMask += "|.py|.xml|.milk|.xpr|.xbt|.cdg|.app|.applescript|.workflow"; #else strFileMask += "|.py|.xml|.milk|.xpr|.xbt|.cdg"; #endif strFileMask += "|"; if (strFileMask.find(strExtension) != std::string::npos) strFileName.erase(period); } }
bool URIUtils::IsOnLAN(const CStdString& strPath) { if(IsMultiPath(strPath)) return IsOnLAN(CMultiPathDirectory::GetFirstPath(strPath)); if(IsStack(strPath)) return IsOnLAN(CStackDirectory::GetFirstStackedFile(strPath)); if(IsSpecial(strPath)) return IsOnLAN(CSpecialProtocol::TranslatePath(strPath)); if(IsDAAP(strPath)) return true; if(IsPlugin(strPath)) return false; if(IsTuxBox(strPath)) return true; if(IsUPnP(strPath)) return true; CURL url(strPath); if (url.GetProtocol() == "rar" || url.GetProtocol() == "zip") return IsOnLAN(url.GetHostName()); if(!IsRemote(strPath)) return false; CStdString host = url.GetHostName(); if(host.length() == 0) return false; // assume a hostname without dot's // is local (smb netbios hostnames) if(host.find('.') == string::npos) return true; unsigned long address = ntohl(inet_addr(host.c_str())); if(address == INADDR_NONE) { CStdString ip; if(CDNSNameCache::Lookup(host, ip)) address = ntohl(inet_addr(ip.c_str())); } if(address != INADDR_NONE) { // check if we are on the local subnet if (!g_application.getNetwork().GetFirstConnectedInterface()) return false; if (g_application.getNetwork().HasInterfaceForIP(address)) return true; } return false; }
bool CSmbFile::IsValidFile(const CStdString& strFileName) { if (strFileName.find('/') == std::string::npos || /* doesn't have sharename */ StringUtils::EndsWith(strFileName, "/.") || /* not current folder */ StringUtils::EndsWith(strFileName, "/..")) /* not parent folder */ return false; return true; }
CStdString CGUIDialogBoxeeTechInfo::removeNItem(int n, CStdString str) { size_t pos; CStdString tempStr; for (int i=1; i<n; i++) { pos = str.find(","); tempStr = tempStr.c_str() + str.substr(0, pos+2); str = str.substr(pos+2); //printf ("CGUIDialogBoxeeTechInfo::removeNItem - str: %s, tempStr: %s\n",str.c_str(), tempStr.c_str()); } pos = str.find(","); str = str.substr(pos+2); tempStr = tempStr + str; return tempStr; }
CZeroconfBrowser::ZeroconfService CZeroconfBrowser::ZeroconfService::fromPath(const CStdString& fcr_path) { if( fcr_path.empty() ) throw std::runtime_error("CZeroconfBrowser::ZeroconfService::fromPath input string empty!"); size_t pos1 = fcr_path.find('@'); //first @ size_t pos2 = fcr_path.find('@', pos1 + 1); //second if(pos1 == std::string::npos || pos2 == std::string::npos) throw std::runtime_error("CZeroconfBrowser::ZeroconfService::fromPath invalid input path"); return ZeroconfService( fcr_path.substr(pos2 + 1, fcr_path.length()), //name fcr_path.substr(0, pos1), //type fcr_path.substr(pos1 + 1, pos2-(pos1+1)) //domain ); }
int __stdcall IMessageProc(sIMessage_base * msgBase) { sIMessage_2params * msg = (msgBase->s_size>=sizeof(sIMessage_2params))?static_cast<sIMessage_2params*>(msgBase):0; switch (msgBase->id) { /* Wiadomoœci na które TRZEBA odpowiedzieæ */ case IM_PLUG_NET: return NET_EXPIMP; // Zwracamy wartoœæ NET, która MUSI byæ ró¿na od 0 i UNIKATOWA! case IM_PLUG_TYPE: return IMT_UI|IMT_CONFIG; // Zwracamy jakiego typu jest nasza wtyczka (które wiadomoœci bêdziemy obs³ugiwaæ) case IM_PLUG_VERSION: return 0; // Wersja wtyczki tekstowo major.minor.release.build ... case IM_PLUG_SDKVERSION: return KONNEKT_SDK_V; // Ta linijka jest wymagana! case IM_PLUG_SIG: return (int)"EXPIMP"; // Sygnaturka wtyczki (krótka, kilkuliterowa nazwa) case IM_PLUG_CORE_V: return (int)"W98"; // Wymagana wersja rdzenia case IM_PLUG_UI_V: return 0; // Wymagana wersja UI case IM_PLUG_NAME: return (int)"exPiMP"; // Pe³na nazwa wtyczki case IM_PLUG_NETNAME: return 0; // Nazwa obs³ugiwanej sieci (o ile jak¹œ sieæ obs³uguje) case IM_PLUG_INIT: Plug_Init(msg->p1,msg->p2);return Init(); case IM_PLUG_DEINIT: Plug_Deinit(msg->p1,msg->p2);return DeInit(); case IM_SETCOLS: return ISetCols(); case IM_UI_PREPARE: return IPrepare(); case IM_START: return IStart(); case IM_END: return IEnd(); case IM_UIACTION: return ActionProc((sUIActionNotify_base*)msg->p1); case IM_PLUG_ARGS: { sIMessage_plugArgs * pa = static_cast<sIMessage_plugArgs*> (msgBase); if (pa->argc < 2) return 0; const char * import_ = getArgV(pa->argv+1 , pa->argc-1 , "-import" , true); if (import_ && *import_) { CStdString import = import_; if (import.find("expimp:")==0) { import = import.substr(import.find(':') + 1); } DoImport(import); } return 0;} /* Tutaj obs³ugujemy wszystkie pozosta³e wiadomoœci */ default: if (Ctrl) Ctrl->setError(IMERROR_NORESULT); return 0; } return 0; }
bool ShouldPrintToTempFile(const CStdString& sOutputFile) { if(sOutputFile.find(L",")!=std::string::npos) { return true; } return false; }
CStdString AddonReplacer(const CStdString &str) { // assumes "addon.id #####" size_t length = str.find(" "); CStdString id = str.substr(0, length); int stringid = atoi(str.substr(length + 1).c_str()); return CAddonMgr::Get().GetString(id, stringid); }
bool TestWorkshareActions::TestManifestFileForVista() { HANDLE hFile = ::CreateFile(sMANIFEST.c_str(), GENERIC_READ|GENERIC_WRITE, 0, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); if (hFile == INVALID_HANDLE_VALUE) return false; LARGE_INTEGER filesize; if (::GetFileSizeEx(hFile, &filesize) == 0) { ::CloseHandle(hFile); return false; } DWORD dwFilesize = filesize.LowPart; DWORD read = 0; BYTE* buf = new BYTE[dwFilesize+2]; if (::ReadFile(hFile, buf, dwFilesize, &read, NULL) == 0) { delete [] buf; ::CloseHandle(hFile); return false; } buf[dwFilesize] = 0; buf[dwFilesize + 1 ] = 0; CStdString fileBuf; fileBuf = reinterpret_cast<TCHAR*>(buf); delete [] buf; buf = NULL; CStdString str = _T("<!--WISEMETA: name=\"[INSTALLDIRWITHDOUBLEBACKSLASH]"); if (fileBuf.find(str) != -1) { ::CloseHandle(hFile); return false; } if (fileBuf.find(sINSTALLDIRWITHDOUBLEBACKSLASH) != -1) { ::CloseHandle(hFile); return false; } ::CloseHandle(hFile); return true; }
void CGUIWindow::AllocResources(bool forceLoad /*= FALSE */) { CSingleLock lock(g_graphicsContext); #ifdef _DEBUG int64_t start; start = CurrentHostCounter(); #endif // use forceLoad to determine if xml file needs loading forceLoad |= NeedXMLReload() || (m_loadType == LOAD_EVERY_TIME); // if window is loaded and load is forced we have to free window resources first if (m_windowLoaded && forceLoad) FreeResources(true); if (forceLoad) { CStdString xmlFile = GetProperty("xmlfile").asString(); if (xmlFile.size()) { bool bHasPath = xmlFile.find("\\") != std::string::npos || xmlFile.find("/") != std::string::npos; Load(xmlFile,bHasPath); } } int64_t slend; slend = CurrentHostCounter(); // and now allocate resources CGUIControlGroup::AllocResources(); #ifdef _DEBUG int64_t end, freq; end = CurrentHostCounter(); freq = CurrentHostFrequency(); if (forceLoad) CLog::Log(LOGDEBUG,"Alloc resources: %.2fms (%.2f ms skin load)", 1000.f * (end - start) / freq, 1000.f * (slend - start) / freq); else { CLog::Log(LOGDEBUG,"Window %s was already loaded", GetProperty("xmlfile").c_str()); CLog::Log(LOGDEBUG,"Alloc resources: %.2fm", 1000.f * (end - start) / freq); } #endif m_bAllocated = true; }
//////////////////////////////////////////////////////////////////////////////////// // Function: ExtractInfo() // Extracts the information in quotes from the string line, returning it in quote //////////////////////////////////////////////////////////////////////////////////// CStdString CCueDocument::ExtractInfo(const CStdString &line) { size_t left = line.find('\"'); if (left != std::string::npos) { size_t right = line.find('\"', left + 1); if (right != std::string::npos) { CStdString text = line.substr(left + 1, right - left - 1); g_charsetConverter.unknownToUTF8(text); return text; } } CStdString text = line; StringUtils::Trim(text); g_charsetConverter.unknownToUTF8(text); return text; }
bool StringUtils::ContainsKeyword(const CStdString &str, const vector<string> &keywords) { for (vector<string>::const_iterator it = keywords.begin(); it != keywords.end(); ++it) { if (str.find(*it) != str.npos) return true; } return false; }
bool StringUtils::ContainsKeyword(const CStdString &str, const CStdStringArray &keywords) { for (CStdStringArray::const_iterator it = keywords.begin(); it != keywords.end(); it++) { if (str.find(*it) != str.npos) return true; } return false; }
bool CRssReader::Parse(int iFeed) { TiXmlElement* rootXmlNode = m_xml.RootElement(); if (!rootXmlNode) return false; TiXmlElement* rssXmlNode = NULL; CStdString strValue = rootXmlNode->Value(); if (strValue.find("rss") != std::string::npos || strValue.find("rdf") != std::string::npos) rssXmlNode = rootXmlNode; else { // Unable to find root <rss> or <rdf> node return false; } TiXmlElement* channelXmlNode = rssXmlNode->FirstChildElement("channel"); if (channelXmlNode) { TiXmlElement* titleNode = channelXmlNode->FirstChildElement("title"); if (titleNode && !titleNode->NoChildren()) { CStdString strChannel = titleNode->FirstChild()->Value(); CStdStringW strChannelUnicode; g_charsetConverter.utf8ToW(strChannel, strChannelUnicode, m_rtlText); AddString(strChannelUnicode, RSS_COLOR_CHANNEL, iFeed); AddString(":", RSS_COLOR_CHANNEL, iFeed); AddString(" ", RSS_COLOR_CHANNEL, iFeed); } GetNewsItems(channelXmlNode,iFeed); } GetNewsItems(rssXmlNode,iFeed); // avoid trailing ' - ' if (m_strFeed[iFeed].size() > 3 && m_strFeed[iFeed].substr(m_strFeed[iFeed].size() - 3) == L" - ") { if (m_rtlText) { m_strFeed[iFeed].erase(0, 3); m_strColors[iFeed].erase(0, 3); } else { m_strFeed[iFeed].erase(m_strFeed[iFeed].length() - 3); m_strColors[iFeed].erase(m_strColors[iFeed].length() - 3); } } return true; }
bool CAFPFile::IsValidFile(const CStdString& strFileName) { if (strFileName.find('/') == std::string::npos || // doesn't have sharename StringUtils::EndsWith(strFileName, "/.") || // not current folder StringUtils::EndsWith(strFileName, "/..")) // not parent folder { return false; } return true; }
bool CWIN32Util::HasGLDefaultDrivers() { unsigned int a=0,b=0; CStdString strVendor = g_Windowing.GetRenderVendor(); g_Windowing.GetRenderVersion(a, b); if(strVendor.find("Microsoft")!=strVendor.npos && a==1 && b==1) return true; else return false; }