Pass 1 at building on linux: remove compile errors from machine independent.

git-svn-id: https://cvs.khronos.org/svn/repos/ogl/trunk/ecosystem/public/sdk/tools/glslang@20536 e7fa87d3-cd2b-0410-9028-fcbf551c1848
This commit is contained in:
John Kessenich 2013-02-11 22:36:01 +00:00
parent dadf945fd7
commit 54d8cda95e
24 changed files with 176 additions and 172 deletions

View file

@ -39,10 +39,14 @@
#ifdef _WIN32
#include <basetsd.h>
#define snprintf sprintf_s
#define safe_vsprintf(buf,max,format,args) vsnprintf_s((buf), (max), (max), (format), (args))
#elif defined (solaris)
#define safe_vsprintf(buf,max,format,args) vsnprintf((buf), (max), (format), (args))
#include <sys/int_types.h>
#define UINT_PTR uintptr_t
#else
#define safe_vsprintf(buf,max,format,args) vsnprintf((buf), (max), (format), (args))
#include <stdint.h>
#define UINT_PTR uintptr_t
#endif
@ -60,11 +64,10 @@
#include <list>
#include <string>
#include <stdio.h>
#include <assert.h>
typedef int TSourceLoc;
#include <assert.h>
#include "PoolAlloc.h"
//
@ -171,9 +174,9 @@ __inline TPersistString FormatSourceLoc(const TSourceLoc loc)
int line = loc & SourceLocLineMask;
if (line)
sprintf_s(locText, maxSize, "%d:%d", string, line);
snprintf(locText, maxSize, "%d:%d", string, line);
else
sprintf_s(locText, maxSize, "%d:? ", string);
snprintf(locText, maxSize, "%d:? ", string);
return TPersistString(locText);
}

View file

@ -73,7 +73,7 @@ public:
TInfoSinkBase& operator<<(int n) { append(String(n)); return *this; }
TInfoSinkBase& operator<<(const unsigned int n) { append(String(n)); return *this; }
TInfoSinkBase& operator<<(float n) { const int size = 40; char buf[size];
sprintf_s(buf, size, (fabs(n) > 1e-8 && fabs(n) < 1e8) || n == 0.0f ?
snprintf(buf, size, (fabs(n) > 1e-8 && fabs(n) < 1e8) || n == 0.0f ?
"%f" : "%g", n);
append(buf);
return *this; }

View file

@ -104,7 +104,7 @@ public:
}
private:
void checkGuardBlock(unsigned char* blockMem, unsigned char val, char* locText) const;
void checkGuardBlock(unsigned char* blockMem, unsigned char val, const char* locText) const;
// Find offsets to pre and post guard blocks, and user data buffer
unsigned char* preGuard() const { return mem + headerSize(); }

View file

@ -140,7 +140,7 @@ public:
};
typedef std::map<TTypeList*, TTypeList*> TStructureMap;
typedef std::map<TTypeList*, TTypeList*>::iterator TStructureMapIterator;
typedef std::map<TTypeList*, TTypeList*>::const_iterator TStructureMapIterator;
//
// Base class for things that have a type.
//
@ -178,7 +178,7 @@ public:
TType(const TType& type) { *this = type; }
void copyType(const TType& copyOf, TStructureMap& remapper)
void copyType(const TType& copyOf, const TStructureMap& remapper)
{
type = copyOf.type;
qualifier = copyOf.qualifier;
@ -226,7 +226,7 @@ public:
arrayInformationType = 0; // arrayInformationType should not be set for builtIn symbol table level
}
TType* clone(TStructureMap& remapper)
TType* clone(const TStructureMap& remapper)
{
TType *newType = new TType();
newType->copyType(*this, remapper);
@ -294,7 +294,7 @@ public:
void setArrayInformationType(TType* t) { arrayInformationType = t; }
TType* getArrayInformationType() { return arrayInformationType; }
virtual bool isVector() const { return vectorSize > 1; }
static char* getBasicString(TBasicType t) {
static const char* getBasicString(TBasicType t) {
switch (t) {
case EbtVoid: return "void"; break;
case EbtFloat: return "float"; break;