changed: using PT::ToLower instead of ToSmall

using PT::ToUpper instead of ToCapital
         using PT::EqualNoCase instead of EqualNoCase
         



git-svn-id: svn://ttmath.org/publicrep/winix/trunk@1112 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2018-05-25 17:22:12 +00:00
parent aa58faf145
commit 436a198c36
3 changed files with 32 additions and 99 deletions

View File

@@ -40,6 +40,7 @@
#include "misc.h"
#include "log.h"
#include "templates/templates.h"
#include "convert/convert.h"
namespace Winix
@@ -331,7 +332,7 @@ void CorrectUrlOnlyAllowedChar(std::wstring & url)
{
CorrectUrlDots(url);
CorrectUrlChars(url);
ToSmall(url);
PT::ToLower(url);
Trim(url, '_');
if( url.empty() || url == L"." )
@@ -788,43 +789,6 @@ void Overwrite(std::wstring & str)
wchar_t ToSmall(wchar_t c)
{
if( c>='A' && c<='Z' )
c = c - 'A' + 'a';
return c;
}
void ToSmall(std::wstring & s)
{
std::wstring::size_type i;
for(i=0 ; i<s.size() ; ++i)
s[i] = ToSmall(s[i]);
}
wchar_t ToCapital(wchar_t c)
{
if( c>='a' && c<='z' )
c = c - 'a' + 'A';
return c;
}
void ToCapital(std::wstring & s)
{
std::wstring::size_type i;
for(i=0 ; i<s.size() ; ++i)
s[i] = ToCapital(s[i]);
}
bool IsEmailCorrectChar(wchar_t c)
{
bool correct = false;
@@ -1231,31 +1195,31 @@ int SelectFileType(const wchar_t * file_name)
// as an image we're using only those types which can be rendered
// by a web browser
if( EqualNoCase(ext, L"jpg") ||
EqualNoCase(ext, L"jpeg") ||
EqualNoCase(ext, L"jpe") ||
EqualNoCase(ext, L"pic") ||
EqualNoCase(ext, L"tga") ||
EqualNoCase(ext, L"gif") ||
EqualNoCase(ext, L"bmp") ||
EqualNoCase(ext, L"png") )
if( PT::EqualNoCase(ext, L"jpg") ||
PT::EqualNoCase(ext, L"jpeg") ||
PT::EqualNoCase(ext, L"jpe") ||
PT::EqualNoCase(ext, L"pic") ||
PT::EqualNoCase(ext, L"tga") ||
PT::EqualNoCase(ext, L"gif") ||
PT::EqualNoCase(ext, L"bmp") ||
PT::EqualNoCase(ext, L"png") )
return WINIX_ITEM_FILETYPE_IMAGE;
if( EqualNoCase(ext, L"pdf") ||
EqualNoCase(ext, L"doc") ||
EqualNoCase(ext, L"xls") ||
EqualNoCase(ext, L"txt") ||
EqualNoCase(ext, L"ods") ||
EqualNoCase(ext, L"odt") )
if( PT::EqualNoCase(ext, L"pdf") ||
PT::EqualNoCase(ext, L"doc") ||
PT::EqualNoCase(ext, L"xls") ||
PT::EqualNoCase(ext, L"txt") ||
PT::EqualNoCase(ext, L"ods") ||
PT::EqualNoCase(ext, L"odt") )
return WINIX_ITEM_FILETYPE_DOCUMENT;
if( EqualNoCase(ext, L"avi") ||
EqualNoCase(ext, L"mp4") ||
EqualNoCase(ext, L"flv") ||
EqualNoCase(ext, L"mpg") ||
EqualNoCase(ext, L"mpeg") ||
EqualNoCase(ext, L"mkv") ||
EqualNoCase(ext, L"wmv") )
if( PT::EqualNoCase(ext, L"avi") ||
PT::EqualNoCase(ext, L"mp4") ||
PT::EqualNoCase(ext, L"flv") ||
PT::EqualNoCase(ext, L"mpg") ||
PT::EqualNoCase(ext, L"mpeg") ||
PT::EqualNoCase(ext, L"mkv") ||
PT::EqualNoCase(ext, L"wmv") )
return WINIX_ITEM_FILETYPE_VIDEO;
return WINIX_ITEM_FILETYPE_UNKNOWN;