compilation fixes after c_str() changes (due to casting of its return value to non-const wxChar *)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@44880 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2007-03-17 22:52:29 +00:00
parent f705f97d31
commit 1693108cfe
8 changed files with 65 additions and 64 deletions

View File

@@ -1874,7 +1874,7 @@ static bool CheckTypeRef()
label.Trim(true); label.Trim(false); label.Trim(true); label.Trim(false);
wxString typeName = label; wxString typeName = label;
label.MakeLower(); label.MakeLower();
TexRef *texRef = FindReference((wxChar*)label.c_str()); TexRef *texRef = FindReference(label);
if (texRef && texRef->refFile && wxStrcmp(texRef->refFile, _T("??")) != 0) { if (texRef && texRef->refFile && wxStrcmp(texRef->refFile, _T("??")) != 0) {
int a = typeDecl.Find(typeName); int a = typeDecl.Find(typeName);
@@ -2150,7 +2150,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
{ {
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("Warning: unresolved reference '%s'"), refName); errBuf.Printf(_T("Warning: unresolved reference '%s'"), refName);
OnInform((wxChar *)errBuf.c_str()); OnInform(errBuf);
} }
} }
} }
@@ -2302,7 +2302,7 @@ bool HTMLOnArgument(int macroId, int arg_no, bool start)
if (f != _T("")) if (f != _T(""))
{ {
// The default HTML file to go to is THIS file (so a no-op) // The default HTML file to go to is THIS file (so a no-op)
SHGToMap((wxChar *)f.c_str(), currentFileName); SHGToMap(f, currentFileName);
} }
wxChar *mapName = GetArgData(); wxChar *mapName = GetArgData();

View File

@@ -107,7 +107,7 @@ int ParseSHG( const wxChar* fileName, HotSpot **hotspots)
// Convert Windows .SHG file to HTML map file // Convert Windows .SHG file to HTML map file
bool SHGToMap(wxChar *filename, wxChar *defaultFile) bool SHGToMap(const wxChar *filename, const wxChar *defaultFile)
{ {
// Test the SHG parser // Test the SHG parser
HotSpot *hotspots = NULL; HotSpot *hotspots = NULL;

View File

@@ -58,7 +58,7 @@ struct HotSpot
extern int ParseSHG( const wxChar* fileName, HotSpot **hotspots); extern int ParseSHG( const wxChar* fileName, HotSpot **hotspots);
// Converts Windows .SHG file to HTML map file // Converts Windows .SHG file to HTML map file
extern bool SHGToMap(wxChar *filename, wxChar *defaultFile); extern bool SHGToMap(const wxChar *filename, const wxChar *defaultFile);
#endif #endif

View File

@@ -3552,7 +3552,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
if(tok.HasMoreTokens()) if(tok.HasMoreTokens())
{ {
wxString token = tok.GetNextToken(); wxString token = tok.GetNextToken();
imageWidth = (int)(20*ParseUnitArgument((wxChar*)token.c_str())); imageWidth = (int)(20*ParseUnitArgument(token));
} }
else else
{ {
@@ -3563,7 +3563,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
if(tok.HasMoreTokens()) if(tok.HasMoreTokens())
{ {
wxString token = tok.GetNextToken(); wxString token = tok.GetNextToken();
imageHeight = (int)(20*ParseUnitArgument((wxChar*)token.c_str())); imageHeight = (int)(20*ParseUnitArgument(token));
} }
else else
{ {

View File

@@ -283,13 +283,13 @@ void ForbidWarning(TexMacroDef *def)
case FORBID_WARN: case FORBID_WARN:
{ {
informBuf.Printf(_T("Warning: it is recommended that command %s is not used."), def->name); informBuf.Printf(_T("Warning: it is recommended that command %s is not used."), def->name);
OnInform((const wxChar *)informBuf.c_str()); OnInform(informBuf);
break; break;
} }
case FORBID_ABSOLUTELY: case FORBID_ABSOLUTELY:
{ {
informBuf.Printf(_T("Error: command %s cannot be used and will lead to errors."), def->name); informBuf.Printf(_T("Error: command %s cannot be used and will lead to errors."), def->name);
OnInform((const wxChar *)informBuf.c_str()); OnInform(informBuf);
break; break;
} }
default: default:
@@ -449,7 +449,7 @@ bool read_a_line(wxChar *buf)
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."),
LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(), MAX_LINE_BUFFER_SIZE); LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(), MAX_LINE_BUFFER_SIZE);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
return false; return false;
} }
@@ -471,7 +471,7 @@ bool read_a_line(wxChar *buf)
{ {
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("An extra right Curly brace ('}') was detected at line %lu inside file %s"), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); errBuf.Printf(_T("An extra right Curly brace ('}') was detected at line %lu inside file %s"), LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str());
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
// Reduce the count of right Curly braces, so the mismatched count // Reduce the count of right Curly braces, so the mismatched count
// isn't reported on every line that has a '}' after the first mismatch // isn't reported on every line that has a '}' after the first mismatch
@@ -500,7 +500,7 @@ bool read_a_line(wxChar *buf)
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."),
LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
return false; return false;
} }
wxStrcat(buf, _T("\\par")); wxStrcat(buf, _T("\\par"));
@@ -515,7 +515,7 @@ bool read_a_line(wxChar *buf)
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."),
LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
return false; return false;
} }
@@ -540,7 +540,7 @@ bool read_a_line(wxChar *buf)
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."),
LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
return false; return false;
} }
buf[bufIndex++]='\\'; buf[bufIndex++]='\\';
@@ -563,7 +563,7 @@ bool read_a_line(wxChar *buf)
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."),
LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
return false; return false;
} }
buf[bufIndex++]='\\'; buf[bufIndex++]='\\';
@@ -578,7 +578,7 @@ bool read_a_line(wxChar *buf)
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."), errBuf.Printf(_T("Line %lu of file %s is too long. Lines can be no longer than %lu characters. Truncated."),
LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE); LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str(),MAX_LINE_BUFFER_SIZE);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
return false; return false;
} }
// If the current character read in is a '_', we need to check // If the current character read in is a '_', we need to check
@@ -599,7 +599,7 @@ bool read_a_line(wxChar *buf)
// wxString errBuf; // wxString errBuf;
// errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that should NOT have a '\\' before it."), // errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that should NOT have a '\\' before it."),
// LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); // LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str());
// OnError((wxChar *)errBuf.c_str()); // OnError(errBuf);
} }
} }
else else
@@ -610,7 +610,7 @@ bool read_a_line(wxChar *buf)
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that may need a '\\' before it."), errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that may need a '\\' before it."),
LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str());
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
} }
else if ((buf[bufIndex-1] != '\\') && (buf[0] != '%') && // If it is a comment line, then no warnings else if ((buf[bufIndex-1] != '\\') && (buf[0] != '%') && // If it is a comment line, then no warnings
(wxStrncmp(buf, _T("\\input"), 6))) // do not report filenames that have underscores in them (wxStrncmp(buf, _T("\\input"), 6))) // do not report filenames that have underscores in them
@@ -618,7 +618,7 @@ bool read_a_line(wxChar *buf)
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that may need a '\\' before it."), errBuf.Printf(_T("An underscore ('_') was detected at line %lu inside file %s that may need a '\\' before it."),
LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str()); LineNumbers[CurrentInputIndex], (const wxChar*) currentFileName.c_str());
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
} }
} }
} }
@@ -643,7 +643,7 @@ bool read_a_line(wxChar *buf)
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("Curly braces do not match inside file %s\n%lu opens, %lu closes"), errBuf.Printf(_T("Curly braces do not match inside file %s\n%lu opens, %lu closes"),
(const wxChar*) currentFileName.c_str(),leftCurly,rightCurly); (const wxChar*) currentFileName.c_str(),leftCurly,rightCurly);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
} }
leftCurly = 0; leftCurly = 0;
rightCurly = 0; rightCurly = 0;
@@ -694,13 +694,13 @@ bool read_a_line(wxChar *buf)
{ {
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("Could not find file: %s"),fileName); errBuf.Printf(_T("Could not find file: %s"),fileName);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
} }
else else
{ {
wxString informStr; wxString informStr;
informStr.Printf(_T("Processing: %s"),actualFile.c_str()); informStr.Printf(_T("Processing: %s"),actualFile.c_str());
OnInform((wxChar *)informStr.c_str()); OnInform(informStr);
CurrentInputIndex ++; CurrentInputIndex ++;
Inputs[CurrentInputIndex] = wxFopen(actualFile, _T("r")); Inputs[CurrentInputIndex] = wxFopen(actualFile, _T("r"));
@@ -758,7 +758,7 @@ bool read_a_line(wxChar *buf)
fileNameStr.Replace(_T("\\"), _T("")); fileNameStr.Replace(_T("\\"), _T(""));
// Ignore some types of input files (e.g. macro definition files) // Ignore some types of input files (e.g. macro definition files)
wxChar *fileOnly = wxFileNameFromPath((wxChar*) (const wxChar*) fileNameStr); wxString fileOnly = wxFileNameFromPath(fileNameStr);
currentFileName = fileOnly; currentFileName = fileOnly;
if (IgnorableInputFiles.Member(fileOnly)) if (IgnorableInputFiles.Member(fileOnly))
return read_a_line(buf); return read_a_line(buf);
@@ -776,7 +776,7 @@ bool read_a_line(wxChar *buf)
{ {
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("Could not find file: %s"),fileName); errBuf.Printf(_T("Could not find file: %s"),fileName);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
} }
else else
{ {
@@ -786,7 +786,7 @@ bool read_a_line(wxChar *buf)
wxString informStr; wxString informStr;
informStr.Printf(_T("Processing: %s"),actualFile.c_str()); informStr.Printf(_T("Processing: %s"),actualFile.c_str());
OnInform((wxChar *)informStr.c_str()); OnInform(informStr);
CurrentInputIndex ++; CurrentInputIndex ++;
Inputs[CurrentInputIndex] = wxFopen(actualFile, _T("r")); Inputs[CurrentInputIndex] = wxFopen(actualFile, _T("r"));
@@ -800,7 +800,7 @@ bool read_a_line(wxChar *buf)
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("Could not open include file %s"), (const wxChar*) actualFile); errBuf.Printf(_T("Could not open include file %s"), (const wxChar*) actualFile);
CurrentInputIndex --; CurrentInputIndex --;
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
} }
} }
bool succ = read_a_line(buf); bool succ = read_a_line(buf);
@@ -833,7 +833,7 @@ bool read_a_line(wxChar *buf)
LineNumbers[CurrentInputIndex], LineNumbers[CurrentInputIndex],
currentFileName.c_str()); currentFileName.c_str());
} }
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
} }
} }
} }
@@ -853,7 +853,7 @@ bool read_a_line(wxChar *buf)
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("Curly braces do not match inside file %s\n%lu opens, %lu closes"), errBuf.Printf(_T("Curly braces do not match inside file %s\n%lu opens, %lu closes"),
(const wxChar*) currentFileName.c_str(),leftCurly,rightCurly); (const wxChar*) currentFileName.c_str(),leftCurly,rightCurly);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
} }
} }
@@ -951,7 +951,7 @@ void MacroError(wxChar *buffer)
errBuf.Printf(_T("Could not find macro: %s at line %d, file %s"), errBuf.Printf(_T("Could not find macro: %s at line %d, file %s"),
macroBuf, (int)(LineNumbers[CurrentInputIndex]-1), FileNames[CurrentInputIndex]); macroBuf, (int)(LineNumbers[CurrentInputIndex]-1), FileNames[CurrentInputIndex]);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
if (wxStrcmp(macroBuf,_T("\\end{document}")) == 0) if (wxStrcmp(macroBuf,_T("\\end{document}")) == 0)
{ {
@@ -1634,7 +1634,7 @@ int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent,
tmpBuffer = tmpBuffer.Mid(0,tmpBuffer.length()-4); tmpBuffer = tmpBuffer.Mid(0,tmpBuffer.length()-4);
} }
errBuf.Printf(_T("Missing macro argument in the line:\n\t%s\n"),tmpBuffer.c_str()); errBuf.Printf(_T("Missing macro argument in the line:\n\t%s\n"),tmpBuffer.c_str());
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
} }
} }
@@ -3249,7 +3249,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
{ {
wxString informBuf; wxString informBuf;
informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName); informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName);
OnInform((wxChar *)informBuf.c_str()); OnInform(informBuf);
} }
} }
else TexOutput(_T("??"), true); else TexOutput(_T("??"), true);
@@ -3403,7 +3403,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
{ {
wxString informBuf; wxString informBuf;
informBuf.Printf(_T("Warning: unresolved citation %s."), citeKey); informBuf.Printf(_T("Warning: unresolved citation %s."), citeKey);
OnInform((wxChar *)informBuf.c_str()); OnInform(informBuf);
} }
} }
citeKey = ParseMultifieldString(citeKeys, &pos); citeKey = ParseMultifieldString(citeKeys, &pos);
@@ -3544,14 +3544,14 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
{ {
wxString errBuf; wxString errBuf;
errBuf.Printf(_T(".bib file %s not found or malformed"), (const wxChar*) actualFile); errBuf.Printf(_T(".bib file %s not found or malformed"), (const wxChar*) actualFile);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
} }
} }
else else
{ {
wxString errBuf; wxString errBuf;
errBuf.Printf(_T(".bib file %s not found"), fileBuf); errBuf.Printf(_T(".bib file %s not found"), fileBuf);
OnError((wxChar *)errBuf.c_str()); OnError(errBuf);
} }
bibFile = ParseMultifieldString(allFiles, &pos); bibFile = ParseMultifieldString(allFiles, &pos);
} }

View File

@@ -356,10 +356,10 @@ void DefaultOnMacro(int macroId, int no_args, bool start);
bool DefaultOnArgument(int macroId, int arg_no, bool start); bool DefaultOnArgument(int macroId, int arg_no, bool start);
// Called on error // Called on error
void OnError(const wxChar *msg); void OnError(const wxString& msg);
// Called for information // Called for information
void OnInform(const wxChar *msg); void OnInform(const wxString& msg);
// Special yield wrapper // Special yield wrapper
void Tex2RTFYield(bool force = false); void Tex2RTFYield(bool force = false);
@@ -377,7 +377,7 @@ void ForceTopicName(const wxChar *name);
void ResetTopicCounter(void); void ResetTopicCounter(void);
// Parse unit eg. 14, 12pt, 34cm and return value in points. // Parse unit eg. 14, 12pt, 34cm and return value in points.
int ParseUnitArgument(wxChar *unitArg); int ParseUnitArgument(const wxChar *unitArg);
// Set small, large, normal etc. point sizes for reference size // Set small, large, normal etc. point sizes for reference size
void SetFontSizes(int pointSize); void SetFontSizes(int pointSize);
@@ -483,11 +483,11 @@ class BibEntry: public wxObject
extern wxList BibList; extern wxList BibList;
extern wxStringList CitationList; extern wxStringList CitationList;
bool ReadBib(wxChar *filename); bool ReadBib(const wxChar *filename);
void OutputBib(void); void OutputBib(void);
void ResolveBibReferences(void); void ResolveBibReferences(void);
void AddCitation(wxChar *citeKey); void AddCitation(const wxChar *citeKey);
TexRef *FindReference(wxChar *key); TexRef *FindReference(const wxChar *key);
/* /*
* Ability to customize, or at least suppress unknown macro errors * Ability to customize, or at least suppress unknown macro errors

View File

@@ -290,7 +290,7 @@ bool MyApp::OnInit()
{ {
wxString buf; wxString buf;
buf.Printf(_T("Invalid switch %s.\n"), argv[i]); buf.Printf(_T("Invalid switch %s.\n"), argv[i]);
OnError((wxChar *)buf.c_str()); OnError(buf);
#ifdef NO_GUI #ifdef NO_GUI
ShowOptions(); ShowOptions();
exit(1); exit(1);
@@ -701,7 +701,7 @@ void MyFrame::OnGo(wxCommandEvent& WXUNUSED(event))
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
wxString errBuf; wxString errBuf;
errBuf.Printf(_T("\nErrors encountered during this pass: %lu\n"), errorCount); errBuf.Printf(_T("\nErrors encountered during this pass: %lu\n"), errorCount);
OnInform((wxChar *)errBuf.c_str()); OnInform(errBuf);
} }
@@ -898,7 +898,7 @@ void ChooseInputFile(bool force)
wxString str = wxFileNameFromPath(InputFile); wxString str = wxFileNameFromPath(InputFile);
wxString buf; wxString buf;
buf.Printf(_T("Tex2RTF [%s]"), str.c_str()); buf.Printf(_T("Tex2RTF [%s]"), str.c_str());
frame->SetTitle((wxChar *)buf.c_str()); frame->SetTitle(buf);
OutputFile = wxEmptyString; OutputFile = wxEmptyString;
} }
} }
@@ -1027,7 +1027,7 @@ bool Go(void)
{ {
wxString buf; wxString buf;
buf.Printf(_T("Working, pass %d...Click CLOSE to abort"), passNumber); buf.Printf(_T("Working, pass %d...Click CLOSE to abort"), passNumber);
frame->SetStatusText((wxChar *)buf.c_str()); frame->SetStatusText(buf);
} }
#endif #endif
OkToClose = false; OkToClose = false;
@@ -1077,28 +1077,28 @@ bool Go(void)
#ifndef NO_GUI #ifndef NO_GUI
wxLongLong elapsed = wxGetLocalTimeMillis() - localTime; wxLongLong elapsed = wxGetLocalTimeMillis() - localTime;
buf.Printf(_T("Finished PASS #%d in %ld seconds.\n"), passNumber, (long)(elapsed.GetLo()/1000.0)); buf.Printf(_T("Finished PASS #%d in %ld seconds.\n"), passNumber, (long)(elapsed.GetLo()/1000.0));
OnInform((wxChar *)buf.c_str()); OnInform(buf);
if (errorCount) if (errorCount)
{ {
buf.Printf(_T("Errors encountered during this pass: %lu\n"), errorCount); buf.Printf(_T("Errors encountered during this pass: %lu\n"), errorCount);
OnInform((wxChar *)buf.c_str()); OnInform(buf);
} }
#if wxUSE_STATUSBAR #if wxUSE_STATUSBAR
if (isInteractive) if (isInteractive)
{ {
buf.Printf(_T("Done, %d %s."), passNumber, (passNumber > 1) ? _T("passes") : _T("pass")); buf.Printf(_T("Done, %d %s."), passNumber, (passNumber > 1) ? _T("passes") : _T("pass"));
frame->SetStatusText((wxChar *)buf.c_str()); frame->SetStatusText(buf);
} }
#endif // wxUSE_STATUSBAR #endif // wxUSE_STATUSBAR
#else #else
buf.Printf(_T("Done, %d %s."), passNumber, (passNumber > 1) ? _T("passes") : _T("pass")); buf.Printf(_T("Done, %d %s."), passNumber, (passNumber > 1) ? _T("passes") : _T("pass"));
OnInform((wxChar *)buf.c_str()); OnInform(buf);
if (errorCount) if (errorCount)
{ {
buf.Printf(_T("Errors encountered during this pass: %lu\n"), errorCount); buf.Printf(_T("Errors encountered during this pass: %lu\n"), errorCount);
OnInform((wxChar *)buf.c_str()); OnInform(buf.c_str());
} }
#endif #endif
passNumber ++; passNumber ++;
@@ -1119,13 +1119,12 @@ bool Go(void)
return false; return false;
} }
void OnError(const wxChar *msg) void OnError(const wxString& msg)
{ {
wxString msg_string = msg;
errorCount++; errorCount++;
#ifdef NO_GUI #ifdef NO_GUI
wxSTD cerr << "Error: " << msg_string.mb_str() << "\n"; wxSTD cerr << "Error: " << msg.mb_str() << "\n";
wxSTD cerr.flush(); wxSTD cerr.flush();
#else #else
if (isInteractive && frame) if (isInteractive && frame)
@@ -1135,7 +1134,7 @@ void OnError(const wxChar *msg)
else else
{ {
#if defined(__UNIX__) #if defined(__UNIX__)
wxSTD cerr << "Error: " << msg_string.mb_str() << "\n"; wxSTD cerr << "Error: " << msg.mb_str() << "\n";
wxSTD cerr.flush(); wxSTD cerr.flush();
#elif defined(__WXMSW__) #elif defined(__WXMSW__)
wxLogError(msg); wxLogError(msg);
@@ -1146,11 +1145,10 @@ void OnError(const wxChar *msg)
#endif // NO_GUI #endif // NO_GUI
} }
void OnInform(const wxChar *msg) void OnInform(const wxString& msg)
{ {
wxString msg_string = msg;
#ifdef NO_GUI #ifdef NO_GUI
wxSTD cout << msg_string.mb_str() << "\n"; wxSTD cout << msg.mb_str() << "\n";
wxSTD cout.flush(); wxSTD cout.flush();
#else #else
if (isInteractive && frame) if (isInteractive && frame)
@@ -1160,7 +1158,7 @@ void OnInform(const wxChar *msg)
else else
{ {
#if defined(__UNIX__) #if defined(__UNIX__)
wxSTD cout << msg_string.mb_str() << "\n"; wxSTD cout << msg.mb_str() << "\n";
wxSTD cout.flush(); wxSTD cout.flush();
#elif defined(__WXMSW__) #elif defined(__WXMSW__)
wxLogInfo(msg); wxLogInfo(msg);

View File

@@ -207,7 +207,7 @@ wxChar *FindTopicName(TexChunk *chunk)
* *
*/ */
void StartSimulateArgument(wxChar *data) void StartSimulateArgument(const wxChar *data)
{ {
wxStrcpy(currentArgData, data); wxStrcpy(currentArgData, data);
haveArgData = true; haveArgData = true;
@@ -223,8 +223,11 @@ void EndSimulateArgument(void)
* *
*/ */
int ParseUnitArgument(wxChar *unitArg) int ParseUnitArgument(const wxChar *unitArg_)
{ {
wxWxCharBuffer unitBuf(unitArg_);
wxChar *unitArg = unitBuf.data();
float conversionFactor = 1.0; float conversionFactor = 1.0;
float unitValue = 0.0; float unitValue = 0.0;
int len = wxStrlen(unitArg); int len = wxStrlen(unitArg);
@@ -470,7 +473,7 @@ void BibEatWhiteSpace(wxString& line)
{ {
while(!line.empty() && (line[0] == _T(' ') || line[0] == _T('\t') || line[0] == (wxChar)EOF)) while(!line.empty() && (line[0] == _T(' ') || line[0] == _T('\t') || line[0] == (wxChar)EOF))
{ {
if (line[0] == 10) if (line[0] == '\r')
BibLine ++; BibLine ++;
line = line.substr(1); line = line.substr(1);
} }
@@ -560,7 +563,7 @@ wxString BibReadToEOL(wxString& line)
// If in quotes, read white space too. If not, // If in quotes, read white space too. If not,
// stop at white space or comment. // stop at white space or comment.
while (!line.empty() && line[0] != _T('"') && while (!line.empty() && line[0] != _T('"') &&
(inQuotes || ((line[0] != _T(' ')) && (line[0] != 9) && (inQuotes || ((line[0] != _T(' ')) && (line[0] != '\t') &&
(line[0] != _T(';')) && (line[0] != _T('%')) && (line[0] != _T('#'))))) (line[0] != _T(';')) && (line[0] != _T('%')) && (line[0] != _T('#')))))
{ {
val << line[0]; val << line[0];
@@ -704,7 +707,7 @@ void BibReadValue(wxSTD istream& istr, wxChar *buffer, bool ignoreBraces = true,
wxUnusedVar(stopping); wxUnusedVar(stopping);
} }
bool ReadBib(wxChar *filename) bool ReadBib(const wxChar *filename)
{ {
if (!wxFileExists(filename)) if (!wxFileExists(filename))
return false; return false;
@@ -1156,7 +1159,7 @@ void ResolveBibReferences(void)
} }
// Remember we need to resolve this citation // Remember we need to resolve this citation
void AddCitation(wxChar *citeKey) void AddCitation(const wxChar *citeKey)
{ {
if (!CitationList.Member(citeKey)) if (!CitationList.Member(citeKey))
CitationList.Add(citeKey); CitationList.Add(citeKey);
@@ -1167,7 +1170,7 @@ void AddCitation(wxChar *citeKey)
} }
} }
TexRef *FindReference(wxChar *key) TexRef *FindReference(const wxChar *key)
{ {
return (TexRef *)TexReferences.Get(key); return (TexRef *)TexReferences.Get(key);
} }