From: Ove Kaaven Date: Fri, 29 Oct 1999 01:55:00 +0000 (+0000) Subject: A few Unicode compilation fixes (mostly wxT()) X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/6eec2beef703b0be6d83e78e44f8b0a3a1999ac4?ds=sidebyside A few Unicode compilation fixes (mostly wxT()) git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@4246 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775 --- diff --git a/src/generic/dcpsg.cpp b/src/generic/dcpsg.cpp index 2206e14df6..d1a44cfe67 100644 --- a/src/generic/dcpsg.cpp +++ b/src/generic/dcpsg.cpp @@ -1856,8 +1856,8 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, if (afmFile==NULL) { - wxLogDebug( "GetTextExtent: can't open AFM file '%s'\n", afmName ); - wxLogDebug( " using approximate values\n"); + wxLogDebug( wxT("GetTextExtent: can't open AFM file '%hs'\n"), afmName ); + wxLogDebug( wxT(" using approximate values\n")); for (int i=0; i<256; i++) lastWidths[i] = 500; /* an approximate value */ lastDescender = -150; /* dito. */ } @@ -1879,7 +1879,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, if ((sscanf(line,"%s%d",descString,&lastDescender)!=2) || (strcmp(descString,"Descender")!=0)) { - wxLogDebug( "AFM-file '%s': line '%s' has error (bad descender)\n", afmName,line ); + wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad descender)\n"), afmName,line ); } } /* JC 1.) check for UnderlinePosition */ @@ -1888,7 +1888,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, if ((sscanf(line,"%s%lf",upString,&UnderlinePosition)!=2) || (strcmp(upString,"UnderlinePosition")!=0)) { - wxLogDebug( "AFM-file '%s': line '%s' has error (bad UnderlinePosition)\n", afmName, line ); + wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad UnderlinePosition)\n"), afmName, line ); } } /* JC 2.) check for UnderlineThickness */ @@ -1897,7 +1897,7 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, if ((sscanf(line,"%s%lf",utString,&UnderlineThickness)!=2) || (strcmp(utString,"UnderlineThickness")!=0)) { - wxLogDebug( "AFM-file '%s': line '%s' has error (bad UnderlineThickness)\n", afmName, line ); + wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad UnderlineThickness)\n"), afmName, line ); } } /* JC 3.) check for EncodingScheme */ @@ -1906,11 +1906,11 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, if ((sscanf(line,"%s%s",utString,encString)!=2) || (strcmp(utString,"EncodingScheme")!=0)) { - wxLogDebug("AFM-file '%s': line '%s' has error (bad EncodingScheme)\n", afmName, line ); + wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (bad EncodingScheme)\n"), afmName, line ); } else if (strncmp(encString, "AdobeStandardEncoding", 21)) { - wxLogDebug( "AFM-file '%s': line '%s' has error (unsupported EncodingScheme %s)\n", + wxLogDebug( wxT("AFM-file '%hs': line '%hs' has error (unsupported EncodingScheme %hs)\n"), afmName,line, encString); } } @@ -1919,11 +1919,11 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, { if (sscanf(line,"%s%d%s%s%d",cString,&ascii,semiString,WXString,&cWidth)!=5) { - wxLogDebug("AFM-file '%s': line '%s' has an error (bad character width)\n",afmName,line); + wxLogDebug(wxT("AFM-file '%hs': line '%hs' has an error (bad character width)\n"),afmName,line); } if(strcmp(cString,"C")!=0 || strcmp(semiString,";")!=0 || strcmp(WXString,"WX")!=0) { - wxLogDebug("AFM-file '%s': line '%s' has a format error\n",afmName,line); + wxLogDebug(wxT("AFM-file '%hs': line '%hs' has a format error\n"),afmName,line); } /* printf(" char '%c'=%d has width '%d'\n",ascii,ascii,cWidth); */ if (ascii>=0 && ascii<256) @@ -1970,11 +1970,11 @@ void wxPostScriptDC::DoGetTextExtent(const wxString& string, double widthSum=0; wxCoord height=Size; /* by default */ unsigned char *p; - for(p=(unsigned char *)strbuf; *p; p++) + for(p=(unsigned char *)wxMBSTRINGCAST strbuf; *p; p++) { if(lastWidths[*p]== INT_MIN) { - wxLogDebug("GetTextExtent: undefined width for character '%c' (%d)\n", *p,*p); + wxLogDebug(wxT("GetTextExtent: undefined width for character '%hc' (%d)\n"), *p,*p); widthSum += /*(wxCoord)*/(lastWidths[' ']/1000.0F * Size); /* assume space */ } else diff --git a/src/generic/dirdlgg.cpp b/src/generic/dirdlgg.cpp index 1b5ee25035..2d64b555fb 100644 --- a/src/generic/dirdlgg.cpp +++ b/src/generic/dirdlgg.cpp @@ -520,7 +520,7 @@ void wxDirDialog::OnNew( wxCommandEvent& WXUNUSED(event) ) do { new_name = wxT("NewName"); wxString num; - num.Printf( "%d", i ); + num.Printf( wxT("%d"), i ); new_name += num; path = data->m_path; diff --git a/src/generic/filedlgg.cpp b/src/generic/filedlgg.cpp index 265e8cb39e..1ce22f39b9 100644 --- a/src/generic/filedlgg.cpp +++ b/src/generic/filedlgg.cpp @@ -93,7 +93,7 @@ int ListCompare( long data1, long data2, long WXUNUSED(data) ) if (fd2->GetName() == wxT("..")) return 1; if (fd1->IsDir() && !fd2->IsDir()) return -1; if (fd2->IsDir() && !fd1->IsDir()) return 1; - return strcmp( fd1->GetName(), fd2->GetName() ); + return wxStrcmp( fd1->GetName(), fd2->GetName() ); } //----------------------------------------------------------------------------- @@ -108,9 +108,9 @@ wxFileData::wxFileData( const wxString &name, const wxString &fname ) m_fileName = fname; struct stat buff; - stat( m_fileName.GetData(), &buff ); + stat( m_fileName.fn_str(), &buff ); struct stat lbuff; - lstat( m_fileName.GetData(), &lbuff ); + lstat( m_fileName.fn_str(), &lbuff ); struct tm *t = localtime( &lbuff.st_mtime ); // struct passwd *user = getpwuid( buff.st_uid ); @@ -128,10 +128,10 @@ wxFileData::wxFileData( const wxString &name, const wxString &fname ) m_day = t->tm_mday; m_year = t->tm_year; - m_permissions.sprintf( "%c%c%c", - ((( buff.st_mode & S_IRUSR ) == S_IRUSR ) ? 'r' : '-'), - ((( buff.st_mode & S_IWUSR ) == S_IWUSR ) ? 'w' : '-'), - ((( buff.st_mode & S_IXUSR ) == S_IXUSR ) ? 'x' : '-') ); + m_permissions.sprintf( wxT("%c%c%c"), + ((( buff.st_mode & S_IRUSR ) == S_IRUSR ) ? wxT('r') : wxT('-')), + ((( buff.st_mode & S_IWUSR ) == S_IWUSR ) ? wxT('w') : wxT('-')), + ((( buff.st_mode & S_IXUSR ) == S_IXUSR ) ? wxT('x') : wxT('-')) ); } wxString wxFileData::GetName() const diff --git a/src/generic/grid.cpp b/src/generic/grid.cpp index 5d24c4943d..cc8a06b254 100644 --- a/src/generic/grid.cpp +++ b/src/generic/grid.cpp @@ -63,8 +63,8 @@ wxGridTableBase::~wxGridTableBase() bool wxGridTableBase::InsertRows( size_t pos, size_t numRows ) { - wxLogWarning( "Called grid table class function InsertRows(pos=%d, N=%d)\n" - "but your derived table class does not override this function", + wxLogWarning( wxT("Called grid table class function InsertRows(pos=%d, N=%d)\n" + "but your derived table class does not override this function"), pos, numRows ); return FALSE; @@ -72,8 +72,8 @@ bool wxGridTableBase::InsertRows( size_t pos, size_t numRows ) bool wxGridTableBase::AppendRows( size_t numRows ) { - wxLogWarning( "Called grid table class function AppendRows(N=%d)\n" - "but your derived table class does not override this function", + wxLogWarning( wxT("Called grid table class function AppendRows(N=%d)\n" + "but your derived table class does not override this function"), numRows ); return FALSE; @@ -81,8 +81,8 @@ bool wxGridTableBase::AppendRows( size_t numRows ) bool wxGridTableBase::DeleteRows( size_t pos, size_t numRows ) { - wxLogWarning( "Called grid table class function DeleteRows(pos=%d, N=%d)\n" - "but your derived table class does not override this function", + wxLogWarning( wxT("Called grid table class function DeleteRows(pos=%d, N=%d)\n" + "but your derived table class does not override this function"), pos, numRows ); return FALSE; @@ -90,8 +90,8 @@ bool wxGridTableBase::DeleteRows( size_t pos, size_t numRows ) bool wxGridTableBase::InsertCols( size_t pos, size_t numCols ) { - wxLogWarning( "Called grid table class function InsertCols(pos=%d, N=%d)\n" - "but your derived table class does not override this function", + wxLogWarning( wxT("Called grid table class function InsertCols(pos=%d, N=%d)\n" + "but your derived table class does not override this function"), pos, numCols ); return FALSE; @@ -99,8 +99,8 @@ bool wxGridTableBase::InsertCols( size_t pos, size_t numCols ) bool wxGridTableBase::AppendCols( size_t numCols ) { - wxLogWarning( "Called grid table class function AppendCols(N=%d)\n" - "but your derived table class does not override this function", + wxLogWarning( wxT("Called grid table class function AppendCols(N=%d)\n" + "but your derived table class does not override this function"), numCols ); return FALSE; @@ -108,8 +108,8 @@ bool wxGridTableBase::AppendCols( size_t numCols ) bool wxGridTableBase::DeleteCols( size_t pos, size_t numCols ) { - wxLogWarning( "Called grid table class function DeleteCols(pos=%d, N=%d)\n" - "but your derived table class does not override this function", + wxLogWarning( wxT("Called grid table class function DeleteCols(pos=%d, N=%d)\n" + "but your derived table class does not override this function"), pos, numCols ); return FALSE; @@ -354,8 +354,8 @@ bool wxGridStringTable::DeleteRows( size_t pos, size_t numRows ) if ( pos >= curNumRows ) { - wxLogError( "Called wxGridStringTable::DeleteRows(pos=%d, N=%d)...\n" - "Pos value is invalid for present table with %d rows", + wxLogError( wxT("Called wxGridStringTable::DeleteRows(pos=%d, N=%d)...\n" + "Pos value is invalid for present table with %d rows"), pos, numRows, curNumRows ); return FALSE; } @@ -432,8 +432,8 @@ bool wxGridStringTable::AppendCols( size_t numCols ) { // TODO: something better than this ? // - wxLogError( "Unable to append cols to a grid table with no rows.\n" - "Call AppendRows() first" ); + wxLogError( wxT("Unable to append cols to a grid table with no rows.\n" + "Call AppendRows() first") ); return FALSE; } @@ -466,8 +466,8 @@ bool wxGridStringTable::DeleteCols( size_t pos, size_t numCols ) if ( pos >= curNumCols ) { - wxLogError( "Called wxGridStringTable::DeleteCols(pos=%d, N=%d)...\n" - "Pos value is invalid for present table with %d cols", + wxLogError( wxT("Called wxGridStringTable::DeleteCols(pos=%d, N=%d)...\n" + "Pos value is invalid for present table with %d cols"), pos, numCols, curNumCols ); return FALSE; } @@ -1792,7 +1792,7 @@ void wxGrid::OnKeyDown( wxKeyEvent& ev ) { // shouldn't be here - we are going round in circles... // - wxLogFatalError( "wxGrid::OnKeyDown called while alread active" ); + wxLogFatalError( wxT("wxGrid::OnKeyDown called while alread active") ); } m_inOnKeyDown = TRUE; @@ -3380,7 +3380,7 @@ bool wxGrid::CreateGrid( int numRows, int numCols ) { if ( m_created ) { - wxLogError( "wxGrid::CreateGrid(numRows, numCols) called more than once" ); + wxLogError( wxT("wxGrid::CreateGrid(numRows, numCols) called more than once") ); return FALSE; } else @@ -3420,7 +3420,7 @@ bool wxGrid::InsertRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( "Called wxGrid::InsertRows() before calling CreateGrid()" ); + wxLogError( wxT("Called wxGrid::InsertRows() before calling CreateGrid()") ); return FALSE; } @@ -3468,7 +3468,7 @@ bool wxGrid::AppendRows( int numRows, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( "Called wxGrid::AppendRows() before calling CreateGrid()" ); + wxLogError( wxT("Called wxGrid::AppendRows() before calling CreateGrid()") ); return FALSE; } @@ -3500,7 +3500,7 @@ bool wxGrid::DeleteRows( int pos, int numRows, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( "Called wxGrid::DeleteRows() before calling CreateGrid()" ); + wxLogError( wxT("Called wxGrid::DeleteRows() before calling CreateGrid()") ); return FALSE; } @@ -3529,7 +3529,7 @@ bool wxGrid::InsertCols( int pos, int numCols, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( "Called wxGrid::InsertCols() before calling CreateGrid()" ); + wxLogError( wxT("Called wxGrid::InsertCols() before calling CreateGrid()") ); return FALSE; } @@ -3569,7 +3569,7 @@ bool wxGrid::AppendCols( int numCols, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( "Called wxGrid::AppendCols() before calling CreateGrid()" ); + wxLogError( wxT("Called wxGrid::AppendCols() before calling CreateGrid()") ); return FALSE; } @@ -3600,7 +3600,7 @@ bool wxGrid::DeleteCols( int pos, int numCols, bool WXUNUSED(updateLabels) ) if ( !m_created ) { - wxLogError( "Called wxGrid::DeleteCols() before calling CreateGrid()" ); + wxLogError( wxT("Called wxGrid::DeleteCols() before calling CreateGrid()") ); return FALSE; }