compilation: Various cross compilation fixes. The "--recursive" option doesn't work on VC now.
This commit is contained in:
parent
ffb6e1dc6e
commit
5e9f1010ff
|
@ -10,6 +10,7 @@
|
||||||
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
|
#include <ctype.h>
|
||||||
#include <mem.h>
|
#include <mem.h>
|
||||||
#endif
|
#endif
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -377,7 +378,7 @@ void CheckUnusedPrivateFunctions()
|
||||||
priv = false;
|
priv = false;
|
||||||
else if (priv && indent_level == 1)
|
else if (priv && indent_level == 1)
|
||||||
{
|
{
|
||||||
if (std::isalpha(tok->str[0]) &&
|
if (isalpha(tok->str[0]) &&
|
||||||
tok->next->str[0]=='(' &&
|
tok->next->str[0]=='(' &&
|
||||||
strcmp(tok->str,classname) != 0)
|
strcmp(tok->str,classname) != 0)
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,6 +16,10 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
#define _strdup(str) strdup(str)
|
||||||
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
@ -151,7 +155,7 @@ static void instoken(TOKEN *tok, const char str[])
|
||||||
{
|
{
|
||||||
TOKEN *newtok = new TOKEN;
|
TOKEN *newtok = new TOKEN;
|
||||||
memcpy( newtok, tok, sizeof(TOKEN) );
|
memcpy( newtok, tok, sizeof(TOKEN) );
|
||||||
newtok->str = strdup(str);
|
newtok->str = _strdup(str);
|
||||||
tok->next = newtok;
|
tok->next = newtok;
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
@ -169,7 +173,7 @@ static TOKEN *getcode(const TOKEN *tok, const char varname[])
|
||||||
#define addtoken(_str) \
|
#define addtoken(_str) \
|
||||||
{ \
|
{ \
|
||||||
TOKEN *newtok = new TOKEN; \
|
TOKEN *newtok = new TOKEN; \
|
||||||
newtok->str = strdup(_str); \
|
newtok->str = _strdup(_str); \
|
||||||
newtok->linenr = tok->linenr; \
|
newtok->linenr = tok->linenr; \
|
||||||
newtok->FileIndex = tok->FileIndex; \
|
newtok->FileIndex = tok->FileIndex; \
|
||||||
newtok->next = 0; \
|
newtok->next = 0; \
|
||||||
|
@ -495,7 +499,7 @@ static void CheckMemoryLeak_CheckScope( const TOKEN *Tok1, const char varname[]
|
||||||
{
|
{
|
||||||
done = false;
|
done = false;
|
||||||
free(tok2->str);
|
free(tok2->str);
|
||||||
tok2->str = strdup(";");
|
tok2->str = _strdup(";");
|
||||||
erase( tok2, gettok(tok2, 2) );
|
erase( tok2, gettok(tok2, 2) );
|
||||||
tok2 = tok2->next;
|
tok2 = tok2->next;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
@ -503,7 +507,7 @@ static void CheckMemoryLeak_CheckScope( const TOKEN *Tok1, const char varname[]
|
||||||
{
|
{
|
||||||
bool def = Match(tok2, "default");
|
bool def = Match(tok2, "default");
|
||||||
free(tok2->str);
|
free(tok2->str);
|
||||||
tok2->str = strdup(first ? "if" : "}");
|
tok2->str = _strdup(first ? "if" : "}");
|
||||||
if ( first )
|
if ( first )
|
||||||
{
|
{
|
||||||
first = false;
|
first = false;
|
||||||
|
@ -522,7 +526,7 @@ static void CheckMemoryLeak_CheckScope( const TOKEN *Tok1, const char varname[]
|
||||||
if (Match(tok2,"break ;"))
|
if (Match(tok2,"break ;"))
|
||||||
{
|
{
|
||||||
free(tok2->str);
|
free(tok2->str);
|
||||||
tok2->str = strdup(";");
|
tok2->str = _strdup(";");
|
||||||
tok2 = tok2->next->next;
|
tok2 = tok2->next->next;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -689,24 +693,20 @@ static void CheckMemoryLeak_ClassMembers_ParseClass( const TOKEN *tok1, std::vec
|
||||||
static void CheckMemoryLeak_ClassMembers_Variable( const std::vector<const char *> &classname, const char varname[] )
|
static void CheckMemoryLeak_ClassMembers_Variable( const std::vector<const char *> &classname, const char varname[] )
|
||||||
{
|
{
|
||||||
// Function pattern.. Check if member function
|
// Function pattern.. Check if member function
|
||||||
char fpattern[500] = {0};
|
std::ostringstream fpattern;
|
||||||
for ( unsigned int i = 0; i < classname.size(); i++ )
|
for ( unsigned int i = 0; i < classname.size(); i++ )
|
||||||
{
|
{
|
||||||
strcat( fpattern, classname[i] );
|
fpattern << classname[i] << " :: ";
|
||||||
strcat( fpattern, " :: " );
|
|
||||||
}
|
}
|
||||||
strcat( fpattern, "%var% (" );
|
fpattern << "%var% (";
|
||||||
|
|
||||||
// Destructor pattern.. Check if class destructor..
|
// Destructor pattern.. Check if class destructor..
|
||||||
char destructor[500] = {0};
|
std::ostringstream destructor;
|
||||||
for ( unsigned int i = 0; i < classname.size(); i++ )
|
for ( unsigned int i = 0; i < classname.size(); i++ )
|
||||||
{
|
{
|
||||||
strcat( destructor, classname[i] );
|
destructor << classname[i] << " :: ";
|
||||||
strcat( destructor, " :: " );
|
|
||||||
}
|
}
|
||||||
strcat( destructor, " ~" );
|
destructor << " ~" << classname.back() << " (";
|
||||||
strcat( destructor, classname.back() );
|
|
||||||
strcat( destructor, " (" );
|
|
||||||
|
|
||||||
// Pattern used in member function. "Var = ..."
|
// Pattern used in member function. "Var = ..."
|
||||||
std::ostringstream varname_eq;
|
std::ostringstream varname_eq;
|
||||||
|
@ -738,7 +738,7 @@ static void CheckMemoryLeak_ClassMembers_Variable( const std::vector<const char
|
||||||
{
|
{
|
||||||
if ( strchr(";}", tok->str[0]) )
|
if ( strchr(";}", tok->str[0]) )
|
||||||
memberfunction = false;
|
memberfunction = false;
|
||||||
else if ( Match( tok, fpattern ) || Match( tok, destructor ) )
|
else if ( Match( tok, fpattern.str().c_str() ) || Match( tok, destructor.str().c_str() ) )
|
||||||
memberfunction = true;
|
memberfunction = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,10 @@
|
||||||
#include <list>
|
#include <list>
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
#include <cstring>
|
#include <cstring>
|
||||||
|
|
||||||
|
#ifdef __BORLANDC__
|
||||||
|
#include <ctype.h>
|
||||||
|
#endif
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
extern bool CheckCodingStyle;
|
extern bool CheckCodingStyle;
|
||||||
bool OnlyReportUniqueErrors;
|
bool OnlyReportUniqueErrors;
|
||||||
|
@ -50,9 +54,13 @@ bool SameFileName( const char fname1[], const char fname2[] )
|
||||||
#endif
|
#endif
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
return bool( strcasecmp(fname1, fname2) == 0 );
|
return bool( strcasecmp(fname1, fname2) == 0 );
|
||||||
#else
|
#endif
|
||||||
|
#ifdef __BORLANDC__
|
||||||
return bool( stricmp(fname1, fname2) == 0 );
|
return bool( stricmp(fname1, fname2) == 0 );
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
return bool( _stricmp(fname1, fname2) == 0 );
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
@ -72,13 +80,13 @@ void ReportErr(const std::string &errmsg)
|
||||||
|
|
||||||
bool IsName(const char str[])
|
bool IsName(const char str[])
|
||||||
{
|
{
|
||||||
return (str[0]=='_' || std::isalpha(str[0]));
|
return bool(str[0]=='_' || isalpha(str[0]));
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
bool IsNumber(const char str[])
|
bool IsNumber(const char str[])
|
||||||
{
|
{
|
||||||
return std::isdigit(str[0]);
|
return bool(isdigit(str[0]) != 0);
|
||||||
}
|
}
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
9
main.cpp
9
main.cpp
|
@ -36,7 +36,8 @@
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
#include <glob.h>
|
#include <glob.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#else
|
#endif
|
||||||
|
#ifdef __BORLANDC__
|
||||||
#include <dir.h>
|
#include <dir.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -61,7 +62,8 @@ static void AddFiles( std::vector<std::string> &filenames, const char path[], co
|
||||||
filenames.push_back( fname.str() );
|
filenames.push_back( fname.str() );
|
||||||
}
|
}
|
||||||
globfree(&glob_results);
|
globfree(&glob_results);
|
||||||
#else
|
#endif
|
||||||
|
#ifdef __BORLANDC__
|
||||||
struct ffblk f;
|
struct ffblk f;
|
||||||
for ( int done = findfirst(pattern, &f, 0); ! done; done = findnext(&f) )
|
for ( int done = findfirst(pattern, &f, 0); ! done; done = findnext(&f) )
|
||||||
{
|
{
|
||||||
|
@ -99,7 +101,8 @@ static void RecursiveAddFiles( std::vector<std::string> &filenames, const char p
|
||||||
chdir( ".." );
|
chdir( ".." );
|
||||||
}
|
}
|
||||||
globfree(&glob_results);
|
globfree(&glob_results);
|
||||||
#else
|
#endif
|
||||||
|
#ifdef __BORLANDC__
|
||||||
struct ffblk f ;
|
struct ffblk f ;
|
||||||
for ( int done = findfirst("*", &f, FA_DIREC); ! done; done = findnext(&f) )
|
for ( int done = findfirst("*", &f, FA_DIREC); ! done; done = findnext(&f) )
|
||||||
{
|
{
|
||||||
|
|
98
tokenize.cpp
98
tokenize.cpp
|
@ -14,9 +14,14 @@
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
#ifdef __BORLANDC__
|
||||||
|
#include <ctype.h>
|
||||||
#include <mem.h>
|
#include <mem.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef _MSC_VER
|
||||||
|
#define _strdup(str) strdup(str)
|
||||||
|
#endif
|
||||||
|
|
||||||
//---------------------------------------------------------------------------
|
//---------------------------------------------------------------------------
|
||||||
|
|
||||||
// Helper functions..
|
// Helper functions..
|
||||||
|
@ -76,30 +81,33 @@ static void Define(const char Name[], const char Value[])
|
||||||
bool dec = true, hex = true;
|
bool dec = true, hex = true;
|
||||||
for (int i = 0; Value[i]; i++)
|
for (int i = 0; Value[i]; i++)
|
||||||
{
|
{
|
||||||
if ( ! std::isdigit(Value[i]) )
|
if ( ! isdigit(Value[i]) )
|
||||||
dec = false;
|
dec = false;
|
||||||
|
|
||||||
if ( ! std::isxdigit(Value[i]) && (!(i==1 && Value[i]=='x')))
|
if ( ! isxdigit(Value[i]) && (!(i==1 && Value[i]=='x')))
|
||||||
hex = false;
|
hex = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!dec && !hex)
|
if (!dec && !hex)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
char *strValue = strdup(Value);
|
char *strValue = _strdup(Value);
|
||||||
|
|
||||||
if (!dec && hex)
|
if (!dec && hex)
|
||||||
{
|
{
|
||||||
char str[50];
|
// Convert Value from hexadecimal to decimal
|
||||||
unsigned long value = strtoul(Value+2, NULL, 16);
|
unsigned long value;
|
||||||
|
std::istringstream istr(Value+2);
|
||||||
|
istr >> std::hex >> value;
|
||||||
|
std::ostringstream ostr;
|
||||||
|
ostr << value;
|
||||||
free(strValue);
|
free(strValue);
|
||||||
sprintf(str, "%lu", value);
|
strValue = _strdup(ostr.str().c_str());
|
||||||
strValue = strdup(str);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DefineSymbol *NewSym = new DefineSymbol;
|
DefineSymbol *NewSym = new DefineSymbol;
|
||||||
memset(NewSym, 0, sizeof(DefineSymbol));
|
memset(NewSym, 0, sizeof(DefineSymbol));
|
||||||
NewSym->name = strdup(Name);
|
NewSym->name = _strdup(Name);
|
||||||
NewSym->value = strValue;
|
NewSym->value = strValue;
|
||||||
NewSym->next = dsymlist;
|
NewSym->next = dsymlist;
|
||||||
dsymlist = NewSym;
|
dsymlist = NewSym;
|
||||||
|
@ -123,17 +131,19 @@ static void addtoken(const char str[], const unsigned int lineno, const unsigned
|
||||||
return;
|
return;
|
||||||
|
|
||||||
// Replace hexadecimal value with decimal
|
// Replace hexadecimal value with decimal
|
||||||
char str2[50];
|
std::ostringstream str2;
|
||||||
memset(str2, 0, sizeof(str2));
|
|
||||||
if (strncmp(str,"0x",2)==0)
|
if (strncmp(str,"0x",2)==0)
|
||||||
{
|
{
|
||||||
unsigned int value = strtoul(str+2, NULL, 16);
|
str2 << strtoul(str+2, NULL, 16);
|
||||||
sprintf( str2, "%d", value );
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
str2 << str;
|
||||||
}
|
}
|
||||||
|
|
||||||
TOKEN *newtoken = new TOKEN;
|
TOKEN *newtoken = new TOKEN;
|
||||||
memset(newtoken, 0, sizeof(TOKEN));
|
memset(newtoken, 0, sizeof(TOKEN));
|
||||||
newtoken->str = strdup(str2[0] ? str2 : str);
|
newtoken->str = _strdup(str2.str().c_str());
|
||||||
newtoken->linenr = lineno;
|
newtoken->linenr = lineno;
|
||||||
newtoken->FileIndex = fileno;
|
newtoken->FileIndex = fileno;
|
||||||
if (tokens_back)
|
if (tokens_back)
|
||||||
|
@ -152,7 +162,7 @@ static void addtoken(const char str[], const unsigned int lineno, const unsigned
|
||||||
if (strcmp(str,sym->name)==0)
|
if (strcmp(str,sym->name)==0)
|
||||||
{
|
{
|
||||||
free(newtoken->str);
|
free(newtoken->str);
|
||||||
newtoken->str = strdup(sym->value);
|
newtoken->str = _strdup(sym->value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -178,9 +188,8 @@ static void combine_2tokens(TOKEN *tok, const char str1[], const char str2[])
|
||||||
return;
|
return;
|
||||||
|
|
||||||
free(tok->str);
|
free(tok->str);
|
||||||
tok->str = (char *)malloc(strlen(str1)+strlen(str2)+1);
|
std::string newstr(std::string(str1) + std::string(str2));
|
||||||
strcpy(tok->str, str1);
|
tok->str = _strdup( newstr.c_str() );
|
||||||
strcat(tok->str, str2);
|
|
||||||
|
|
||||||
DeleteNextToken(tok);
|
DeleteNextToken(tok);
|
||||||
}
|
}
|
||||||
|
@ -238,7 +247,7 @@ static void InsertTokens(TOKEN *dest, TOKEN *src, unsigned int n)
|
||||||
TOKEN *NewToken = new TOKEN;
|
TOKEN *NewToken = new TOKEN;
|
||||||
NewToken->FileIndex = src->FileIndex;
|
NewToken->FileIndex = src->FileIndex;
|
||||||
NewToken->linenr = src->linenr;
|
NewToken->linenr = src->linenr;
|
||||||
NewToken->str = strdup(src->str);
|
NewToken->str = _strdup(src->str);
|
||||||
|
|
||||||
NewToken->next = dest->next;
|
NewToken->next = dest->next;
|
||||||
dest->next = NewToken;
|
dest->next = NewToken;
|
||||||
|
@ -332,22 +341,22 @@ void TokenizeCode(std::istream &code, const unsigned int FileIndex)
|
||||||
{
|
{
|
||||||
if (State==Space1 || State==Space2)
|
if (State==Space1 || State==Space2)
|
||||||
{
|
{
|
||||||
if (std::isspace(line[i]))
|
if (isspace(line[i]))
|
||||||
continue;
|
continue;
|
||||||
State = (State==Space1) ? Id : Value;
|
State = (State==Space1) ? Id : Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (State==Id)
|
else if (State==Id)
|
||||||
{
|
{
|
||||||
if ( std::isspace( line[i] ) )
|
if ( isspace( line[i] ) )
|
||||||
{
|
{
|
||||||
strId = strdup(CurrentToken);
|
strId = _strdup(CurrentToken);
|
||||||
memset(CurrentToken, 0, sizeof(CurrentToken));
|
memset(CurrentToken, 0, sizeof(CurrentToken));
|
||||||
pToken = CurrentToken;
|
pToken = CurrentToken;
|
||||||
State = Space2;
|
State = Space2;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
else if ( ! std::isalnum(line[i]) )
|
else if ( ! isalnum(line[i]) )
|
||||||
{
|
{
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -516,7 +525,7 @@ void TokenizeCode(std::istream &code, const unsigned int FileIndex)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (std::isspace(ch) || std::iscntrl(ch))
|
if (isspace(ch) || iscntrl(ch))
|
||||||
{
|
{
|
||||||
addtoken(CurrentToken, lineno, FileIndex);
|
addtoken(CurrentToken, lineno, FileIndex);
|
||||||
pToken = CurrentToken;
|
pToken = CurrentToken;
|
||||||
|
@ -562,7 +571,8 @@ void TokenizeCode(std::istream &code, const unsigned int FileIndex)
|
||||||
{
|
{
|
||||||
if ( strcmp(tok->str, "->") == 0 )
|
if ( strcmp(tok->str, "->") == 0 )
|
||||||
{
|
{
|
||||||
strcpy( tok->str, "." );
|
tok->str[0] = '.';
|
||||||
|
tok->str[1] = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -578,7 +588,7 @@ void TokenizeCode(std::istream &code, const unsigned int FileIndex)
|
||||||
if (tok2->str!=type2 && strcmp(tok2->str,type2)==0)
|
if (tok2->str!=type2 && strcmp(tok2->str,type2)==0)
|
||||||
{
|
{
|
||||||
free(tok2->str);
|
free(tok2->str);
|
||||||
tok2->str = strdup(type1);
|
tok2->str = _strdup(type1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -593,10 +603,10 @@ void TokenizeCode(std::istream &code, const unsigned int FileIndex)
|
||||||
if (tok2->str!=type3 && strcmp(tok2->str,type3)==0)
|
if (tok2->str!=type3 && strcmp(tok2->str,type3)==0)
|
||||||
{
|
{
|
||||||
free(tok2->str);
|
free(tok2->str);
|
||||||
tok2->str = strdup(type1);
|
tok2->str = _strdup(type1);
|
||||||
|
|
||||||
TOKEN *newtok = new TOKEN;
|
TOKEN *newtok = new TOKEN;
|
||||||
newtok->str = strdup(type2);
|
newtok->str = _strdup(type2);
|
||||||
newtok->FileIndex = tok2->FileIndex;
|
newtok->FileIndex = tok2->FileIndex;
|
||||||
newtok->linenr = tok2->linenr;
|
newtok->linenr = tok2->linenr;
|
||||||
newtok->next = tok2->next;
|
newtok->next = tok2->next;
|
||||||
|
@ -644,7 +654,7 @@ void SimplifyTokenList()
|
||||||
if (strcmp(tok2->str,sym) == 0)
|
if (strcmp(tok2->str,sym) == 0)
|
||||||
{
|
{
|
||||||
free(tok2->str);
|
free(tok2->str);
|
||||||
tok2->str = strdup(num);
|
tok2->str = _strdup(num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -682,10 +692,10 @@ void SimplifyTokenList()
|
||||||
if (Match(tok, "sizeof ( %type% * )"))
|
if (Match(tok, "sizeof ( %type% * )"))
|
||||||
{
|
{
|
||||||
free(tok->str);
|
free(tok->str);
|
||||||
char str[10];
|
std::ostringstream str;
|
||||||
// 'sizeof(type *)' has the same size as 'sizeof(char *)'
|
// 'sizeof(type *)' has the same size as 'sizeof(char *)'
|
||||||
sprintf( str, "%u", (unsigned int)sizeof(char *));
|
str << sizeof(char *);
|
||||||
tok->str = strdup( str );
|
tok->str = _strdup( str.str().c_str() );
|
||||||
|
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
{
|
{
|
||||||
|
@ -700,9 +710,9 @@ void SimplifyTokenList()
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
{
|
{
|
||||||
free(tok->str);
|
free(tok->str);
|
||||||
char str[10];
|
std::ostringstream str;
|
||||||
sprintf( str, "%d", size );
|
str << size;
|
||||||
tok->str = strdup( str );
|
tok->str = _strdup( str.str().c_str() );
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
DeleteNextToken(tok);
|
DeleteNextToken(tok);
|
||||||
|
@ -747,9 +757,9 @@ void SimplifyTokenList()
|
||||||
if (strcmp(getstr(tok2,2), varname) == 0)
|
if (strcmp(getstr(tok2,2), varname) == 0)
|
||||||
{
|
{
|
||||||
free(tok2->str);
|
free(tok2->str);
|
||||||
char str[20];
|
std::ostringstream str;
|
||||||
sprintf( str, "%d", total_size);
|
str << total_size;
|
||||||
tok2->str = strdup(str );
|
tok2->str = _strdup(str.str().c_str());
|
||||||
// Delete the other tokens..
|
// Delete the other tokens..
|
||||||
for (int i = 0; i < 3; i++)
|
for (int i = 0; i < 3; i++)
|
||||||
{
|
{
|
||||||
|
@ -802,9 +812,9 @@ void SimplifyTokenList()
|
||||||
}
|
}
|
||||||
tok = tok->next;
|
tok = tok->next;
|
||||||
free(tok->str);
|
free(tok->str);
|
||||||
char str[10];
|
std::ostringstream str;
|
||||||
sprintf(str,"%d", i1);
|
str << i1;
|
||||||
tok->str = strdup(str);
|
tok->str = _strdup(str.str().c_str());
|
||||||
for (int i = 0; i < 2; i++)
|
for (int i = 0; i < 2; i++)
|
||||||
{
|
{
|
||||||
DeleteNextToken(tok);
|
DeleteNextToken(tok);
|
||||||
|
@ -836,7 +846,7 @@ void SimplifyTokenList()
|
||||||
{
|
{
|
||||||
tok = tok->next;
|
tok = tok->next;
|
||||||
free(tok->str);
|
free(tok->str);
|
||||||
tok->str = strdup(str[i]);
|
tok->str = _strdup(str[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
DeleteNextToken(tok);
|
DeleteNextToken(tok);
|
||||||
|
@ -921,7 +931,7 @@ void SimplifyTokenList()
|
||||||
if (tok2->str[0] == ',')
|
if (tok2->str[0] == ',')
|
||||||
{
|
{
|
||||||
free(tok2->str);
|
free(tok2->str);
|
||||||
tok2->str = strdup(";");
|
tok2->str = _strdup(";");
|
||||||
InsertTokens(tok2, type0, typelen);
|
InsertTokens(tok2, type0, typelen);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -952,13 +962,13 @@ void SimplifyTokenList()
|
||||||
VarTok = VarTok->next;
|
VarTok = VarTok->next;
|
||||||
InsertTokens(eq, VarTok, 2);
|
InsertTokens(eq, VarTok, 2);
|
||||||
free(eq->str);
|
free(eq->str);
|
||||||
eq->str = strdup(";");
|
eq->str = _strdup(";");
|
||||||
|
|
||||||
// "= x, " => "= x; type "
|
// "= x, " => "= x; type "
|
||||||
if (tok2->str[0] == ',')
|
if (tok2->str[0] == ',')
|
||||||
{
|
{
|
||||||
free(tok2->str);
|
free(tok2->str);
|
||||||
tok2->str = strdup(";");
|
tok2->str = _strdup(";");
|
||||||
InsertTokens( tok2, type0, typelen );
|
InsertTokens( tok2, type0, typelen );
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue