]> git.saurik.com Git - wxWidgets.git/commitdiff
don't use implicit wxString->char*/wchar_t* conversion, it will not be available...
authorVáclav Slavík <vslavik@fastmail.fm>
Sun, 10 Jun 2007 17:42:41 +0000 (17:42 +0000)
committerVáclav Slavík <vslavik@fastmail.fm>
Sun, 10 Jun 2007 17:42:41 +0000 (17:42 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@46391 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

51 files changed:
docs/latex/wx/fltfactory.tex
docs/latex/wx/function.tex
include/wx/archive.h
include/wx/arrstr.h
include/wx/cmdline.h
include/wx/confbase.h
include/wx/ipcbase.h
include/wx/sckipc.h
include/wx/sstream.h
include/wx/strconv.h
include/wx/stream.h
src/common/arcfind.cpp
src/common/arrstr.cpp
src/common/cmdline.cpp
src/common/config.cpp
src/common/dcbase.cpp
src/common/docview.cpp
src/common/dynarray.cpp
src/common/fileconf.cpp
src/common/filename.cpp
src/common/filtfind.cpp
src/common/ftp.cpp
src/common/http.cpp
src/common/image.cpp
src/common/sstream.cpp
src/common/strconv.cpp
src/common/stream.cpp
src/common/tarstrm.cpp
src/common/txtstrm.cpp
src/common/uri.cpp
src/common/zipstrm.cpp
src/gtk/animate.cpp
src/gtk/dirdlg.cpp
src/gtk/filedlg.cpp
src/gtk/hyperlink.cpp
src/gtk/menu.cpp
src/gtk/radiobox.cpp
src/msw/utils.cpp
src/richtext/richtexthtml.cpp
src/richtext/richtextstyledlg.cpp
src/richtext/richtextxml.cpp
src/unix/dir.cpp
src/unix/mimetype.cpp
src/unix/utilsunx.cpp
src/xml/xml.cpp
tests/arrays/arrays.cpp
tests/datetime/datetimetest.cpp
tests/formatconverter/formatconvertertest.cpp
tests/lists/lists.cpp
tests/mbconv/mbconvtest.cpp
tests/regex/regextest.cpp

index fdbc71965141181168604b5135f2aebbc69e88cd..1c01f8fac9ec8c9d6d098806869795ccb0988f52 100644 (file)
@@ -55,7 +55,7 @@ enum wxStreamProtocolType
 
 \membersection{wxFilterClassFactory::CanHandle}\label{wxfilterclassfactorycanhandle}
 
 
 \membersection{wxFilterClassFactory::CanHandle}\label{wxfilterclassfactorycanhandle}
 
-\constfunc{bool}{CanHandle}{\param{const wxChar* }{protocol}, \param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}
+\constfunc{bool}{CanHandle}{\param{const wxString\& }{protocol}, \param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}
 
 Returns true if this factory can handle the given protocol, MIME type, HTTP
 encoding or file extension.
 
 Returns true if this factory can handle the given protocol, MIME type, HTTP
 encoding or file extension.
@@ -66,7 +66,7 @@ can be a complete filename rather than just an extension.
 
 \membersection{wxFilterClassFactory::Find}\label{wxfilterclassfactoryfind}
 
 
 \membersection{wxFilterClassFactory::Find}\label{wxfilterclassfactoryfind}
 
-\func{static const wxFilterClassFactory*}{Find}{\param{const wxChar* }{protocol}, \param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}
+\func{static const wxFilterClassFactory*}{Find}{\param{const wxString\& }{protocol}, \param{wxStreamProtocolType }{type = wxSTREAM\_PROTOCOL}}
 
 A static member that finds a factory that can handle a given protocol, MIME
 type, HTTP encoding or file extension.  Returns a pointer to the class
 
 A static member that finds a factory that can handle a given protocol, MIME
 type, HTTP encoding or file extension.  Returns a pointer to the class
index c1056d214ffac3d9c5947163124b3da54bb19e0e..e71c46f65125170645cc3a2ff2e077ee15d47bc4 100644 (file)
@@ -1044,7 +1044,7 @@ temporary storage that should not be deallocated.
 
 \membersection{::wxFindFirstFile}\label{wxfindfirstfile}
 
 
 \membersection{::wxFindFirstFile}\label{wxfindfirstfile}
 
-\func{wxString}{wxFindFirstFile}{\param{const char *}{spec}, \param{int}{ flags = 0}}
+\func{wxString}{wxFindFirstFile}{\param{const wxString\& }{spec}, \param{int}{ flags = 0}}
 
 This function does directory searching; returns the first file
 that matches the path {\it spec}, or the empty string. Use \helpref{wxFindNextFile}{wxfindnextfile} to
 
 This function does directory searching; returns the first file
 that matches the path {\it spec}, or the empty string. Use \helpref{wxFindNextFile}{wxfindnextfile} to
@@ -1342,7 +1342,7 @@ Note that empty tokens will be generated if there are two or more adjacent separ
 
 \membersection{::wxSplitPath}\label{wxsplitfunction}
 
 
 \membersection{::wxSplitPath}\label{wxsplitfunction}
 
-\func{void}{wxSplitPath}{\param{const char *}{ fullname}, \param{wxString *}{ path}, \param{wxString *}{ name}, \param{wxString *}{ ext}}
+\func{void}{wxSplitPath}{\param{const wxString\&}{ fullname}, \param{wxString *}{ path}, \param{wxString *}{ name}, \param{wxString *}{ ext}}
 
 {\bf NB:} This function is obsolete, please use
 \helpref{wxFileName::SplitPath}{wxfilenamesplitpath} instead.
 
 {\bf NB:} This function is obsolete, please use
 \helpref{wxFileName::SplitPath}{wxfilenamesplitpath} instead.
index f814b8f3b8af42648fc44c86336626c97b9aa98a..67419a91fc2364dc710bb0fe72abf68f9099c8e5 100644 (file)
@@ -347,7 +347,7 @@ public:
     wxMBConv& GetConv() const
         { if (m_pConv) return *m_pConv; else return wxConvLocal; }
 
     wxMBConv& GetConv() const
         { if (m_pConv) return *m_pConv; else return wxConvLocal; }
 
-    static const wxArchiveClassFactory *Find(const wxChar *protocol,
+    static const wxArchiveClassFactory *Find(const wxString& protocol,
                                              wxStreamProtocolType type
                                              = wxSTREAM_PROTOCOL);
 
                                              wxStreamProtocolType type
                                              = wxSTREAM_PROTOCOL);
 
index 4ce526be62e43ceff6b109577a5806d65843ceab..d1e893cd3dba1126e3d8455161f7d6f2ee3ee570 100644 (file)
@@ -45,7 +45,7 @@ public:
     wxArrayString(size_t sz, const wxChar** a);
     wxArrayString(size_t sz, const wxString* a);
 
     wxArrayString(size_t sz, const wxChar** a);
     wxArrayString(size_t sz, const wxString* a);
 
-    int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const;
+    int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const;
 
     void Sort(bool reverseOrder = false);
     void Sort(CompareFunction function);
 
     void Sort(bool reverseOrder = false);
     void Sort(CompareFunction function);
@@ -75,7 +75,7 @@ public:
             Add(src[n]);
     }
 
             Add(src[n]);
     }
 
-    int Index(const wxChar* sz, bool bCase = true, bool bFromEnd = false) const;
+    int Index(const wxString& str, bool bCase = true, bool bFromEnd = false) const;
 };
 
 #else // if !wxUSE_STL
 };
 
 #else // if !wxUSE_STL
@@ -158,7 +158,7 @@ public:
     // bFromEnd is false or from end otherwise. If bCase, comparison is case
     // sensitive (default). Returns index of the first item matched or
     // wxNOT_FOUND
     // bFromEnd is false or from end otherwise. If bCase, comparison is case
     // sensitive (default). Returns index of the first item matched or
     // wxNOT_FOUND
-  int  Index (const wxChar *sz, bool bCase = true, bool bFromEnd = false) const;
+  int  Index (const wxString& str, bool bCase = true, bool bFromEnd = false) const;
     // add new element at the end (if the array is not sorted), return its
     // index
   size_t Add(const wxString& str, size_t nInsert = 1);
     // add new element at the end (if the array is not sorted), return its
     // index
   size_t Add(const wxString& str, size_t nInsert = 1);
index dc1d4ee9da007405a2369d1a85e6a264cf328701..07c893eb752f8d50a60fb60a760c23840343160f 100644 (file)
@@ -209,7 +209,7 @@ public:
     void Reset();
 
     // break down the command line in arguments
     void Reset();
 
     // break down the command line in arguments
-    static wxArrayString ConvertStringToArgs(const wxChar *cmdline);
+    static wxArrayString ConvertStringToArgs(const wxString& cmdline);
 
 private:
     // get usage string
 
 private:
     // get usage string
@@ -230,7 +230,7 @@ private:
 class WXDLLIMPEXP_BASE wxCmdLineParser
 {
 public:
 class WXDLLIMPEXP_BASE wxCmdLineParser
 {
 public:
-    static wxArrayString ConvertStringToArgs(const wxChar *cmdline);
+    static wxArrayString ConvertStringToArgs(const wxString& cmdline);
 };
 
 #endif // wxUSE_CMDLINE_PARSER/!wxUSE_CMDLINE_PARSER
 };
 
 #endif // wxUSE_CMDLINE_PARSER/!wxUSE_CMDLINE_PARSER
index bccafa801eafca7ca91323ec059211648c482347..25f6797049cd26f62503814801ff535fe3dd1b86 100644 (file)
@@ -358,7 +358,7 @@ WXDLLIMPEXP_BASE wxString wxExpandEnvVars(const wxString &sz);
 /*
   Split path into parts removing '..' in progress
  */
 /*
   Split path into parts removing '..' in progress
  */
-WXDLLIMPEXP_BASE void wxSplitPath(wxArrayString& aParts, const wxChar *sz);
+WXDLLIMPEXP_BASE void wxSplitPath(wxArrayString& aParts, const wxString& path);
 
 #endif // _WX_CONFBASE_H_
 
 
 #endif // _WX_CONFBASE_H_
 
index d5c41a52b8d18c1c4b30bb94499c98a124d0c494..523f1d8e37b4375cd3c2900384cb0d473c9a505e 100644 (file)
@@ -56,7 +56,10 @@ public:
 
   // Calls that CLIENT can make
   virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT ) = 0;
 
   // Calls that CLIENT can make
   virtual bool Execute(const wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT ) = 0;
-  virtual bool Execute(const wxString& str) { return Execute(str, -1, wxIPC_TEXT); }
+  // FIXME-UTF8: review this code for compatibility implications, update
+  //             accordingly, don' use c_str() below
+  virtual bool Execute(const wxString& str)
+    { return Execute(str.c_str(), -1, wxIPC_TEXT); }
   virtual wxChar *Request(const wxString& item, int *size = (int *) NULL, wxIPCFormat format = wxIPC_TEXT) = 0;
   virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0;
   virtual bool StartAdvise(const wxString& item) = 0;
   virtual wxChar *Request(const wxString& item, int *size = (int *) NULL, wxIPCFormat format = wxIPC_TEXT) = 0;
   virtual bool Poke(const wxString& item, wxChar *data, int size = -1, wxIPCFormat format = wxIPC_TEXT) = 0;
   virtual bool StartAdvise(const wxString& item) = 0;
index 70ea564b785600af57c78dd77de6d74d65a03fb6..6611cc85930ac12f854f72ae8acdfdc3e4df96fd 100644 (file)
@@ -82,8 +82,10 @@ public:
   void Compress(bool on);
 
   // unhide the Execute overload from wxConnectionBase
   void Compress(bool on);
 
   // unhide the Execute overload from wxConnectionBase
+  // FIXME-UTF8: change Execute() to DoExecute() to avoid having to do this;
+  //             don't use c_str() below after removing ANSI build
   virtual bool Execute(const wxString& str)
   virtual bool Execute(const wxString& str)
-    { return Execute(str, -1, wxIPC_TEXT); }
+    { return Execute(str.c_str(), -1, wxIPC_TEXT); }
 
 protected:
   wxSocketBase       *m_sock;
 
 protected:
   wxSocketBase       *m_sock;
index f8e75790ab940b88465b754e8851f256f4fe3321..1b2cbd08977d45f60ac3afad6b2511ce756be0be 100644 (file)
@@ -26,7 +26,6 @@ public:
     // ctor associates the stream with the given string which makes a copy of
     // it
     wxStringInputStream(const wxString& s);
     // ctor associates the stream with the given string which makes a copy of
     // it
     wxStringInputStream(const wxString& s);
-    virtual ~wxStringInputStream();
 
     virtual wxFileOffset GetLength() const;
 
 
     virtual wxFileOffset GetLength() const;
 
@@ -40,7 +39,7 @@ private:
     wxString m_str;
 
     // the buffer we're reading from
     wxString m_str;
 
     // the buffer we're reading from
-    char* m_buf;
+    wxCharBuffer m_buf;
 
     // length of the buffer we're reading from
     size_t m_len;
 
     // length of the buffer we're reading from
     size_t m_len;
index 1c9cc8d895dd6e2be7b17f99a8f3aeffc83e964d..b36ad0b862ae8bde53daa8044e7f9673a4dbb6e5 100644 (file)
@@ -29,6 +29,8 @@
 
 #if wxUSE_WCHAR_T
 
 
 #if wxUSE_WCHAR_T
 
+class WXDLLIMPEXP_BASE wxString;
+
 // the error value returned by wxMBConv methods
 #define wxCONV_FAILED ((size_t)-1)
 
 // the error value returned by wxMBConv methods
 #define wxCONV_FAILED ((size_t)-1)
 
@@ -199,7 +201,7 @@ public:
 class WXDLLIMPEXP_BASE wxConvBrokenFileNames : public wxMBConv
 {
 public:
 class WXDLLIMPEXP_BASE wxConvBrokenFileNames : public wxMBConv
 {
 public:
-    wxConvBrokenFileNames(const wxChar *charset);
+    wxConvBrokenFileNames(const wxString& charset);
     wxConvBrokenFileNames(const wxConvBrokenFileNames& conv)
         : wxMBConv(),
           m_conv(conv.m_conv ? conv.m_conv->Clone() : NULL)
     wxConvBrokenFileNames(const wxConvBrokenFileNames& conv)
         : wxMBConv(),
           m_conv(conv.m_conv ? conv.m_conv->Clone() : NULL)
@@ -387,7 +389,7 @@ class WXDLLIMPEXP_BASE wxCSConv : public wxMBConv
 public:
     // we can be created either from charset name or from an encoding constant
     // but we can't have both at once
 public:
     // we can be created either from charset name or from an encoding constant
     // but we can't have both at once
-    wxCSConv(const wxChar *charset);
+    wxCSConv(const wxString& charset);
     wxCSConv(wxFontEncoding encoding);
 
     wxCSConv(const wxCSConv& conv);
     wxCSConv(wxFontEncoding encoding);
 
     wxCSConv(const wxCSConv& conv);
@@ -426,12 +428,12 @@ private:
 
     // set the name (may be only called when m_name == NULL), makes copy of
     // charset string
 
     // set the name (may be only called when m_name == NULL), makes copy of
     // charset string
-    void SetName(const wxChar *charset);
+    void SetName(const char *charset);
 
 
     // note that we can't use wxString here because of compilation
     // dependencies: we're included from wx/string.h
 
 
     // note that we can't use wxString here because of compilation
     // dependencies: we're included from wx/string.h
-    wxChar *m_name;
+    char *m_name;
     wxFontEncoding m_encoding;
 
     // use CreateConvIfNeeded() before accessing m_convReal!
     wxFontEncoding m_encoding;
 
     // use CreateConvIfNeeded() before accessing m_convReal!
index 5ef6ccdc4bd5f43eb0d0f1b6be02d5d00598196a..ebdda32f34db67d2631a1ebeace3b1db0b37163c 100644 (file)
@@ -354,12 +354,12 @@ public:
     virtual const wxChar * const *GetProtocols(wxStreamProtocolType type
                                                = wxSTREAM_PROTOCOL) const = 0;
 
     virtual const wxChar * const *GetProtocols(wxStreamProtocolType type
                                                = wxSTREAM_PROTOCOL) const = 0;
 
-    bool CanHandle(const wxChar *protocol,
+    bool CanHandle(const wxString& protocol,
                    wxStreamProtocolType type
                    = wxSTREAM_PROTOCOL) const;
 
 protected:
                    wxStreamProtocolType type
                    = wxSTREAM_PROTOCOL) const;
 
 protected:
-    wxString::size_type FindExtension(const wxChar *location) const;
+    wxString::size_type FindExtension(const wxString& location) const;
 
     DECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase)
 };
 
     DECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase)
 };
@@ -374,7 +374,7 @@ public:
     virtual wxFilterInputStream  *NewStream(wxInputStream *stream)  const = 0;
     virtual wxFilterOutputStream *NewStream(wxOutputStream *stream) const = 0;
 
     virtual wxFilterInputStream  *NewStream(wxInputStream *stream)  const = 0;
     virtual wxFilterOutputStream *NewStream(wxOutputStream *stream) const = 0;
 
-    static const wxFilterClassFactory *Find(const wxChar *protocol,
+    static const wxFilterClassFactory *Find(const wxString& protocol,
                                             wxStreamProtocolType type
                                             = wxSTREAM_PROTOCOL);
 
                                             wxStreamProtocolType type
                                             = wxSTREAM_PROTOCOL);
 
index b71aeb8f9cdf9909c54a393c83326eb78cfcd13c..cf7cc29c94f590f888c5598336cc5a7cfdedc5ef 100644 (file)
@@ -23,7 +23,7 @@
 // the archive classes they use.
 
 const wxArchiveClassFactory *
 // the archive classes they use.
 
 const wxArchiveClassFactory *
-wxArchiveClassFactory::Find(const wxChar *protocol, wxStreamProtocolType type)
+wxArchiveClassFactory::Find(const wxString& protocol, wxStreamProtocolType type)
 {
     for (const wxArchiveClassFactory *f = GetFirst(); f; f = f->GetNext())
         if (f->CanHandle(protocol, type))
 {
     for (const wxArchiveClassFactory *f = GetFirst(); f; f = f->GetNext())
         if (f->CanHandle(protocol, type))
index ace83a67126f3eee89ba0e57d88532c2ddaa325c..ec41806616123b2fba1c8776d5a3c0c80aec668a 100644 (file)
@@ -197,7 +197,7 @@ void wxArrayString::Shrink()
 }
 
 // searches the array for an item (forward or backwards)
 }
 
 // searches the array for an item (forward or backwards)
-int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const
+int wxArrayString::Index(const wxString& str, bool bCase, bool bFromEnd) const
 {
   if ( m_autoSort ) {
     // use binary search in the sorted array
 {
   if ( m_autoSort ) {
     // use binary search in the sorted array
@@ -211,7 +211,7 @@ int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const
     while ( lo < hi ) {
       i = (lo + hi)/2;
 
     while ( lo < hi ) {
       i = (lo + hi)/2;
 
-      res = wxStrcmp(sz, m_pItems[i]);
+      res = str.compare(m_pItems[i]);
       if ( res < 0 )
         hi = i;
       else if ( res > 0 )
       if ( res < 0 )
         hi = i;
       else if ( res > 0 )
@@ -228,7 +228,7 @@ int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const
       if ( m_nCount > 0 ) {
         size_t ui = m_nCount;
         do {
       if ( m_nCount > 0 ) {
         size_t ui = m_nCount;
         do {
-          if ( m_pItems[--ui].IsSameAs(sz, bCase) )
+          if ( m_pItems[--ui].IsSameAs(str, bCase) )
             return ui;
         }
         while ( ui != 0 );
             return ui;
         }
         while ( ui != 0 );
@@ -236,7 +236,7 @@ int wxArrayString::Index(const wxChar *sz, bool bCase, bool bFromEnd) const
     }
     else {
       for( size_t ui = 0; ui < m_nCount; ui++ ) {
     }
     else {
       for( size_t ui = 0; ui < m_nCount; ui++ ) {
-        if( m_pItems[ui].IsSameAs(sz, bCase) )
+        if( m_pItems[ui].IsSameAs(str, bCase) )
           return ui;
       }
     }
           return ui;
       }
     }
index 30bf7f09d6e50d1db4b6b8a767d3e475592c0649..88d22ca1848ced79f051eec0e2a943cc288cac1f 100644 (file)
 
 static wxString GetTypeName(wxCmdLineParamType type);
 
 
 static wxString GetTypeName(wxCmdLineParamType type);
 
-static wxString GetOptionName(const wxChar *p, const wxChar *allowedChars);
+static wxString GetOptionName(wxString::const_iterator p,
+                              wxString::const_iterator end,
+                              const wxChar *allowedChars);
 
 
-static wxString GetShortOptionName(const wxChar *p);
+static wxString GetShortOptionName(wxString::const_iterator p,
+                                   wxString::const_iterator end);
 
 
-static wxString GetLongOptionName(const wxChar *p);
+static wxString GetLongOptionName(wxString::const_iterator p,
+                                  wxString::const_iterator end);
 
 // ----------------------------------------------------------------------------
 // private structs
 
 // ----------------------------------------------------------------------------
 // private structs
@@ -73,16 +77,16 @@ struct wxCmdLineOption
                       _T("option should have at least one name") );
 
         wxASSERT_MSG
                       _T("option should have at least one name") );
 
         wxASSERT_MSG
-            (
-                GetShortOptionName(shrt).Len() == shrt.Len(),
-                wxT("Short option contains invalid characters")
-            );
+        (
+            GetShortOptionName(shrt.begin(), shrt.end()).Len() == shrt.Len(),
+            wxT("Short option contains invalid characters")
+        );
 
         wxASSERT_MSG
 
         wxASSERT_MSG
-            (
-                GetLongOptionName(lng).Len() == lng.Len(),
-                wxT("Long option contains invalid characters")
-            );
+        (
+            GetLongOptionName(lng.begin(), lng.end()).Len() == lng.Len(),
+            wxT("Long option contains invalid characters")
+        );
 
 
         kind = k;
 
 
         kind = k;
@@ -572,24 +576,25 @@ int wxCmdLineParser::Parse(bool showUsage)
 
         // empty argument or just '-' is not an option but a parameter
         if ( maybeOption && arg.length() > 1 &&
 
         // empty argument or just '-' is not an option but a parameter
         if ( maybeOption && arg.length() > 1 &&
-                wxStrchr(m_data->m_switchChars, arg[0u]) )
+                // FIXME-UTF8: use wc_str() after removing ANSI build
+                wxStrchr(m_data->m_switchChars.c_str(), arg[0u]) )
         {
             bool isLong;
             wxString name;
             int optInd = wxNOT_FOUND;   // init to suppress warnings
 
             // an option or a switch: find whether it's a long or a short one
         {
             bool isLong;
             wxString name;
             int optInd = wxNOT_FOUND;   // init to suppress warnings
 
             // an option or a switch: find whether it's a long or a short one
-            if ( arg[0u] == _T('-') && arg[1u] == _T('-') )
+            if ( arg.length() >= 3 && arg[0u] == _T('-') && arg[1u] == _T('-') )
             {
                 // a long one
                 isLong = true;
 
                 // Skip leading "--"
             {
                 // a long one
                 isLong = true;
 
                 // Skip leading "--"
-                const wxChar *p = arg.c_str() + 2;
+                wxString::const_iterator p = arg.begin() + 2;
 
                 bool longOptionsEnabled = AreLongOptionsEnabled();
 
 
                 bool longOptionsEnabled = AreLongOptionsEnabled();
 
-                name = GetLongOptionName(p);
+                name = GetLongOptionName(p, arg.end());
 
                 if (longOptionsEnabled)
                 {
 
                 if (longOptionsEnabled)
                 {
@@ -617,9 +622,9 @@ int wxCmdLineParser::Parse(bool showUsage)
 
                 // a short one: as they can be cumulated, we try to find the
                 // longest substring which is a valid option
 
                 // a short one: as they can be cumulated, we try to find the
                 // longest substring which is a valid option
-                const wxChar *p = arg.c_str() + 1;
+                wxString::const_iterator p = arg.begin() + 1;
 
 
-                name = GetShortOptionName(p);
+                name = GetShortOptionName(p, arg.end());
 
                 size_t len = name.length();
                 do
 
                 size_t len = name.length();
                 do
@@ -679,15 +684,17 @@ int wxCmdLineParser::Parse(bool showUsage)
             // look at what follows:
 
             // +1 for leading '-'
             // look at what follows:
 
             // +1 for leading '-'
-            const wxChar *p = arg.c_str() + 1 + name.length();
+            wxString::const_iterator p = arg.begin() + 1 + name.length();
+            wxString::const_iterator end = arg.end();
+
             if ( isLong )
             if ( isLong )
-                p++;    // for another leading '-'
+                ++p;    // for another leading '-'
 
             wxCmdLineOption& opt = m_data->m_options[(size_t)optInd];
             if ( opt.kind == wxCMD_LINE_SWITCH )
             {
                 // we must check that there is no value following the switch
 
             wxCmdLineOption& opt = m_data->m_options[(size_t)optInd];
             if ( opt.kind == wxCMD_LINE_SWITCH )
             {
                 // we must check that there is no value following the switch
-                if ( *p != _T('\0') )
+                if ( p != arg.end() )
                 {
                     errorMsg << wxString::Format(_("Unexpected characters following option '%s'."), name.c_str())
                              << _T('\n');
                 {
                     errorMsg << wxString::Format(_("Unexpected characters following option '%s'."), name.c_str())
                              << _T('\n');
@@ -722,12 +729,12 @@ int wxCmdLineParser::Parse(bool showUsage)
                 }
                 else // short option
                 {
                 }
                 else // short option
                 {
-                    switch ( *p )
+                    switch ( (*p).GetValue() )
                     {
                         case _T('='):
                         case _T(':'):
                             // the value follows
                     {
                         case _T('='):
                         case _T(':'):
                             // the value follows
-                            p++;
+                            ++p;
                             break;
 
                         case 0:
                             break;
 
                         case 0:
@@ -744,7 +751,8 @@ int wxCmdLineParser::Parse(bool showUsage)
                             else
                             {
                                 // ... take it from there
                             else
                             {
                                 // ... take it from there
-                                p = m_data->m_arguments[n].c_str();
+                                p = m_data->m_arguments[n].begin();
+                                end = m_data->m_arguments[n].end();
                             }
                             break;
 
                             }
                             break;
 
@@ -764,7 +772,7 @@ int wxCmdLineParser::Parse(bool showUsage)
 
                 if ( ok )
                 {
 
                 if ( ok )
                 {
-                    wxString value = p;
+                    wxString value(p, end);
                     switch ( opt.type )
                     {
                         default:
                     switch ( opt.type )
                     {
                         default:
@@ -797,7 +805,8 @@ int wxCmdLineParser::Parse(bool showUsage)
                         case wxCMD_LINE_VAL_DATE:
                             {
                                 wxDateTime dt;
                         case wxCMD_LINE_VAL_DATE:
                             {
                                 wxDateTime dt;
-                                const wxChar *res = dt.ParseDate(value);
+                                // FIXME-UTF8: ParseDate API will need changes
+                                const wxChar *res = dt.ParseDate(value.c_str());
                                 if ( !res || *res )
                                 {
                                     errorMsg << wxString::Format(_("Option '%s': '%s' cannot be converted to a date."),
                                 if ( !res || *res )
                                 {
                                     errorMsg << wxString::Format(_("Option '%s': '%s' cannot be converted to a date."),
@@ -1140,12 +1149,13 @@ the parameter allowedChars.
 For example, if p points to "abcde-@-_", and allowedChars is "-_",
 this function returns "abcde-".
 */
 For example, if p points to "abcde-@-_", and allowedChars is "-_",
 this function returns "abcde-".
 */
-static wxString GetOptionName(const wxChar *p,
-    const wxChar *allowedChars)
+static wxString GetOptionName(wxString::const_iterator p,
+                              wxString::const_iterator end,
+                              const wxChar *allowedChars)
 {
     wxString argName;
 
 {
     wxString argName;
 
-    while ( *p && (wxIsalnum(*p) || wxStrchr(allowedChars, *p)) )
+    while ( p != end && (wxIsalnum(*p) || wxStrchr(allowedChars, *p)) )
     {
         argName += *p++;
     }
     {
         argName += *p++;
     }
@@ -1163,14 +1173,16 @@ static wxString GetOptionName(const wxChar *p,
 #define wxCMD_LINE_CHARS_ALLOWED_BY_LONG_OPTION \
     wxCMD_LINE_CHARS_ALLOWED_BY_SHORT_OPTION wxT("-")
 
 #define wxCMD_LINE_CHARS_ALLOWED_BY_LONG_OPTION \
     wxCMD_LINE_CHARS_ALLOWED_BY_SHORT_OPTION wxT("-")
 
-static wxString GetShortOptionName(const wxChar *p)
+static wxString GetShortOptionName(wxString::const_iterator p,
+                                  wxString::const_iterator end)
 {
 {
-    return GetOptionName(p, wxCMD_LINE_CHARS_ALLOWED_BY_SHORT_OPTION);
+    return GetOptionName(p, end, wxCMD_LINE_CHARS_ALLOWED_BY_SHORT_OPTION);
 }
 
 }
 
-static wxString GetLongOptionName(const wxChar *p)
+static wxString GetLongOptionName(wxString::const_iterator p,
+                                  wxString::const_iterator end)
 {
 {
-    return GetOptionName(p, wxCMD_LINE_CHARS_ALLOWED_BY_LONG_OPTION);
+    return GetOptionName(p, end, wxCMD_LINE_CHARS_ALLOWED_BY_LONG_OPTION);
 }
 
 #endif // wxUSE_CMDLINE_PARSER
 }
 
 #endif // wxUSE_CMDLINE_PARSER
@@ -1188,7 +1200,7 @@ static wxString GetLongOptionName(const wxChar *p)
  */
 
 /* static */
  */
 
 /* static */
-wxArrayString wxCmdLineParser::ConvertStringToArgs(const wxChar *p)
+wxArrayString wxCmdLineParser::ConvertStringToArgs(const wxString& cmdline)
 {
     wxArrayString args;
 
 {
     wxArrayString args;
 
@@ -1196,14 +1208,17 @@ wxArrayString wxCmdLineParser::ConvertStringToArgs(const wxChar *p)
     arg.reserve(1024);
 
     bool isInsideQuotes = false;
     arg.reserve(1024);
 
     bool isInsideQuotes = false;
+
+    wxString::const_iterator p = cmdline.begin();
+
     for ( ;; )
     {
         // skip white space
     for ( ;; )
     {
         // skip white space
-        while ( *p == _T(' ') || *p == _T('\t') )
-            p++;
+        while ( p != cmdline.end() && (*p == _T(' ') || *p == _T('\t')) )
+            ++p;
 
         // anything left?
 
         // anything left?
-        if ( *p == _T('\0') )
+        if ( p == cmdline.end() )
             break;
 
         // parse this parameter
             break;
 
         // parse this parameter
@@ -1211,7 +1226,7 @@ wxArrayString wxCmdLineParser::ConvertStringToArgs(const wxChar *p)
         bool lastBS = false;
         for ( arg.clear(); !endParam; p++ )
         {
         bool lastBS = false;
         for ( arg.clear(); !endParam; p++ )
         {
-            switch ( *p )
+            switch ( (*p).GetValue() )
             {
                 case _T('"'):
                     if ( !lastBS )
             {
                 case _T('"'):
                     if ( !lastBS )
index e7e62a34bb7897ee5a56f3621265c224f08a8355..c4ae2ed8d19bbcb831302b58d0699a21e717b728 100644 (file)
@@ -264,7 +264,7 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer,
 
         /* JACS: work around a memory bug that causes an assert
            when using wxRegConfig, related to reference-counting.
 
         /* JACS: work around a memory bug that causes an assert
            when using wxRegConfig, related to reference-counting.
-           Can be reproduced by removing (const wxChar*) below and
+           Can be reproduced by removing .wc_str() below and
            adding the following code to the config sample OnInit under
            Windows:
 
            adding the following code to the config sample OnInit under
            Windows:
 
@@ -273,7 +273,7 @@ wxConfigPathChanger::wxConfigPathChanger(const wxConfigBase *pContainer,
            int value;
            pConfig->Read(_T("MainWindowX"), & value);
         */
            int value;
            pConfig->Read(_T("MainWindowX"), & value);
         */
-        m_strOldPath = (const wxChar*) m_pContainer->GetPath();
+        m_strOldPath = m_pContainer->GetPath().wc_str();
         if ( *m_strOldPath.c_str() != wxCONFIG_PATH_SEPARATOR )
           m_strOldPath += wxCONFIG_PATH_SEPARATOR;
         m_pContainer->SetPath(strPath);
         if ( *m_strOldPath.c_str() != wxCONFIG_PATH_SEPARATOR )
           m_strOldPath += wxCONFIG_PATH_SEPARATOR;
         m_pContainer->SetPath(strPath);
@@ -399,19 +399,20 @@ wxString wxExpandEnvVars(const wxString& str)
           wxString strVarName(str.c_str() + n + 1, m - n - 1);
 
 #ifdef __WXWINCE__
           wxString strVarName(str.c_str() + n + 1, m - n - 1);
 
 #ifdef __WXWINCE__
-          const wxChar *pszValue = NULL;
+          const bool expanded = false;
 #else
           // NB: use wxGetEnv instead of wxGetenv as otherwise variables
           //     set through wxSetEnv may not be read correctly!
 #else
           // NB: use wxGetEnv instead of wxGetenv as otherwise variables
           //     set through wxSetEnv may not be read correctly!
-          const wxChar *pszValue = NULL;
+          bool expanded = false;
           wxString tmp;
           if (wxGetEnv(strVarName, &tmp))
           wxString tmp;
           if (wxGetEnv(strVarName, &tmp))
-              pszValue = tmp;
-#endif
-          if ( pszValue != NULL ) {
-            strResult += pszValue;
+          {
+              strResult += tmp;
+              expanded = true;
           }
           }
-          else {
+          else
+#endif
+          {
             // variable doesn't exist => don't change anything
             #ifdef  __WXMSW__
               if ( bracket != Bracket_Windows )
             // variable doesn't exist => don't change anything
             #ifdef  __WXMSW__
               if ( bracket != Bracket_Windows )
@@ -437,7 +438,7 @@ wxString wxExpandEnvVars(const wxString& str)
             }
             else {
               // skip closing bracket unless the variables wasn't expanded
             }
             else {
               // skip closing bracket unless the variables wasn't expanded
-              if ( pszValue == NULL )
+              if ( !expanded )
                 strResult << (wxChar)bracket;
               m++;
             }
                 strResult << (wxChar)bracket;
               m++;
             }
@@ -466,21 +467,21 @@ wxString wxExpandEnvVars(const wxString& str)
 }
 
 // this function is used to properly interpret '..' in path
 }
 
 // this function is used to properly interpret '..' in path
-void wxSplitPath(wxArrayString& aParts, const wxChar *sz)
+void wxSplitPath(wxArrayString& aParts, const wxString& path)
 {
   aParts.clear();
 
   wxString strCurrent;
 {
   aParts.clear();
 
   wxString strCurrent;
-  const wxChar *pc = sz;
+  wxString::const_iterator pc = path.begin();
   for ( ;; ) {
   for ( ;; ) {
-    if ( *pc == wxT('\0') || *pc == wxCONFIG_PATH_SEPARATOR ) {
+    if ( pc == path.end() || *pc == wxCONFIG_PATH_SEPARATOR ) {
       if ( strCurrent == wxT(".") ) {
         // ignore
       }
       else if ( strCurrent == wxT("..") ) {
         // go up one level
         if ( aParts.size() == 0 )
       if ( strCurrent == wxT(".") ) {
         // ignore
       }
       else if ( strCurrent == wxT("..") ) {
         // go up one level
         if ( aParts.size() == 0 )
-          wxLogWarning(_("'%s' has extra '..', ignored."), sz);
+          wxLogWarning(_("'%s' has extra '..', ignored."), path);
         else
           aParts.erase(aParts.end() - 1);
 
         else
           aParts.erase(aParts.end() - 1);
 
@@ -493,12 +494,12 @@ void wxSplitPath(wxArrayString& aParts, const wxChar *sz)
       //else:
         // could log an error here, but we prefer to ignore extra '/'
 
       //else:
         // could log an error here, but we prefer to ignore extra '/'
 
-      if ( *pc == wxT('\0') )
+      if ( pc == path.end() )
         break;
     }
     else
       strCurrent += *pc;
 
         break;
     }
     else
       strCurrent += *pc;
 
-    pc++;
+    ++pc;
   }
 }
   }
 }
index 249af182a671d52126707f2a0e6debb6a4d97d5f..f42c88530e070a08b9cc46f1e58e263eb8759efc 100644 (file)
@@ -2172,9 +2172,9 @@ void wxDCBase::GetMultiLineTextExtent(const wxString& text,
             heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
 
     wxString curLine;
             heightTextTotal = 0, heightLineDefault = 0, heightLine = 0;
 
     wxString curLine;
-    for ( const wxChar *pc = text; ; pc++ )
+    for ( wxString::const_iterator pc = text.begin(); ; ++pc )
     {
     {
-        if ( *pc == _T('\n') || *pc == _T('\0') )
+        if ( pc == text.end() || *pc == _T('\n') )
         {
             if ( curLine.empty() )
             {
         {
             if ( curLine.empty() )
             {
@@ -2205,14 +2205,13 @@ void wxDCBase::GetMultiLineTextExtent(const wxString& text,
                 heightTextTotal += heightLine;
             }
 
                 heightTextTotal += heightLine;
             }
 
-            if ( *pc == _T('\n') )
+            if ( pc == text.end() )
             {
             {
-               curLine.clear();
+               break;
             }
             }
-            else
+            else // '\n'
             {
             {
-               // the end of string
-               break;
+               curLine.clear();
             }
         }
         else
             }
         }
         else
index 41b31fb23ed45eca6d70b62f05bf9af8dff85fed..1ebad15e2ba009c72649967b880edeaa1955a502 100644 (file)
@@ -112,7 +112,7 @@ static const wxChar *s_MRUEntryFormat = wxT("&%d %s");
 // local functions
 // ----------------------------------------------------------------------------
 
 // local functions
 // ----------------------------------------------------------------------------
 
-static wxString FindExtension(const wxChar *path)
+static wxString FindExtension(const wxString& path)
 {
     wxString ext;
     wxSplitPath(path, NULL, NULL, &ext);
 {
     wxString ext;
     wxSplitPath(path, NULL, NULL, &ext);
@@ -456,8 +456,7 @@ bool wxDocument::OnSaveModified()
             msgTitle = wxString(_("Warning"));
 
         wxString prompt;
             msgTitle = wxString(_("Warning"));
 
         wxString prompt;
-        prompt.Printf(_("Do you want to save changes to document %s?"),
-                (const wxChar *)title);
+        prompt.Printf(_("Do you want to save changes to document %s?"), title);
         int res = wxMessageBox(prompt, msgTitle,
                 wxYES_NO|wxCANCEL|wxICON_QUESTION,
                 GetDocumentWindow());
         int res = wxMessageBox(prompt, msgTitle,
                 wxYES_NO|wxCANCEL|wxICON_QUESTION,
                 GetDocumentWindow());
index 2157246df36176d6fc48917f64adbeaf86b5d2b0..5d99bf67fdf6293fa6de896c35039d0a21393769 100644 (file)
@@ -427,17 +427,31 @@ _WX_DEFINE_BASEARRAY(wxString, wxBaseArrayStringBase)
 // extern "C" functions and the functions with C++ linkage and ptr_fun and
 // wxStringCompareLess can't take wxStrcmp/wxStricmp directly as arguments in
 // this case, we need the wrappers below to make this work
 // extern "C" functions and the functions with C++ linkage and ptr_fun and
 // wxStringCompareLess can't take wxStrcmp/wxStricmp directly as arguments in
 // this case, we need the wrappers below to make this work
-inline int wxStrcmpCppWrapper(const wxChar *p, const wxChar *q)
+struct wxStringCmp
 {
 {
-    return wxStrcmp(p, q);
-}
+    typedef wxString first_argument_type;
+    typedef wxString second_argument_type;
+    typedef int result_type;
+
+    int operator()(const wxString& s1, const wxString& s2) const
+    {
+        return s1.compare(s2);
+    }
+};
 
 
-inline int wxStricmpCppWrapper(const wxChar *p, const wxChar *q)
+struct wxStringCmpNoCase
 {
 {
-    return wxStricmp(p, q);
-}
+    typedef wxString first_argument_type;
+    typedef wxString second_argument_type;
+    typedef int result_type;
 
 
-int wxArrayString::Index(const wxChar* sz, bool bCase, bool WXUNUSED(bFromEnd)) const
+    int operator()(const wxString& s1, const wxString& s2) const
+    {
+        return s1.CmpNoCase(s2);
+    }
+};
+
+int wxArrayString::Index(const wxString& str, bool bCase, bool WXUNUSED(bFromEnd)) const
 {
     wxArrayString::const_iterator it;
 
 {
     wxArrayString::const_iterator it;
 
@@ -446,14 +460,14 @@ int wxArrayString::Index(const wxChar* sz, bool bCase, bool WXUNUSED(bFromEnd))
         it = std::find_if(begin(), end(),
                           std::not1(
                               std::bind2nd(
         it = std::find_if(begin(), end(),
                           std::not1(
                               std::bind2nd(
-                                  std::ptr_fun(wxStrcmpCppWrapper), sz)));
+                                  wxStringCmp(), str)));
     }
     else // !bCase
     {
         it = std::find_if(begin(), end(),
                           std::not1(
                               std::bind2nd(
     }
     else // !bCase
     {
         it = std::find_if(begin(), end(),
                           std::not1(
                               std::bind2nd(
-                                  std::ptr_fun(wxStricmpCppWrapper), sz)));
+                                  wxStringCmpNoCase(), str)));
     }
 
     return it == end() ? wxNOT_FOUND : it - begin();
     }
 
     return it == end() ? wxNOT_FOUND : it - begin();
@@ -464,8 +478,6 @@ class wxStringCompareLess
 {
 public:
     wxStringCompareLess(F f) : m_f(f) { }
 {
 public:
     wxStringCompareLess(F f) : m_f(f) { }
-    bool operator()(const wxChar* s1, const wxChar* s2)
-        { return m_f(s1, s2) < 0; }
     bool operator()(const wxString& s1, const wxString& s2)
         { return m_f(s1, s2) < 0; }
 private:
     bool operator()(const wxString& s1, const wxString& s2)
         { return m_f(s1, s2) < 0; }
 private:
@@ -495,33 +507,32 @@ void wxArrayString::Sort(bool reverseOrder)
     }
 }
 
     }
 }
 
-int wxSortedArrayString::Index(const wxChar* sz, bool bCase, bool WXUNUSED(bFromEnd)) const
+int wxSortedArrayString::Index(const wxString& str, bool bCase, bool WXUNUSED(bFromEnd)) const
 {
     wxSortedArrayString::const_iterator it;
 {
     wxSortedArrayString::const_iterator it;
-    wxString s(sz);
 
     if (bCase)
 
     if (bCase)
-        it = std::lower_bound(begin(), end(), s,
-                              wxStringCompare(wxStrcmpCppWrapper));
+        it = std::lower_bound(begin(), end(), str,
+                              wxStringCompare(wxStringCmp()));
     else
     else
-        it = std::lower_bound(begin(), end(), s,
-                              wxStringCompare(wxStricmpCppWrapper));
+        it = std::lower_bound(begin(), end(), str,
+                              wxStringCompare(wxStringCmpNoCase()));
 
     if (it == end())
         return wxNOT_FOUND;
 
     if (bCase)
     {
 
     if (it == end())
         return wxNOT_FOUND;
 
     if (bCase)
     {
-        if (wxStrcmp(it->c_str(), sz) != 0)
+        if (str.Cmp(*it) != 0)
             return wxNOT_FOUND;
     }
     else
     {
             return wxNOT_FOUND;
     }
     else
     {
-        if (wxStricmp(it->c_str(), sz) != 0)
+        if (str.CmpNoCase(*it) != 0)
             return wxNOT_FOUND;
     }
 
     return it - begin();
 }
 
             return wxNOT_FOUND;
     }
 
     return it - begin();
 }
 
-#endif
+#endif // wxUSE_STL
index 0c3912dbdb76b96775c7191a3ff64d257974552d..bc153a0a9f9994af8c07c1ab4c2ee52ecd361391 100644 (file)
@@ -222,12 +222,12 @@ public:
   bool  IsEmpty() const { return Entries().IsEmpty() && Groups().IsEmpty(); }
 
   // find entry/subgroup (NULL if not found)
   bool  IsEmpty() const { return Entries().IsEmpty() && Groups().IsEmpty(); }
 
   // find entry/subgroup (NULL if not found)
-  wxFileConfigGroup *FindSubgroup(const wxChar *szName) const;
-  wxFileConfigEntry *FindEntry   (const wxChar *szName) const;
+  wxFileConfigGroup *FindSubgroup(const wxString& name) const;
+  wxFileConfigEntry *FindEntry   (const wxString& name) const;
 
   // delete entry/subgroup, return false if doesn't exist
 
   // delete entry/subgroup, return false if doesn't exist
-  bool DeleteSubgroupByName(const wxChar *szName);
-  bool DeleteEntry(const wxChar *szName);
+  bool DeleteSubgroupByName(const wxString& name);
+  bool DeleteEntry(const wxString& name);
 
   // create new entry/subgroup returning pointer to newly created element
   wxFileConfigGroup *AddSubgroup(const wxString& strName);
 
   // create new entry/subgroup returning pointer to newly created element
   wxFileConfigGroup *AddSubgroup(const wxString& strName);
@@ -536,15 +536,16 @@ wxFileConfig::~wxFileConfig()
 
 void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal)
 {
 
 void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal)
 {
-  const wxChar *pStart;
-  const wxChar *pEnd;
-  wxString strLine;
 
   size_t nLineCount = buffer.GetLineCount();
 
   for ( size_t n = 0; n < nLineCount; n++ )
   {
 
   size_t nLineCount = buffer.GetLineCount();
 
   for ( size_t n = 0; n < nLineCount; n++ )
   {
-    strLine = buffer[n];
+    wxString strLine = buffer[n];
+    // FIXME-UTF8: rewrite using iterators, without this buffer
+    wxWxCharBuffer buf(strLine.c_str());
+    const wxChar *pStart;
+    const wxChar *pEnd;
 
     // add the line to linked list
     if ( bLocal )
 
     // add the line to linked list
     if ( bLocal )
@@ -560,7 +561,7 @@ void wxFileConfig::Parse(const wxTextBuffer& buffer, bool bLocal)
 
 
     // skip leading spaces
 
 
     // skip leading spaces
-    for ( pStart = strLine; wxIsspace(*pStart); pStart++ )
+    for ( pStart = buf; wxIsspace(*pStart); pStart++ )
       ;
 
     // skip blank/comment lines
       ;
 
     // skip blank/comment lines
@@ -1059,7 +1060,7 @@ bool wxFileConfig::Save(wxOutputStream& os, const wxMBConv& conv)
 bool wxFileConfig::RenameEntry(const wxString& oldName,
                                const wxString& newName)
 {
 bool wxFileConfig::RenameEntry(const wxString& oldName,
                                const wxString& newName)
 {
-    wxASSERT_MSG( !wxStrchr(oldName, wxCONFIG_PATH_SEPARATOR),
+    wxASSERT_MSG( oldName.find(wxCONFIG_PATH_SEPARATOR) == wxString::npos,
                    _T("RenameEntry(): paths are not supported") );
 
     // check that the entry exists
                    _T("RenameEntry(): paths are not supported") );
 
     // check that the entry exists
@@ -1148,7 +1149,8 @@ bool wxFileConfig::DeleteAll()
 
   if ( m_fnLocalFile.IsOk() )
   {
 
   if ( m_fnLocalFile.IsOk() )
   {
-      if ( m_fnLocalFile.FileExists() && wxRemove(m_fnLocalFile.GetFullPath()) == -1 )
+      if ( m_fnLocalFile.FileExists() &&
+           !wxRemoveFile(m_fnLocalFile.GetFullPath()) )
       {
           wxLogSysError(_("can't delete user configuration file '%s'"),
                         m_fnLocalFile.GetFullPath().c_str());
       {
           wxLogSysError(_("can't delete user configuration file '%s'"),
                         m_fnLocalFile.GetFullPath().c_str());
@@ -1548,7 +1550,7 @@ wxString wxFileConfigGroup::GetFullName() const
 
 // use binary search because the array is sorted
 wxFileConfigEntry *
 
 // use binary search because the array is sorted
 wxFileConfigEntry *
-wxFileConfigGroup::FindEntry(const wxChar *szName) const
+wxFileConfigGroup::FindEntry(const wxString& name) const
 {
   size_t i,
        lo = 0,
 {
   size_t i,
        lo = 0,
@@ -1561,9 +1563,9 @@ wxFileConfigGroup::FindEntry(const wxChar *szName) const
     pEntry = m_aEntries[i];
 
     #if wxCONFIG_CASE_SENSITIVE
     pEntry = m_aEntries[i];
 
     #if wxCONFIG_CASE_SENSITIVE
-      res = wxStrcmp(pEntry->Name(), szName);
+      res = pEntry->Name().compare(name);
     #else
     #else
-      res = wxStricmp(pEntry->Name(), szName);
+      res = pEntry->Name().CmpNoCase(name);
     #endif
 
     if ( res > 0 )
     #endif
 
     if ( res > 0 )
@@ -1578,7 +1580,7 @@ wxFileConfigGroup::FindEntry(const wxChar *szName) const
 }
 
 wxFileConfigGroup *
 }
 
 wxFileConfigGroup *
-wxFileConfigGroup::FindSubgroup(const wxChar *szName) const
+wxFileConfigGroup::FindSubgroup(const wxString& name) const
 {
   size_t i,
        lo = 0,
 {
   size_t i,
        lo = 0,
@@ -1591,9 +1593,9 @@ wxFileConfigGroup::FindSubgroup(const wxChar *szName) const
     pGroup = m_aSubgroups[i];
 
     #if wxCONFIG_CASE_SENSITIVE
     pGroup = m_aSubgroups[i];
 
     #if wxCONFIG_CASE_SENSITIVE
-      res = wxStrcmp(pGroup->Name(), szName);
+      res = pGroup->Name().compare(name);
     #else
     #else
-      res = wxStricmp(pGroup->Name(), szName);
+      res = pGroup->Name().CmpNoCase(name);
     #endif
 
     if ( res > 0 )
     #endif
 
     if ( res > 0 )
@@ -1644,9 +1646,9 @@ wxFileConfigGroup *wxFileConfigGroup::AddSubgroup(const wxString& strName)
   delete several of them.
  */
 
   delete several of them.
  */
 
-bool wxFileConfigGroup::DeleteSubgroupByName(const wxChar *szName)
+bool wxFileConfigGroup::DeleteSubgroupByName(const wxString& name)
 {
 {
-    wxFileConfigGroup * const pGroup = FindSubgroup(szName);
+    wxFileConfigGroup * const pGroup = FindSubgroup(name);
 
     return pGroup ? DeleteSubgroup(pGroup) : false;
 }
 
     return pGroup ? DeleteSubgroup(pGroup) : false;
 }
@@ -1765,9 +1767,9 @@ bool wxFileConfigGroup::DeleteSubgroup(wxFileConfigGroup *pGroup)
     return true;
 }
 
     return true;
 }
 
-bool wxFileConfigGroup::DeleteEntry(const wxChar *szName)
+bool wxFileConfigGroup::DeleteEntry(const wxString& name)
 {
 {
-  wxFileConfigEntry *pEntry = FindEntry(szName);
+  wxFileConfigEntry *pEntry = FindEntry(name);
   if ( !pEntry )
   {
       // entry doesn't exist, nothing to do
   if ( !pEntry )
   {
       // entry doesn't exist, nothing to do
@@ -1920,18 +1922,18 @@ void wxFileConfigEntry::SetValue(const wxString& strValue, bool bUser)
 int CompareEntries(wxFileConfigEntry *p1, wxFileConfigEntry *p2)
 {
 #if wxCONFIG_CASE_SENSITIVE
 int CompareEntries(wxFileConfigEntry *p1, wxFileConfigEntry *p2)
 {
 #if wxCONFIG_CASE_SENSITIVE
-    return wxStrcmp(p1->Name(), p2->Name());
+    return p1->Name().compare(p2->Name());
 #else
 #else
-    return wxStricmp(p1->Name(), p2->Name());
+    return p1->Name().CmpNoCase(p2->Name());
 #endif
 }
 
 int CompareGroups(wxFileConfigGroup *p1, wxFileConfigGroup *p2)
 {
 #if wxCONFIG_CASE_SENSITIVE
 #endif
 }
 
 int CompareGroups(wxFileConfigGroup *p1, wxFileConfigGroup *p2)
 {
 #if wxCONFIG_CASE_SENSITIVE
-    return wxStrcmp(p1->Name(), p2->Name());
+    return p1->Name().compare(p2->Name());
 #else
 #else
-    return wxStricmp(p1->Name(), p2->Name());
+    return p1->Name().CmpNoCase(p2->Name());
 #endif
 }
 
 #endif
 }
 
index 3c5764a6bb7a4b0061ef60eaba6fdf15ae929f2d..6334696a3468478ac3fc2024d589fc6604a20ec2 100644 (file)
@@ -767,7 +767,7 @@ static wxString wxCreateTempImpl(
     path += _T("XXXXXX");
 
     // we need to copy the path to the buffer in which mkstemp() can modify it
     path += _T("XXXXXX");
 
     // we need to copy the path to the buffer in which mkstemp() can modify it
-    wxCharBuffer buf( wxConvFile.cWX2MB( path ) );
+    wxCharBuffer buf(path.fn_str());
 
     // cast is safe because the string length doesn't change
     int fdTemp = mkstemp( (char*)(const char*) buf );
 
     // cast is safe because the string length doesn't change
     int fdTemp = mkstemp( (char*)(const char*) buf );
index bd7d5a6c8a84630f1b263c288bcc008fe5b80c04..c72cc6f47d5b078d915f59c332e70c8e83d5848b 100644 (file)
@@ -23,7 +23,7 @@
 // the filter classes they use.
 
 const wxFilterClassFactory *
 // the filter classes they use.
 
 const wxFilterClassFactory *
-wxFilterClassFactory::Find(const wxChar *protocol, wxStreamProtocolType type)
+wxFilterClassFactory::Find(const wxString& protocol, wxStreamProtocolType type)
 {
     for (const wxFilterClassFactory *f = GetFirst(); f; f = f->GetNext())
         if (f->CanHandle(protocol, type))
 {
     for (const wxFilterClassFactory *f = GetFirst(); f; f = f->GetNext())
         if (f->CanHandle(protocol, type))
index da7c72171ec2356abd69a6ce88af7185a153d864..6455c2390e278321cb421a3a8a27b6af65ed67fc 100644 (file)
@@ -314,7 +314,7 @@ char wxFTP::GetResult()
             }
             else // subsequent line of multiline reply
             {
             }
             else // subsequent line of multiline reply
             {
-                if ( wxStrncmp(line, code, LEN_CODE) == 0 )
+                if ( line.compare(0, LEN_CODE, code) == 0 )
                 {
                     if ( chMarker == _T(' ') )
                     {
                 {
                     if ( chMarker == _T(' ') )
                     {
@@ -378,7 +378,7 @@ bool wxFTP::SetTransferMode(TransferMode transferMode)
 
     if ( !DoSimpleCommand(_T("TYPE"), mode) )
     {
 
     if ( !DoSimpleCommand(_T("TYPE"), mode) )
     {
-        wxLogError(_("Failed to set FTP transfer mode to %s."), (const wxChar*)
+        wxLogError(_("Failed to set FTP transfer mode to %s."),
                    (transferMode == ASCII ? _("ASCII") : _("binary")));
 
         return false;
                    (transferMode == ASCII ? _("ASCII") : _("binary")));
 
         return false;
@@ -707,18 +707,20 @@ wxSocketBase *wxFTP::GetPassivePort()
         return NULL;
     }
 
         return NULL;
     }
 
-    const wxChar *addrStart = wxStrchr(m_lastResult, _T('('));
-    const wxChar *addrEnd = addrStart ? wxStrchr(addrStart, _T(')')) : NULL;
-    if ( !addrEnd )
+    size_t addrStart = m_lastResult.find(_T('('));
+    size_t addrEnd = (addrStart == wxString::npos)
+                     ? wxString::npos
+                     : m_lastResult.find(_T(')'), addrStart);
+
+    if ( addrEnd == wxString::npos )
     {
         m_lastError = wxPROTO_PROTERR;
     {
         m_lastError = wxPROTO_PROTERR;
-
         return NULL;
     }
 
     // get the port number and address
     int a[6];
         return NULL;
     }
 
     // get the port number and address
     int a[6];
-    wxString straddr(addrStart + 1, addrEnd);
+    wxString straddr(m_lastResult, addrStart + 1, addrEnd - (addrStart + 1));
     wxSscanf(straddr, wxT("%d,%d,%d,%d,%d,%d"),
              &a[2],&a[3],&a[4],&a[5],&a[0],&a[1]);
 
     wxSscanf(straddr, wxT("%d,%d,%d,%d,%d,%d"),
              &a[2],&a[3],&a[4],&a[5],&a[0],&a[1]);
 
index f8977ecedffbf4188ad68b02ff431eba1e476605..5a185bf899c0a7e8a1e53e8b943fcbfffb74595b 100644 (file)
@@ -75,7 +75,7 @@ wxHTTP::wxHeaderIterator wxHTTP::FindHeader(const wxString& header)
     wxHeaderIterator it = m_headers.begin();
     for ( wxHeaderIterator en = m_headers.end(); it != en; ++it )
     {
     wxHeaderIterator it = m_headers.begin();
     for ( wxHeaderIterator en = m_headers.end(); it != en; ++it )
     {
-        if ( wxStricmp(it->first, header) == 0 )
+        if ( header.CmpNoCase(it->first) == 0 )
             break;
     }
 
             break;
     }
 
@@ -87,7 +87,7 @@ wxHTTP::wxHeaderConstIterator wxHTTP::FindHeader(const wxString& header) const
     wxHeaderConstIterator it = m_headers.begin();
     for ( wxHeaderConstIterator en = m_headers.end(); it != en; ++it )
     {
     wxHeaderConstIterator it = m_headers.begin();
     for ( wxHeaderConstIterator en = m_headers.end(); it != en; ++it )
     {
-        if ( wxStricmp(it->first, header) == 0 )
+        if ( header.CmpNoCase(it->first) == 0 )
             break;
     }
 
             break;
     }
 
@@ -274,8 +274,8 @@ bool wxHTTP::BuildRequest(const wxString& path, wxHTTP_Req req)
 
     wxString buf;
     buf.Printf(wxT("%s %s HTTP/1.0\r\n"), request, path.c_str());
 
     wxString buf;
     buf.Printf(wxT("%s %s HTTP/1.0\r\n"), request, path.c_str());
-    const wxWX2MBbuf pathbuf = wxConvLocal.cWX2MB(buf);
-    Write(pathbuf, strlen(wxMBSTRINGCAST pathbuf));
+    const wxWX2MBbuf pathbuf = buf.mb_str();
+    Write(pathbuf, strlen(pathbuf));
     SendHeaders();
     Write("\r\n", 2);
 
     SendHeaders();
     Write("\r\n", 2);
 
@@ -407,7 +407,7 @@ wxInputStream *wxHTTP::GetInputStream(const wxString& path)
     inp_stream = new wxHTTPStream(this);
 
     if (!GetHeader(wxT("Content-Length")).empty())
     inp_stream = new wxHTTPStream(this);
 
     if (!GetHeader(wxT("Content-Length")).empty())
-        inp_stream->m_httpsize = wxAtoi(WXSTRINGCAST GetHeader(wxT("Content-Length")));
+        inp_stream->m_httpsize = wxAtoi(GetHeader(wxT("Content-Length")));
     else
         inp_stream->m_httpsize = (size_t)-1;
 
     else
         inp_stream->m_httpsize = (size_t)-1;
 
index d91c445e04a4a1cbdeb4283d5330a3de067ae627..1c30e71c921b98d79af88c976057f84e18d50b0d 100644 (file)
@@ -2231,7 +2231,7 @@ bool wxImage::LoadFile( wxInputStream& stream, const wxString& mimetype, int ind
 
     if (stream.IsSeekable() && !handler->CanRead(stream))
     {
 
     if (stream.IsSeekable() && !handler->CanRead(stream))
     {
-        wxLogError(_("Image file is not of type %s."), (const wxChar*) mimetype);
+        wxLogError(_("Image file is not of type %s."), mimetype);
         return false;
     }
     else
         return false;
     }
     else
index f92916a6672e878deb2f76fb197d721f15175573..7d276e665be2a3c2343632d89f262666f304536d 100644 (file)
 
 // TODO:  Do we want to include the null char in the stream?  If so then
 // just add +1 to m_len in the ctor 
 
 // TODO:  Do we want to include the null char in the stream?  If so then
 // just add +1 to m_len in the ctor 
-wxStringInputStream::wxStringInputStream(const wxString& s) 
+wxStringInputStream::wxStringInputStream(const wxString& s)
 #if wxUSE_UNICODE
 #if wxUSE_UNICODE
-    : m_str(s), m_buf(wxMBConvUTF8().cWX2MB(s).release()), m_len(strlen(m_buf))
+    // FIXME-UTF8: use wxCharBufferWithLength if we have it
+    : m_str(s), m_buf(s.utf8_str()), m_len(strlen(m_buf))
 #else
 #else
-    : m_str(s), m_buf((char*)(const char*)s.c_str()), m_len(s.length())
+    : m_str(s), m_buf(s.mb_str()), m_len(s.length())
 #endif
 {
 #if wxUSE_UNICODE
 #endif
 {
 #if wxUSE_UNICODE
-    wxASSERT_MSG(m_buf != NULL, _T("Could not convert string to UTF8!"));
+    wxASSERT_MSG(m_buf.data() != NULL, _T("Could not convert string to UTF8!"));
 #endif
     m_pos = 0;
 }
 
 #endif
     m_pos = 0;
 }
 
-wxStringInputStream::~wxStringInputStream()
-{
-#if wxUSE_UNICODE
-    // Note: wx[W]CharBuffer uses malloc()/free()
-    free(m_buf);
-#endif
-}
-
 // ----------------------------------------------------------------------------
 // getlength
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // getlength
 // ----------------------------------------------------------------------------
@@ -126,7 +119,7 @@ size_t wxStringInputStream::OnSysRead(void *buffer, size_t size)
         size = sizeMax;
     }
 
         size = sizeMax;
     }
 
-    memcpy(buffer, m_buf + m_pos, size);
+    memcpy(buffer, m_buf.data() + m_pos, size);
     m_pos += size;
 
     return size;
     m_pos += size;
 
     return size;
index 96f4b27ce76cc2140049d589ae9312df03d74a95..62af673a0e4db25e316a864653d3dde22cd80cbf 100644 (file)
@@ -476,10 +476,10 @@ size_t wxMBConvLibc::WC2MB(char *buf, const wchar_t *psz, size_t n) const
 
 #ifdef __UNIX__
 
 
 #ifdef __UNIX__
 
-wxConvBrokenFileNames::wxConvBrokenFileNames(const wxChar *charset)
+wxConvBrokenFileNames::wxConvBrokenFileNames(const wxString& charset)
 {
 {
-    if ( !charset || wxStricmp(charset, _T("UTF-8")) == 0
-                  || wxStricmp(charset, _T("UTF8")) == 0  )
+    if ( wxStricmp(charset, _T("UTF-8")) == 0 ||
+         wxStricmp(charset, _T("UTF8")) == 0  )
         m_conv = new wxMBConvUTF8(wxMBConvUTF8::MAP_INVALID_UTF8_TO_PUA);
     else
         m_conv = new wxCSConv(charset);
         m_conv = new wxMBConvUTF8(wxMBConvUTF8::MAP_INVALID_UTF8_TO_PUA);
     else
         m_conv = new wxCSConv(charset);
@@ -1588,7 +1588,7 @@ wxMBConvUTF32swap::FromWChar(char *dst, size_t dstLen,
 class wxMBConv_iconv : public wxMBConv
 {
 public:
 class wxMBConv_iconv : public wxMBConv
 {
 public:
-    wxMBConv_iconv(const wxChar *name);
+    wxMBConv_iconv(const char *name);
     virtual ~wxMBConv_iconv();
 
     virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
     virtual ~wxMBConv_iconv();
 
     virtual size_t MB2WC(wchar_t *buf, const char *psz, size_t n) const;
@@ -1603,7 +1603,7 @@ public:
 
     virtual wxMBConv *Clone() const
     {
 
     virtual wxMBConv *Clone() const
     {
-        wxMBConv_iconv *p = new wxMBConv_iconv(m_name);
+        wxMBConv_iconv *p = new wxMBConv_iconv(m_name.ToAscii());
         p->m_minMBCharWidth = m_minMBCharWidth;
         return p;
     }
         p->m_minMBCharWidth = m_minMBCharWidth;
         return p;
     }
@@ -1641,7 +1641,7 @@ private:
 };
 
 // make the constructor available for unit testing
 };
 
 // make the constructor available for unit testing
-WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_iconv( const wxChar* name )
+WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_iconv( const char* name )
 {
     wxMBConv_iconv* result = new wxMBConv_iconv( name );
     if ( !result->IsOk() )
 {
     wxMBConv_iconv* result = new wxMBConv_iconv( name );
     if ( !result->IsOk() )
@@ -1656,15 +1656,11 @@ WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_iconv( const wxChar* name )
 wxString wxMBConv_iconv::ms_wcCharsetName;
 bool wxMBConv_iconv::ms_wcNeedsSwap = false;
 
 wxString wxMBConv_iconv::ms_wcCharsetName;
 bool wxMBConv_iconv::ms_wcNeedsSwap = false;
 
-wxMBConv_iconv::wxMBConv_iconv(const wxChar *name)
+wxMBConv_iconv::wxMBConv_iconv(const char *name)
               : m_name(name)
 {
     m_minMBCharWidth = 0;
 
               : m_name(name)
 {
     m_minMBCharWidth = 0;
 
-    // iconv operates with chars, not wxChars, but luckily it uses only ASCII
-    // names for the charsets
-    const wxCharBuffer cname(wxString(name).ToAscii());
-
     // check for charset that represents wchar_t:
     if ( ms_wcCharsetName.empty() )
     {
     // check for charset that represents wchar_t:
     if ( ms_wcCharsetName.empty() )
     {
@@ -1701,13 +1697,13 @@ wxMBConv_iconv::wxMBConv_iconv(const wxChar *name)
             wxLogTrace(TRACE_STRCONV, _T("  trying charset \"%s\""),
                        nameXE.c_str());
 
             wxLogTrace(TRACE_STRCONV, _T("  trying charset \"%s\""),
                        nameXE.c_str());
 
-            m2w = iconv_open(nameXE.ToAscii(), cname);
+            m2w = iconv_open(nameXE.ToAscii(), name);
             if ( m2w == ICONV_T_INVALID )
             {
                 // try charset w/o bytesex info (e.g. "UCS4")
                 wxLogTrace(TRACE_STRCONV, _T("  trying charset \"%s\""),
                            nameCS.c_str());
             if ( m2w == ICONV_T_INVALID )
             {
                 // try charset w/o bytesex info (e.g. "UCS4")
                 wxLogTrace(TRACE_STRCONV, _T("  trying charset \"%s\""),
                            nameCS.c_str());
-                m2w = iconv_open(nameCS.ToAscii(), cname);
+                m2w = iconv_open(nameCS.ToAscii(), name);
 
                 // and check for bytesex ourselves:
                 if ( m2w != ICONV_T_INVALID )
 
                 // and check for bytesex ourselves:
                 if ( m2w != ICONV_T_INVALID )
@@ -1757,7 +1753,7 @@ wxMBConv_iconv::wxMBConv_iconv(const wxChar *name)
     }
     else // we already have ms_wcCharsetName
     {
     }
     else // we already have ms_wcCharsetName
     {
-        m2w = iconv_open(ms_wcCharsetName.ToAscii(), cname);
+        m2w = iconv_open(ms_wcCharsetName.ToAscii(), name);
     }
 
     if ( ms_wcCharsetName.empty() )
     }
 
     if ( ms_wcCharsetName.empty() )
@@ -1766,12 +1762,12 @@ wxMBConv_iconv::wxMBConv_iconv(const wxChar *name)
     }
     else
     {
     }
     else
     {
-        w2m = iconv_open(cname, ms_wcCharsetName.ToAscii());
+        w2m = iconv_open(name, ms_wcCharsetName.ToAscii());
         if ( w2m == ICONV_T_INVALID )
         {
             wxLogTrace(TRACE_STRCONV,
                        wxT("\"%s\" -> \"%s\" works but not the converse!?"),
         if ( w2m == ICONV_T_INVALID )
         {
             wxLogTrace(TRACE_STRCONV,
                        wxT("\"%s\" -> \"%s\" works but not the converse!?"),
-                       ms_wcCharsetName.c_str(), cname.data());
+                       ms_wcCharsetName.c_str(), name);
         }
     }
 }
         }
     }
 }
@@ -1982,8 +1978,8 @@ size_t wxMBConv_iconv::GetMBNulLen() const
 #if wxUSE_UNICODE_UTF8
 bool wxMBConv_iconv::IsUTF8() const
 {
 #if wxUSE_UNICODE_UTF8
 bool wxMBConv_iconv::IsUTF8() const
 {
-    return wxStricmp(m_name, _T("UTF-8")) == 0 ||
-           wxStricmp(m_name, _T("UTF8")) == 0;
+    return wxStricmp(m_name, "UTF-8") == 0 ||
+           wxStricmp(m_name, "UTF8") == 0;
 }
 #endif
 
 }
 #endif
 
@@ -1998,7 +1994,7 @@ bool wxMBConv_iconv::IsUTF8() const
 
 // from utils.cpp
 #if wxUSE_FONTMAP
 
 // from utils.cpp
 #if wxUSE_FONTMAP
-extern WXDLLIMPEXP_BASE long wxCharsetToCodepage(const wxChar *charset);
+extern WXDLLIMPEXP_BASE long wxCharsetToCodepage(const char *charset);
 extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding);
 #endif
 
 extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding);
 #endif
 
@@ -2019,7 +2015,7 @@ public:
     }
 
 #if wxUSE_FONTMAP
     }
 
 #if wxUSE_FONTMAP
-    wxMBConv_win32(const wxChar* name)
+    wxMBConv_win32(const char* name)
     {
         m_CodePage = wxCharsetToCodepage(name);
         m_minMBCharWidth = 0;
     {
         m_CodePage = wxCharsetToCodepage(name);
         m_minMBCharWidth = 0;
@@ -3107,7 +3103,7 @@ private:
 public:
     // temporarily just use wxEncodingConverter stuff,
     // so that it works while a better implementation is built
 public:
     // temporarily just use wxEncodingConverter stuff,
     // so that it works while a better implementation is built
-    wxMBConv_wxwin(const wxChar* name)
+    wxMBConv_wxwin(const char* name)
     {
         if (name)
             m_enc = wxFontMapperBase::Get()->CharsetToEncoding(name, false);
     {
         if (name)
             m_enc = wxFontMapperBase::Get()->CharsetToEncoding(name, false);
@@ -3180,7 +3176,7 @@ private:
 };
 
 // make the constructors available for unit testing
 };
 
 // make the constructors available for unit testing
-WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_wxwin( const wxChar* name )
+WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_wxwin( const char* name )
 {
     wxMBConv_wxwin* result = new wxMBConv_wxwin( name );
     if ( !result->IsOk() )
 {
     wxMBConv_wxwin* result = new wxMBConv_wxwin( name );
     if ( !result->IsOk() )
@@ -3205,13 +3201,13 @@ void wxCSConv::Init()
     m_deferred = true;
 }
 
     m_deferred = true;
 }
 
-wxCSConv::wxCSConv(const wxChar *charset)
+wxCSConv::wxCSConv(const wxString& charset)
 {
     Init();
 
 {
     Init();
 
-    if ( charset )
+    if ( !charset.empty() )
     {
     {
-        SetName(charset);
+        SetName(charset.ToAscii());
     }
 
 #if wxUSE_FONTMAP
     }
 
 #if wxUSE_FONTMAP
@@ -3268,11 +3264,11 @@ void wxCSConv::Clear()
     m_convReal = NULL;
 }
 
     m_convReal = NULL;
 }
 
-void wxCSConv::SetName(const wxChar *charset)
+void wxCSConv::SetName(const char *charset)
 {
     if (charset)
     {
 {
     if (charset)
     {
-        m_name = wxStrdup(charset);
+        m_name = strdup(charset);
         m_deferred = true;
     }
 }
         m_deferred = true;
     }
 }
@@ -3291,7 +3287,7 @@ wxMBConv *wxCSConv::DoCreate() const
     wxLogTrace(TRACE_STRCONV,
                wxT("creating conversion for %s"),
                (m_name ? m_name
     wxLogTrace(TRACE_STRCONV,
                wxT("creating conversion for %s"),
                (m_name ? m_name
-                       : (const wxChar*)wxFontMapperBase::GetEncodingName(m_encoding).c_str()));
+                       : (const char*)wxFontMapperBase::GetEncodingName(m_encoding).mb_str()));
 #endif // wxUSE_FONTMAP
 
     // check for the special case of ASCII or ISO8859-1 charset: as we have
 #endif // wxUSE_FONTMAP
 
     // check for the special case of ASCII or ISO8859-1 charset: as we have
@@ -3318,14 +3314,13 @@ wxMBConv *wxCSConv::DoCreate() const
     if ( m_name )
 #endif // !wxUSE_FONTMAP
     {
     if ( m_name )
 #endif // !wxUSE_FONTMAP
     {
-        wxString name(m_name);
 #if wxUSE_FONTMAP
         wxFontEncoding encoding(m_encoding);
 #endif
 
 #if wxUSE_FONTMAP
         wxFontEncoding encoding(m_encoding);
 #endif
 
-        if ( !name.empty() )
+        if ( m_name )
         {
         {
-            wxMBConv_iconv *conv = new wxMBConv_iconv(name);
+            wxMBConv_iconv *conv = new wxMBConv_iconv(m_name);
             if ( conv->IsOk() )
                 return conv;
 
             if ( conv->IsOk() )
                 return conv;
 
@@ -3333,7 +3328,7 @@ wxMBConv *wxCSConv::DoCreate() const
 
 #if wxUSE_FONTMAP
             encoding =
 
 #if wxUSE_FONTMAP
             encoding =
-                wxFontMapperBase::Get()->CharsetToEncoding(name, false);
+                wxFontMapperBase::Get()->CharsetToEncoding(m_name, false);
 #endif // wxUSE_FONTMAP
         }
 #if wxUSE_FONTMAP
 #endif // wxUSE_FONTMAP
         }
 #if wxUSE_FONTMAP
@@ -3344,7 +3339,7 @@ wxMBConv *wxCSConv::DoCreate() const
                 if ( it->second.empty() )
                     return NULL;
 
                 if ( it->second.empty() )
                     return NULL;
 
-                wxMBConv_iconv *conv = new wxMBConv_iconv(it->second);
+                wxMBConv_iconv *conv = new wxMBConv_iconv(it->second.ToAscii());
                 if ( conv->IsOk() )
                     return conv;
 
                 if ( conv->IsOk() )
                     return conv;
 
@@ -3352,15 +3347,19 @@ wxMBConv *wxCSConv::DoCreate() const
             }
 
             const wxChar** names = wxFontMapperBase::GetAllEncodingNames(encoding);
             }
 
             const wxChar** names = wxFontMapperBase::GetAllEncodingNames(encoding);
-            // CS : in case this does not return valid names (eg for MacRoman) encoding
-            // got a 'failure' entry in the cache all the same, although it just has to
-            // be created using a different method, so only store failed iconv creation
-            // attempts (or perhaps we shoulnd't do this at all ?)
+            // CS : in case this does not return valid names (eg for MacRoman)
+            // encoding got a 'failure' entry in the cache all the same,
+            // although it just has to be created using a different method, so
+            // only store failed iconv creation attempts (or perhaps we
+            // shoulnd't do this at all ?)
             if ( names[0] != NULL )
             {
                 for ( ; *names; ++names )
                 {
             if ( names[0] != NULL )
             {
                 for ( ; *names; ++names )
                 {
-                    wxMBConv_iconv *conv = new wxMBConv_iconv(*names);
+                    // FIXME-UTF8: wxFontMapperBase::GetAllEncodingNames()
+                    //             will need changes that will obsolete this
+                    wxString name(*names);
+                    wxMBConv_iconv *conv = new wxMBConv_iconv(name.ToAscii());
                     if ( conv->IsOk() )
                     {
                         gs_nameCache[encoding] = *names;
                     if ( conv->IsOk() )
                     {
                         gs_nameCache[encoding] = *names;
@@ -3494,9 +3493,9 @@ wxMBConv *wxCSConv::DoCreate() const
                    m_name ? m_name
                       :
 #if wxUSE_FONTMAP
                    m_name ? m_name
                       :
 #if wxUSE_FONTMAP
-                         (const wxChar*)wxFontMapperBase::GetEncodingDescription(m_encoding).c_str()
+                         (const char*)wxFontMapperBase::GetEncodingDescription(m_encoding).ToAscii()
 #else // !wxUSE_FONTMAP
 #else // !wxUSE_FONTMAP
-                         (const wxChar*)wxString::Format(_("encoding %i"), m_encoding).c_str()
+                         (const char*)wxString::Format(_("encoding %i"), m_encoding).ToAscii()
 #endif // wxUSE_FONTMAP/!wxUSE_FONTMAP
               );
 
 #endif // wxUSE_FONTMAP/!wxUSE_FONTMAP
               );
 
index e3d076ad77bb450d968d47dd8f446222ea6dac3d..32e6fe8d15591e43d464b1491c25d57d3727e600 100644 (file)
@@ -1156,29 +1156,25 @@ wxString wxFilterClassFactoryBase::PopExtension(const wxString& location) const
 }
 
 wxString::size_type wxFilterClassFactoryBase::FindExtension(
 }
 
 wxString::size_type wxFilterClassFactoryBase::FindExtension(
-        const wxChar *location) const
+        const wxString& location) const
 {
 {
-    size_t len = wxStrlen(location);
-
     for (const wxChar *const *p = GetProtocols(wxSTREAM_FILEEXT); *p; p++)
     {
     for (const wxChar *const *p = GetProtocols(wxSTREAM_FILEEXT); *p; p++)
     {
-        size_t l = wxStrlen(*p);
-
-        if (l <= len && wxStrcmp(*p, location + len - l) == 0)
-            return len - l;
+        if ( location.EndsWith(*p) )
+            return location.length() - wxStrlen(*p);
     }
 
     return wxString::npos;
 }
 
     }
 
     return wxString::npos;
 }
 
-bool wxFilterClassFactoryBase::CanHandle(const wxChar *protocol,
+bool wxFilterClassFactoryBase::CanHandle(const wxString& protocol,
                                          wxStreamProtocolType type) const
 {
     if (type == wxSTREAM_FILEEXT)
         return FindExtension(protocol) != wxString::npos;
     else
         for (const wxChar *const *p = GetProtocols(type); *p; p++)
                                          wxStreamProtocolType type) const
 {
     if (type == wxSTREAM_FILEEXT)
         return FindExtension(protocol) != wxString::npos;
     else
         for (const wxChar *const *p = GetProtocols(type); *p; p++)
-            if (wxStrcmp(*p, protocol) == 0)
+            if (protocol == *p)
                 return true;
 
     return false;
                 return true;
 
     return false;
index 400a4e39894108388ef98eaaf51e247c807e003f..65a4099d41f59149b176167466a8248025dc4040 100644 (file)
@@ -829,8 +829,8 @@ wxTarNumber wxTarInputStream::GetHeaderNumber(int id) const
 
     if ((value = GetExtendedHeader(m_hdr->Name(id))) != wxEmptyString) {
         wxTarNumber n = 0;
 
     if ((value = GetExtendedHeader(m_hdr->Name(id))) != wxEmptyString) {
         wxTarNumber n = 0;
-        const wxChar *p = value;
-        while (*p == ' ')
+        wxString::const_iterator p = value.begin();
+        while (*p == ' ' && p != value.end())
             p++;
         while (isdigit(*p))
             n = n * 10 + (*p++ - '0');
             p++;
         while (isdigit(*p))
             n = n * 10 + (*p++ - '0');
index d2e08f5c8ffbe5f53cb707397a82af18739c7059..524402d54fb0e522b81549bfb1559e988b4806ca 100644 (file)
@@ -416,7 +416,8 @@ void wxTextOutputStream::WriteString(const wxString& string)
     }
 
 #if wxUSE_UNICODE
     }
 
 #if wxUSE_UNICODE
-    wxCharBuffer buffer = m_conv->cWC2MB(out, out.length(), &len);
+    // FIXME-UTF8: use wxCharBufferWithLength if/when we have it
+    wxCharBuffer buffer = m_conv->cWC2MB(out.wc_str(), out.length(), &len);
     m_output.Write(buffer, len);
 #else
     m_output.Write(out.c_str(), out.length() );
     m_output.Write(buffer, len);
 #else
     m_output.Write(out.c_str(), out.length() );
index a5151947ef9a17b85440b69ee79eda4234348657..5ddfbc3cbc88806824fbf2ef1b75ba9a814dbee3 100644 (file)
@@ -93,7 +93,10 @@ const wxChar* wxURI::Create(const wxString& uri)
     if (m_fields)
         Clear();
 
     if (m_fields)
         Clear();
 
-    return Parse(uri);
+    // FIXME-UTF8: rewrite ParseXXX() methods using iterators
+    // NB: using wxWxCharBuffer instead of just c_str() avoids keeping
+    //     converted string in memory for longer than needed
+    return Parse(wxWxCharBuffer(uri.c_str()));
 }
 
 // ---------------------------------------------------------------------------
 }
 
 // ---------------------------------------------------------------------------
@@ -374,7 +377,7 @@ bool wxURI::IsReference() const
 // URI-reference = URI / relative
 // ---------------------------------------------------------------------------
 
 // URI-reference = URI / relative
 // ---------------------------------------------------------------------------
 
-const wxChar* wxURI::Parse(const wxCharuri)
+const wxChar* wxURI::Parse(const wxChar *uri)
 {
     uri = ParseScheme(uri);
     uri = ParseAuthority(uri);
 {
     uri = ParseScheme(uri);
     uri = ParseAuthority(uri);
@@ -389,7 +392,7 @@ const wxChar* wxURI::Parse(const wxChar* uri)
 // Individual parsers for each URI component
 // ---------------------------------------------------------------------------
 
 // Individual parsers for each URI component
 // ---------------------------------------------------------------------------
 
-const wxChar* wxURI::ParseScheme(const wxCharuri)
+const wxChar* wxURI::ParseScheme(const wxChar *uri)
 {
     wxASSERT(uri != NULL);
 
 {
     wxASSERT(uri != NULL);
 
index aa3568f0d572cb15e53d614c4bf65ceb2f9d4e2b..c960f548e3e4cc1c04c214879072eeaa75f2c39a 100644 (file)
@@ -1004,7 +1004,7 @@ size_t wxZipEntry::ReadLocal(wxInputStream& stream, wxMBConv& conv)
 size_t wxZipEntry::WriteLocal(wxOutputStream& stream, wxMBConv& conv) const
 {
     wxString unixName = GetName(wxPATH_UNIX);
 size_t wxZipEntry::WriteLocal(wxOutputStream& stream, wxMBConv& conv) const
 {
     wxString unixName = GetName(wxPATH_UNIX);
-    const wxWX2MBbuf name_buf = conv.cWX2MB(unixName);
+    const wxWX2MBbuf name_buf = unixName.mb_str(conv);
     const char *name = name_buf;
     if (!name) name = "";
     wxUint16 nameLen = wx_truncate_cast(wxUint16, strlen(name));
     const char *name = name_buf;
     if (!name) name = "";
     wxUint16 nameLen = wx_truncate_cast(wxUint16, strlen(name));
@@ -1080,12 +1080,12 @@ size_t wxZipEntry::ReadCentral(wxInputStream& stream, wxMBConv& conv)
 size_t wxZipEntry::WriteCentral(wxOutputStream& stream, wxMBConv& conv) const
 {
     wxString unixName = GetName(wxPATH_UNIX);
 size_t wxZipEntry::WriteCentral(wxOutputStream& stream, wxMBConv& conv) const
 {
     wxString unixName = GetName(wxPATH_UNIX);
-    const wxWX2MBbuf name_buf = conv.cWX2MB(unixName);
+    const wxWX2MBbuf name_buf = unixName.mb_str(conv);
     const char *name = name_buf;
     if (!name) name = "";
     wxUint16 nameLen = wx_truncate_cast(wxUint16, strlen(name));
 
     const char *name = name_buf;
     if (!name) name = "";
     wxUint16 nameLen = wx_truncate_cast(wxUint16, strlen(name));
 
-    const wxWX2MBbuf comment_buf = conv.cWX2MB(m_Comment);
+    const wxWX2MBbuf comment_buf = m_Comment.mb_str(conv);
     const char *comment = comment_buf;
     if (!comment) comment = "";
     wxUint16 commentLen = wx_truncate_cast(wxUint16, strlen(comment));
     const char *comment = comment_buf;
     if (!comment) comment = "";
     wxUint16 commentLen = wx_truncate_cast(wxUint16, strlen(comment));
@@ -1235,7 +1235,7 @@ wxZipEndRec::wxZipEndRec()
 
 bool wxZipEndRec::Write(wxOutputStream& stream, wxMBConv& conv) const
 {
 
 bool wxZipEndRec::Write(wxOutputStream& stream, wxMBConv& conv) const
 {
-    const wxWX2MBbuf comment_buf = conv.cWX2MB(m_Comment);
+    const wxWX2MBbuf comment_buf = m_Comment.mb_str(conv);
     const char *comment = comment_buf;
     if (!comment) comment = "";
     wxUint16 commentLen = (wxUint16)strlen(comment);
     const char *comment = comment_buf;
     if (!comment) comment = "";
     wxUint16 commentLen = (wxUint16)strlen(comment);
index 820536a56489d495fce5d8e1cca98665d91cc65c..8786f1fde980b47493a532f1aa04fbc3bc2f5353 100644 (file)
@@ -82,8 +82,7 @@ wxAnimation& wxAnimation::operator=(const wxAnimation& that)
 bool wxAnimation::LoadFile(const wxString &name, wxAnimationType WXUNUSED(type))
 {
     UnRef();
 bool wxAnimation::LoadFile(const wxString &name, wxAnimationType WXUNUSED(type))
 {
     UnRef();
-    m_pixbuf = gdk_pixbuf_animation_new_from_file(
-        wxConvFileName->cWX2MB(name), NULL);
+    m_pixbuf = gdk_pixbuf_animation_new_from_file(name.fn_str(), NULL);
     return IsOk();
 }
 
     return IsOk();
 }
 
index 742961c9947035fd7ff76d6a28ecd042fa0b3f35..16bd7a83fe774e5fd000e237fea070e6cefba66a 100644 (file)
@@ -148,7 +148,7 @@ wxDirDialog::wxDirDialog(wxWindow* parent, const wxString& title,
 
         if ( !defaultPath.empty() )
             gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
 
         if ( !defaultPath.empty() )
             gtk_file_chooser_set_current_folder( GTK_FILE_CHOOSER(m_widget),
-                    wxConvFileName->cWX2MB(defaultPath) );
+                    defaultPath.fn_str() );
     }
     else
         wxGenericDirDialog::Create(parent, title, defaultPath, style, pos, sz, name);
     }
     else
         wxGenericDirDialog::Create(parent, title, defaultPath, style, pos, sz, name);
@@ -192,7 +192,8 @@ void wxDirDialog::SetPath(const wxString& dir)
     {
         if (wxDirExists(dir))
         {
     {
         if (wxDirExists(dir))
         {
-            gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir));
+            gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget),
+                                                dir.fn_str());
         }
     }
     else
         }
     }
     else
@@ -204,7 +205,7 @@ wxString wxDirDialog::GetPath() const
     if (!gtk_check_version(2,4,0))
     {
         wxGtkString str(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
     if (!gtk_check_version(2,4,0))
     {
         wxGtkString str(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
-        return wxConvFileName->cMB2WX(str);
+        return wxString(str, *wxConvFileName);
     }
 
     return wxGenericDirDialog::GetPath();
     }
 
     return wxGenericDirDialog::GetPath();
index 30395b73f04ec967b42234929cdea9b433911bc9..1f12180c3268a6f279ad189796e238ef7df37c01 100644 (file)
@@ -50,7 +50,7 @@ static void gtk_filedialog_ok_callback(GtkWidget *widget, wxFileDialog *dialog)
 
             msg.Printf(
                 _("File '%s' already exists, do you really want to overwrite it?"),
 
             msg.Printf(
                 _("File '%s' already exists, do you really want to overwrite it?"),
-                wxString(wxConvFileName->cMB2WX(filename)).c_str());
+                wxString(filename, *wxConvFileName));
 
             wxMessageDialog dlg(dialog, msg, _("Confirm"),
                                wxYES_NO | wxICON_QUESTION);
 
             wxMessageDialog dlg(dialog, msg, _("Confirm"),
                                wxYES_NO | wxICON_QUESTION);
@@ -318,7 +318,7 @@ wxString wxFileDialog::GetPath() const
     if (!gtk_check_version(2,4,0))
     {
         wxGtkString str(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
     if (!gtk_check_version(2,4,0))
     {
         wxGtkString str(gtk_file_chooser_get_filename(GTK_FILE_CHOOSER(m_widget)));
-        return wxConvFileName->cMB2WX(str);
+        return wxString(str, *wxConvFileName);
     }
 
     return wxGenericFileDialog::GetPath();
     }
 
     return wxGenericFileDialog::GetPath();
@@ -350,7 +350,7 @@ void wxFileDialog::GetPaths(wxArrayString& paths) const
             GSList *gpaths = gpathsi;
             while (gpathsi)
             {
             GSList *gpaths = gpathsi;
             while (gpathsi)
             {
-                wxString file(wxConvFileName->cMB2WX((gchar*) gpathsi->data));
+                wxString file((gchar*) gpathsi->data, *wxConvFileName);
                 paths.Add(file);
                 g_free(gpathsi->data);
                 gpathsi = gpathsi->next;
                 paths.Add(file);
                 g_free(gpathsi->data);
                 gpathsi = gpathsi->next;
@@ -382,7 +382,7 @@ void wxFileDialog::SetPath(const wxString& path)
     {
         if (path.empty()) return;
 
     {
         if (path.empty()) return;
 
-        gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(path));
+        gtk_file_chooser_set_filename(GTK_FILE_CHOOSER(m_widget), path.fn_str());
     }
     else
         wxGenericFileDialog::SetPath( path );
     }
     else
         wxGenericFileDialog::SetPath( path );
@@ -394,7 +394,7 @@ void wxFileDialog::SetDirectory(const wxString& dir)
     {
         if (wxDirExists(dir))
         {
     {
         if (wxDirExists(dir))
         {
-            gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), wxConvFileName->cWX2MB(dir));
+            gtk_file_chooser_set_current_folder(GTK_FILE_CHOOSER(m_widget), dir.fn_str());
         }
     }
     else
         }
     }
     else
@@ -406,7 +406,7 @@ wxString wxFileDialog::GetDirectory() const
     if (!gtk_check_version(2,4,0))
     {
         wxGtkString str(gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(m_widget)));
     if (!gtk_check_version(2,4,0))
     {
         wxGtkString str(gtk_file_chooser_get_current_folder(GTK_FILE_CHOOSER(m_widget)));
-        return wxConvFileName->cMB2WX(str);
+        return wxString(str, *wxConvFileName);
     }
 
     return wxGenericFileDialog::GetDirectory();
     }
 
     return wxGenericFileDialog::GetDirectory();
index 8d120d9c13b8af09432d0422054734ac9908226a..4ea40b70c72680f66b4e2d8970b709bc368b417d 100644 (file)
@@ -151,7 +151,7 @@ wxString wxHyperlinkCtrl::GetURL() const
     if ( UseNative() )
     {
         const gchar *str = gtk_link_button_get_uri(GTK_LINK_BUTTON(m_widget));
     if ( UseNative() )
     {
         const gchar *str = gtk_link_button_get_uri(GTK_LINK_BUTTON(m_widget));
-        return wxConvFileName->cMB2WX(str);
+        return wxString(str, *wxConvFileName);
     }
 
     return wxGenericHyperlinkCtrl::GetURL();
     }
 
     return wxGenericHyperlinkCtrl::GetURL();
index bd901c5000d1da0ccf15b166bd37a9bec7f514c8..9f8004024621c945631536f2eff7a6d30a77172f 100644 (file)
@@ -55,14 +55,12 @@ static wxString GetGtkHotKey( const wxMenuItem& item );
 
 static wxString wxReplaceUnderscore( const wxString& title )
 {
 
 static wxString wxReplaceUnderscore( const wxString& title )
 {
-    const wxChar *pc;
-
     // GTK 1.2 wants to have "_" instead of "&" for accelerators
     wxString str;
     // GTK 1.2 wants to have "_" instead of "&" for accelerators
     wxString str;
-    pc = title;
-    while (*pc != wxT('\0'))
+
+    for ( wxString::const_iterator pc = title.begin(); pc != title.end(); ++pc )
     {
     {
-        if ((*pc == wxT('&')) && (*(pc+1) == wxT('&')))
+        if ((*pc == wxT('&')) && (pc+1 != title.end()) && (*(pc+1) == wxT('&')))
         {
             // "&" is doubled to indicate "&" instead of accelerator
             ++pc;
         {
             // "&" is doubled to indicate "&" instead of accelerator
             ++pc;
@@ -83,7 +81,6 @@ static wxString wxReplaceUnderscore( const wxString& title )
 
             str << *pc;
         }
 
             str << *pc;
         }
-        ++pc;
     }
 
     // wxPrintf( wxT("before %s after %s\n"), title.c_str(), str.c_str() );
     }
 
     // wxPrintf( wxT("before %s after %s\n"), title.c_str(), str.c_str() );
index e5bb933d2b30baf5fd4962750238510f65da8064..1dea75490ea353fe4b01ac1bd529f9f51ae240d9 100644 (file)
@@ -275,7 +275,8 @@ bool wxRadioBox::Create( wxWindow *parent, wxWindowID id, const wxString& title,
             radio_button_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON(rbtn) );
 
         label.Empty();
             radio_button_group = gtk_radio_button_get_group( GTK_RADIO_BUTTON(rbtn) );
 
         label.Empty();
-        for ( const wxChar *pc = choices[i]; *pc; pc++ )
+        for ( wxString::const_iterator pc = choices[i].begin();
+              pc != choices[i].end(); ++pc )
         {
             if ( *pc != wxT('&') )
                 label += *pc;
         {
             if ( *pc != wxT('&') )
                 label += *pc;
index c236c47c4e6e4909da60fc150f58d8e42ceb9185..14bfb8e2b4f3a871d2a6d382ba39699ca1a8bbff 100644 (file)
@@ -1444,7 +1444,7 @@ extern WXDLLIMPEXP_BASE long wxEncodingToCodepage(wxFontEncoding encoding)
     return (long) ret;
 }
 
     return (long) ret;
 }
 
-extern long wxCharsetToCodepage(const wxChar *name)
+extern long wxCharsetToCodepage(const char *name)
 {
     // first get the font encoding for this charset
     if ( !name )
 {
     // first get the font encoding for this charset
     if ( !name )
@@ -1463,7 +1463,7 @@ extern long wxCharsetToCodepage(const wxChar *name)
 #include "wx/msw/registry.h"
 
 // this should work if Internet Exploiter is installed
 #include "wx/msw/registry.h"
 
 // this should work if Internet Exploiter is installed
-extern long wxCharsetToCodepage(const wxChar *name)
+extern long wxCharsetToCodepage(const char *name)
 {
     if (!name)
         return GetACP();
 {
     if (!name)
         return GetACP();
index 76ea00e815346fb057e9d49eb8f6714326ca0bd9..e2371f649723e9846a941e5bcae3c649db60e6c2 100644 (file)
@@ -394,7 +394,7 @@ void wxRichTextHTMLHandler::WriteImage(wxRichTextImage* image, wxOutputStream& s
         if (image->GetImage().Ok())
         {        
             wxString ext(image->GetImageBlock().GetExtension());
         if (image->GetImage().Ok())
         {        
             wxString ext(image->GetImageBlock().GetExtension());
-            wxString tempFilename(wxString::Format(wxT("image%d.%s"), sm_fileCounter, (const wxChar*) ext));
+            wxString tempFilename(wxString::Format(wxT("image%d.%s"), sm_fileCounter, ext));
             wxMemoryFSHandler::AddFile(tempFilename, image->GetImage(), image->GetImageBlock().GetImageType());
             
             m_imageLocations.Add(tempFilename);
             wxMemoryFSHandler::AddFile(tempFilename, image->GetImage(), image->GetImageBlock().GetImageType());
             
             m_imageLocations.Add(tempFilename);
@@ -420,7 +420,7 @@ void wxRichTextHTMLHandler::WriteImage(wxRichTextImage* image, wxOutputStream& s
                 tempDir = wxFileName::GetTempDir();
             
             wxString ext(image->GetImageBlock().GetExtension());
                 tempDir = wxFileName::GetTempDir();
             
             wxString ext(image->GetImageBlock().GetExtension());
-            wxString tempFilename(wxString::Format(wxT("%s/image%d.%s"), (const wxChar*) tempDir, sm_fileCounter, (const wxChar*) ext));
+            wxString tempFilename(wxString::Format(wxT("%s/image%d.%s"), tempDir, sm_fileCounter, ext));
             image->GetImageBlock().Write(tempFilename);
             
             m_imageLocations.Add(tempFilename);
             image->GetImageBlock().Write(tempFilename);
             
             m_imageLocations.Add(tempFilename);
index 77f034d89b12889e2cbc3fc7a6c048a1d0b9796c..e31fbc1b030c3b2f391e60950e73b00f545360c1 100644 (file)
@@ -724,7 +724,7 @@ void wxRichTextStyleOrganiserDialog::OnDeleteClick( wxCommandEvent& WXUNUSED(eve
     {
         wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
         wxString name(def->GetName());
     {
         wxRichTextStyleDefinition* def = m_stylesListBox->GetStyleListBox()->GetStyle(sel);
         wxString name(def->GetName());
-        if (wxYES == wxMessageBox(wxString::Format(_("Delete style %s?"), (const wxChar*) name), _("Delete Style"), wxYES_NO|wxICON_QUESTION, this))
+        if (wxYES == wxMessageBox(wxString::Format(_("Delete style %s?"), name), _("Delete Style"), wxYES_NO|wxICON_QUESTION, this))
         {
             m_stylesListBox->GetStyleListBox()->SetItemCount(0);
 
         {
             m_stylesListBox->GetStyleListBox()->SetItemCount(0);
 
index 2d6df34af1013252f4e1769759e2362e23c33221..620f6fd6dfa18f654333fc7a587a52a0e0a6717a 100644 (file)
@@ -573,7 +573,7 @@ bool wxRichTextXMLHandler::DoSaveFile(wxRichTextBuffer *buffer, wxOutputStream&
 
     wxString s ;
     s.Printf(wxT("<?xml version=\"%s\" encoding=\"%s\"?>\n"),
 
     wxString s ;
     s.Printf(wxT("<?xml version=\"%s\" encoding=\"%s\"?>\n"),
-        (const wxChar*) version, (const wxChar*) fileEncoding );
+             version, fileEncoding);
     OutputString(stream, s, NULL, NULL);
     OutputString(stream, wxT("<richtext version=\"1.0.0.0\" xmlns=\"http://www.wxwidgets.org\">") , NULL, NULL);
 
     OutputString(stream, s, NULL, NULL);
     OutputString(stream, wxT("<richtext version=\"1.0.0.0\" xmlns=\"http://www.wxwidgets.org\">") , NULL, NULL);
 
index d87bf47002382bace41d6ba24304d40aa865bdf7..7743d9b064d822e9e2a4c3878b709712b249cde1 100644 (file)
@@ -132,7 +132,7 @@ bool wxDirData::Read(wxString *filename)
             return false;
 
 #if wxUSE_UNICODE
             return false;
 
 #if wxUSE_UNICODE
-        de_d_name = wxConvFileName->cMB2WC( de->d_name );
+        de_d_name = wxString(de->d_name, *wxConvFileName);
 #else
         de_d_name = de->d_name;
 #endif
 #else
         de_d_name = de->d_name;
 #endif
index 20b96b5c21ba32a35a6ecf1c7d4d668ae6677a41..4a39baa089317cc20dd3c71c5dbac7c6604a90e3 100644 (file)
@@ -1367,14 +1367,15 @@ size_t wxFileTypeImpl::GetAllCommands(wxArrayString *verbs,
 
 bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
 {
 
 bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
 {
-    wxString strExtensions = m_manager->GetExtension(m_index[0]);
+    const wxString strExtensions = m_manager->GetExtension(m_index[0]);
     extensions.Empty();
 
     // one extension in the space or comma-delimited list
     wxString strExt;
     extensions.Empty();
 
     // one extension in the space or comma-delimited list
     wxString strExt;
-    for ( const wxChar *p = strExtensions; /* nothing */; p++ )
+    wxString::const_iterator end = strExtensions.end();
+    for ( wxString::const_iterator p = strExtensions.begin(); /* nothing */; ++p )
     {
     {
-        if ( *p == wxT(' ') || *p == wxT(',') || *p == wxT('\0') )
+        if ( p == end || *p == wxT(' ') || *p == wxT(',') )
         {
             if ( !strExt.empty() )
             {
         {
             if ( !strExt.empty() )
             {
@@ -1384,7 +1385,7 @@ bool wxFileTypeImpl::GetExtensions(wxArrayString& extensions)
             //else: repeated spaces
             // (shouldn't happen, but it's not that important if it does happen)
 
             //else: repeated spaces
             // (shouldn't happen, but it's not that important if it does happen)
 
-            if ( *p == wxT('\0') )
+            if ( p == end )
                 break;
         }
         else if ( *p == wxT('.') )
                 break;
         }
         else if ( *p == wxT('.') )
@@ -2488,8 +2489,7 @@ wxMimeTypesManagerImpl::ProcessOtherMailcapField(MailcapLineData& data,
     }
 
     // is this something of the form foo=bar?
     }
 
     // is this something of the form foo=bar?
-    const wxChar *pEq = wxStrchr(curField, wxT('='));
-    if ( pEq != NULL )
+    if ( curField.find('=') != wxString::npos )
     {
         // split "LHS = RHS" in 2
         wxString lhs = curField.BeforeFirst(wxT('=')),
     {
         // split "LHS = RHS" in 2
         wxString lhs = curField.BeforeFirst(wxT('=')),
index 2eab9e451b7fd154627b18e5978eb18156a70faa..25b1558c73500c7add00c24ef3a00f8a3c017bbb 100644 (file)
@@ -917,7 +917,8 @@ wxOperatingSystemId wxGetOsVersion(int *verMaj, int *verMin)
     // get OS version
     int major, minor;
     wxString release = wxGetCommandOutput(wxT("uname -r"));
     // get OS version
     int major, minor;
     wxString release = wxGetCommandOutput(wxT("uname -r"));
-    if ( release.empty() || wxSscanf(release, wxT("%d.%d"), &major, &minor) != 2 )
+    if ( release.empty() ||
+         wxSscanf(release.c_str(), wxT("%d.%d"), &major, &minor) != 2 )
     {
         // failed to get version string or unrecognized format
         major =
     {
         // failed to get version string or unrecognized format
         major =
@@ -1051,7 +1052,7 @@ bool wxGetDiskSpace(const wxString& path, wxDiskspaceSize_t *pTotal, wxDiskspace
 bool wxGetEnv(const wxString& var, wxString *value)
 {
     // wxGetenv is defined as getenv()
 bool wxGetEnv(const wxString& var, wxString *value)
 {
     // wxGetenv is defined as getenv()
-    wxChar *p = wxGetenv(var);
+    char *p = wxGetenv(var);
     if ( !p )
         return false;
 
     if ( !p )
         return false;
 
index e9f3e92df74d0eb0dcdcfaf7b41d595b0f6f2325..16ced8c8f6a34480467b2ff68317b32ffba3486a 100644 (file)
@@ -558,8 +558,7 @@ static int UnknownEncodingHnd(void * WXUNUSED(encodingHandlerData),
     // We must build conversion table for expat. The easiest way to do so
     // is to let wxCSConv convert as string containing all characters to
     // wide character representation:
     // We must build conversion table for expat. The easiest way to do so
     // is to let wxCSConv convert as string containing all characters to
     // wide character representation:
-    wxString str(name, wxConvLibc);
-    wxCSConv conv(str.c_str());
+    wxCSConv conv(name);
     char mbBuf[2];
     wchar_t wcBuf[10];
     size_t i;
     char mbBuf[2];
     wchar_t wcBuf[10];
     size_t i;
index 8d05e0ca8dae15ec965aa2fbdc60939ba7df104c..f50901de147a8e816dbca7f4a1c002ec405ba4c7 100644 (file)
@@ -82,7 +82,7 @@ public:
 
    static size_t GetNumber() { return ms_bars; }
 
 
    static size_t GetNumber() { return ms_bars; }
 
-   const wxChar *GetName() const { return m_name; }
+   const wxChar *GetName() const { return m_name.c_str(); }
 
 private:
    wxString m_name;
 
 private:
    wxString m_name;
index db64b5c53ecb8dbf900b40a7405d776bd0837aeb..f2a0d60016866cb73230909520741ea8822da1c9 100644 (file)
@@ -639,7 +639,7 @@ void DateTimeTestCase::TestTimeFormat()
 
             // convert back
             wxDateTime dt2;
 
             // convert back
             wxDateTime dt2;
-            const wxChar *result = dt2.ParseFormat(s, fmt);
+            const wxChar *result = dt2.ParseFormat(s.c_str(), fmt);
             if ( !result )
             {
                 // converion failed - should it have?
             if ( !result )
             {
                 // converion failed - should it have?
index 987a69e862223c397c26a63d58b23067b9b9ab93..b7bcff8873fc744f7012b43d3ef8043b76e45501 100644 (file)
@@ -286,7 +286,7 @@ void FormatConverterTestCase::doTest(const wxChar *input,
 void FormatConverterTestCase::check(const wxString& input,
                                     const wxString& expected)
 {
 void FormatConverterTestCase::check(const wxString& input,
                                     const wxString& expected)
 {
-    wxString result = wxConvertFormat(input);
+    wxString result = wxConvertFormat(input.wc_str());
     wxString msg = _T("input: '") + input +
                    _T("', result: '") + result +
                    _T("', expected: '") + expected + _T("'");
     wxString msg = _T("input: '") + input +
                    _T("', result: '") + result +
                    _T("', expected: '") + expected + _T("'");
index 16ea8a3d37ad9f46e2825050c43b0132efe73349..85eea4c98f7cb73895c4014b0e3918862019ebc7 100644 (file)
@@ -61,7 +61,7 @@ public:
 
    static size_t GetNumber() { return ms_bars; }
 
 
    static size_t GetNumber() { return ms_bars; }
 
-   const wxChar *GetName() const { return m_name; }
+   const wxChar *GetName() const { return m_name.c_str(); }
 
 private:
    wxString m_name;
 
 private:
    wxString m_name;
index 49baef19d3880cc502e4c1c3c026f6a402c59e76..dde306ab6c796f7c11e36379293fc55f6ef85a5d 100644 (file)
@@ -120,7 +120,7 @@ private:
         size_t         wideChars,   // the number of wide characters at wideBuffer
         const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
         size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
         size_t         wideChars,   // the number of wide characters at wideBuffer
         const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
         size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
-        wxMBConv*      converter,   // the wxMBConv object that can decode multiBuffer into a wide character sequence
+        wxMBConv&      converter,   // the wxMBConv object that can decode multiBuffer into a wide character sequence
         int            sizeofNull   // number of bytes occupied by terminating null in this encoding
         );
 
         int            sizeofNull   // number of bytes occupied by terminating null in this encoding
         );
 
@@ -130,7 +130,7 @@ private:
         size_t         wideChars,   // the number of wide characters at wideBuffer
         const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
         size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
         size_t         wideChars,   // the number of wide characters at wideBuffer
         const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
         size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
-        wxMBConv*      converter,   // the wxMBConv object that can decode multiBuffer into a wide character sequence
+        wxMBConv&      converter,   // the wxMBConv object that can decode multiBuffer into a wide character sequence
         int            sizeofNull   // number of bytes occupied by terminating null in this encoding
         );
 
         int            sizeofNull   // number of bytes occupied by terminating null in this encoding
         );
 
@@ -142,7 +142,7 @@ private:
         size_t         wideChars,   // the number of wide characters at wideBuffer
         const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
         size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
         size_t         wideChars,   // the number of wide characters at wideBuffer
         const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
         size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
-        wxMBConv*      converter    // the wxMBConv object that can decode multiBuffer into a wide character sequence
+        wxMBConv&      converter    // the wxMBConv object that can decode multiBuffer into a wide character sequence
         );
 
     // use wxTextOutputStream to exercise wxMBConv interface
         );
 
     // use wxTextOutputStream to exercise wxMBConv interface
@@ -152,7 +152,7 @@ private:
         size_t         wideChars,   // the number of wide characters at wideBuffer
         const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
         size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
         size_t         wideChars,   // the number of wide characters at wideBuffer
         const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
         size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
-        wxMBConv*      converter    // the wxMBConv object that can decode multiBuffer into a wide character sequence
+        wxMBConv&      converter    // the wxMBConv object that can decode multiBuffer into a wide character sequence
         );
 #endif
 
         );
 #endif
 
@@ -167,7 +167,7 @@ private:
         size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
         const char*    utf8Buffer,  // the same character sequence as multiBuffer, encoded as UTF-8
         size_t         utf8Bytes,   // the byte length of the UTF-8 encoded character sequence
         size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
         const char*    utf8Buffer,  // the same character sequence as multiBuffer, encoded as UTF-8
         size_t         utf8Bytes,   // the byte length of the UTF-8 encoded character sequence
-        wxMBConv*      converter,   // the wxMBConv object that can decode multiBuffer into a wide character sequence
+        wxMBConv&      converter,   // the wxMBConv object that can decode multiBuffer into a wide character sequence
         int            sizeofNull   // the number of bytes occupied by a terminating null in the converter's encoding
         );
 
         int            sizeofNull   // the number of bytes occupied by a terminating null in the converter's encoding
         );
 
@@ -393,7 +393,7 @@ void MBConvTestCase::UTF7Tests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf7_iconv, 
         sizeof(welcome_utf7_iconv), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf7_iconv, 
         sizeof(welcome_utf7_iconv), 
-        &wxConvUTF7,
+        wxConvUTF7,
         1
         );
     TestDecoder
         1
         );
     TestDecoder
@@ -402,7 +402,7 @@ void MBConvTestCase::UTF7Tests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf7_wx, 
         sizeof(welcome_utf7_wx), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf7_wx, 
         sizeof(welcome_utf7_wx), 
-        &wxConvUTF7,
+        wxConvUTF7,
         1
         );
 #if 0 
         1
         );
 #if 0 
@@ -415,7 +415,7 @@ void MBConvTestCase::UTF7Tests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf7_iconv, 
         sizeof(welcome_utf7_iconv), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf7_iconv, 
         sizeof(welcome_utf7_iconv), 
-        &wxConvUTF7,
+        wxConvUTF7,
         1
         );
 #endif
         1
         );
 #endif
@@ -425,7 +425,7 @@ void MBConvTestCase::UTF7Tests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf7_wx, 
         sizeof(welcome_utf7_wx), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf7_wx, 
         sizeof(welcome_utf7_wx), 
-        &wxConvUTF7,
+        wxConvUTF7,
         1
         );
 }
         1
         );
 }
@@ -438,7 +438,7 @@ void MBConvTestCase::UTF8Tests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf8, 
         sizeof(welcome_utf8), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf8, 
         sizeof(welcome_utf8), 
-        &wxConvUTF8,
+        wxConvUTF8,
         1
         );
     TestEncoder
         1
         );
     TestEncoder
@@ -447,7 +447,7 @@ void MBConvTestCase::UTF8Tests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf8, 
         sizeof(welcome_utf8), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf8, 
         sizeof(welcome_utf8), 
-        &wxConvUTF8,
+        wxConvUTF8,
         1
         );
 }
         1
         );
 }
@@ -461,7 +461,7 @@ void MBConvTestCase::UTF16LETests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf16le, 
         sizeof(welcome_utf16le), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf16le, 
         sizeof(welcome_utf16le), 
-        &convUTF16LE,
+        convUTF16LE,
         2
         );
     TestEncoder
         2
         );
     TestEncoder
@@ -470,7 +470,7 @@ void MBConvTestCase::UTF16LETests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf16le, 
         sizeof(welcome_utf16le), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf16le, 
         sizeof(welcome_utf16le), 
-        &convUTF16LE,
+        convUTF16LE,
         2
         );
 }
         2
         );
 }
@@ -484,7 +484,7 @@ void MBConvTestCase::UTF16BETests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf16be, 
         sizeof(welcome_utf16be), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf16be, 
         sizeof(welcome_utf16be), 
-        &convUTF16BE,
+        convUTF16BE,
         2
         );
     TestEncoder
         2
         );
     TestEncoder
@@ -493,7 +493,7 @@ void MBConvTestCase::UTF16BETests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf16be, 
         sizeof(welcome_utf16be), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf16be, 
         sizeof(welcome_utf16be), 
-        &convUTF16BE,
+        convUTF16BE,
         2
         );
 }
         2
         );
 }
@@ -507,7 +507,7 @@ void MBConvTestCase::UTF32LETests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf32le, 
         sizeof(welcome_utf32le), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf32le, 
         sizeof(welcome_utf32le), 
-        &convUTF32LE,
+        convUTF32LE,
         4
         );
     TestEncoder
         4
         );
     TestEncoder
@@ -516,7 +516,7 @@ void MBConvTestCase::UTF32LETests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf32le, 
         sizeof(welcome_utf32le), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf32le, 
         sizeof(welcome_utf32le), 
-        &convUTF32LE,
+        convUTF32LE,
         4
         );
 }
         4
         );
 }
@@ -530,7 +530,7 @@ void MBConvTestCase::UTF32BETests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf32be, 
         sizeof(welcome_utf32be), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf32be, 
         sizeof(welcome_utf32be), 
-        &convUTF32BE,
+        convUTF32BE,
         4
         );
     TestEncoder
         4
         );
     TestEncoder
@@ -539,7 +539,7 @@ void MBConvTestCase::UTF32BETests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf32be, 
         sizeof(welcome_utf32be), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_utf32be, 
         sizeof(welcome_utf32be), 
-        &convUTF32BE,
+        convUTF32BE,
         4
         );
 }
         4
         );
 }
@@ -553,7 +553,7 @@ void MBConvTestCase::CP932Tests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_cp932, 
         sizeof(welcome_cp932), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_cp932, 
         sizeof(welcome_cp932), 
-        &convCP932,
+        convCP932,
         1
         );
     TestEncoder
         1
         );
     TestEncoder
@@ -562,7 +562,7 @@ void MBConvTestCase::CP932Tests()
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_cp932, 
         sizeof(welcome_cp932), 
         sizeof(welcome_wchar_t)/sizeof(wchar_t),
         (const char*)welcome_cp932, 
         sizeof(welcome_cp932), 
-        &convCP932,
+        convCP932,
         1
         );
 }
         1
         );
 }
@@ -743,7 +743,7 @@ void MBConvTestCase::TestCoder(
     size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
     const char*    utf8Buffer,  // the same character sequence as multiBuffer, encoded as UTF-8
     size_t         utf8Bytes,   // the byte length of the UTF-8 encoded character sequence
     size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
     const char*    utf8Buffer,  // the same character sequence as multiBuffer, encoded as UTF-8
     size_t         utf8Bytes,   // the byte length of the UTF-8 encoded character sequence
-    wxMBConv*      converter,   // the wxMBConv object thta can decode multiBuffer into a wide character sequence
+    wxMBConv&      converter,   // the wxMBConv object thta can decode multiBuffer into a wide character sequence
     int            sizeofNull   // the number of bytes occupied by a terminating null in the converter's encoding
     )
 {
     int            sizeofNull   // the number of bytes occupied by a terminating null in the converter's encoding
     )
 {
@@ -777,12 +777,12 @@ void MBConvTestCase::TestCoder(
 }
 
 
 }
 
 
-WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_wxwin( const wxChar* name );
+WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_wxwin( const char* name );
 
 void MBConvTestCase::FontmapTests()
 {
 #ifdef wxUSE_FONTMAP
 
 void MBConvTestCase::FontmapTests()
 {
 #ifdef wxUSE_FONTMAP
-    wxMBConv* converter = new_wxMBConv_wxwin( _T("CP1252") );
+    wxMBConv* converter = new_wxMBConv_wxwin("CP1252");
     if ( !converter )
     {
         return;
     if ( !converter )
     {
         return;
@@ -792,7 +792,7 @@ void MBConvTestCase::FontmapTests()
         sizeof(CP1252),
         (const char*)CP1252_utf8,
         sizeof(CP1252_utf8),
         sizeof(CP1252),
         (const char*)CP1252_utf8,
         sizeof(CP1252_utf8),
-        converter,
+        *converter,
         1
         );
     delete converter;
         1
         );
     delete converter;
@@ -800,12 +800,12 @@ void MBConvTestCase::FontmapTests()
 }
 
 
 }
 
 
-WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_iconv( const wxChar* name );
+WXDLLIMPEXP_BASE wxMBConv* new_wxMBConv_iconv( const char* name );
 
 void MBConvTestCase::IconvTests()
 {
 #ifdef HAVE_ICONV
 
 void MBConvTestCase::IconvTests()
 {
 #ifdef HAVE_ICONV
-    wxMBConv* converter = new_wxMBConv_iconv( _T("CP932") );
+    wxMBConv* converter = new_wxMBConv_iconv("CP932");
     if ( !converter )
     {
         return;
     if ( !converter )
     {
         return;
@@ -815,7 +815,7 @@ void MBConvTestCase::IconvTests()
         sizeof(welcome_cp932),
         (const char*)welcome_utf8,
         sizeof(welcome_utf8),
         sizeof(welcome_cp932),
         (const char*)welcome_utf8,
         sizeof(welcome_utf8),
-        converter,
+        *converter,
         1
         );
     delete converter;
         1
         );
     delete converter;
@@ -830,7 +830,7 @@ void MBConvTestCase::CP1252Tests()
         sizeof(CP1252),
         (const char*)CP1252_utf8,
         sizeof(CP1252_utf8),
         sizeof(CP1252),
         (const char*)CP1252_utf8,
         sizeof(CP1252_utf8),
-        &convCP1252,
+        convCP1252,
         1
         );
 }
         1
         );
 }
@@ -874,7 +874,7 @@ void MBConvTestCase::TestDecoder(
     size_t         wideChars,   // the number of wide characters at wideBuffer
     const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
     size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
     size_t         wideChars,   // the number of wide characters at wideBuffer
     const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
     size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
-    wxMBConv*      converter,   // the wxMBConv object that can decode multiBuffer into a wide character sequence
+    wxMBConv&      converter,   // the wxMBConv object that can decode multiBuffer into a wide character sequence
     int            sizeofNull   // number of bytes occupied by terminating null in this encoding
     )
 {
     int            sizeofNull   // number of bytes occupied by terminating null in this encoding
     )
 {
@@ -886,7 +886,7 @@ void MBConvTestCase::TestDecoder(
     memset( &inputCopy.data()[multiBytes], 0, sizeofNull );
 
     // calculate the output size
     memset( &inputCopy.data()[multiBytes], 0, sizeofNull );
 
     // calculate the output size
-    size_t outputWritten = converter->MB2WC
+    size_t outputWritten = converter.MB2WC
         ( 
         0, 
         (const char*)inputCopy.data(), 
         ( 
         0, 
         (const char*)inputCopy.data(), 
@@ -902,7 +902,7 @@ void MBConvTestCase::TestDecoder(
     wxWCharBuffer outputBuffer(outputBufferChars);
     memset( outputBuffer.data(), UNINITIALIZED, outputBufferChars*sizeof(wchar_t) );
 
     wxWCharBuffer outputBuffer(outputBufferChars);
     memset( outputBuffer.data(), UNINITIALIZED, outputBufferChars*sizeof(wchar_t) );
 
-    outputWritten = converter->MB2WC
+    outputWritten = converter.MB2WC
         ( 
         outputBuffer.data(), 
         (const char*)inputCopy.data(), 
         ( 
         outputBuffer.data(), 
         (const char*)inputCopy.data(), 
@@ -934,7 +934,7 @@ void MBConvTestCase::TestEncoder(
     size_t         wideChars,   // the number of wide characters at wideBuffer
     const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
     size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
     size_t         wideChars,   // the number of wide characters at wideBuffer
     const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
     size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
-    wxMBConv*      converter,   // the wxMBConv object that can decode multiBuffer into a wide character sequence
+    wxMBConv&      converter,   // the wxMBConv object that can decode multiBuffer into a wide character sequence
     int            sizeofNull   // number of bytes occupied by terminating null in this encoding
     )
 {
     int            sizeofNull   // number of bytes occupied by terminating null in this encoding
     )
 {
@@ -946,7 +946,7 @@ void MBConvTestCase::TestEncoder(
     inputCopy.data()[wideChars] = 0;
 
     // calculate the output size
     inputCopy.data()[wideChars] = 0;
 
     // calculate the output size
-    size_t outputWritten = converter->WC2MB
+    size_t outputWritten = converter.WC2MB
         ( 
         0, 
         (const wchar_t*)inputCopy.data(), 
         ( 
         0, 
         (const wchar_t*)inputCopy.data(), 
@@ -961,7 +961,7 @@ void MBConvTestCase::TestEncoder(
     wxCharBuffer outputBuffer(outputBufferSize);
     memset( outputBuffer.data(), UNINITIALIZED, outputBufferSize );
 
     wxCharBuffer outputBuffer(outputBufferSize);
     memset( outputBuffer.data(), UNINITIALIZED, outputBufferSize );
 
-    outputWritten = converter->WC2MB
+    outputWritten = converter.WC2MB
         ( 
         outputBuffer.data(), 
         (const wchar_t*)inputCopy.data(), 
         ( 
         outputBuffer.data(), 
         (const wchar_t*)inputCopy.data(), 
@@ -1001,14 +1001,14 @@ void MBConvTestCase::TestStreamDecoder(
                                        size_t         wideChars,   // the number of wide characters at wideBuffer
                                        const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
                                        size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
                                        size_t         wideChars,   // the number of wide characters at wideBuffer
                                        const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
                                        size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
-                                       wxMBConv*      converter    // the wxMBConv object that can decode multiBuffer into a wide character sequence
+                                       wxMBConv&      converter    // the wxMBConv object that can decode multiBuffer into a wide character sequence
                                        )
 {
     // this isn't meant to test wxMemoryInputStream or wxTextInputStream
     // it's meant to test the way wxTextInputStream uses wxMBConv
     // (which has exposed some problems with wxMBConv)
     wxMemoryInputStream memoryInputStream( multiBuffer, multiBytes );
                                        )
 {
     // this isn't meant to test wxMemoryInputStream or wxTextInputStream
     // it's meant to test the way wxTextInputStream uses wxMBConv
     // (which has exposed some problems with wxMBConv)
     wxMemoryInputStream memoryInputStream( multiBuffer, multiBytes );
-    wxTextInputStream textInputStream( memoryInputStream, wxT(""), *converter );
+    wxTextInputStream textInputStream( memoryInputStream, wxT(""), converter );
     for ( size_t i = 0; i < wideChars; i++ )
     {
         wxChar wc = textInputStream.GetChar();
     for ( size_t i = 0; i < wideChars; i++ )
     {
         wxChar wc = textInputStream.GetChar();
@@ -1027,7 +1027,7 @@ void MBConvTestCase::TestStreamEncoder(
     size_t         wideChars,   // the number of wide characters at wideBuffer
     const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
     size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
     size_t         wideChars,   // the number of wide characters at wideBuffer
     const char*    multiBuffer, // a multibyte encoded character sequence that can be decoded by "converter"
     size_t         multiBytes,  // the byte length of the multibyte character sequence that can be decoded by "converter"
-    wxMBConv*      converter    // the wxMBConv object that can decode multiBuffer into a wide character sequence
+    wxMBConv&      converter    // the wxMBConv object that can decode multiBuffer into a wide character sequence
     )
 {
     // this isn't meant to test wxMemoryOutputStream or wxTextOutputStream
     )
 {
     // this isn't meant to test wxMemoryOutputStream or wxTextOutputStream
@@ -1035,7 +1035,7 @@ void MBConvTestCase::TestStreamEncoder(
     // (which has exposed some problems with wxMBConv)
     wxMemoryOutputStream memoryOutputStream;
     // wxEOL_UNIX will pass \n \r unchanged
     // (which has exposed some problems with wxMBConv)
     wxMemoryOutputStream memoryOutputStream;
     // wxEOL_UNIX will pass \n \r unchanged
-    wxTextOutputStream textOutputStream( memoryOutputStream, wxEOL_UNIX, *converter );
+    wxTextOutputStream textOutputStream( memoryOutputStream, wxEOL_UNIX, converter );
     for ( size_t i = 0; i < wideChars; i++ )
     {
         textOutputStream.PutChar( wideBuffer[i] );
     for ( size_t i = 0; i < wideChars; i++ )
     {
         textOutputStream.PutChar( wideBuffer[i] );
index 89885575683f08d534c77557361382b484e7a6d2..ef63306560d8f04c85f2ccb53a729cba757517c9 100644 (file)
@@ -178,8 +178,9 @@ wxString RegExTestCase::Conv(const char *str)
 //
 void RegExTestCase::parseFlags(const wxString& flags)
 {
 //
 void RegExTestCase::parseFlags(const wxString& flags)
 {
-    for (const wxChar *p = flags; *p; p++) {
-        switch (*p) {
+    for ( wxString::const_iterator p = flags.begin(); p != flags.end(); ++p )
+    {
+        switch ( (*p).GetValue() ) {
             // noop
             case '-': break;
 
             // noop
             case '-': break;