OSDN Git Service

PATCH: [ 1991259 ] Convert editor find/replace to use PCRE regexps
authorTakashi Sawanaka <sdottaka@users.sourceforge.net>
Thu, 25 Sep 2008 15:00:51 +0000 (15:00 +0000)
committerTakashi Sawanaka <sdottaka@users.sourceforge.net>
Thu, 25 Sep 2008 15:00:51 +0000 (15:00 +0000)
- case-sensitive regexp search didn't work.

Docs/Users/ChangeLog.txt
Src/editlib/ccrystaltextview.cpp

index 77bcecb..f8babcd 100644 (file)
@@ -17,6 +17,7 @@ WinMerge 2.11.1.5
    (#2098626)
   BugFix: Customized colors weren't used in some areas (#2110218)
   BugFix: Zip files were extracted into wrong folder (#2110350)
+  BugFix: Case-sensitive regexp search didn't work (#1991259)
   Translation updates:
   - German (r5934)
   - Russian (#2067785)
index 1912719..f4e54f1 100644 (file)
@@ -4533,22 +4533,21 @@ FindStringHelper (LPCTSTR pszFindWhere, LPCTSTR pszFindWhat, DWORD dwFlags,
         }
 
       int ovector[30];
-      char compString[200] = {0};
+      int compStringBufLen = _tcslen(pszFindWhere) * sizeof(TCHAR) + 1;
+      char *compString = new char[compStringBufLen];
       int stringLen = 0;
-      TCHAR * tempName = _tcsdup(pszFindWhere); // Create temp copy for conversions
-      TCHAR * cmpStr = _tcsupr(tempName);
 
 #ifdef UNICODE
-      stringLen = TransformUcs2ToUtf8(cmpStr, _tcslen(cmpStr),
-          compString, sizeof(compString));
+      stringLen = TransformUcs2ToUtf8(pszFindWhere, _tcslen(pszFindWhere),
+          compString, compStringBufLen);
+      compString[stringLen] = '\0';
 #else
-      strcpy(compString, cmpStr);
+      strncpy(compString, pszFindWhere, compStringBufLen);
       stringLen = strlen(compString);
 #endif
 
       int result = pcre_exec(regexp, pe, compString, stringLen,
           0, 0, ovector, 30);
-      free(tempName);
 
       if (result >= 0)
         {
@@ -4559,10 +4558,11 @@ FindStringHelper (LPCTSTR pszFindWhere, LPCTSTR pszFindWhat, DWORD dwFlags,
           pos = ovector[0];
           nLen = ovector[1] - ovector[0];
 #endif
-               }
+        }
       else
         pos = -1;
 
+      delete [] compString;
       pcre_free(regexp);
       pcre_free(pe);
       return pos;