Warning fixes found under hardest mode of OpenWatcom. Seems clean in Borland, MinGW and DMC.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@29660 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-10-05 15:38:40 +00:00
parent 908686c52e
commit 254a21292b
49 changed files with 721 additions and 792 deletions

View File

@@ -22,7 +22,7 @@ void DecToHex(int dec, wxChar *buf)
buf[1] = hexArray[secondDigit];
buf[2] = 0;
}
static unsigned int getshort(FILE *fp)
{
int c, c1;
@@ -35,7 +35,7 @@ static unsigned long getint(FILE *fp)
int c, c1, c2, c3;
c = getc(fp); c1 = getc(fp); c2 = getc(fp); c3 = getc(fp);
return (long)((long) c) +
(((long) c1) << 8) +
(((long) c1) << 8) +
(((long) c2) << 16) +
(((long) c3) << 24);
}
@@ -44,20 +44,20 @@ bool GetBMPHeader(FILE *fp, int *Width, int *Height, int *Planes, int *BitsPerPi
{
// Remember about all fields but store only important ones
unsigned long /*
bfSize,
bfOffBits,
biSize,
*/
biWidth,
biHeight,
bfSize,
bfOffBits,
biSize,
*/
biWidth,
biHeight,
biPlanes,
biBitCount
/* ,
biCompression,
biSizeImage,
biXPelsPerMeter,
biYPelsPerMeter,
biClrUsed,
biSizeImage,
biXPelsPerMeter,
biYPelsPerMeter,
biClrUsed,
biClrImportant
*/
;
@@ -161,7 +161,7 @@ struct mfPLACEABLEHEADER {
bool GetMetafileHeader(FILE *handle, int *width, int *height)
{
char buffer[40];
mfPLACEABLEHEADER *theHeader = (mfPLACEABLEHEADER *)&buffer;
mfPLACEABLEHEADER *theHeader = (mfPLACEABLEHEADER *)&buffer[0];
fread((void *)theHeader, sizeof(char), sizeof(mfPLACEABLEHEADER), handle);
if (theHeader->key != 0x9AC6CDD7)
{
@@ -223,7 +223,7 @@ bool OutputMetafileData(FILE *handle)
int ch;
do
{
ch = getc(handle);
ch = getc(handle);
if (bytesSoFar == scanLineWidth)
{
bytesSoFar = 0;

View File

@@ -208,7 +208,7 @@ void ResetContentsLevels(int l)
int i;
for (i = l; i < 5; i++)
ContentsLevels[i] = false;
// There are always books on the top level
ContentsLevels[0] = true;
}
@@ -218,7 +218,7 @@ void ResetContentsLevels(int l)
void OutputSectionKeyword(FILE *fd)
{
OutputCurrentSectionToString(wxTex2RTFBuffer);
unsigned int i;
for (i = 0; i < wxStrlen(wxTex2RTFBuffer); i++)
if (wxTex2RTFBuffer[i] == ':')
@@ -229,7 +229,7 @@ void OutputSectionKeyword(FILE *fd)
wxFprintf(fd, _T("K{\\footnote {K} "));
wxFprintf(fd, _T("%s"), wxTex2RTFBuffer);
wxFprintf(fd, _T("}\n"));
}
@@ -242,12 +242,12 @@ void WriteWinHelpContentsFileLine(wxChar *topicName, wxChar *xitle, int level)
int d=0;
while ( (xitle[s]!=0)&&(d<255) )
{
wxChar ch=xitle[s]&0xff;
wxChar ch=wxChar(xitle[s]&0xff);
if (ch==0x5c) {
wxChar ch1=xitle[s+1]&0xff;
wxChar ch2=xitle[s+2]&0xff;
wxChar ch3=xitle[s+3]&0xff;
s+=4; // next character
wxChar ch1=wxChar(xitle[s+1]&0xff);
wxChar ch2=wxChar(xitle[s+2]&0xff);
wxChar ch3=wxChar(xitle[s+3]&0xff);
s+=4; // next character
if ((ch1==0x27)&&(ch2==0x66)&&(ch3==0x36)) { title[d++]=_T('<EFBFBD>'); }
if ((ch1==0x27)&&(ch2==0x65)&&(ch3==0x34)) { title[d++]=_T('<EFBFBD>'); }
if ((ch1==0x27)&&(ch2==0x66)&&(ch3==0x63)) { title[d++]=_T('<EFBFBD>'); }
@@ -257,7 +257,7 @@ void WriteWinHelpContentsFileLine(wxChar *topicName, wxChar *xitle, int level)
} else {
title[d++]=ch;
s++;
}
}
}
title[d]=0;
@@ -267,12 +267,9 @@ void WriteWinHelpContentsFileLine(wxChar *topicName, wxChar *xitle, int level)
if (level == 0) // Means we had a Chapter in an article, oops.
return;
ResetContentsLevels(level);
if (!title)
return;
if (winHelp && winHelpContents && WinHelpContentsFile)
{
TexTopic *texTopic = (TexTopic *)TopicTable.Get(topicName);
@@ -352,7 +349,7 @@ void GenerateKeywordsForTopic(wxChar *topic)
// Must separate out main entry form subentry (only 1 subentry allowed)
wxChar buf1[100]; wxChar buf2[100];
SplitIndexEntry(s, buf1, buf2);
// Check for ':' which messes up index
unsigned int i;
for (i = 0; i < wxStrlen(buf1) ; i++)
@@ -382,7 +379,7 @@ void GenerateKeywordsForTopic(wxChar *topic)
* Output index entry in linear RTF
*
*/
void GenerateIndexEntry(wxChar *entry)
{
if (useWord)
@@ -405,7 +402,7 @@ void GenerateIndexEntry(wxChar *entry)
* Write a suitable RTF header.
*
*/
void WriteColourTable(FILE *fd)
{
wxFprintf(fd, _T("{\\colortbl"));
@@ -474,7 +471,7 @@ void WriteRTFHeader(FILE *fd)
// Table of contents styles
wxFprintf(fd, _T("{\\s20\\sb300\\tqr\\tldot\\tx8640 \\b\\f2 \\sbasedon0\\snext0 toc 1;}\n"));
wxFprintf(fd, _T("{\\s21\\sb90\\tqr\\tldot\\li400\\tqr\\tx8640 \\f2\\fs20\\sbasedon0\\snext0 toc 2;}\n"));
wxFprintf(fd, _T("{\\s22\\sb90\\tqr\\tldot\\li800\\tx8640 \\f2\\fs20 \\sbasedon0\\snext0 toc 3;}\n"));
wxFprintf(fd, _T("{\\s23\\sb90\\tqr\\tldot\\li1200\\tx8640 \\f2\\fs20 \\sbasedon0\\snext0 toc 4;}\n"));
@@ -522,7 +519,7 @@ void OutputNumberStyle(wxChar *numberStyle)
/*
* Write a Windows help project file
*/
bool WriteHPJ(wxChar *filename)
{
wxChar hpjFilename[256];
@@ -537,7 +534,7 @@ bool WriteHPJ(wxChar *filename)
wxStrcpy(rtfFile, helpFile);
wxStrcat(helpFile, _T(".hlp"));
wxStrcat(rtfFile, _T(".rtf"));
FILE *fd = wxFopen(hpjFilename, _T("w"));
if (!fd)
return false;
@@ -545,7 +542,7 @@ bool WriteHPJ(wxChar *filename)
wxChar *helpTitle = winHelpTitle;
if (!helpTitle)
helpTitle = _T("Untitled");
wxString thePath = wxPathOnly(InputFile);
if (thePath.IsEmpty())
thePath = _T(".");
@@ -703,7 +700,7 @@ void ProcessText2RTF(TexChunk *chunk)
* and before TraverseDocument is called.
*
*/
void Text2RTF(TexChunk *chunk)
{
Tex2RTFYield();
@@ -758,7 +755,7 @@ void Text2RTF(TexChunk *chunk)
* Not used yet
*
*/
wxChar browseBuf[10];
static long browseId = 0;
wxChar *GetBrowseString(void)
@@ -879,7 +876,7 @@ void OutputRTFHeaderCommands(void)
{
int oldForbidResetPar = forbidResetPar;
forbidResetPar = 0;
if (LeftHeaderEven || CentreHeaderEven || RightHeaderEven)
{
TexOutput(_T("{\\headerl\\fi0 "));
@@ -1147,7 +1144,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
OutputRTFHeaderCommands();
OutputRTFFooterCommands();
}
// Need to reset the current numbering style, or RTF forgets it.
SetCurrentOutput(Chapters);
OutputNumberStyle(currentNumberStyle);
@@ -1168,14 +1165,14 @@ void RTFOnMacro(int macroId, int no_args, bool start)
else SetCurrentOutput(NULL); // No entry in table of contents
}
}
startedSections = true;
// Output heading to contents page
if (!InPopups())
{
OutputCurrentSection();
if (winHelp)
{
wxFprintf(Contents, _T("}{\\v %s}\\pard\\par\n"), topicName);
@@ -1187,12 +1184,12 @@ void RTFOnMacro(int macroId, int no_args, bool start)
// From here, just output to chapter
SetCurrentOutput(Chapters);
}
if (winHelp)
{
wxFprintf(Chapters, _T("}\n#{\\footnote %s}\n"), topicName);
wxFprintf(Chapters, _T("+{\\footnote %s}\n"), GetBrowseString());
OutputSectionKeyword(Chapters);
GenerateKeywordsForTopic(topicName);
@@ -1318,7 +1315,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
}
}
else SetCurrentOutput(NULL);
}
}
if (startedSections)
{
@@ -1349,7 +1346,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
else
wxFprintf(Contents, _T("}\\par\\par\\pard\n"));
}
SetCurrentOutput(winHelp ? Sections : Chapters);
if (winHelp)
@@ -1386,7 +1383,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
wxChar *keep = _T("");
if (winHelp && (macroId != ltGLOSS) && !InPopups())
keep = _T("\\keepn\\sa140\\sb140");
wxFprintf(winHelp ? Sections : Chapters, _T("\\pard{%s%s"),
keep, styleCommand);
@@ -1490,7 +1487,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
#if 0
else
wxFprintf(Chapters, _T("\\par\n"));
#endif
#endif
}
startedSections = true;
@@ -1585,7 +1582,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
}
}
OutputCurrentSection(); // Repeat section header
// Experimental JACS
TexOutput(_T("\\par\\pard}\n"));
// TexOutput(_T("\\par\\pard}\\par\n"));
@@ -1641,7 +1638,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
else
SetCurrentOutput(NULL); // Don't write it into the contents, or anywhere else
}
if (startedSections)
{
if (winHelp)
@@ -1650,7 +1647,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
#if 0
else
wxFprintf(Chapters, _T("\\par\n"));
#endif
#endif
}
startedSections = true;
@@ -1668,7 +1665,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
}
else if ((DocumentStyle == LATEX_ARTICLE) && (macroId != ltSUBSUBSECTIONSTAR))
wxFprintf(Contents, _T("\\par\\pard\n"));
SetCurrentOutput(winHelp ? Subsubsections : Chapters);
if (winHelp)
{
@@ -1708,7 +1705,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
WriteHeadingStyle((winHelp ? Subsubsections : Chapters),
(DocumentStyle == LATEX_ARTICLE ? 3 : 4));
wxFprintf(winHelp ? Subsubsections : Chapters, _T(" "));
if (!winHelp)
{
if ((macroId != ltSUBSUBSECTIONSTAR))
@@ -2003,7 +2000,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
if (TableData[i].leftBorder)
TexOutput(_T("\\clbrdrl\\brdrs\\brdrw15"));
wxSnprintf(buf, sizeof(buf), _T("\\cellx%d"), currentWidth);
TexOutput(buf);
}
@@ -2072,7 +2069,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
ItemizeStruc *struc = new ItemizeStruc(listType, indentSize2, indentSize1);
itemizeStack.Insert(struc);
wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\tx%d\\li%d\\sa200"), indentSize1, indentSize2, indentSize2);
PushEnvironmentStyle(buf);
}
@@ -2113,7 +2110,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
ItemizeStruc *struc = new ItemizeStruc(LATEX_TWOCOL, indentSize);
itemizeStack.Insert(struc);
// wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\ri%d"), indentSize, indentSize, TwoColWidthA+TwoColWidthB+oldIndent);
wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\sa200"), indentSize, indentSize);
PushEnvironmentStyle(buf);
@@ -2143,7 +2140,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
OnMacro(ltPAR, 0, true);
OnMacro(ltPAR, 0, false);
}
#endif
#endif
}
break;
}
@@ -2266,7 +2263,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
// WriteEnvironmentStyles();
}
#endif
#endif
// wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\fi-%d\\ri%d\n"), TwoColWidthA,
// TwoColWidthA, TwoColWidthA, TwoColWidthA+TwoColWidthB+oldIndent);
@@ -2299,7 +2296,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
else issuedNewParagraph = 0;
}
#endif
if (macroId == ltVERBATIM)
wxSnprintf(buf, sizeof(buf), _T("{\\f3\\s10\\fs20\\li720\\sa0 "));
else
@@ -2317,7 +2314,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
#if 0
TexOutput(_T("\\par\n"));
issuedNewParagraph = 1;
#endif
#endif
}
}
break;
@@ -2508,7 +2505,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
case ltRMFAMILY:
case ltRM:
{
/*
/*
if (start)
{
TexOutput(_T("{\\plain "));
@@ -2585,7 +2582,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
{
TexOutput(_T("\\par\\pard"));
issuedNewParagraph ++;
// Extra par if parskip is more than zero (usually looks best.)
// N.B. JACS 2004-02-21: shouldn't need this for linear RTF if
// we have a suitable set of styles.
@@ -2595,7 +2592,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
TexOutput(_T("\\par"));
issuedNewParagraph ++;
}
#endif
#endif
WriteEnvironmentStyles();
}
// 1 is a whole paragraph if ParSkip == 0,
@@ -2611,7 +2608,7 @@ void RTFOnMacro(int macroId, int no_args, bool start)
TexOutput(_T("\\par"));
issuedNewParagraph ++;
}
#endif
#endif
WriteEnvironmentStyles();
}
/*
@@ -3231,7 +3228,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
{
if (!suppressNameDecoration) TexOutput(_T("}"));
}
if (start && (arg_no == 3))
TexOutput(_T("("));
if (!start && (arg_no == 3))
@@ -3339,7 +3336,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
if (start)
{
wxChar *sec = NULL;
wxChar *refName = GetArgData();
if (winHelp || !useWord)
{
@@ -3547,10 +3544,10 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
{
if (arg_no == 3)
return false;
static int imageWidth = 0;
static int imageHeight = 0;
if (start && (arg_no == 1))
{
wxChar *imageDimensions = copystring(GetArgData());
@@ -3581,7 +3578,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
if (imageDimensions) // glt
delete [] imageDimensions;
return false;
}
}
else if (start && (arg_no == 2 ))
{
wxChar *filename = copystring(GetArgData());
@@ -3702,7 +3699,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
}
else
{
#endif
#endif
TexOutput(_T("[No BMP or WMF for image file "));
TexOutput(filename);
TexOutput(_T("]"));
@@ -4476,7 +4473,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
if (currentNumberStyle) delete[] currentNumberStyle;
currentNumberStyle = copystring(data);
OutputNumberStyle(currentNumberStyle);
TexOutput(_T("\n"));
}
return false;
@@ -4687,7 +4684,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
if (TableData[i].leftBorder)
TexOutput(_T("\\clbrdrl\\brdrs\\brdrw15"));
wxSnprintf(buf, sizeof(buf), _T("\\cellx%d"), currentWidth);
TexOutput(buf);
}
@@ -4753,7 +4750,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
ItemizeStruc *struc = new ItemizeStruc(LATEX_INDENT, indentSize);
itemizeStack.Insert(struc);
wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\sa200 "), indentSize, indentSize);
PushEnvironmentStyle(buf);
TexOutput(buf);
@@ -4796,7 +4793,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
ItemizeStruc *struc = new ItemizeStruc(LATEX_INDENT, indentSize);
itemizeStack.Insert(struc);
wxSnprintf(buf, sizeof(buf), _T("\\tx%d\\li%d\\lr%d\\sa200\\box%s "), indentSize, indentSize, indentSizeRight,
((macroId == ltCENTEREDBOX) ? _T("\\brdrs") : _T("\\brdrdb")));
PushEnvironmentStyle(buf);
@@ -4920,7 +4917,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
OutputRTFHeaderCommands();
OutputRTFFooterCommands();
}
// Need to reset the current numbering style, or RTF forgets it.
OutputNumberStyle(currentNumberStyle);
SetCurrentOutput(Contents);
@@ -4960,7 +4957,7 @@ bool RTFOnArgument(int macroId, int arg_no, bool start)
wxFileNameFromPath(FileRoot), "Contents");
}
}
SetCurrentOutput(Chapters);
wxChar *styleCommand = _T("");
if (!winHelp && useHeadingStyles)
@@ -5171,7 +5168,7 @@ bool RTFGo(void)
startedSections = false;
inVerbatim = false;
browseId = 0;
if (InputFile && OutputFile)
{
// Do some RTF-specific transformations on all the strings,
@@ -5218,7 +5215,7 @@ bool RTFGo(void)
wxFprintf(Chapters, _T("\\titlepg\n"));
wxFprintf(Contents, _T("\\par\\pard\\pgnrestart\\sect\\titlepg"));
}
// In WinHelp, Contents title takes font of title.
// In linear RTF, same as chapter headings.
wxFprintf(Contents, _T("{\\b\\fs%d %s}\\par\\par\\pard\n\n"),
@@ -5226,7 +5223,7 @@ bool RTFGo(void)
// By default, Swiss, 11 point.
wxFprintf(Chapters, _T("\\f2\\fs22\n"));
PushEnvironmentStyle(_T("\\f2\\fs22\\sa200"));
SetCurrentOutput(Chapters);
@@ -5248,7 +5245,7 @@ bool RTFGo(void)
fclose(Header);
PopEnvironmentStyle();
Tex2RTFYield(true);
if (winHelp)
{
@@ -5324,7 +5321,7 @@ bool RTFGo(void)
Tex2RTFYield(true);
wxRemoveFile(_T("tmp1.rtf"));
}
if (wxFileExists(ContentsName)) wxRemoveFile(ContentsName);
if (!wxRenameFile(TmpContentsName, ContentsName))
@@ -5335,7 +5332,7 @@ bool RTFGo(void)
wxRemoveFile(_T("chapters.rtf"));
wxRemoveFile(_T("header.rtf"));
if (winHelp)
{
wxRemoveFile(_T("sections.rtf"));

View File

@@ -38,7 +38,7 @@ static inline wxChar* copystring(const wxChar* s)
* Variables accessible from clients
*
*/
TexChunk * DocumentTitle = NULL;
TexChunk * DocumentAuthor = NULL;
TexChunk * DocumentDate = NULL;
@@ -181,7 +181,7 @@ wxChar *UpNameString = copystring(_T("Up"));
* Section numbering
*
*/
int chapterNo = 0;
int sectionNo = 0;
int subsectionNo = 0;
@@ -193,7 +193,7 @@ int tableNo = 0;
* Other variables
*
*/
FILE *CurrentOutput1 = NULL;
FILE *CurrentOutput2 = NULL;
FILE *Inputs[15];
@@ -302,7 +302,7 @@ void ForbidWarning(TexMacroDef *def)
break;
}
}
TexMacroDef *MatchMacro(wxChar *buffer, int *pos, wxChar **env, bool *parseToBrace)
{
*parseToBrace = true;
@@ -359,11 +359,11 @@ TexMacroDef *MatchMacro(wxChar *buffer, int *pos, wxChar **env, bool *parseToBra
macroBuf[j-i] = 0;
def = (TexMacroDef *)MacroDefs.Get(macroBuf);
}
if (def)
{
i = j;
// We want to check whether this is a space-consuming macro
// (e.g. {\bf word})
// No brace, e.g. \input thing.tex instead of \input{thing};
@@ -492,7 +492,7 @@ bool read_a_line(wxChar *buf)
if ((ch1 == 10) || (ch1 == 13))
{
// Eliminate newline (10) following DOS linefeed
if (ch1 == 13)
if (ch1 == 13)
getc(Inputs[CurrentInputIndex]);
buf[bufIndex] = 0;
IncrementLineNumber();
@@ -522,7 +522,7 @@ bool read_a_line(wxChar *buf)
return false;
}
buf[bufIndex] = ch;
buf[bufIndex] = (wxChar)ch;
bufIndex ++;
}
}
@@ -537,7 +537,7 @@ bool read_a_line(wxChar *buf)
case 0xfc: // <20>
case 0xd6: // <20>
case 0xc4: // <20>
case 0xdc: // <20>
case 0xdc: // <20>
if (bufIndex+5 >= MAX_LINE_BUFFER_SIZE)
{
wxString errBuf;
@@ -556,11 +556,11 @@ bool read_a_line(wxChar *buf)
case 0xfc:buf[bufIndex++]='u';break; // <20>
case 0xd6:buf[bufIndex++]='O';break; // <20>
case 0xc4:buf[bufIndex++]='A';break; // <20>
case 0xdc:buf[bufIndex++]='U';break; // <20>
}
case 0xdc:buf[bufIndex++]='U';break; // <20>
}
buf[bufIndex++]='}';
break;
case 0xdf: // <20>
case 0xdf: // <20>
if (bufIndex+5 >= MAX_LINE_BUFFER_SIZE)
{
wxString errBuf;
@@ -574,7 +574,7 @@ bool read_a_line(wxChar *buf)
buf[bufIndex++]='s';
buf[bufIndex++]='\\';
buf[bufIndex++]='/';
break;
break;
default:
if (bufIndex >= MAX_LINE_BUFFER_SIZE)
{
@@ -584,11 +584,11 @@ bool read_a_line(wxChar *buf)
OnError((wxChar *)errBuf.c_str());
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
// whether there should be a '\' before it or not
if (ch != '_')
{
buf[bufIndex++] = ch;
buf[bufIndex++] = (wxChar)ch;
break;
}
@@ -625,7 +625,7 @@ bool read_a_line(wxChar *buf)
}
}
}
buf[bufIndex++] = ch;
buf[bufIndex++] = (wxChar)ch;
break;
} // switch
} // else
@@ -635,7 +635,7 @@ bool read_a_line(wxChar *buf)
buf[bufIndex] = 0;
fclose(Inputs[CurrentInputIndex]);
Inputs[CurrentInputIndex] = NULL;
if (CurrentInputIndex > 0)
if (CurrentInputIndex > 0)
ch = ' '; // No real end of file
CurrentInputIndex --;
@@ -687,7 +687,7 @@ bool read_a_line(wxChar *buf)
j -= 5;
buf[j] = 0;
}
if (buf[j-1] == '}')
buf[j-1] = 0; // Ignore final brace
@@ -753,7 +753,7 @@ bool read_a_line(wxChar *buf)
buf[j] = 0;
}
if (buf[j-1] == _T('}'))
if (buf[j-1] == _T('}'))
buf[j-1] = 0; // Ignore final brace
// Remove backslashes from name
@@ -975,7 +975,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
{
Tex2RTFYield();
if (stopRunning) return pos;
bool eof = false;
BigBuffer[0] = 0;
int buf_ptr = 0;
@@ -1005,7 +1005,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
}
}
*/
// If not parsing to brace, just read the next word
// (e.g. \vskip 20pt)
if (!parseToBrace)
@@ -1014,7 +1014,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
while (!eof && ch != 13 && ch != 32 && ch != 10 &&
ch != 0 && ch != '{')
{
BigBuffer[buf_ptr] = ch;
BigBuffer[buf_ptr] = (wxChar)ch;
buf_ptr ++;
pos ++;
ch = buffer[pos];
@@ -1124,7 +1124,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
children.Append((wxObject *)chunk);
}
pos ++;
// Try matching \end{environment}
if (environment && FindEndEnvironment(buffer, &pos, environment))
{
@@ -1190,7 +1190,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
}
else
{
wxTex2RTFBuffer[i] = ch;
wxTex2RTFBuffer[i] = (wxChar)ch;
pos ++;
i ++;
if (ch == 0)
@@ -1221,7 +1221,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
if (buffer[pos] == '*')
pos ++;
// Find the delimiter character
// Find the delimiter character
int ch = buffer[pos];
pos ++;
// Now at start of verbatim text
@@ -1297,7 +1297,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
wxStrcat(macroBuf, _T("}"));
ParseArg(thisArg, children, macroBuf, 0, NULL, true, chunk);
}
// delete chunk; // Might delete children
}
}
@@ -1353,7 +1353,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
wxStrcat(macroBuf, _T("}"));
ParseArg(thisArg, children, macroBuf, 0, NULL, true, chunk);
}
// delete chunk; // Might delete children
}
}
@@ -1557,7 +1557,7 @@ int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxCha
* Consume as many arguments as the macro definition specifies
*
*/
int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent,
int no_args, wxChar *buffer, int pos,
wxChar *environment, bool parseToBrace,
@@ -1674,11 +1674,11 @@ bool TexLoadFile(wxChar *filename)
TexPathList.EnsureFileAccessible(filename);
if (line_buffer)
if (line_buffer)
delete line_buffer;
line_buffer = new wxChar[MAX_LINE_BUFFER_SIZE];
Inputs[0] = wxFopen(filename, _T("r"));
LineNumbers[0] = 1;
FileNames[0] = copystring(filename);
@@ -1725,7 +1725,7 @@ TexChunk::TexChunk(TexChunk& toCopy)
no_args = toCopy.no_args;
argn = toCopy.argn;
macroId = toCopy.macroId;
// if (toCopy.name)
// name = copystring(toCopy.name);
// else
@@ -1736,7 +1736,7 @@ TexChunk::TexChunk(TexChunk& toCopy)
value = copystring(toCopy.value);
else
value = NULL;
optional = toCopy.optional;
wxNode *node = toCopy.children.GetFirst();
while (node)
@@ -1776,7 +1776,7 @@ int GetNoArgs(void) // Number of args for this macro
* only!)
*
*/
void GetArgData1(TexChunk *chunk)
{
switch (chunk->type)
@@ -2066,7 +2066,7 @@ void TexCleanUp(void)
refNode = TexReferences.Next();
}
TexReferences.Clear();
wxNode* bibNode = BibList.GetFirst();
while (bibNode)
{
@@ -2506,7 +2506,7 @@ void DefineDefaultMacros(void)
AddMacroDef(ltUPSHAPE, _T("upshape"), 1);
AddMacroDef(ltURLREF, _T("urlref"), 2);
AddMacroDef(ltUSEPACKAGE, _T("usepackage"), 1);
AddMacroDef(ltVAREPSILON, _T("varepsilon"), 0);
AddMacroDef(ltVARPHI, _T("varphi"), 0);
AddMacroDef(ltVARPI, _T("varpi"), 0);
@@ -2570,7 +2570,7 @@ void DefineDefaultMacros(void)
* Default behaviour, should be called by client if can't match locally.
*
*/
// Called on start/end of macro examination
void DefaultOnMacro(int macroId, int no_args, bool start)
{
@@ -2691,7 +2691,7 @@ void DefaultOnMacro(int macroId, int no_args, bool start)
TexOutput(_T("(r)"), true);
break;
case ltBACKSLASH:
if (start)
if (start)
TexOutput(_T("\\"), true);
break;
case ltLDOTS:
@@ -3174,7 +3174,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
else
{
wxString informBuf;
informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName);
informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName);
OnInform((wxChar *)informBuf.c_str());
}
}
@@ -3222,7 +3222,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
DocumentStyle = LATEX_LETTER;
else if (wxStrncmp(DocumentStyleString, _T("slides"), 6) == 0)
DocumentStyle = LATEX_SLIDES;
if (StringMatch(_T("10"), DocumentStyleString))
SetFontSizes(10);
else if (StringMatch(_T("11"), DocumentStyleString))
@@ -3436,12 +3436,12 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
if (fd)
{
ch = getc(fd);
smallBuf[0] = ch;
smallBuf[0] = (wxChar)ch;
while (ch != EOF)
{
TexOutput(smallBuf);
ch = getc(fd);
smallBuf[0] = ch;
smallBuf[0] = (wxChar)ch;
}
fclose(fd);
}
@@ -3515,7 +3515,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
wxChar *s1 = copystring(s);
int i;
for (i = 0; i < (int)wxStrlen(s); i++)
s1[i] = wxToupper(s[i]);
s1[i] = (wxChar)wxToupper(s[i]);
TexOutput(s1);
delete[] s1;
return false;
@@ -3535,7 +3535,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
wxChar *s1 = copystring(s);
int i;
for (i = 0; i < (int)wxStrlen(s); i++)
s1[i] = wxTolower(s[i]);
s1[i] = (wxChar)wxTolower(s[i]);
TexOutput(s1);
delete[] s1;
return false;
@@ -3555,7 +3555,7 @@ bool DefaultOnArgument(int macroId, int arg_no, bool start)
wxChar *s1 = copystring(s);
int i;
for (i = 0; i < (int)wxStrlen(s); i++)
s1[i] = wxToupper(s[i]);
s1[i] = (wxChar)wxToupper(s[i]);
TexOutput(s1);
delete[] s1;
return false;

View File

@@ -430,7 +430,7 @@ bool MyApp::OnInit()
ReadCustomMacros((wxChar*)path.c_str());
Go();
if (runTwice)
if (runTwice)
{
Go();
}
@@ -1118,7 +1118,7 @@ void OnInform(const wxChar *msg)
/* This whole block of code is just wrong I think. It would behave
completely wrong under anything other than MSW due to the ELSE
with no statement, and the cout calls would fail under MSW, as
the code in this block is compiled if !NO_GUI This code has been
the code in this block is compiled if !NO_GUI This code has been
here since v1.1 of this file too. - gt
else
#ifdef __WXMSW__
@@ -1213,10 +1213,6 @@ Tex2RTFConnection::Tex2RTFConnection(wxChar *buf, int size):wxDDEConnection(buf,
{
}
Tex2RTFConnection::~Tex2RTFConnection(void)
{
}
bool SplitCommand(wxChar *data, wxChar *firstArg, wxChar *secondArg)
{
firstArg[0] = 0;

View File

@@ -22,7 +22,7 @@
#endif
// Define a new application type
class MyApp: public
class MyApp: public
#ifndef NO_GUI
wxApp
#else
@@ -74,7 +74,7 @@ class Tex2RTFConnection: public wxDDEConnection
{
public:
Tex2RTFConnection(wxChar *buf, int size);
~Tex2RTFConnection(void);
~Tex2RTFConnection(void){};
bool OnExecute(const wxString& topic, wxChar *data, int size, wxIPCFormat format);
wxChar *OnRequest(const wxString& topic, const wxString& item, int *size, wxIPCFormat format);
};

View File

@@ -88,20 +88,20 @@ void OutputChunkToString(TexChunk *chunk, wxChar *buf)
FILE *tempfd = wxFopen(_T("tmp.tmp"), _T("w"));
if (!tempfd)
return;
FILE *old1 = CurrentOutput1;
FILE *old2 = CurrentOutput2;
CurrentOutput1 = tempfd;
CurrentOutput2 = NULL;
TraverseChildrenFromChunk(chunk);
CurrentOutput1 = old1;
CurrentOutput2 = old2;
fclose(tempfd);
// Read from file into string
tempfd = wxFopen(_T("tmp.tmp"), _T("r"));
if (!tempfd)
@@ -177,7 +177,7 @@ wxChar *FindTopicName(TexChunk *chunk)
{
if (forceTopicName)
return forceTopicName;
wxChar *topicName = NULL;
static wxChar topicBuf[100];
@@ -216,7 +216,7 @@ wxChar *FindTopicName(TexChunk *chunk)
* Snag is that some save a TexChunk, so don't use yet...
*
*/
void StartSimulateArgument(wxChar *data)
{
wxStrcpy(currentArgData, data);
@@ -243,13 +243,13 @@ int ParseUnitArgument(wxChar *unitArg)
if (unitArg[i] == '\\')
unitArg[i] = 0;
len = wxStrlen(unitArg);
if (unitArg && (len > 0) && (isdigit(unitArg[0]) || unitArg[0] == '-'))
{
wxSscanf(unitArg, _T("%f"), &unitValue);
if (len > 1)
{
wxChar units[3];
wxChar units[3];
units[0] = unitArg[len-2];
units[1] = unitArg[len-1];
units[2] = 0;
@@ -272,7 +272,7 @@ int ParseUnitArgument(wxChar *unitArg)
* IF one exists. Inserts zero into buffer.
*
*/
void StripExtension(wxChar *buffer)
{
int len = wxStrlen(buffer);
@@ -339,18 +339,18 @@ void SetFontSizes(int pointSize)
}
}
/*
* Latex references
*
*/
void AddTexRef(wxChar *name, wxChar *file, wxChar *sectionName,
int chapter, int section, int subsection, int subsubsection)
{
TexRef *texRef = (TexRef *)TexReferences.Get(name);
if (texRef) TexReferences.Delete(name);
wxChar buf[100];
buf[0] = 0;
/*
@@ -399,7 +399,7 @@ void WriteTexReferences(wxChar *filename)
wxString name = filename;
wxSTD ofstream ostr((char const *)name.fn_str());
if (ostr.bad()) return;
TexReferences.BeginFind();
wxHashTable::Node *node = TexReferences.Next();
while (node)
@@ -467,17 +467,17 @@ void ReadTexReferences(wxChar *filename)
wxString sectionName_string = wxString::FromAscii(sectionName);
wxString section_string = wxString::FromAscii(section);
// gt - needed to trick the hash table "TexReferences" into deleting the key
// gt - needed to trick the hash table "TexReferences" into deleting the key
// strings it creates in the Put() function, but not the item that is
// created here, as that is destroyed elsewhere. Without doing this, there
// were massive memory leaks
TexReferences.DeleteContents(true);
TexReferences.Put(
label_string.c_str(),
label_string.c_str(),
new TexRef(
label_string.c_str(),
file_string.c_str(),
section_string.c_str(),
label_string.c_str(),
file_string.c_str(),
section_string.c_str(),
sectionName_string.c_str()
)
);
@@ -495,13 +495,13 @@ void ReadTexReferences(wxChar *filename)
void BibEatWhiteSpace(wxSTD istream& str)
{
char ch = (char)str.peek();
while (!str.eof() && (ch == ' ' || ch == '\t' || ch == 13 || ch == 10 || ch == EOF))
while (!str.eof() && (ch == ' ' || ch == '\t' || ch == 13 || ch == 10 || ch == (char)EOF))
{
if (ch == 10)
BibLine ++;
str.get(ch);
if ((ch == EOF) || str.eof()) return;
if ((ch == (char)EOF) || str.eof()) return;
ch = (char)str.peek();
}
@@ -585,7 +585,7 @@ void BibReadValue(wxSTD istream& istr, wxChar *buffer, bool ignoreBraces = true,
return;
}
istr.get(ch);
if (ch == '{')
braceCount ++;
@@ -617,7 +617,7 @@ void BibReadValue(wxSTD istream& istr, wxChar *buffer, bool ignoreBraces = true,
buffer[i] = 0;
wxUnusedVar(stopping);
}
bool ReadBib(wxChar *filename)
{
if (!wxFileExists(filename))
@@ -1377,7 +1377,7 @@ bool ReadCustomMacros(wxChar *filename)
istr.get(ch);
if (istr.eof())
break;
if (ch != '\\') // Not a macro definition, so must be NAME=VALUE
{
wxChar settingName[100];
@@ -1426,7 +1426,7 @@ bool ReadCustomMacros(wxChar *filename)
BibReadValue(istr, macroBody, false, false); // Don't ignore extra braces
if (wxStrlen(macroBody) > 0)
macro->macroBody = copystring(macroBody);
BibEatWhiteSpace(istr);
CustomMacroList.Append(macroName, macro);
AddMacroDef(ltCUSTOM_MACRO, macroName, noArgs);
@@ -1437,7 +1437,7 @@ bool ReadCustomMacros(wxChar *filename)
OnInform(mbuf);
return true;
}
CustomMacro *FindCustomMacro(wxChar *name)
{
wxNode *node = CustomMacroList.Find(name);
@@ -1458,7 +1458,7 @@ void ShowCustomMacros(void)
OnInform(_T("No custom macros loaded.\n"));
return;
}
wxChar buf[400];
while (node)
{
@@ -1506,7 +1506,7 @@ wxChar *ParseMultifieldString(wxChar *allFields, int *pos)
buffer[i] = 0;
if (oldPos == (*pos))
*pos = len + 1;
if (i == 0)
return NULL;
else
@@ -1517,7 +1517,7 @@ wxChar *ParseMultifieldString(wxChar *allFields, int *pos)
* Colour tables
*
*/
ColourTableEntry::ColourTableEntry(const wxChar *theName, unsigned int r, unsigned int g, unsigned int b)
{
name = copystring(theName);
@@ -1575,7 +1575,7 @@ bool FindColourHTMLString(wxChar *theName, wxChar *buf)
if (wxStrcmp(theName, entry->name) == 0)
{
wxStrcpy(buf, _T("#"));
wxChar buf2[3];
DecToHex(entry->red, buf2);
wxStrcat(buf, buf2);
@@ -1591,7 +1591,7 @@ bool FindColourHTMLString(wxChar *theName, wxChar *buf)
return false;
}
void InitialiseColourTable(void)
{
// \\red0\\green0\\blue0;
@@ -1602,16 +1602,16 @@ void InitialiseColourTable(void)
// \\red0\\green255\\blue0;
AddColour(_T("green"), 0,255,0);
// \\red255\\green0\\blue255;
AddColour(_T("magenta"), 255,0,255);
// \\red255\\green0\\blue0;
AddColour(_T("red"), 255,0,0);
// \\red255\\green255\\blue0;
AddColour(_T("yellow"), 255,255,0);
// \\red255\\green255\\blue255;}");
AddColour(_T("white"), 255,255,255);
}
@@ -1625,10 +1625,10 @@ void Tex2RTFYield(bool force)
{
#ifdef __WXMSW__
static int yieldCount = 0;
if (isSync)
return;
if (force)
yieldCount = 0;
if (yieldCount == 0)
@@ -1655,7 +1655,7 @@ void AddKeyWordForTopic(wxChar *topic, wxChar *entry, wxChar *filename)
texTopic->keywords = new wxStringList;
TopicTable.Put(topic, texTopic);
}
if (!texTopic->keywords->Member(entry))
texTopic->keywords->Add(entry);
}
@@ -1677,7 +1677,7 @@ void ClearKeyWordTable(void)
/*
* TexTopic structure
*/
TexTopic::TexTopic(wxChar *f)
{
if (f)
@@ -1704,17 +1704,17 @@ wxChar *ConvertCase(wxChar *s)
int i;
if (upperCaseNames)
for (i = 0; i < len; i ++)
buf[i] = wxToupper(s[i]);
buf[i] = (wxChar)wxToupper(s[i]);
else
for (i = 0; i < len; i ++)
buf[i] = wxTolower(s[i]);
buf[i] = (wxChar)wxTolower(s[i]);
buf[i] = 0;
return buf;
return buf;
}
#if !WXWIN_COMPATIBILITY_2
// if substring is true, search for str1 in str2
bool StringMatch(const wxChar *str1, const wxChar *str2, bool subString,
bool StringMatch(const wxChar *str1, const wxChar *str2, bool subString,
bool exact)
{
if (subString)
@@ -1729,7 +1729,7 @@ bool StringMatch(const wxChar *str1, const wxChar *str2, bool subString,
return Sstr2.Index(Sstr1) != (size_t)wxNOT_FOUND;
}
else
return exact ? wxString(str2).Cmp(str1) == 0 :
return exact ? wxString(str2).Cmp(str1) == 0 :
wxString(str2).CmpNoCase(str1) == 0;
}
#endif