Update of /cvsroot/mahogany/M/src/util
In directory sc8-pr-cvs1:/tmp/cvs-serv6042/src/util

Modified Files:
        matchurl.cpp miscutil.cpp ssl.cpp strutil.cpp sysutil.cpp 
        upgrade.cpp 
Log Message:
unicode fixes

Index: matchurl.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/util/matchurl.cpp,v
retrieving revision 1.27
retrieving revision 1.28
diff -b -u -2 -r1.27 -r1.28
--- matchurl.cpp        2 Oct 2003 16:49:14 -0000       1.27
+++ matchurl.cpp        12 Oct 2003 22:03:37 -0000      1.28
@@ -82,5 +82,5 @@
      Keywords can be added between calls to this method.
     */
-   int scanAtStart(const char* toBeScanned);
+   int scanAtStart(const wxChar* toBeScanned);
 
    /** Scans the given string to find a keyword.
@@ -92,5 +92,5 @@
      first call to this function.
     */
-   int scan(const char* toBeScanned, int& lng) {
+   int scan(const wxChar* toBeScanned, int& lng) {
       return scan(toBeScanned, lng, _root);
    }
@@ -108,8 +108,8 @@
          KeywordDetectorCell* current,
          int toBeAdded = 1);
-   int scanAtStart(const char* toBeScanned,
+   int scanAtStart(const wxChar* toBeScanned,
          KeywordDetectorCell* current,
          int longueurDejaVue, int lngDernierTrouve);
-   int scan(const char* toBeScanned, int& lng, KeywordDetectorCell* current);
+   int scan(const wxChar* toBeScanned, int& lng, KeywordDetectorCell* current);
 
    KeywordDetectorCell* _root;
@@ -129,5 +129,5 @@
      @return the position of the first match or -1 if nothing found
     */
-   int FindURL(const char *str, int& len);
+   int FindURL(const wxChar *str, int& len);
 };
 
@@ -197,5 +197,5 @@
 
 int
-KeywordDetector::scanAtStart(const char* toBeScanned,
+KeywordDetector::scanAtStart(const wxChar* toBeScanned,
                              KeywordDetectorCell* current,
                              int longueurDejaVue,
@@ -245,5 +245,5 @@
 
 
-int KeywordDetector::scanAtStart(const char* toBeScanned)
+int KeywordDetector::scanAtStart(const wxChar* toBeScanned)
 {
    return scanAtStart(toBeScanned, _root, 0, 0);
@@ -251,5 +251,5 @@
 
 
-int KeywordDetector::scan(const char* toBeScanned,
+int KeywordDetector::scan(const wxChar* toBeScanned,
                           int& lng, KeywordDetectorCell* current)
 {
@@ -495,5 +495,5 @@
    the full extension here, chances are that the URL is not wrapped.
  */
-static bool CanBeWrapped(const char *p)
+static bool CanBeWrapped(const wxChar *p)
 {
    // first check: if the last character on the previous line is a slash,
@@ -508,19 +508,19 @@
    // we consider any alphanumeric string of 3 characters an extension
    // but we have separate arrays of known extensions of other lengths
-   static const char *extensions1 =
+   static const wxChar *extensions1 =
    {
       // this one is actually a string and not an array as like this we can use
       // strchr() below
-      "cCfhZ",
+      _T("cCfhZ"),
    };
 
-   static const char *extensions2[] =
+   static const wxChar *extensions2[] =
    {
-      "cc", "gz",
+      _T("cc"), _T("gz"),
    };
 
-   static const char *extensions4[] =
+   static const wxChar *extensions4[] =
    {
-      "html", "jpeg", "tiff",
+      _T("html"), _T("jpeg"), _T("tiff"),
    };
 
@@ -534,5 +534,5 @@
    if ( p[-2] == '.' )
    {
-      if ( strchr(extensions1, p[-1]) )
+      if ( wxStrchr(extensions1, p[-1]) )
       {
          // we seem to have a one letter extension at the end
@@ -566,6 +566,6 @@
       for ( size_t n = 0; n < WXSIZEOF(extensions4); n++ )
       {
-         const char * const ext = extensions4[n];
-         if ( strncmp(p - 3, ext, 3) == 0 && p[2] == ext[3] )
+         const wxChar * const ext = extensions4[n];
+         if ( wxStrncmp(p - 3, ext, 3) == 0 && p[2] == ext[3] )
          {
             // looks like a long extension got wrapped
@@ -582,5 +582,5 @@
       for ( size_t n = 0; n < WXSIZEOF(extensions4); n++ )
       {
-         if ( strncmp(p - 4, extensions4[n], 4) == 0 )
+         if ( wxStrncmp(p - 4, extensions4[n], 4) == 0 )
          {
             // line ends with an extension, shouldn't wrap normally
@@ -602,5 +602,5 @@
 }
 
-int URLDetector::FindURL(const char *text, int& len)
+int URLDetector::FindURL(const wxChar *text, int& len)
 {
    // offset of the current value of text from the initial one
@@ -613,6 +613,6 @@
 
    // the provisional start and end of the URL, will be changed below
-   const char *start = text + pos;
-   const char *p = start + len;
+   const wxChar *start = text + pos;
+   const wxChar *p = start + len;
 
    // there are 2 different cases: a mailto: URL or a mail address and
@@ -728,5 +728,5 @@
          // when they occur at the beginning of the line, possibly after some
          // white space as this is how people usually format them
-         const char *q = start;
+         const wxChar *q = start;
          while ( q >= text && *q != '\n' )
          {

Index: miscutil.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/util/miscutil.cpp,v
retrieving revision 1.44
retrieving revision 1.45
diff -b -u -2 -r1.44 -r1.45
--- miscutil.cpp        2 Oct 2003 14:53:45 -0000       1.44
+++ miscutil.cpp        12 Oct 2003 22:03:37 -0000      1.45
@@ -71,8 +71,8 @@
    if ( mfStatus.newmsgs > 0 )
       frame->SetIcon( frame == mApplication->TopLevelFrame() ?
-                      ICON("MainFrameNewMail") : ICON("MFrameNewMail"));
+                      ICON(_T("MainFrameNewMail")) : ICON(_T("MFrameNewMail")));
    else
       frame->SetIcon( frame == mApplication->TopLevelFrame() ?
-                      ICON("MainFrame") : ICON("MFrame"));
+                      ICON(_T("MainFrame")) : ICON(_T("MFrame")));
 }
 
@@ -81,5 +81,5 @@
 // ---------------------------------------------------------------------------
 
-static const char *rgbSpecificationString = gettext_noop("RGB(%d, %d, %d)");
+static const wxChar *rgbSpecificationString = gettext_noop("RGB(%d, %d, %d)");
 
 bool ParseColourString(const String& name, wxColour* colour)
@@ -92,5 +92,5 @@
    // first check if it's a RGB specification
    int red, green, blue;
-   if ( sscanf(name, customColourString, &red, &green, &blue) == 3 )
+   if ( wxSscanf(name, customColourString, &red, &green, &blue) == 3 )
    {
       // it's a custom colour

Index: ssl.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/util/ssl.cpp,v
retrieving revision 1.32
retrieving revision 1.33
diff -b -u -2 -r1.32 -r1.33
--- ssl.cpp     18 Sep 2003 16:31:03 -0000      1.32
+++ ssl.cpp     12 Oct 2003 22:03:37 -0000      1.33
@@ -85,10 +85,10 @@
 
 #define SSL_LOOKUP(name) \
-      stub_##name = (name##_TYPE) gs_dllSll.GetSymbol(#name); \
+      stub_##name = (name##_TYPE) gs_dllSll.GetSymbol(wxConvertMB2WX(#name)); \
       if ( !stub_##name ) \
          goto error
 
 #define CRYPTO_LOOKUP(name) \
-      stub_##name = (name##_TYPE) gs_dllCrypto.GetSymbol(#name); \
+      stub_##name = (name##_TYPE) gs_dllCrypto.GetSymbol(wxConvertMB2WX(#name)); \
       if ( !stub_##name ) \
          goto error
@@ -259,6 +259,6 @@
            " or if they have some other names on your system."),
          NULL,
-         "SSL tip",
-         "SSLLibTip"
+         _T("SSL tip"),
+         _T("SSLLibTip")
       );
    }

Index: strutil.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/util/strutil.cpp,v
retrieving revision 1.122
retrieving revision 1.123
diff -b -u -2 -r1.122 -r1.123
--- strutil.cpp 12 Oct 2003 12:10:57 -0000      1.122
+++ strutil.cpp 12 Oct 2003 22:03:37 -0000      1.123
@@ -77,5 +77,5 @@
 {
    char ch;
-   str = "";
+   str = _T("");
    for(;;)
    {
@@ -91,5 +91,5 @@
 {
    char ch;
-   str = "";
+   str = _T("");
    for(;;)
    {
@@ -113,8 +113,8 @@
 
 String
-strutil_before(const String &str, const char delim)
+strutil_before(const String &str, const wxChar delim)
 {
-   String newstr = "";
-   const char *cptr = str.c_str();
+   String newstr = _T("");
+   const wxChar *cptr = str.c_str();
    while(*cptr && *cptr != delim)
       newstr += *cptr++;
@@ -123,8 +123,8 @@
 
 String
-strutil_after(const String &str, const char delim)
+strutil_after(const String &str, const wxChar delim)
 {
-   String newstr = "";
-   const char *cptr = str.c_str();
+   String newstr = _T("");
+   const wxChar *cptr = str.c_str();
    while(*cptr && *cptr != delim)
       cptr++;
@@ -140,7 +140,7 @@
 strutil_delwhitespace(String &str)
 {
-   String newstr = "";
+   String newstr = _T("");
 
-   const char *cptr = str.c_str();
+   const wxChar *cptr = str.c_str();
    while(isspace(*cptr))
       cptr++;
@@ -153,6 +153,6 @@
 strutil_toupper(String &str)
 {
-   String s = "";
-   const char *cptr = str.c_str();
+   String s = _T("");
+   const wxChar *cptr = str.c_str();
    while(*cptr)
       s += toupper(*cptr++);
@@ -163,6 +163,6 @@
 strutil_tolower(String &str)
 {
-   String s = "";
-   const char *cptr = str.c_str();
+   String s = _T("");
+   const wxChar *cptr = str.c_str();
    while(*cptr)
       s += tolower(*cptr++);
@@ -174,5 +174,5 @@
       int offs1, int offs2)
 {
-   return strcmp(str1.c_str()+offs1, str2.c_str()+offs2) == 0;
+   return wxStrcmp(str1.c_str()+offs1, str2.c_str()+offs2) == 0;
 }
 
@@ -181,5 +181,5 @@
       int offs2)
 {
-   return strncmp(str1.c_str()+offs1, str2.c_str()+offs2, n) == 0;
+   return wxStrncmp(str1.c_str()+offs1, str2.c_str()+offs2, n) == 0;
 }
 
@@ -187,6 +187,6 @@
 strutil_ltoa(long i)
 {
-   char buffer[256];   // much longer than any integer
-   sprintf(buffer,"%ld", i);
+   wxChar buffer[256];   // much longer than any integer
+   wxSprintf(buffer, _T("%ld"), i);
    return String(buffer);
 }
@@ -195,6 +195,6 @@
 strutil_ultoa(unsigned long i)
 {
-   char buffer[256];   // much longer than any integer
-   sprintf(buffer,"%lu", i);
+   wxChar buffer[256];   // much longer than any integer
+   wxSprintf(buffer, _T("%lu"), i);
    return String(buffer);
 }
@@ -204,5 +204,5 @@
 strutil_strdup(const wxChar *in)
 {
-   wxChar *cptr = new wxChar[strlen(in)+1];
+   wxChar *cptr = new wxChar[wxStrlen(in)+1];
    wxStrcpy(cptr,in);
    return cptr;
@@ -261,5 +261,5 @@
       if(! found || ! *found)
          break;
-      tlist.push_back(new String(found));
+      tlist.push_back(new String(wxConvertMB2WX(found)));
    }
 }
@@ -366,5 +366,5 @@
 strutil_getfilename(const String& path)
 {
-   const char *pLast1 = strrchr(path, '/');
+   const wxChar *pLast1 = wxStrrchr(path, '/');
    size_t nPos1 = pLast1 ? pLast1 - path.c_str() : 0;
 
@@ -372,5 +372,5 @@
    // '\\' doesn't count as path separator under Unix
 #ifdef OS_WIN
-   const char *pLast2 = strrchr(path, '\\');
+   const wxChar *pLast2 = wxStrrchr(path, '\\');
    size_t nPos2 = pLast2 ? pLast2 - path.c_str() : 0;
    if ( nPos2 > nPos1 )
@@ -400,5 +400,5 @@
 {
    String result;
-   for ( const char *p = path.c_str(); *p != '\0'; p++ )
+   for ( const wxChar *p = path.c_str(); *p != '\0'; p++ )
    {
       if ( *p == '/' )
@@ -448,5 +448,5 @@
 
    if(strutil_isempty(ipath))
-      return "";
+      return _T("");
 
    if(ipath[0u]=='~')
@@ -454,5 +454,5 @@
       if(ipath[1u] == DIR_SEPARATOR)
       {
-         path = getenv("HOME");
+         path = wxGetenv(_T("HOME"));
          path << (ipath.c_str() + 1);
          return path;
@@ -461,18 +461,18 @@
       {
          String user =
-            strutil_before(String(ipath.c_str()+1),DIR_SEPARATOR);
+            strutil_before(String(ipath.c_str()+1), DIR_SEPARATOR);
          struct passwd *entry;
          do
          {
             entry = getpwent();
-            if(entry && entry->pw_name == user)
+            if(entry && entry->pw_name == wxConvertWX2MB(user))
                break;
          } while(entry);
          if(entry)
-            path << entry->pw_dir;
+            path << wxConvertMB2WX(entry->pw_dir);
          else
-            path << DIR_SEPARATOR << "home" << DIR_SEPARATOR << user; // improvise!
+            path << DIR_SEPARATOR << _T("home") << DIR_SEPARATOR << user; // 
improvise!
          path << DIR_SEPARATOR
-              << strutil_after(String(ipath.c_str()+1),DIR_SEPARATOR);
+              << strutil_after(String(ipath.c_str()+1), DIR_SEPARATOR);
          return path;
       }
@@ -490,9 +490,9 @@
 */
 String
-strutil_path_parent(String const &path, char separator)
+strutil_path_parent(String const &path, wxChar separator)
 {
-   const char *cptr = strrchr(path.c_str(),separator);
+   const wxChar *cptr = wxStrrchr(path.c_str(),separator);
    if(cptr == NULL) // not found
-      return "";
+      return _T("");
 
    return path.Left(cptr - path.c_str());
@@ -506,9 +506,9 @@
 */
 String
-strutil_path_filename(String const &path, char separator)
+strutil_path_filename(String const &path, wxChar separator)
 {
-   const char *cptr = strrchr(path.c_str(),separator);
+   const wxChar *cptr = wxStrrchr(path.c_str(),separator);
    if(cptr == NULL) // not found
-      return "";
+      return _T("");
 
    return String(cptr+1);
@@ -526,9 +526,9 @@
 {
    String out;
-   const char *cptr = in.c_str();
+   const wxChar *cptr = in.c_str();
    bool has_cr =  false;
 
    if(! cptr)
-      return "";
+      return _T("");
    while(*cptr)
    {
@@ -626,9 +626,9 @@
    String ToHex(void)
       {
-         String to = "";
+         String to = _T("");
          String tmp;
          for(size_t i = 0; i < len; i++)
          {
-            tmp.Printf("%02x", (int) data[i]);
+            tmp.Printf(_T("%02x"), (int) data[i]);
             to << tmp;
          }
@@ -640,13 +640,13 @@
          len = hexdata.Length() / 2;
          data = (BYTE *)malloc( len );
-         const char *cptr = hexdata.c_str();
+         const wxChar *cptr = hexdata.c_str();
          String tmp;
          int val, idx = 0;
          while(*cptr)
          {
-            tmp = "";
+            tmp = _T("");
             tmp << *cptr << *(cptr+1);
             cptr += 2;
-            sscanf(tmp.c_str(),"%02x", &val);
+            wxSscanf(tmp.c_str(), _T("%02x"), &val);
             data[idx++] = (BYTE)val;
          }
@@ -761,10 +761,10 @@
          // we hadn't used the global password before
          mApplication->GetProfile()->writeEntry(MP_CRYPT_TESTDATA,
-               strutil_encrypt_tf("TESTDATA"));
+               strutil_encrypt_tf(_T("TESTDATA")));
 
          return true;
       }
 
-      if ( strutil_decrypt(testdata) == "TESTDATA" )
+      if ( strutil_decrypt(testdata) == _T("TESTDATA") )
       {
          // correct password
@@ -794,7 +794,7 @@
    if ( setup_twofish() )
    {
-      CryptData input(original);
+      CryptData input(wxConvertWX2MB(original));
       CryptData output;
-      int rc = TwoFishCrypt(1, 128, gs_GlobalPassword, &input ,&output);
+      int rc = TwoFishCrypt(1, 128, wxConvertWX2MB(gs_GlobalPassword), &input 
,&output);
       if(rc)
       {
@@ -810,5 +810,5 @@
    }
 
-   return "";
+   return _T("");
 }
 
@@ -819,5 +819,5 @@
    {
       ERRORMESSAGE((_("Strong encryption algorithm not available.")));
-      return "";
+      return _T("");
    }
    if ( !setup_twofish() )
@@ -829,10 +829,10 @@
    input.FromHex(original.c_str()+1); // skip initial '-'
    CryptData output;
-   int rc = TwoFishCrypt(0,128,gs_GlobalPassword, &input,&output);
+   int rc = TwoFishCrypt(0, 128, wxConvertWX2MB(gs_GlobalPassword), &input,&output);
    if(rc)
    {
-      return output.data;
+      return wxChar(output.data);
    }
-   return "";
+   return _T("");
 }
 
@@ -877,6 +877,6 @@
    {
       String oldPassword = gs_GlobalPassword;
-      gs_GlobalPassword = "testPassword";
-      String test = "This is a test, in cleartext.";
+      gs_GlobalPassword = _T("testPassword");
+      String test = _T("This is a test, in cleartext.");
       String cipher = strutil_encrypt_tf(test);
       strutil_has_twofish = TRUE; // assume or it will fail
@@ -892,5 +892,5 @@
             NULL,
             _("Missing feature"),
-            "EncryptionAlgoBroken");
+            _T("EncryptionAlgoBroken"));
          strutil_has_twofish = FALSE;
       }
@@ -933,5 +933,5 @@
 {
    if(original.Length() == 0)
-      return "";
+      return _T("");
 
    if(! strutil_encrypt_initialised)
@@ -945,5 +945,5 @@
       tmpstr,
       newstr;
-   const char
+   const wxChar
       *cptr = original.c_str();
 
@@ -956,5 +956,5 @@
       // now we have the encrypted pair, which could be binary data,
       // so we write hex values instead:
-      tmpstr.Printf("%02x%02x", pair[0], pair[1]);
+      tmpstr.Printf(_T("%02x%02x"), (wxChar)pair[0], (wxChar)pair[1]);
       newstr << tmpstr;
       cptr ++;
@@ -969,5 +969,5 @@
    gs_GlobalPassword = newpasswd;
    mApplication->GetProfile()->writeEntry(MP_CRYPT_TESTDATA,
-                                          strutil_encrypt("TESTDATA"));
+                                          strutil_encrypt(_T("TESTDATA")));
 }
 
@@ -993,5 +993,5 @@
    String oldPassword = gs_GlobalPassword;
    gs_GlobalPassword = passwd;
-   bool ok = strutil_decrypt(testdata) == "TESTDATA";
+   bool ok = strutil_decrypt(testdata) == _T("TESTDATA");
    gs_GlobalPassword = oldPassword;
 
@@ -1003,5 +1003,5 @@
 {
    if(original.Length() == 0)
-      return "";
+      return _T("");
 
    if(! strutil_encrypt_initialised)
@@ -1016,5 +1016,5 @@
       wxLogWarning(_("Decrypt function called with illegal string."));
 
-      return "";
+      return _T("");
    }
 
@@ -1022,5 +1022,5 @@
       tmpstr,
       newstr;
-   const char
+   const wxChar
       *cptr = original.c_str();
 
@@ -1029,13 +1029,13 @@
    while(*cptr)
    {
-      tmpstr = "";
+      tmpstr = _T("");
       tmpstr << *cptr << *(cptr+1);
       cptr += 2;
-      sscanf(tmpstr.c_str(), "%02x", &i);
+      wxSscanf(tmpstr.c_str(), _T("%02x"), &i);
       pair[0] = (unsigned char) i;
-      tmpstr = "";
+      tmpstr = _T("");
       tmpstr << *cptr << *(cptr+1);
       cptr += 2;
-      sscanf(tmpstr.c_str(), "%02x", &i);
+      wxSscanf(tmpstr.c_str(), _T("%02x"), &i);
       pair[1] = (unsigned char) i;
       strutil_encrypt_pair(pair);
@@ -1100,6 +1100,6 @@
    if ( tmvalue )
    {
-      char buffer[256];
-      strftime(buffer, 256, format.c_str(), tmvalue);
+      wxChar buffer[256];
+      wxStrftime(buffer, 256, format.c_str(), tmvalue);
       strTime = buffer;
    }
@@ -1119,5 +1119,5 @@
 
    String newstr;
-   const char *cptr;
+   const wxChar *cptr;
    for ( cptr = string.c_str();
          *cptr && (isdigit(*cptr) || *cptr == '+' || *cptr == '-');
@@ -1148,5 +1148,5 @@
    bool ok;
 
-   const char *cptr = string.c_str();
+   const wxChar *cptr = string.c_str();
    if ( *cptr != '"' )
    {
@@ -1188,5 +1188,5 @@
    newstr.reserve(string.length());
 
-   for ( const char *cptr = string.c_str(); *cptr; cptr++ )
+   for ( const wxChar *cptr = string.c_str(); *cptr; cptr++ )
    {
       if ( *cptr == '"' )

Index: sysutil.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/util/sysutil.cpp,v
retrieving revision 1.7
retrieving revision 1.8
diff -b -u -2 -r1.7 -r1.8
--- sysutil.cpp 18 Sep 2003 16:31:03 -0000      1.7
+++ sysutil.cpp 12 Oct 2003 22:03:37 -0000      1.8
@@ -29,15 +29,15 @@
    int rc;
 
-   rc = stat(file1, &statbuf1);
+   rc = wxStat(file1, &statbuf1);
    if(rc != 0)
       if(rc == ENOENT)
       {
          // using all flags but x, will be modified by umask anyway
-         int fd = creat(file1,S_IWUSR|S_IRUSR|S_IWGRP|S_IWUSR|S_IWOTH|S_IROTH);
+         int fd = creat(file1.fn_str(), 
S_IWUSR|S_IRUSR|S_IWGRP|S_IWUSR|S_IWOTH|S_IROTH);
          if(fd == -1)
             return strutil_compare_filenames(file1, file2);
          close(fd); //    created the empty file
-         rc = stat(file1, &statbuf1);
-         unlink(file1);
+         rc = wxStat(file1, &statbuf1);
+         unlink(file1.fn_str());
          if(rc != 0)
             return strutil_compare_filenames(file1, file2);
@@ -46,15 +46,15 @@
             return strutil_compare_filenames(file1, file2);
    
-   rc = stat(file2, &statbuf2);
+   rc = wxStat(file2, &statbuf2);
    if(rc != 0)
       if(rc == ENOENT)
       {
          // using all flags but x, will be modified by umask anyway
-         int fd = creat(file2,S_IWUSR|S_IRUSR|S_IWGRP|S_IWUSR|S_IWOTH|S_IROTH);
+         int fd = creat(file2.fn_str(), 
S_IWUSR|S_IRUSR|S_IWGRP|S_IWUSR|S_IWOTH|S_IROTH);
          if(fd == -1)
             return strutil_compare_filenames(file1, file2);
          close(fd); //    created the empty file
-         rc = stat(file2, &statbuf2);
-         unlink(file2);
+         rc = wxStat(file2, &statbuf2);
+         unlink(file2.fn_str());
          if(rc != 0)
             return strutil_compare_filenames(file1, file2);

Index: upgrade.cpp
===================================================================
RCS file: /cvsroot/mahogany/M/src/util/upgrade.cpp,v
retrieving revision 1.216
retrieving revision 1.217
diff -b -u -2 -r1.216 -r1.217
--- upgrade.cpp 30 Sep 2003 13:46:22 -0000      1.216
+++ upgrade.cpp 12 Oct 2003 22:03:37 -0000      1.217
@@ -154,5 +154,5 @@
 #ifdef USE_INBOX
    // the INBOX name is not translated -- should it be?
-   static const char *INBOX_NAME = "INBOX";
+   static const wxChar *INBOX_NAME = _T("INBOX");
 #endif // USE_INBOX
 
@@ -160,10 +160,10 @@
 // update the old versions of the config
 
-#define MP_OLD_FOLDER_HOST "HostName"
+#define MP_OLD_FOLDER_HOST _T("HostName")
 
-#define M_TEMPLATES_SECTION "Templates"
-#define M_TEMPLATE_SECTION "Template"
+#define M_TEMPLATES_SECTION _T("Templates")
+#define M_TEMPLATE_SECTION _T("Template")
 
-#define M_CUSTOM_HEADERS_CONFIG_SECTION "CustomHeaders"
+#define M_CUSTOM_HEADERS_CONFIG_SECTION _T("CustomHeaders")
 
 // obsolete folder flags which are not used any more but are needed here for
@@ -1406,5 +1406,5 @@
    wxString tmp;
    tmp << labels[Label_MbxFormat]
-       << ":Unix mbx mailbox:Unix mailbox:MMDF (SCO Unix):Tenex (Unix MM format)";
+       << _T(":Unix mbx mailbox:Unix mailbox:MMDF (SCO Unix):Tenex (Unix MM format)");
    m_FolderTypeChoice = panel->CreateChoice(tmp, widthMax, last);
    last = m_FolderTypeChoice;
@@ -1547,20 +1547,20 @@
    switch(ourtime->tm_mon)
    {
-   case  0: timeStr = "Jan"; break;
-   case  1: timeStr = "Feb"; break;
-   case  2: timeStr = "Mar"; break;
-   case  3: timeStr = "Apr"; break;
-   case  4: timeStr = "May"; break;
-   case  5: timeStr = "Jun"; break;
-   case  6: timeStr = "Jul"; break;
-   case  7: timeStr = "Aug"; break;
-   case  8: timeStr = "Sep"; break;
-   case  9: timeStr = "Oct"; break;
-   case 10: timeStr = "Nov"; break;
-   case 11: timeStr = "Dec"; break;
+   case  0: timeStr = _T("Jan"); break;
+   case  1: timeStr = _T("Feb"); break;
+   case  2: timeStr = _T("Mar"); break;
+   case  3: timeStr = _T("Apr"); break;
+   case  4: timeStr = _T("May"); break;
+   case  5: timeStr = _T("Jun"); break;
+   case  6: timeStr = _T("Jul"); break;
+   case  7: timeStr = _T("Aug"); break;
+   case  8: timeStr = _T("Sep"); break;
+   case  9: timeStr = _T("Oct"); break;
+   case 10: timeStr = _T("Nov"); break;
+   case 11: timeStr = _T("Dec"); break;
    default:
       ; // suppress warning
    }
-   timeStr.Printf("%02d %s %d %02d:%02d:%02d",
+   timeStr.Printf(_T("%02d %s %d %02d:%02d:%02d"),
                   ourtime->tm_mday,
                   timeStr.c_str(),
@@ -1642,5 +1642,5 @@
                         -1,                           // id
                         _("Mahogany Installation"),   // title
-                        iconManager->GetBitmap("install_welcome") // def image
+                        iconManager->GetBitmap(_T("install_welcome")) // def image
 #if wxCHECK_VERSION(2,5,0)
                         ,
@@ -1695,8 +1695,8 @@
    {
       // load all modules by default:
-      wxString modules = "Filters";
+      wxString modules = _T("Filters");
 #ifdef USE_PISOCK
       if(gs_installWizardData.usePalmOs)
-         modules += ":PalmOS";
+         modules += _T(":PalmOS");
 #endif // USE_PISOCK
 
@@ -1725,5 +1725,5 @@
       gs_installWizardData.pop =
       gs_installWizardData.imap =
-      gs_installWizardData.nntp = "";
+      gs_installWizardData.nntp = _T("");
 
       // don't try to send the test message if the SMTP server wasn't
@@ -2137,12 +2137,12 @@
    //FIXME paths need adjustment for windows?
    if ( CopyEntries(mApplication->GetProfile()->GetConfig(),
-                    "/M/Profiles/Folders","/M/Profiles") == -1 )
+                    _T("/M/Profiles/Folders"), _T("/M/Profiles")) == -1 )
       rc = false;
 
    if ( CopyEntries(mApplication->GetProfile()->GetConfig(),
-                    "/AdbEditor","/M/Profiles/AdbEditor") )
+                    _T("/AdbEditor"), _T("/M/Profiles/AdbEditor")) )
       rc = false;
 
-   Profile_obj p("");
+   Profile_obj p(_T(""));
    kbStringList
       folders;
@@ -2165,6 +2165,6 @@
    wxConfigBase *c = mApplication->GetProfile()->GetConfig();
    // Delete obsolete groups:
-   c->DeleteGroup("/M/Profiles/Folders");
-   c->DeleteGroup("/AdbEditor");
+   c->DeleteGroup(_T("/M/Profiles/Folders"));
+   c->DeleteGroup(_T("/AdbEditor"));
 
    /* Encrypt passwords in new location and make sure we have no
@@ -2224,5 +2224,5 @@
 
          Profile::ReadResult found;
-         String hostname = profile->readEntry(MP_OLD_FOLDER_HOST, "", &found);
+         String hostname = profile->readEntry(MP_OLD_FOLDER_HOST, _T(""), &found);
          if ( found == Profile::Read_FromHere )
          {
@@ -2258,5 +2258,5 @@
 
    // enumerate all folders recursively
-   MFolder_obj folderRoot("");
+   MFolder_obj folderRoot(_T(""));
    UpgradeFolderFrom020Traversal traverse(folderRoot);
    traverse.Traverse();
@@ -2289,5 +2289,5 @@
       if ( profile->HasGroup(group) )
       {
-         static const char *templateKinds[] =
+         static const wxChar *templateKinds[] =
          {
             MP_TEMPLATE_NEWMESSAGE,
@@ -2306,5 +2306,5 @@
             if ( profile->HasEntry(entry) )
             {
-               String templateValue = profile->readEntry(entry, "");
+               String templateValue = profile->readEntry(entry, _T(""));
 
                String entryNew;
@@ -2315,7 +2315,7 @@
                if ( profileApp->HasEntry(entryNew) )
                {
-                  wxLogWarning("A profile entry '%s' already exists, "
+                  wxLogWarning(_T("A profile entry '%s' already exists, "
                                "impossible to upgrade the existing template "
-                               "in '%s/%s/%s'",
+                               "in '%s/%s/%s'"),
                                entryNew.c_str(),
                                folderName.c_str(),
@@ -2362,5 +2362,5 @@
 
    // enumerate all folders recursively
-   MFolder_obj folderRoot("");
+   MFolder_obj folderRoot(_T(""));
    TemplateFixFolderTraversal traverse(folderRoot);
    traverse.Traverse();
@@ -2413,14 +2413,14 @@
    static const struct
    {
-      const char *name;
+      const wxChar *name;
       int pos;
    } SystemFolders[] =
    {
-      { "INBOX",     MFolderIndex_Inbox   },
-      { "New Mail",  MFolderIndex_NewMail },
-      { "SentMail",  MFolderIndex_SentMail},
-      { "Trash",     MFolderIndex_Trash   },
-      { "Outbox",    MFolderIndex_Outbox  },
-      { "Draft",     MFolderIndex_Draft   },
+      { _T("INBOX"),     MFolderIndex_Inbox   },
+      { _T("New Mail"),  MFolderIndex_NewMail },
+      { _T("SentMail"),  MFolderIndex_SentMail},
+      { _T("Trash"),     MFolderIndex_Trash   },
+      { _T("Outbox"),    MFolderIndex_Outbox  },
+      { _T("Draft"),     MFolderIndex_Draft   },
    };
 
@@ -2452,9 +2452,9 @@
 {
    // from wxHeadersDialogs.cpp
-   static const char *customHeaderSubgroups[] =
+   static const wxChar *customHeaderSubgroups[] =
    {
-      "News",
-      "Mail",
-      "Both"
+      _T("News"),
+      _T("Mail"),
+      _T("Both")
    };
 
@@ -2462,5 +2462,5 @@
    for ( size_t type = 0; type < WXSIZEOF(customHeaderSubgroups); type++ )
    {
-      String path = pathBase + '/' + customHeaderSubgroups[type];
+      String path = pathBase + _T('/') + customHeaderSubgroups[type];
       if ( config->HasGroup(path) )
       {
@@ -2477,8 +2477,8 @@
          {
             headerNames.Add(name);
-            headerValues.Add(config->Read(name, ""));
+            headerValues.Add(config->Read(name, _T("")));
          }
 
-         config->SetPath("../..");
+         config->SetPath(_T("../.."));
 
          // write them as ::GetCustomHeaders() expects them to be
@@ -2515,8 +2515,8 @@
    {
       names.Add(name);
-      values.Add(config->Read(name, ""));
+      values.Add(config->Read(name, _T("")));
    }
 
-   config->SetPath("..");
+   config->SetPath(_T(".."));
 
    size_t count = names.GetCount();
@@ -2546,5 +2546,5 @@
          deleteGroup = true;
       }
-      else if ( name == "Template" )
+      else if ( name == _T("Template") )
       {
          UpdateTemplatesTo064(config);
@@ -2559,5 +2559,5 @@
          // version?) and if we leave them in config we'd have all kinds of
          // problems with them because they don't represent the real folders
-         deleteGroup = config->Read(name + "/ProfileType", 0l) != 1;
+         deleteGroup = config->Read(name + _T("/ProfileType"), 0l) != 1;
          if ( deleteGroup )
          {
@@ -2576,9 +2576,9 @@
       {
          // remove obsolete "ProfileType", it's not used nor needed any more
-         config->DeleteEntry(name + "/ProfileType");
+         config->DeleteEntry(name + _T("/ProfileType"));
 
          config->SetPath(name);
          UpdateNonFolderProfiles(config);
-         config->SetPath("..");
+         config->SetPath(_T(".."));
       }
 
@@ -2625,5 +2625,5 @@
    pathOld.clear();
    pathNew.clear();
-   pathOld << '/' << Profile::GetProfilePath() << "/Templates";
+   pathOld << _T('/') << Profile::GetProfilePath() << _T("/Templates");
    pathNew << Profile::GetTemplatesPath();
    if ( CopyEntries(config, pathOld, pathNew) == -1 )
@@ -2674,5 +2674,5 @@
 {
    // add MF_FLAGS_MONITOR to all folders with MF_FLAGS_INCOMING flag
-   MFolder_obj folderRoot("");
+   MFolder_obj folderRoot(_T(""));
    UpgradeFolderFrom064Traversal traverse(folderRoot);
 
@@ -2746,5 +2746,5 @@
          // SSLSupport_XXX values
 
-         const char *key = GetOptionName(MP_SMTPHOST_USE_SSL);
+         const wxChar *key = GetOptionName(MP_SMTPHOST_USE_SSL);
          Profile::ReadResult readFrom;
          bool wasUsingSSL = profile->readEntry(key, false, &readFrom);
@@ -2790,5 +2790,5 @@
 {
    // replace SSL flags with SSL profile settings
-   MFolder_obj folderRoot("");
+   MFolder_obj folderRoot(_T(""));
    UpgradeFolderFrom0641Traversal traverse(folderRoot);
 
@@ -2811,9 +2811,9 @@
    wxConfigBase *config = mApplication->GetProfile()->GetConfig();
 
-   if ( CopyEntries(config, "/M", "/") < 0 )
+   if ( CopyEntries(config, _T("/M"), _T("/")) < 0 )
       return false;
 
-   if ( !config->DeleteGroup("/M") )
-      wxLogDebug("Old data was left in [M] config section.");
+   if ( !config->DeleteGroup(_T("/M")) )
+      wxLogDebug(_T("Old data was left in [M] config section."));
 
 
@@ -2827,5 +2827,5 @@
 
    String path;
-   path << '/' << M_SETTINGS_CONFIG_SECTION << "MessageBox";
+   path << _T('/') << M_SETTINGS_CONFIG_SECTION << _T("MessageBox");
    config->SetPath(path);
 
@@ -2837,5 +2837,5 @@
          cont = config->GetNextGroup(groupOld, cookie) )
    {
-      if ( groupOld.StartsWith("M_Profiles_", &groupNew) )
+      if ( groupOld.StartsWith(_T("M_Profiles_"), &groupNew) )
       {
          config->RenameGroup(groupOld, groupNew);
@@ -2870,24 +2870,24 @@
          version.Truncate(version.Len() - 1);
 
-      if ( version == "0.01" )
+      if ( version == _T("0.01") )
          oldVersion = Version_Alpha001;
-      else if ( version == "0.02" || version == "0.10")
+      else if ( version == _T("0.02") || version == _T("0.10"))
          oldVersion = Version_Alpha010;
-      else if ( version == "0.20" )
+      else if ( version == _T("0.20") )
          oldVersion = Version_Alpha020;
-      else if ( version == "0.21" || version == "0.22" ||
-                version == "0.23" || version == "0.50" )
+      else if ( version == _T("0.21") || version == _T("0.22") ||
+                version == _T("0.23") || version == _T("0.50") )
          oldVersion = Version_050;
-      else if ( version == "0.60" )
+      else if ( version == _T("0.60") )
          oldVersion = Version_060;
-      else if ( version == "0.61" || version == "0.62" || version == "0.63" )
+      else if ( version == _T("0.61") || version == _T("0.62") || version == 
_T("0.63") )
          oldVersion = Version_061;
-      else if ( version == "0.64" )
+      else if ( version == _T("0.64") )
          oldVersion = Version_064;
-      else if ( version == "0.64.1" || version == "0.64.2" )
+      else if ( version == _T("0.64.1") || version == _T("0.64.2") )
          oldVersion = Version_064_1;
-      else if ( version == "0.65" || version == "0.65.0" )
+      else if ( version == _T("0.65") || version == _T("0.65.0") )
          oldVersion = Version_065;
-      else if ( version == "0.66" )
+      else if ( version == _T("0.66") )
          oldVersion = Version_066;
       else
@@ -3195,5 +3195,5 @@
           NULL,
           MDIALOG_MSGTITLE,
-          "WarnInbox"
+          _T("WarnInbox")
          );
       }
@@ -3397,5 +3397,5 @@
        << me
        << _("\n\nPlease check whether it arrives.");
-   MDialog_Message(msg, NULL, _("Testing your configuration"), "TestMailSent");
+   MDialog_Message(msg, NULL, _("Testing your configuration"), _T("TestMailSent"));
 
    return true; // till we know something better
@@ -3410,5 +3410,5 @@
                                          int flags)
 {
-   return CreateFolderTreeEntry(NULL, name, type, flags, "", false);
+   return CreateFolderTreeEntry(NULL, name, type, flags, _T(""), false);
 }
 
@@ -3579,7 +3579,7 @@
    if( strutil_isempty(READ_APPCONFIG(MP_NNTPHOST)) )
    {
-      char *cptr = getenv("NNTPSERVER");
+      wxChar *cptr = wxGetenv(_T("NNTPSERVER"));
       if(!cptr || !*cptr)
-        cptr = "news";
+        cptr = _T("news");
       profile->writeEntry(MP_NNTPHOST, cptr);
    }
@@ -3587,7 +3587,7 @@
    if( strutil_isempty(READ_APPCONFIG(MP_SMTPHOST)) )
    {
-      char *cptr = getenv("SMTPSERVER");
+      wxChar *cptr = wxGetenv(_T("SMTPSERVER"));
       if(!cptr || !*cptr)
-        cptr = "localhost";
+        cptr = _T("localhost");
       profile->writeEntry(MP_SMTPHOST, cptr);
    }
@@ -3595,5 +3595,5 @@
    if( strutil_isempty(READ_APPCONFIG(MP_POPHOST)) )
    {
-      char *cptr = getenv("POPSERVER");
+      wxChar *cptr = wxGetenv(_T("POPSERVER"));
       if(cptr && *cptr)
          profile->writeEntry(MP_POPHOST, cptr);
@@ -3601,5 +3601,5 @@
    if( strutil_isempty(READ_APPCONFIG(MP_IMAPHOST)) )
    {
-      char *cptr = getenv("IMAPSERVER");
+      wxChar *cptr = wxGetenv(_T("IMAPSERVER"));
       if(cptr && *cptr)
          profile->writeEntry(MP_IMAPHOST, cptr);
@@ -3614,6 +3614,6 @@
  */
 
-#define M_SYNCMAIL_SUBJECT   "DO NOT DELETE! Mahogany remote configuration info"
-#define M_SYNCMAIL_CONFIGSTART "Mahogany configuration info:"
+#define M_SYNCMAIL_SUBJECT   _T("DO NOT DELETE! Mahogany remote configuration info")
+#define M_SYNCMAIL_CONFIGSTART _T("Mahogany configuration info:")
 
 static time_t  gs_RemoteSyncDate = 0;
@@ -3695,11 +3695,11 @@
 
    msgText = msgText.Mid( msgText.Find(M_SYNCMAIL_CONFIGSTART) +
-                          strlen( M_SYNCMAIL_CONFIGSTART) );
-   wxString filename = wxGetTempFileName("MTemp");
+                          wxStrlen( M_SYNCMAIL_CONFIGSTART) );
+   wxString filename = wxGetTempFileName(_T("MTemp"));
    wxFile tmpfile(filename, wxFile::write);
    tmpfile.Write(msgText, msgText.Length());
    tmpfile.Close();
 
-   wxFileConfig fc("","",filename,"",wxCONFIG_USE_LOCAL_FILE);
+   wxFileConfig fc(_T(""), _T(""), filename, _T(""), wxCONFIG_USE_LOCAL_FILE);
 
    bool rc = true;
@@ -3763,5 +3763,5 @@
          MEventData *data = new MEventFolderTreeChangeData
                                 (
-                                 "",
+                                 _T(""),
                                  MEventFolderTreeChangeData::CreateUnder
                                 );
@@ -3866,6 +3866,6 @@
    }
 
-   wxString filename = wxGetTempFileName("MTemp");
-   wxFileConfig fc("","",filename,"",wxCONFIG_USE_LOCAL_FILE);
+   wxString filename = wxGetTempFileName(_T("MTemp"));
+   wxFileConfig fc(_T(""), _T(""), filename, _T(""), wxCONFIG_USE_LOCAL_FILE);
 
    bool rc = true;
@@ -3913,5 +3913,5 @@
 
    wxFile tmpfile(filename, wxFile::read);
-   char * buffer = new char [ tmpfile.Length() + 1];
+   wxChar * buffer = new wxChar [ tmpfile.Length() + 1];
    if(tmpfile.Read(buffer, tmpfile.Length()) != tmpfile.Length())
    {
@@ -3927,10 +3927,10 @@
 
    wxString msgText;
-   msgText << "From: [EMAIL PROTECTED]"
-           << "Subject: " << M_SYNCMAIL_SUBJECT << "\n"
-           << "Date: " << GetRFC822Time() << "\n"
-           << "\n"
-           << M_SYNCMAIL_CONFIGSTART << "\n"
-           << buffer << "\n";
+   msgText << _T("From: [EMAIL PROTECTED]")
+           << _T("Subject: ") << M_SYNCMAIL_SUBJECT << _T("\n")
+           << _T("Date: ") << GetRFC822Time() << _T("\n")
+           << _T("\n")
+           << M_SYNCMAIL_CONFIGSTART << _T("\n")
+           << buffer << _T("\n");
    delete [] buffer;
    if( ! mf->AppendMessage(msgText) )
@@ -3988,5 +3988,5 @@
 
    // do we need to upgrade something?
-   String version = profile->readEntry(MP_VERSION, "");
+   String version = profile->readEntry(MP_VERSION, _T(""));
    if ( version != M_VERSION )
    {



-------------------------------------------------------
This SF.net email is sponsored by: SF.net Giveback Program.
SourceForge.net hosts over 70,000 Open Source Projects.
See the people who have HELPED US provide better services:
Click here: http://sourceforge.net/supporters.php
_______________________________________________
Mahogany-cvsupdates mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-cvsupdates

Reply via email to