소스 검색

Using tolower and towupper

Source commit: 9679e092efa1a4683538eb9b46374f90b5699ab3
Martin Prikryl 2 년 전
부모
커밋
266b470cf8

+ 5 - 5
source/core/Common.cpp

@@ -1402,8 +1402,8 @@ RawByteString __fastcall HexToBytes(const UnicodeString Hex)
   {
     for (int i = 1; i <= Hex.Length(); i += 2)
     {
-      P1 = Digits.Pos((wchar_t)toupper(Hex[i]));
-      P2 = Digits.Pos((wchar_t)toupper(Hex[i + 1]));
+      P1 = Digits.Pos(towupper(Hex[i]));
+      P2 = Digits.Pos(towupper(Hex[i + 1]));
       if (P1 <= 0 || P2 <= 0)
       {
         Result = L"";
@@ -1422,8 +1422,8 @@ unsigned char __fastcall HexToByte(const UnicodeString Hex)
 {
   static UnicodeString Digits = L"0123456789ABCDEF";
   DebugAssert(Hex.Length() == 2);
-  int P1 = Digits.Pos((wchar_t)toupper(Hex[1]));
-  int P2 = Digits.Pos((wchar_t)toupper(Hex[2]));
+  int P1 = Digits.Pos(towupper(Hex[1]));
+  int P2 = Digits.Pos(towupper(Hex[2]));
 
   return
     static_cast<unsigned char>(((P1 <= 0) || (P2 <= 0)) ? 0 : (((P1 - 1) << 4) + (P2 - 1)));
@@ -2081,7 +2081,7 @@ bool __fastcall TryStrToSize(UnicodeString SizeStr, __int64 & Size)
       Result = (SizeStr.Length() == 1);
       if (Result)
       {
-        wchar_t Unit = (wchar_t)toupper(SizeStr[1]);
+        wchar_t Unit = towupper(SizeStr[1]);
         switch (Unit)
         {
           case GigaSize:

+ 1 - 1
source/core/Configuration.cpp

@@ -229,7 +229,7 @@ UnicodeString __fastcall TConfiguration::PropertyToKey(const UnicodeString & Pro
   // no longer useful
   int P = Property.LastDelimiter(L".>");
   UnicodeString Result = Property.SubString(P + 1, Property.Length() - P);
-  if ((Result[1] == L'F') && ((wchar_t)toupper(Result[2]) == Result[2]))
+  if ((Result[1] == L'F') && (towupper(Result[2]) == Result[2]))
   {
     Result.Delete(1, 1);
   }

+ 2 - 2
source/core/FileMasks.cpp

@@ -1072,7 +1072,7 @@ bool __fastcall TCustomCommand::FindPattern(const UnicodeString & Command,
     int Len;
     wchar_t APatternCmd;
     GetToken(Command, Index, Len, APatternCmd);
-    if (((PatternCmd != L'!') && (tolower(PatternCmd) == tolower(APatternCmd))) ||
+    if (((PatternCmd != L'!') && (towlower(PatternCmd) == towlower(APatternCmd))) ||
         ((PatternCmd == L'!') && (Len == 1) && (APatternCmd != TEXT_TOKEN)) ||
         ((PatternCmd == L'\0') && (APatternCmd != TEXT_TOKEN)))
     {
@@ -1289,7 +1289,7 @@ TFileCustomCommand::TFileCustomCommand(const TCustomCommandData & Data,
 int __fastcall TFileCustomCommand::PatternLen(const UnicodeString & Command, int Index)
 {
   int Len;
-  wchar_t PatternCmd = (Index < Command.Length()) ? tolower(Command[Index + 1]) : L'\0';
+  wchar_t PatternCmd = (Index < Command.Length()) ? towlower(Command[Index + 1]) : L'\0';
   switch (PatternCmd)
   {
     case L's':

+ 1 - 1
source/core/RemoteFiles.cpp

@@ -990,7 +990,7 @@ Boolean __fastcall TRemoteFile::GetIsDirectory() const
   }
   else
   {
-    return (toupper(Type) == FILETYPE_DIRECTORY);
+    return (towupper(Type) == FILETYPE_DIRECTORY);
   }
 }
 //---------------------------------------------------------------------------

+ 1 - 1
source/core/SessionData.cpp

@@ -5750,7 +5750,7 @@ UnicodeString GetExpandedLogFileName(UnicodeString LogFileName, TDateTime Starte
     {
       UnicodeString Replacement;
       // keep consistent with TFileCustomCommand::PatternReplacement
-      switch (tolower(ANewFileName[Index + 1]))
+      switch (towlower(ANewFileName[Index + 1]))
       {
         case L'y':
           Replacement = FormatDateTime(L"yyyy", Started);

+ 1 - 1
source/filezilla/FtpControlSocket.cpp

@@ -705,7 +705,7 @@ void CFtpControlSocket::LogOnToServer(BOOL bSkipReply /*=FALSE*/)
       ftp_capabilities_t cap = m_serverCapabilities.GetCapabilityString(opts_mlst_command);
       if (cap == unknown)
       {
-        std::transform(facts.begin(), facts.end(), facts.begin(), ::tolower);
+        std::transform(facts.begin(), facts.end(), facts.begin(), ::towlower);
         bool had_unset = false;
         std::string opts_facts;
         // Create a list of all facts understood by both FZ and the server.

+ 1 - 1
source/forms/CustomScpExplorer.cpp

@@ -7551,7 +7551,7 @@ void __fastcall TCustomScpExplorerForm::CMDialogChar(TMessage & AMessage)
 {
   TCMDialogChar & Message = reinterpret_cast<TCMDialogChar &>(AMessage);
   if ((FIgnoreNextDialogChar != 0) &&
-      (toupper(Message.CharCode) == toupper(FIgnoreNextDialogChar)))
+      (towupper(Message.CharCode) == towupper(FIgnoreNextDialogChar)))
   {
     Message.Result = 1;
   }

+ 2 - 2
source/windows/Setup.cpp

@@ -65,10 +65,10 @@ void err_out_sys(LPCTSTR base_err_msg, LONG sys_err)
 //---------------------------------------------------------------------------
 // Works as "strcmp" but the comparison is not case sensitive.
 int tcharicmp(LPCTSTR str1, LPCTSTR str2){
-    for (; tolower(*str1) == tolower(*str2); ++str1, ++str2)
+    for (; towlower(*str1) == towlower(*str2); ++str1, ++str2)
         if (*str1 == L'\0')
             return 0;
-    return tolower(*str1) - tolower(*str2);
+    return towlower(*str1) - towlower(*str2);
 }
 //---------------------------------------------------------------------------
 // Returns un unquoted copy of "str" (or a copy of "str" if the quotes are