Fix the few non-portable uses of "char" (where a -1 might be relevant): All uses of char are now either "int", "unsigned char" or char arrays for storing strings. Also, went to consistent "char* foo" coding convention. (There were only a few ambiguous uses.)

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@25400 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2014-02-18 23:37:57 +00:00
parent 52c351442c
commit 51cdd90fa8
15 changed files with 72 additions and 72 deletions

View file

@ -96,7 +96,7 @@ using namespace glslang;
const struct {
int val;
const char *str;
const char* str;
} tokens[] = {
{ CPP_AND_OP, "&&" },
{ CPP_AND_ASSIGN, "&=" },
@ -128,7 +128,7 @@ namespace glslang {
//
// Map a new or existing string to an atom, inventing a new atom if necessary.
//
int TPpContext::LookUpAddString(const char *s)
int TPpContext::LookUpAddString(const char* s)
{
TAtomMap::const_iterator it = atomMap.find(s);
if (it == atomMap.end())
@ -140,7 +140,7 @@ int TPpContext::LookUpAddString(const char *s)
//
// Map an already created atom to its string.
//
const char *TPpContext::GetAtomString(int atom)
const char* TPpContext::GetAtomString(int atom)
{
if (atom == 0)
return "<null atom>";
@ -159,7 +159,7 @@ const char *TPpContext::GetAtomString(int atom)
//
// Add forced mapping of string to atom.
//
int TPpContext::AddAtomFixed(const char *s, int atom)
int TPpContext::AddAtomFixed(const char* s, int atom)
{
TAtomMap::const_iterator it = atomMap.insert(std::pair<TString, int>(s, atom)).first;
if (stringMap.size() < (size_t)atom + 1)
@ -175,7 +175,7 @@ int TPpContext::AddAtomFixed(const char *s, int atom)
void TPpContext::InitAtomTable()
{
// Add single character tokens to the atom table:
const char *s = "~!%^&*()-+=|,.<>/?;:[]{}#";
const char* s = "~!%^&*()-+=|,.<>/?;:[]{}#";
char t[2];
t[1] = '\0';

View file

@ -232,7 +232,7 @@ protected:
int ifdepth; // current #if-#else-#endif nesting in the cpp.c file (pre-processor)
bool elseSeen[maxIfNesting]; // Keep a track of whether an else has been seen at a particular depth
int elsetracker; // #if-#else and #endif constructs...Counter.
const char *ErrMsg;
const char* ErrMsg;
class tMacroInput : public tInput {
public:
@ -371,17 +371,17 @@ protected:
class tStringInput : public tInput {
public:
tStringInput(TPpContext* pp, TInputScanner& i) : tInput(pp), input(&i) { }
virtual int scan(TPpToken *);
virtual int scan(TPpToken*);
virtual int getch();
virtual void ungetch();
protected:
TInputScanner* input;
};
int InitScanner(TPpContext *cpp);
int ScanFromString(char *s);
int InitScanner(TPpContext* cpp);
int ScanFromString(char* s);
void missingEndifCheck();
int lFloatConst(char *str, int len, int ch, TPpToken * ppToken);
int lFloatConst(char* str, int len, int ch, TPpToken* ppToken);
bool inComment;
@ -394,17 +394,17 @@ protected:
TStringMap stringMap;
int nextAtom;
void InitAtomTable();
int AddAtomFixed(const char *s, int atom);
int LookUpAddString(const char *s);
const char *GetAtomString(int atom);
int AddAtomFixed(const char* s, int atom);
int LookUpAddString(const char* s);
const char* GetAtomString(int atom);
//
// From PpMemory.cpp
//
MemoryPool *mem_CreatePool(size_t chunksize, unsigned align);
void mem_FreePool(MemoryPool *);
void *mem_Alloc(MemoryPool *p, size_t size);
int mem_AddCleanup(MemoryPool *p, void (*fn)(void *, void*), void *arg1, void* arg2);
void mem_FreePool(MemoryPool*);
void *mem_Alloc(MemoryPool* p, size_t size);
int mem_AddCleanup(MemoryPool* p, void (*fn)(void *, void*), void* arg1, void* arg2);
};
} // end namespace glslang

View file

@ -98,15 +98,15 @@ namespace glslang {
*/
TPpContext::Symbol* TPpContext::NewSymbol(int atom)
{
Symbol *lSymb;
char *pch;
Symbol* lSymb;
char* pch;
int ii;
lSymb = (Symbol *) mem_Alloc(pool, sizeof(Symbol));
lSymb->atom = atom;
// Clear macro
pch = (char *) &lSymb->mac;
pch = (char*) &lSymb->mac;
for (ii = 0; ii < sizeof(lSymb->mac); ii++)
*pch++ = 0;

View file

@ -117,8 +117,8 @@ int TPpContext::lReadByte(TokenStream *pTok)
*/
void TPpContext::RecordToken(TokenStream *pTok, int token, TPpToken* ppToken)
{
const char *s;
char *str = NULL;
const char* s;
char* str = NULL;
if (token > 256)
lAddByte(pTok, (unsigned char)((token & 0x7f) + 0x80));
@ -164,7 +164,7 @@ int TPpContext::ReadToken(TokenStream *pTok, TPpToken *ppToken)
{
char tokenText[TPpToken::maxTokenLength + 1];
int ltoken, len;
char ch;
int ch;
ltoken = lReadByte(pTok);
ppToken->loc = parseContext.getCurrentLoc();