|
From: <pst...@us...> - 2010-05-09 22:57:25
|
Revision: 777
http://jazzplusplus.svn.sourceforge.net/jazzplusplus/?rev=777&view=rev
Author: pstieber
Date: 2010-05-09 22:57:18 +0000 (Sun, 09 May 2010)
Log Message:
-----------
Fixed size_t vs. int warnings in 64-bit VC9 builds.
Modified Paths:
--------------
tex2rtf/src/htmlutil.cpp
tex2rtf/src/rtfutils.cpp
tex2rtf/src/table.cpp
tex2rtf/src/tex2any.cpp
tex2rtf/src/tex2any.h
tex2rtf/src/texutils.cpp
tex2rtf/src/xlputils.cpp
Modified: tex2rtf/src/htmlutil.cpp
===================================================================
--- tex2rtf/src/htmlutil.cpp 2010-04-28 23:36:06 UTC (rev 776)
+++ tex2rtf/src/htmlutil.cpp 2010-05-09 22:57:18 UTC (rev 777)
@@ -259,10 +259,10 @@
void ProcessText2HTML(TexChunk *chunk)
{
bool changed = false;
- int ptr = 0;
- int i = 0;
+ size_t ptr = 0;
+ size_t i = 0;
wxChar ch = 1;
- int len = wxStrlen(chunk->value);
+ size_t len = wxStrlen(chunk->value);
while (ch != 0)
{
ch = chunk->value[i];
Modified: tex2rtf/src/rtfutils.cpp
===================================================================
--- tex2rtf/src/rtfutils.cpp 2010-04-28 23:36:06 UTC (rev 776)
+++ tex2rtf/src/rtfutils.cpp 2010-05-09 22:57:18 UTC (rev 777)
@@ -312,15 +312,24 @@
void SplitIndexEntry(const wxChar *entry, wxChar *buf1, wxChar *buf2)
{
- int len = wxStrlen(entry); int i = 0;
+ size_t len = wxStrlen(entry);
+ size_t i = 0;
while ((i < len) && entry[i] != '!')
- { buf1[i] = entry[i]; i ++; }
+ {
+ buf1[i] = entry[i];
+ ++i;
+ }
buf1[i] = 0; buf2[0] = 0; int j = 0;
if (entry[i] == '!')
{
- i ++;
- while (i < len) { buf2[j] = entry[i]; i ++; j++; }
+ ++i;
+ while (i < len)
+ {
+ buf2[j] = entry[i];
+ ++i;
+ ++j;
+ }
buf2[j] = 0;
}
}
@@ -590,10 +599,10 @@
void ProcessText2RTF(TexChunk *chunk)
{
bool changed = false;
- int ptr = 0;
- int i = 0;
+ size_t ptr = 0;
+ size_t i = 0;
wxChar ch = 1;
- int len = wxStrlen(chunk->value);
+ size_t len = wxStrlen(chunk->value);
while (ch != 0)
{
ch = chunk->value[i];
@@ -761,11 +770,11 @@
wxChar *GetBrowseString(void)
{
wxChar buf[10];
- browseId ++;
+ ++browseId;
wxSnprintf(buf, sizeof(buf), _T("%ld"), browseId);
- int noZeroes = 5-wxStrlen(buf);
+ size_t noZeroes = 5 - wxStrlen(buf);
wxStrcpy(browseBuf, _T("browse"));
- for (int i = 0; i < noZeroes; i++)
+ for (size_t i = 0; i < noZeroes; i++)
wxStrcat(browseBuf, _T("0"));
wxStrcat(browseBuf, buf);
return browseBuf;
Modified: tex2rtf/src/table.cpp
===================================================================
--- tex2rtf/src/table.cpp 2010-04-28 23:36:06 UTC (rev 776)
+++ tex2rtf/src/table.cpp 2010-05-09 22:57:18 UTC (rev 777)
@@ -57,8 +57,8 @@
bool ParseTableArgument(wxChar *value)
{
noColumns = 0;
- int i = 0;
- int len = wxStrlen(value);
+ size_t i = 0;
+ size_t len = wxStrlen(value);
bool isBorder = false;
while (i < len)
{
Modified: tex2rtf/src/tex2any.cpp
===================================================================
--- tex2rtf/src/tex2any.cpp 2010-04-28 23:36:06 UTC (rev 776)
+++ tex2rtf/src/tex2any.cpp 2010-05-09 22:57:18 UTC (rev 777)
@@ -250,11 +250,11 @@
void TexOutput(const wxChar *s, bool ordinaryText)
{
- int len = wxStrlen(s);
+ size_t len = wxStrlen(s);
// Update current column, but only if we're guaranteed to
// be ordinary text (not mark-up stuff)
- int i;
+ size_t i;
if (ordinaryText)
for (i = 0; i < len; i++)
{
@@ -299,98 +299,106 @@
}
}
-TexMacroDef *MatchMacro(wxChar *buffer, int *pos, wxChar **env, bool *parseToBrace)
+TexMacroDef *MatchMacro(
+ wxChar *buffer,
+ size_t *pos,
+ wxChar **env,
+ bool *parseToBrace)
{
- *parseToBrace = true;
- int i = (*pos);
- TexMacroDef *def = NULL;
- wxChar macroBuf[40];
+ *parseToBrace = true;
+ size_t i = *pos;
+ TexMacroDef *def = NULL;
+ wxChar macroBuf[40];
- // First, try to find begin{thing}
- if (wxStrncmp(buffer+i, _T("begin{"), 6) == 0)
+ // First, try to find begin{thing}
+ if (wxStrncmp(buffer+i, _T("begin{"), 6) == 0)
+ {
+ i += 6;
+
+ size_t j = i;
+ while ((isalpha(buffer[j]) || buffer[j] == '*') && ((j - i) < 39))
{
- i += 6;
+ macroBuf[j-i] = buffer[j];
+ ++j;
+ }
+ macroBuf[j-i] = 0;
+ def = (TexMacroDef *)MacroDefs.Get(macroBuf);
- int j = i;
- while ((isalpha(buffer[j]) || buffer[j] == '*') && ((j - i) < 39))
- {
- macroBuf[j-i] = buffer[j];
- j ++;
- }
- macroBuf[j-i] = 0;
- def = (TexMacroDef *)MacroDefs.Get(macroBuf);
-
- if (def)
- {
- *pos = j + 1; // BUGBUG Should this be + 1???
- *env = def->name;
- ForbidWarning(def);
- return def;
- }
- else
- {
- return NULL;
- }
+ if (def)
+ {
+ *pos = j + 1; // BUGBUG Should this be + 1???
+ *env = def->name;
+ ForbidWarning(def);
+ return def;
}
+ else
+ {
+ return NULL;
+ }
+ }
- // Failed, so try to find macro from definition list
- int j = i;
+ // Failed, so try to find macro from definition list
+ size_t j = i;
- // First try getting a one-character macro, but ONLY
- // if these TWO characters are not both alphabetical (could
- // be a longer macro)
- if (!(isalpha(buffer[i]) && isalpha(buffer[i+1])))
- {
- macroBuf[0] = buffer[i];
- macroBuf[1] = 0;
+ // First try getting a one-character macro, but ONLY
+ // if these TWO characters are not both alphabetical (could
+ // be a longer macro)
+ if (!(isalpha(buffer[i]) && isalpha(buffer[i+1])))
+ {
+ macroBuf[0] = buffer[i];
+ macroBuf[1] = 0;
- def = (TexMacroDef *)MacroDefs.Get(macroBuf);
- if (def) j ++;
- }
+ def = (TexMacroDef *)MacroDefs.Get(macroBuf);
+ if (def)
+ ++j;
+ }
- if (!def)
+ if (!def)
+ {
+ while ((isalpha(buffer[j]) || buffer[j] == '*') && ((j - i) < 39))
{
- while ((isalpha(buffer[j]) || buffer[j] == '*') && ((j - i) < 39))
- {
- macroBuf[j-i] = buffer[j];
- j ++;
- }
- macroBuf[j-i] = 0;
- def = (TexMacroDef *)MacroDefs.Get(macroBuf);
+ macroBuf[j-i] = buffer[j];
+ ++j;
}
+ macroBuf[j-i] = 0;
+ def = (TexMacroDef *)MacroDefs.Get(macroBuf);
+ }
- if (def)
+ 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};
+ // or a numeric argument, such as \parindent0pt
+ if (
+ (def->no_args > 0) &&
+ ((buffer[i] == 32) || (buffer[i] == '=') || (isdigit(buffer[i]))))
{
- i = j;
+ if ((buffer[i] == 32) || (buffer[i] == '='))
+ ++i;
- // 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};
- // or a numeric argument, such as \parindent0pt
- if ((def->no_args > 0) && ((buffer[i] == 32) || (buffer[i] == '=') || (isdigit(buffer[i]))))
- {
- if ((buffer[i] == 32) || (buffer[i] == '='))
- i ++;
-
- *parseToBrace = false;
- }
- *pos = i;
- ForbidWarning(def);
- return def;
+ *parseToBrace = false;
}
- return NULL;
+ *pos = i;
+ ForbidWarning(def);
+ return def;
+ }
+ return NULL;
}
-void EatWhiteSpace(wxChar *buffer, int *pos)
+void EatWhiteSpace(wxChar *buffer, size_t *pos)
{
- int len = wxStrlen(buffer);
- int j = *pos;
+ size_t len = wxStrlen(buffer);
+ size_t j = *pos;
bool keepGoing = true;
bool moreLines = true;
- while ((j < len) && keepGoing &&
- (buffer[j] == 10 || buffer[j] == 13 || buffer[j] == ' ' || buffer[j] == 9))
+ while (
+ (j < len) && keepGoing &&
+ (buffer[j] == 10 || buffer[j] == 13 || buffer[j] == ' ' || buffer[j] == 9))
{
- j ++;
+ ++j;
if (j >= len)
{
if (moreLines)
@@ -400,15 +408,17 @@
j = 0;
}
else
+ {
keepGoing = false;
+ }
}
}
*pos = j;
}
-bool FindEndEnvironment(wxChar *buffer, int *pos, wxChar *env)
+bool FindEndEnvironment(wxChar *buffer, size_t *pos, wxChar *env)
{
- int i = (*pos);
+ size_t i = *pos;
// Try to find end{thing}
if ((wxStrncmp(buffer+i, _T("end{"), 4) == 0) &&
@@ -867,7 +877,7 @@
*
*/
-bool ParseNewCommand(wxChar *buffer, int *pos)
+bool ParseNewCommand(wxChar *buffer, size_t *pos)
{
if ((wxStrncmp((buffer+(*pos)), _T("newcommand"), 10) == 0) ||
(wxStrncmp((buffer+(*pos)), _T("renewcommand"), 12) == 0))
@@ -971,15 +981,23 @@
* e.g. in {\bf an argument} as opposed to \vskip 30pt
*
*/
-int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos, wxChar *environment, bool parseToBrace, TexChunk *customMacroArgs)
+size_t ParseArg(
+ TexChunk *thisArg,
+ wxList& children,
+ wxChar *buffer,
+ size_t pos,
+ wxChar *environment,
+ bool parseToBrace,
+ TexChunk *customMacroArgs)
{
Tex2RTFYield();
- if (stopRunning) return pos;
+ if (stopRunning)
+ return pos;
bool eof = false;
BigBuffer[0] = 0;
- int buf_ptr = 0;
- int len;
+ size_t buf_ptr = 0;
+ size_t len;
/*
@@ -1225,18 +1243,18 @@
wxChar ch = buffer[pos];
pos ++;
// Now at start of verbatim text
- int j = pos;
+ size_t j = pos;
while ((buffer[pos] != ch) && buffer[pos] != 0)
pos ++;
wxChar *val = new wxChar[pos - j + 1];
- int i;
+ size_t i;
for (i = j; i < pos; i++)
{
- val[i-j] = buffer[i];
+ val[i - j] = buffer[i];
}
- val[i-j] = 0;
+ val[i - j] = 0;
- pos ++;
+ ++pos;
TexChunk *chunk = new TexChunk(CHUNK_TYPE_MACRO);
chunk->no_args = 1;
@@ -1282,13 +1300,15 @@
pos ++;
}
- pos = ParseMacroBody(def->name,
- chunk, chunk->no_args,
- buffer,
- pos,
- env,
- tmpParseToBrace,
- customMacroArgs);
+ pos = ParseMacroBody(
+ def->name,
+ chunk,
+ chunk->no_args,
+ buffer,
+ pos,
+ env,
+ tmpParseToBrace,
+ customMacroArgs);
// If custom macro, parse the body substituting the above found args.
if (customMacro)
@@ -1343,8 +1363,15 @@
if (!customMacro)
children.Append((wxObject *)chunk);
- pos = ParseMacroBody(def->name, chunk, chunk->no_args,
- buffer, pos, NULL, true, customMacroArgs);
+ pos = ParseMacroBody(
+ def->name,
+ chunk,
+ chunk->no_args,
+ buffer,
+ pos,
+ NULL,
+ true,
+ customMacroArgs);
// If custom macro, parse the body substituting the above found args.
if (customMacro)
@@ -1399,7 +1426,14 @@
arg->argn = 1;
arg->macroId = chunk->macroId;
- pos = ParseArg(arg, arg->children, buffer, pos, NULL, true, customMacroArgs);
+ pos = ParseArg(
+ arg,
+ arg->children,
+ buffer,
+ pos,
+ NULL,
+ true,
+ customMacroArgs);
}
break;
}
@@ -1562,13 +1596,20 @@
*
*/
-int ParseMacroBody(const wxChar *WXUNUSED(macro_name), TexChunk *parent,
- int no_args, wxChar *buffer, int pos,
- wxChar *environment, bool parseToBrace,
- TexChunk *customMacroArgs)
+size_t ParseMacroBody(
+ const wxChar *WXUNUSED(macro_name),
+ TexChunk *parent,
+ int no_args,
+ wxChar
+ *buffer,
+ size_t pos,
+ wxChar *environment,
+ bool parseToBrace,
+ TexChunk *customMacroArgs)
{
Tex2RTFYield();
- if (stopRunning) return pos;
+ if (stopRunning)
+ return pos;
// Check for a first optional argument
if (buffer[pos] == ' ' && buffer[pos+1] == '[')
@@ -1643,7 +1684,14 @@
}
arg->optional = isOptional;
- pos = ParseArg(arg, arg->children, buffer, pos, actualEnv, parseToBrace, customMacroArgs);
+ pos = ParseArg(
+ arg,
+ arg->children,
+ buffer,
+ pos,
+ actualEnv,
+ parseToBrace,
+ customMacroArgs);
// If we've encountered an OPTIONAL argument, go another time around
// the loop, because we've got more than we thought.
@@ -3224,27 +3272,30 @@
// from a normal 'ref' reference
wxChar buf[150];
wxStrcpy(buf, texRef->sectionNumber);
- int len = wxStrlen(buf);
- int i = 0;
+ size_t len = wxStrlen(buf);
+ size_t i = 0;
if (wxStrcmp(buf, _T("??")) != 0)
{
while (i < len)
{
if (buf[i] == ' ')
{
- i ++;
+ ++i;
break;
}
- else i ++;
+ else
+ {
+ ++i;
+ }
}
}
TexOutput(texRef->sectionNumber + i, true);
}
else
{
- wxString informBuf;
- informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName);
- OnInform((wxChar *)informBuf.c_str());
+ wxString informBuf;
+ informBuf.Printf(_T("Warning: unresolved reference '%s'"), refName);
+ OnInform((wxChar *)informBuf.c_str());
}
}
else TexOutput(_T("??"), true);
@@ -3385,7 +3436,7 @@
if (start && !IsArgOptional())
{
wxChar *citeKeys = GetArgData();
- int pos = 0;
+ size_t pos = 0;
wxChar *citeKey = ParseMultifieldString(citeKeys, &pos);
while (citeKey)
{
@@ -3521,7 +3572,7 @@
// Read in the .bib file, resolve all known references, write out the RTF.
wxChar *allFiles = GetArgData();
- int pos = 0;
+ size_t pos = 0;
wxChar *bibFile = ParseMultifieldString(allFiles, &pos);
while (bibFile)
{
Modified: tex2rtf/src/tex2any.h
===================================================================
--- tex2rtf/src/tex2any.h 2010-04-28 23:36:06 UTC (rev 776)
+++ tex2rtf/src/tex2any.h 2010-05-09 22:57:18 UTC (rev 777)
@@ -151,10 +151,23 @@
bool read_a_line(wxChar *buf);
bool TexLoadFile(const wxString& filename);
-int ParseArg(TexChunk *thisArg, wxList& children, wxChar *buffer, int pos,
- wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL);
-int ParseMacroBody(const wxChar *macro_name, TexChunk *parent, int no_args,
- wxChar *buffer, int pos, wxChar *environment = NULL, bool parseArgToBrace = true, TexChunk *customMacroArgs = NULL);
+size_t ParseArg(
+ TexChunk *thisArg,
+ wxList& children,
+ wxChar *buffer,
+ size_t pos,
+ wxChar *environment = NULL,
+ bool parseArgToBrace = true,
+ TexChunk *customMacroArgs = NULL);
+size_t ParseMacroBody(
+ const wxChar *macro_name,
+ TexChunk *parent,
+ int no_args,
+ wxChar *buffer,
+ size_t pos,
+ wxChar *environment = NULL,
+ bool parseArgToBrace = true,
+ TexChunk *customMacroArgs = NULL);
void TraverseDocument(void);
void TraverseFromChunk(TexChunk *chunk, wxList::compatibility_iterator* thisNode = NULL, bool childrenOnly = false);
#define TraverseChildrenFromChunk(arg) TraverseFromChunk(arg, NULL, true)
@@ -540,7 +553,7 @@
bool ReadCustomMacros(const wxString& filename);
void ShowCustomMacros(void);
CustomMacro *FindCustomMacro(wxChar *name);
-wxChar *ParseMultifieldString(wxChar *s, int *pos);
+wxChar *ParseMultifieldString(wxChar *s, size_t *pos);
/*
* Colour table stuff
Modified: tex2rtf/src/texutils.cpp
===================================================================
--- tex2rtf/src/texutils.cpp 2010-04-28 23:36:06 UTC (rev 776)
+++ tex2rtf/src/texutils.cpp 2010-05-09 22:57:18 UTC (rev 777)
@@ -230,9 +230,9 @@
{
float conversionFactor = 1.0;
float unitValue = 0.0;
- int len = wxStrlen(unitArg);
+ size_t len = wxStrlen(unitArg);
// Get rid of any accidentally embedded commands
- for (int i = 0; i < len; i++)
+ for (size_t i = 0; i < len; i++)
if (unitArg[i] == '\\')
unitArg[i] = 0;
len = wxStrlen(unitArg);
@@ -268,8 +268,8 @@
void StripExtension(wxChar *buffer)
{
- int len = wxStrlen(buffer);
- int i = len-1;
+ size_t len = wxStrlen(buffer);
+ size_t i = len-1;
while (i > 0)
{
if (buffer[i] == '.')
@@ -277,7 +277,7 @@
buffer[i] = 0;
break;
}
- i --;
+ --i;
}
}
@@ -1583,13 +1583,13 @@
}
// Parse a string into several comma-separated fields
-wxChar *ParseMultifieldString(wxChar *allFields, int *pos)
+wxChar *ParseMultifieldString(wxChar *allFields, size_t *pos)
{
static wxChar buffer[300];
int i = 0;
- int fieldIndex = *pos;
- int len = wxStrlen(allFields);
- int oldPos = *pos;
+ size_t fieldIndex = *pos;
+ size_t len = wxStrlen(allFields);
+ size_t oldPos = *pos;
bool keepGoing = true;
while ((fieldIndex <= len) && keepGoing)
{
@@ -1616,7 +1616,7 @@
}
}
buffer[i] = 0;
- if (oldPos == (*pos))
+ if (oldPos == *pos)
*pos = len + 1;
if (i == 0)
@@ -1813,8 +1813,8 @@
wxChar* ConvertCase(const wxChar* pString)
{
static wxChar buf[256];
- int len = wxStrlen(pString);
- int i;
+ size_t len = wxStrlen(pString);
+ size_t i;
if (upperCaseNames)
{
for (i = 0; i < len; i ++)
Modified: tex2rtf/src/xlputils.cpp
===================================================================
--- tex2rtf/src/xlputils.cpp 2010-04-28 23:36:06 UTC (rev 776)
+++ tex2rtf/src/xlputils.cpp 2010-05-09 22:57:18 UTC (rev 777)
@@ -742,7 +742,7 @@
// Count the number of columns
noColumns = 0;
- int len = wxStrlen(alignString);
+ size_t len = wxStrlen(alignString);
if (len > 0)
{
if (alignString[0] == '|')
@@ -751,7 +751,7 @@
tableVerticalLineRight = true;
}
- for (int i = 0; i < len; i++)
+ for (size_t i = 0; i < len; i++)
if (isalpha(alignString[i]))
noColumns ++;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|