]> git.saurik.com Git - wxWidgets.git/commitdiff
Replaced incorrect or inefficient usage of char_str() by wx_str().
authorStefan Neis <Stefan.Neis@t-online.de>
Sat, 7 Apr 2007 12:21:15 +0000 (12:21 +0000)
committerStefan Neis <Stefan.Neis@t-online.de>
Sat, 7 Apr 2007 12:21:15 +0000 (12:21 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45296 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/os2/choice.cpp
src/os2/dc.cpp
src/os2/dcprint.cpp
src/os2/listbox.cpp
src/os2/menu.cpp
src/os2/menuitem.cpp
src/os2/ownerdrw.cpp
src/os2/textctrl.cpp
src/os2/utils.cpp
src/os2/window.cpp

index 0b769aceb8840a7e98a161a746a83af9af6160b2..59e63f9275e91bc98d40ceb4bd65b7dc5c484987 100644 (file)
@@ -134,7 +134,7 @@ int wxChoice::DoAppend(
     nIndex = (int)::WinSendMsg( GetHwnd()
                                ,LM_INSERTITEM
                                ,(MPARAM)nIndexType
-                               ,(MPARAM)rsItem.char_str()
+                               ,(MPARAM)rsItem.wx_str()
                               );
     return nIndex;
 } // end of wxChoice::DoAppend
@@ -157,7 +157,7 @@ int wxChoice::DoInsert( const wxString& rsItem, unsigned int pos )
     nIndex = (int)::WinSendMsg( GetHwnd()
                                ,LM_INSERTITEM
                                ,(MPARAM)nIndexType
-                               ,(MPARAM)rsItem.char_str()
+                               ,(MPARAM)rsItem.wx_str()
                               );
     return nIndex;
 } // end of wxChoice::DoInsert
@@ -232,7 +232,7 @@ void wxChoice::SetString(unsigned int n, const wxString& rsStr)
     ::WinSendMsg( GetHwnd()
                  ,LM_INSERTITEM
                  ,(MPARAM)nIndexType
-                 ,(MPARAM)rsStr.char_str()
+                 ,(MPARAM)rsStr.wx_str()
                 );
 
     if (pData)
index 1a65b1804c4a7c97856f9d60b686a0df58d59ec6..11d9169319780e333c92e8f416b7ebc133c5ab5b 100644 (file)
@@ -1753,12 +1753,10 @@ void wxDC::DrawAnyText( const wxString& rsText,
             vPtlStart.y = vY;
     }
 
-    PCH pzStr = rsText.char_str();
-
     ::GpiMove(m_hPS, &vPtlStart);
     lHits = ::GpiCharString( m_hPS
                             ,rsText.length()
-                            ,pzStr
+                            ,rsText.wx_str()
                            );
     if (lHits != GPI_OK)
     {
@@ -2178,7 +2176,7 @@ void wxDC::DoGetTextExtent(
     //
     bRc = ::GpiQueryTextBox( m_hPS
                             ,l
-                            ,rsString.char_str()
+                            ,(char *)rsString.wx_str()
                             ,TXTBOX_COUNT // return maximum information
                             ,avPoint      // array of coordinates points
                            );
index 807340d397979131b225e6c6bc5c602ec238322e..1c4a11c248532c2686c41a3b6f1a14321291d8e7 100644 (file)
@@ -41,8 +41,8 @@ wxPrinterDC::wxPrinterDC( const wxString& rsDriverName,
                           bool bInteractive,
                           int nOrientation )
 {
-    DEVOPENSTRUC    vDevOpen = { rsDeviceName.char_str()
-                                ,rsDriverName.char_str()
+    DEVOPENSTRUC    vDevOpen = { (char*)rsDeviceName.wx_str()
+                                ,(char*)rsDriverName.wx_str()
                                 ,NULL
                                 ,NULL
                                 ,NULL
index b7990354077a9da47bee2d521e4fb34f5e445714..aaca7eabcb76c03ff319862a77a5cb33a47f1d34 100644 (file)
@@ -281,7 +281,7 @@ int wxListBox::DoAppend(const wxString& rsItem)
     else
         lIndexType = LIT_END;
 
-    lIndex = (long)::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)rsItem.char_str());
+    lIndex = (long)::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)rsItem.wx_str());
     m_nNumItems++;
 
 #if wxUSE_OWNER_DRAWN
@@ -318,7 +318,7 @@ void wxListBox::DoSetItems( const wxArrayString& raChoices,
             lIndexType = LIT_SORTASCENDING;
         else
             lIndexType = LIT_END;
-        ::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)raChoices[i].char_str());
+        ::WinSendMsg(GetHwnd(), LM_INSERTITEM, (MPARAM)lIndexType, (MPARAM)raChoices[i].wx_str());
 
         if (ppClientData)
         {
@@ -563,7 +563,7 @@ void wxListBox::DoInsertItems(const wxArrayString& asItems, unsigned int nPos)
         int nIndex = (int)::WinSendMsg( GetHwnd(),
                                         LM_INSERTITEM,
                                         MPFROMLONG((LONG)(i + nPos)),
-                                        (MPARAM)asItems[i].char_str() );
+                                        (MPARAM)asItems[i].wx_str() );
 
         wxOwnerDrawn* pNewItem = CreateItem(nIndex);
 
@@ -613,7 +613,7 @@ void wxListBox::SetString(unsigned int n, const wxString& rsString)
     ::WinSendMsg( GetHwnd()
                  ,LM_INSERTITEM
                  ,(MPARAM)nNewN
-                 ,(MPARAM)rsString.char_str()
+                 ,(MPARAM)rsString.wx_str()
                 );
 
     //
index bd013d35bf249ca55fc1ee7cf25b0617509c22ac..7f693d4d2ddc4278ab2443a83216f46e4d1597ce 100644 (file)
@@ -323,7 +323,7 @@ bool wxMenu::DoInsertOrAppend( wxMenuItem* pItem,
             //
             rItem.afStyle |= MIS_TEXT;
         }
-        pData = pItem->GetText().char_str();
+        pData = (char*) pItem->GetText().wx_str();
     }
 
     if (nPos == (size_t)-1)
@@ -804,7 +804,7 @@ WXHMENU wxMenuBar::Create()
 
             (*it)->m_vMenuData.iPosition = (SHORT)i;
 
-            rc = (APIRET)::WinSendMsg(m_hMenu, MM_INSERTITEM, (MPARAM)&(*it)->m_vMenuData, (MPARAM)m_titles[i].char_str());
+            rc = (APIRET)::WinSendMsg(m_hMenu, MM_INSERTITEM, (MPARAM)&(*it)->m_vMenuData, (MPARAM)m_titles[i].wx_str());
             if (rc == (APIRET)MIT_MEMERROR || rc == (APIRET)MIT_ERROR)
             {
                 vError = ::WinGetLastError(vHabmain);
@@ -879,7 +879,7 @@ void wxMenuBar::SetLabelTop(
     }
     nId = vItem.id;
 
-    if (::WinSendMsg(GetHmenu(), MM_SETITEMTEXT, MPFROMSHORT(nId), (MPARAM)rLabel.char_str()));
+    if (::WinSendMsg(GetHmenu(), MM_SETITEMTEXT, MPFROMSHORT(nId), (MPARAM)rLabel.wx_str()));
     {
         wxLogLastError(wxT("ModifyMenu"));
     }
@@ -925,7 +925,7 @@ wxMenu* wxMenuBar::Replace(
     if (IsAttached())
     {
         ::WinSendMsg((HWND)m_hMenu, MM_REMOVEITEM, MPFROM2SHORT(nId, TRUE), (MPARAM)0);
-        ::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)sTitle.char_str());
+        ::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)sTitle.wx_str());
 
 #if wxUSE_ACCEL
         if (pMenuOld->HasAccels() || pMenu->HasAccels())
@@ -958,7 +958,7 @@ bool wxMenuBar::Insert( size_t          nPos,
         ::WinSendMsg( (HWND)m_hMenu
                      ,MM_INSERTITEM
                      ,(MPARAM)&pMenu->m_vMenuData
-                     ,(MPARAM)sTitle.char_str()
+                     ,(MPARAM)sTitle.wx_str()
                     );
 #if wxUSE_ACCEL
         if (pMenu->HasAccels())
@@ -990,7 +990,7 @@ bool wxMenuBar::Append( wxMenu* pMenu,
     if ( IsAttached() )
     {
         pMenu->m_vMenuData.iPosition = MIT_END;
-        ::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)sTitle.char_str());
+        ::WinSendMsg((HWND)m_hMenu, MM_INSERTITEM, (MPARAM)&pMenu->m_vMenuData, (MPARAM)sTitle.wx_str());
 #if wxUSE_ACCEL
         if (pMenu->HasAccels())
         {
index f0b69b5f796b285df9f430db0ab11a376370b4c9..921cfd2cbe4c633f6ce423185c3427aabb62b286 100644 (file)
@@ -427,7 +427,7 @@ void wxMenuItem::SetText( const wxString& rText )
 #endif  //owner drawn
         {
             uFlagsOld |= MIS_TEXT;
-            pData = m_text.char_str();
+            pData = (char*) m_text.wx_str();
         }
 
         //
index 12790b51ceb709c55bece245e4f9b07bcc1d2e0c..d5d0db57c3c65a008f10754800aed9dfbe6c0c51 100644 (file)
@@ -351,7 +351,7 @@ bool wxOwnerDrawn::OnDrawItem( wxDC& rDC,
     ::GpiCharStringAt( rDC.GetHPS()
                       ,&vPntStart
                       ,sFullString.length()
-                      ,sFullString.char_str()
+                      ,sFullString.wx_str()
                      );
     if (bFoundMnemonic)
     {
@@ -389,7 +389,7 @@ bool wxOwnerDrawn::OnDrawItem( wxDC& rDC,
         ::GpiCharStringAt( rDC.GetHPS()
                           ,&vPntStart
                           ,sAccel.length()
-                          ,sAccel.char_str()
+                          ,sAccel.wx_str()
                          );
     }
 
index 24dca77ce6d235e51474846d2a6d370a5adf8c9d..1c7014d733d23ba0c6b57be535ba6966ee61b6a6 100644 (file)
@@ -329,7 +329,8 @@ void wxTextCtrl::SetupColours()
 wxString wxTextCtrl::GetValue() const
 {
     wxString                        sStr = wxGetWindowText(GetHWND());
-    char*                           zStr = sStr.char_str();
+    wxCharBuffer                    buf(sStr.char_str());
+    char*                           zStr = buf.data();
 
     for ( ; *zStr; zStr++ )
     {
@@ -370,7 +371,7 @@ void wxTextCtrl::WriteText(
 )
 {
     if (m_bIsMLE)
-        ::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM(rsValue.char_str()), MPARAM(0));
+        ::WinSendMsg(GetHwnd(), MLM_INSERT, MPARAM(rsValue.wx_str()), MPARAM(0));
     else
         ::WinSetWindowText(GetHwnd(), rsValue.c_str());
     AdjustSpaceLimit();
index 7fb53b78a362e1a573d8df3322aa725f3f9f89d5..5576bc9b82d55bbcb550e86522d83bb5cab2a0f5 100644 (file)
@@ -157,7 +157,7 @@ bool wxShell( const wxString& rCommand )
     SData.PgmName  = (char*)zShell;
 
     sInputs = _T("/C ") + rCommand;
-    SData.PgmInputs     = (BYTE*)sInputs.char_str();
+    SData.PgmInputs     = (BYTE*)sInputs.wx_str();
     SData.TermQ         = 0;
     SData.Environment   = 0;
     SData.InheritOpt    = SSF_INHERTOPT_SHELL;
index 31fda2d2e40b607ff4230976a26258b7c4f08768..44fdde685bfa3403f14fae76a6e9e40086809300 100644 (file)
@@ -1673,7 +1673,6 @@ void wxWindowOS2::GetTextExtent( const wxString& rString,
     int         l;
     FONTMETRICS vFM; // metrics structure
     BOOL        bRc = FALSE;
-    char*       pStr;
     HPS         hPS;
 
     hPS = ::WinGetPS(GetHwnd());
@@ -1681,14 +1680,12 @@ void wxWindowOS2::GetTextExtent( const wxString& rString,
     l = rString.length();
     if (l > 0L)
     {
-        pStr = rString.char_str();
-
         //
         // In world coordinates.
         //
         bRc = ::GpiQueryTextBox( hPS,
                                  l,
-                                 pStr,
+                                 (char*) rString.wx_str(),
                                  TXTBOX_COUNT,// return maximum information
                                  avPoint      // array of coordinates points
                                 );