diff options
Diffstat (limited to 'plugins/NewsAggregator/Src/Utils.cpp')
-rw-r--r-- | plugins/NewsAggregator/Src/Utils.cpp | 91 |
1 files changed, 0 insertions, 91 deletions
diff --git a/plugins/NewsAggregator/Src/Utils.cpp b/plugins/NewsAggregator/Src/Utils.cpp index ffcb2ec955..8750bde3df 100644 --- a/plugins/NewsAggregator/Src/Utils.cpp +++ b/plugins/NewsAggregator/Src/Utils.cpp @@ -284,97 +284,6 @@ time_t __stdcall DateToUnixTime(const TCHAR *stamp, bool FeedType) return (t >= 0) ? t : 0;
}
-TCHAR * _tcsistr(const TCHAR *str, const TCHAR *substr)
-{
- if (!str || !substr || (substr[0] == _T('\0')))
- return (TCHAR *)str;
-
- size_t nLen = mir_tstrlen(substr);
- while (*str)
- {
- if (_tcsnicmp(str, substr, nLen) == 0)
- break;
- str++;
- }
-
- if (*str == _T('\0'))
- str = NULL;
-
- return (TCHAR *)str;
-}
-
-int StrReplace(TCHAR *lpszOld, const TCHAR *lpszNew, TCHAR *&lpszStr)
-{
- if (!lpszStr || !lpszOld || !lpszNew)
- return 0;
-
- size_t nStrLen = mir_tstrlen(lpszStr);
- if (nStrLen == 0)
- return 0;
-
- size_t nOldLen = mir_tstrlen(lpszOld);
- if (nOldLen == 0)
- return 0;
-
- size_t nNewLen = mir_tstrlen(lpszNew);
-
- // loop once to figure out the size of the result string
- size_t nCount = 0;
- TCHAR *pszStart = (TCHAR *)lpszStr;
- TCHAR *pszEnd = (TCHAR *)lpszStr + nStrLen;
- TCHAR *pszTarget = NULL;
- TCHAR *pszResultStr = NULL;
-
- while (pszStart < pszEnd) {
- while ((pszTarget = _tcsistr(pszStart, lpszOld)) != NULL) {
- nCount++;
- pszStart = pszTarget + nOldLen;
- }
- pszStart += mir_tstrlen(pszStart);
- }
-
- // if any changes, make them now
- if (nCount > 0) {
- // allocate buffer for result string
- size_t nResultStrSize = nStrLen + (nNewLen - nOldLen) * nCount + 2;
- pszResultStr = new TCHAR[nResultStrSize];
- memset(pszResultStr, 0, (nResultStrSize * sizeof(TCHAR)));
-
- pszStart = (TCHAR *)lpszStr;
- pszEnd = (TCHAR *)lpszStr + nStrLen;
- TCHAR *cp = pszResultStr;
-
- // loop again to actually do the work
- while (pszStart < pszEnd) {
- while ((pszTarget = _tcsistr(pszStart, lpszOld)) != NULL) {
- size_t nCopyLen = (size_t)(pszTarget - pszStart);
- mir_tstrncpy(cp, &lpszStr[pszStart - lpszStr], nCopyLen);
-
- cp += nCopyLen;
-
- pszStart = pszTarget + nOldLen;
-
- mir_tstrcpy(cp, lpszNew);
-
- cp += nNewLen;
- }
- mir_tstrcpy(cp, pszStart);
- pszStart += mir_tstrlen(pszStart);
- }
-
- if (pszResultStr)
- lpszStr = mir_tstrdup(pszResultStr);
- }
-
- int nSize = 0;
- if (pszResultStr) {
- nSize = (int)mir_tstrlen(pszResultStr);
- delete[] pszResultStr;
- }
-
- return nSize;
-}
-
bool DownloadFile(LPCTSTR tszURL, LPCTSTR tszLocal)
{
NETLIBHTTPREQUEST nlhr = { 0 };
|