adaptions for cleaned up string conversions
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@19009 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -44,7 +44,8 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
#else
|
#else
|
||||||
OSStatus err = noErr ;
|
OSStatus err = noErr ;
|
||||||
#endif
|
#endif
|
||||||
void * data = NULL ;
|
void * data = NULL ;
|
||||||
|
Size byteCount;
|
||||||
|
|
||||||
switch (dataFormat.GetType())
|
switch (dataFormat.GetType())
|
||||||
{
|
{
|
||||||
@@ -68,7 +69,6 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
if ( err != noTypeErr && err != memFullErr )
|
if ( err != noTypeErr && err != memFullErr )
|
||||||
{
|
{
|
||||||
ScrapFlavorFlags flavorFlags;
|
ScrapFlavorFlags flavorFlags;
|
||||||
Size byteCount;
|
|
||||||
|
|
||||||
if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
|
if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
|
||||||
{
|
{
|
||||||
@@ -101,7 +101,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
HUnlock( datahandle ) ;
|
HUnlock( datahandle ) ;
|
||||||
if ( GetHandleSize( datahandle ) > 0 )
|
if ( GetHandleSize( datahandle ) > 0 )
|
||||||
{
|
{
|
||||||
long byteCount = GetHandleSize( datahandle ) ;
|
byteCount = GetHandleSize( datahandle ) ;
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
data = new char[ byteCount + 1] ;
|
data = new char[ byteCount + 1] ;
|
||||||
else
|
else
|
||||||
@@ -110,7 +110,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
|
memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
((char*)data)[byteCount] = 0 ;
|
((char*)data)[byteCount] = 0 ;
|
||||||
* len = byteCount ;
|
*len = byteCount ;
|
||||||
}
|
}
|
||||||
DisposeHandle( datahandle ) ;
|
DisposeHandle( datahandle ) ;
|
||||||
#endif
|
#endif
|
||||||
@@ -122,7 +122,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
}
|
}
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
|
if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
wxMacConvertToPC((char*)data) ;
|
wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@@ -105,7 +105,7 @@ void wxFontEnumeratorHelper::DoEnumerate()
|
|||||||
{
|
{
|
||||||
MenuHandle menu ;
|
MenuHandle menu ;
|
||||||
Str255 p_name ;
|
Str255 p_name ;
|
||||||
char c_name[256] ;
|
|
||||||
short lines ;
|
short lines ;
|
||||||
|
|
||||||
menu = NewMenu( 32000 , "\pFont" ) ;
|
menu = NewMenu( 32000 , "\pFont" ) ;
|
||||||
@@ -115,12 +115,8 @@ void wxFontEnumeratorHelper::DoEnumerate()
|
|||||||
for ( int i = 1 ; i < lines+1 ; i ++ )
|
for ( int i = 1 ; i < lines+1 ; i ++ )
|
||||||
{
|
{
|
||||||
GetMenuItemText( menu , i , p_name ) ;
|
GetMenuItemText( menu , i , p_name ) ;
|
||||||
#if TARGET_CARBON
|
wxString c_name = wxMacMakeStringFromPascal(p_name) ;
|
||||||
p2cstrcpy( c_name, p_name ) ;
|
|
||||||
#else
|
|
||||||
p2cstr( p_name ) ;
|
|
||||||
strcpy( c_name, (char *)p_name ) ;
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
if ( m_fixedOnly )
|
if ( m_fixedOnly )
|
||||||
|
@@ -44,7 +44,8 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
#else
|
#else
|
||||||
OSStatus err = noErr ;
|
OSStatus err = noErr ;
|
||||||
#endif
|
#endif
|
||||||
void * data = NULL ;
|
void * data = NULL ;
|
||||||
|
Size byteCount;
|
||||||
|
|
||||||
switch (dataFormat.GetType())
|
switch (dataFormat.GetType())
|
||||||
{
|
{
|
||||||
@@ -68,7 +69,6 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
if ( err != noTypeErr && err != memFullErr )
|
if ( err != noTypeErr && err != memFullErr )
|
||||||
{
|
{
|
||||||
ScrapFlavorFlags flavorFlags;
|
ScrapFlavorFlags flavorFlags;
|
||||||
Size byteCount;
|
|
||||||
|
|
||||||
if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
|
if (( err = GetScrapFlavorFlags( scrapRef, dataFormat.GetFormatId(), &flavorFlags )) == noErr)
|
||||||
{
|
{
|
||||||
@@ -101,7 +101,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
HUnlock( datahandle ) ;
|
HUnlock( datahandle ) ;
|
||||||
if ( GetHandleSize( datahandle ) > 0 )
|
if ( GetHandleSize( datahandle ) > 0 )
|
||||||
{
|
{
|
||||||
long byteCount = GetHandleSize( datahandle ) ;
|
byteCount = GetHandleSize( datahandle ) ;
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
data = new char[ byteCount + 1] ;
|
data = new char[ byteCount + 1] ;
|
||||||
else
|
else
|
||||||
@@ -110,7 +110,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
|
memcpy( (char*) data , (char*) *datahandle , byteCount ) ;
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT )
|
if ( dataFormat.GetType() == wxDF_TEXT )
|
||||||
((char*)data)[byteCount] = 0 ;
|
((char*)data)[byteCount] = 0 ;
|
||||||
* len = byteCount ;
|
*len = byteCount ;
|
||||||
}
|
}
|
||||||
DisposeHandle( datahandle ) ;
|
DisposeHandle( datahandle ) ;
|
||||||
#endif
|
#endif
|
||||||
@@ -122,7 +122,7 @@ void *wxGetClipboardData(wxDataFormat dataFormat, long *len)
|
|||||||
}
|
}
|
||||||
if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
|
if ( dataFormat.GetType() == wxDF_TEXT && wxApp::s_macDefaultEncodingIsPC )
|
||||||
{
|
{
|
||||||
wxMacConvertToPC((char*)data) ;
|
wxMacConvertToPC((char*)data,(char*)data,byteCount) ;
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
@@ -105,7 +105,7 @@ void wxFontEnumeratorHelper::DoEnumerate()
|
|||||||
{
|
{
|
||||||
MenuHandle menu ;
|
MenuHandle menu ;
|
||||||
Str255 p_name ;
|
Str255 p_name ;
|
||||||
char c_name[256] ;
|
|
||||||
short lines ;
|
short lines ;
|
||||||
|
|
||||||
menu = NewMenu( 32000 , "\pFont" ) ;
|
menu = NewMenu( 32000 , "\pFont" ) ;
|
||||||
@@ -115,12 +115,8 @@ void wxFontEnumeratorHelper::DoEnumerate()
|
|||||||
for ( int i = 1 ; i < lines+1 ; i ++ )
|
for ( int i = 1 ; i < lines+1 ; i ++ )
|
||||||
{
|
{
|
||||||
GetMenuItemText( menu , i , p_name ) ;
|
GetMenuItemText( menu , i , p_name ) ;
|
||||||
#if TARGET_CARBON
|
wxString c_name = wxMacMakeStringFromPascal(p_name) ;
|
||||||
p2cstrcpy( c_name, p_name ) ;
|
|
||||||
#else
|
|
||||||
p2cstr( p_name ) ;
|
|
||||||
strcpy( c_name, (char *)p_name ) ;
|
|
||||||
#endif
|
|
||||||
/*
|
/*
|
||||||
|
|
||||||
if ( m_fixedOnly )
|
if ( m_fixedOnly )
|
||||||
|
Reference in New Issue
Block a user