]> git.saurik.com Git - wxWidgets.git/commitdiff
adaptions for cleaned up string conversions
authorStefan Csomor <csomor@advancedconcepts.ch>
Wed, 29 Jan 2003 15:03:43 +0000 (15:03 +0000)
committerStefan Csomor <csomor@advancedconcepts.ch>
Wed, 29 Jan 2003 15:03:43 +0000 (15:03 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

src/mac/carbon/clipbrd.cpp
src/mac/carbon/fontenum.cpp
src/mac/clipbrd.cpp
src/mac/fontenum.cpp

index 76952a442ea69563a1ef6d3b690b604b7e289a17..7059fae3c20bace9124e955fa1738c9f5443834b 100644 (file)
@@ -44,7 +44,8 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
 #else
     OSStatus err = noErr ;
 #endif
-  void * data = NULL ;
+       void * data = NULL ;
+       Size byteCount;
     
     switch (dataFormat.GetType())
     {
@@ -68,7 +69,6 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
     if ( err != noTypeErr && err != memFullErr )    
     {
         ScrapFlavorFlags    flavorFlags;
-        Size                byteCount;
         
         if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
         {
@@ -101,7 +101,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
     HUnlock( datahandle ) ;
     if ( GetHandleSize( datahandle ) > 0 )
     {
-      long byteCount = GetHandleSize( datahandle ) ;
+      byteCount = GetHandleSize( datahandle ) ;
       if ( dataFormat.GetType() == wxDF_TEXT )  
         data = new char[ byteCount + 1] ;
       else
@@ -110,7 +110,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
       memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
       if ( dataFormat.GetType() == wxDF_TEXT )  
           ((char*)data)[byteCount] = 0 ;
-      * len = byteCount ;
+      *len = byteCount ;
     }
     DisposeHandle( datahandle ) ;
 #endif
@@ -122,7 +122,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
     }
     if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
     {
-      wxMacConvertToPC((char*)data) ;
+      wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
     }
     return data;
 }
index 43aeb9a7a82b46ee044d4b5d2b89a73ac54add31..4a91e5703f1bee306fd2166efeb7f78a3bdb2df1 100644 (file)
@@ -105,7 +105,7 @@ void wxFontEnumeratorHelper::DoEnumerate()
 {
        MenuHandle      menu ;
        Str255          p_name ;
-       char        c_name[256] ;
+
        short           lines ;
        
        menu = NewMenu( 32000 , "\pFont" )  ;
@@ -115,12 +115,8 @@ void wxFontEnumeratorHelper::DoEnumerate()
        for ( int i = 1 ; i < lines+1  ; i ++ )
        {
            GetMenuItemText( menu , i , p_name ) ;
-#if TARGET_CARBON
-           p2cstrcpy( c_name, p_name ) ;
-#else
-               p2cstr( p_name ) ;
-           strcpy( c_name, (char *)p_name ) ;
-#endif
+           wxString c_name = wxMacMakeStringFromPascal(p_name) ;
+
            /*
              
              if ( m_fixedOnly )
index 76952a442ea69563a1ef6d3b690b604b7e289a17..7059fae3c20bace9124e955fa1738c9f5443834b 100644 (file)
@@ -44,7 +44,8 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
 #else
     OSStatus err = noErr ;
 #endif
-  void * data = NULL ;
+       void * data = NULL ;
+       Size byteCount;
     
     switch (dataFormat.GetType())
     {
@@ -68,7 +69,6 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
     if ( err != noTypeErr && err != memFullErr )    
     {
         ScrapFlavorFlags    flavorFlags;
-        Size                byteCount;
         
         if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
         {
@@ -101,7 +101,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
     HUnlock( datahandle ) ;
     if ( GetHandleSize( datahandle ) > 0 )
     {
-      long byteCount = GetHandleSize( datahandle ) ;
+      byteCount = GetHandleSize( datahandle ) ;
       if ( dataFormat.GetType() == wxDF_TEXT )  
         data = new char[ byteCount + 1] ;
       else
@@ -110,7 +110,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
       memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
       if ( dataFormat.GetType() == wxDF_TEXT )  
           ((char*)data)[byteCount] = 0 ;
-      * len = byteCount ;
+      *len = byteCount ;
     }
     DisposeHandle( datahandle ) ;
 #endif
@@ -122,7 +122,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
     }
     if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
     {
-      wxMacConvertToPC((char*)data) ;
+      wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
     }
     return data;
 }
index 43aeb9a7a82b46ee044d4b5d2b89a73ac54add31..4a91e5703f1bee306fd2166efeb7f78a3bdb2df1 100644 (file)
@@ -105,7 +105,7 @@ void wxFontEnumeratorHelper::DoEnumerate()
 {
        MenuHandle      menu ;
        Str255          p_name ;
-       char        c_name[256] ;
+
        short           lines ;
        
        menu = NewMenu( 32000 , "\pFont" )  ;
@@ -115,12 +115,8 @@ void wxFontEnumeratorHelper::DoEnumerate()
        for ( int i = 1 ; i < lines+1  ; i ++ )
        {
            GetMenuItemText( menu , i , p_name ) ;
-#if TARGET_CARBON
-           p2cstrcpy( c_name, p_name ) ;
-#else
-               p2cstr( p_name ) ;
-           strcpy( c_name, (char *)p_name ) ;
-#endif
+           wxString c_name = wxMacMakeStringFromPascal(p_name) ;
+
            /*
              
              if ( m_fixedOnly )