mirror of
https://github.com/SWG-Source/src.git
synced 2026-09-11 23:45:01 -04:00
Datatables now compiling correctly
This commit is contained in:
@@ -49,11 +49,11 @@ typedef int32_t flex_int32_t;
|
||||
typedef uint32_t flex_uint32_t;
|
||||
#else
|
||||
typedef signed char flex_int8_t;
|
||||
typedef short int flex_int16_t;
|
||||
typedef int flex_int32_t;
|
||||
typedef short short int flex_int16_t;
|
||||
typedef short int flex_int32_t;
|
||||
typedef unsigned char flex_uint8_t;
|
||||
typedef unsigned short int flex_uint16_t;
|
||||
typedef unsigned int flex_uint32_t;
|
||||
typedef unsigned short short int flex_uint16_t;
|
||||
typedef unsigned short int flex_uint32_t;
|
||||
|
||||
/* Limits of integral types. */
|
||||
#ifndef INT8_MIN
|
||||
|
||||
@@ -29,6 +29,7 @@
|
||||
#include <wchar.h> /* for wide character (16bit) strings */
|
||||
#include <ctype.h> /* for strtoupper and strtolower */
|
||||
#include <stdio.h>
|
||||
#include <stdint.h> /* for standard types - i.e. uint32_t */
|
||||
|
||||
/*----------------------------------------------------------------**
|
||||
** debug options, turn these on to TEST ONLY! don't leave these **
|
||||
@@ -66,11 +67,11 @@ void checkPragmas(void);
|
||||
|
||||
void includeBinary(char *fname);
|
||||
|
||||
void write32(long i32);
|
||||
void write16(short i16);
|
||||
void write32(int32_t i32);
|
||||
void write16(int16_t i16);
|
||||
void write8(char i8);
|
||||
void writeU32(unsigned long ui32);
|
||||
void writeU16(unsigned short ui16);
|
||||
void writeU32(uint32_t ui32);
|
||||
void writeU16(uint16_t ui16);
|
||||
void writeU8(unsigned char u8);
|
||||
void writeDouble(double d);
|
||||
void writeFloat(float f);
|
||||
@@ -627,14 +628,14 @@ void checkArgs(void)
|
||||
/*----------------------------**
|
||||
** Write to FILE functions... **
|
||||
**----------------------------*/
|
||||
void write32(long i32)
|
||||
void write32(int32_t i32)
|
||||
{
|
||||
MIFFinsertChunkData(&i32, sizeof(long));
|
||||
MIFFinsertChunkData(&i32, sizeof(int32_t));
|
||||
}
|
||||
|
||||
void write16(short i16)
|
||||
void write16(int16_t i16)
|
||||
{
|
||||
MIFFinsertChunkData(&i16, sizeof(short));
|
||||
MIFFinsertChunkData(&i16, sizeof(int16_t));
|
||||
}
|
||||
|
||||
void write8(char i8)
|
||||
@@ -642,14 +643,14 @@ void write8(char i8)
|
||||
MIFFinsertChunkData(&i8, sizeof(char));
|
||||
}
|
||||
|
||||
void writeU32(unsigned long ui32)
|
||||
void writeU32(uint32_t ui32)
|
||||
{
|
||||
MIFFinsertChunkData(&ui32, sizeof(long));
|
||||
MIFFinsertChunkData(&ui32, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
void writeU16(unsigned short ui16)
|
||||
void writeU16(uint16_t ui16)
|
||||
{
|
||||
MIFFinsertChunkData(&ui16, sizeof(short));
|
||||
MIFFinsertChunkData(&ui16, sizeof(uint16_t));
|
||||
}
|
||||
|
||||
void writeU8(unsigned char ui8)
|
||||
|
||||
@@ -134,11 +134,11 @@ void checkPragmas(void);
|
||||
|
||||
void includeBinary(char *fname);
|
||||
|
||||
void write32(long i32);
|
||||
void write16(short i16);
|
||||
void write32(int32_t i32);
|
||||
void write16(int16_t i16);
|
||||
void write8(char i8);
|
||||
void writeU32(unsigned long ui32);
|
||||
void writeU16(unsigned short ui16);
|
||||
void writeU32(uint32_t ui32);
|
||||
void writeU16(uint16_t ui16);
|
||||
void writeU8(unsigned char u8);
|
||||
void writeDouble(double d);
|
||||
void writeFloat(float f);
|
||||
@@ -2829,14 +2829,14 @@ void checkArgs(void)
|
||||
/*----------------------------**
|
||||
** Write to FILE functions... **
|
||||
**----------------------------*/
|
||||
void write32(long i32)
|
||||
void write32(int32_t i32)
|
||||
{
|
||||
MIFFinsertChunkData(&i32, sizeof(long));
|
||||
MIFFinsertChunkData(&i32, sizeof(int32_t));
|
||||
}
|
||||
|
||||
void write16(short i16)
|
||||
void write16(int16_t i16)
|
||||
{
|
||||
MIFFinsertChunkData(&i16, sizeof(short));
|
||||
MIFFinsertChunkData(&i16, sizeof(int16_t));
|
||||
}
|
||||
|
||||
void write8(char i8)
|
||||
@@ -2844,14 +2844,14 @@ void write8(char i8)
|
||||
MIFFinsertChunkData(&i8, sizeof(char));
|
||||
}
|
||||
|
||||
void writeU32(unsigned long ui32)
|
||||
void writeU32(uint32_t ui32)
|
||||
{
|
||||
MIFFinsertChunkData(&ui32, sizeof(long));
|
||||
MIFFinsertChunkData(&ui32, sizeof(uint32_t));
|
||||
}
|
||||
|
||||
void writeU16(unsigned short ui16)
|
||||
void writeU16(uint16_t ui16)
|
||||
{
|
||||
MIFFinsertChunkData(&ui16, sizeof(short));
|
||||
MIFFinsertChunkData(&ui16, sizeof(uint16_t));
|
||||
}
|
||||
|
||||
void writeU8(unsigned char ui8)
|
||||
|
||||
+2
-2
@@ -31,8 +31,8 @@ namespace Base
|
||||
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef signed short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
@@ -744,10 +744,10 @@ void Iff::insertForm(Tag name, bool shouldEnterForm)
|
||||
|
||||
void Iff::insertChunk(Tag name, bool shouldEnterChunk)
|
||||
{
|
||||
const int CHUNK_OVERHEAD = sizeof(Tag) + sizeof(uint32);
|
||||
const int32 CHUNK_OVERHEAD = sizeof(Tag) + sizeof(uint32);
|
||||
|
||||
Tag t;
|
||||
int offset;
|
||||
int32 offset;
|
||||
|
||||
NOT_NULL(data);
|
||||
IFF_DEBUG_FATAL(inChunk, "inside chunk");
|
||||
|
||||
@@ -14,6 +14,7 @@
|
||||
#include "sharedFoundation/ConstCharCrcString.h"
|
||||
|
||||
#include <vector>
|
||||
#include <iostream>
|
||||
|
||||
// ======================================================================
|
||||
|
||||
@@ -164,6 +165,26 @@ ConstCharCrcString const CrcStringTable::lookUp(uint32 crc) const
|
||||
high = mid - 1;
|
||||
}
|
||||
|
||||
WARNING(true,("\n=========== Could not find entry 0x%08x with %d entries!!\n", crc, m_numberOfEntries));
|
||||
|
||||
low = 0;
|
||||
high = m_numberOfEntries - 1;
|
||||
|
||||
while (low <= high)
|
||||
{
|
||||
int const mid = (low + high) / 2;
|
||||
uint32 const entry = m_crcTable[mid];
|
||||
|
||||
WARNING(true, ("Checking 0x%08x against entry value 0x%08x at index %d", crc, entry, mid));
|
||||
if (crc == entry)
|
||||
return ConstCharCrcString(m_strings + m_stringsOffsetTable[mid], crc);
|
||||
else
|
||||
if (crc > entry)
|
||||
low = mid + 1;
|
||||
else
|
||||
high = mid - 1;
|
||||
}
|
||||
|
||||
return ConstCharCrcString("", 0);
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@
|
||||
#include "sharedObject/Object.h"
|
||||
#include "sharedFoundation/ConstCharCrcString.h"
|
||||
#include "sharedFoundation/CrcStringTable.h"
|
||||
#include "sharedFoundation/Crc.h"
|
||||
#include "sharedFoundation/DataResourceList.h"
|
||||
|
||||
#include <vector>
|
||||
@@ -174,7 +175,7 @@ void ObjectTemplateList::loadCrcStringTable(const char *fileName)
|
||||
ConstCharCrcString const ObjectTemplateList::lookUp(const char * string)
|
||||
{
|
||||
ConstCharCrcString result = ms_crcStringTable.lookUp(string);
|
||||
WARNING(result.isEmpty(), ("ObjectTemplateList::lookUp objectTemplate %s not found in table", string));
|
||||
WARNING(result.isEmpty(), ("ObjectTemplateList::lookUp objectTemplate %s (CRC 0x%08x) not found in table", string, Crc::calculate(string)));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ int DataTable::getIntValue(const std::string & column, int row) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
int DataTable::getIntValue(int column, int row) const
|
||||
int32 DataTable::getIntValue(int column, int row) const
|
||||
{
|
||||
DEBUG_FATAL(row < 0 || row >= getNumRows(), ("DataTable [%s] getIntValue(): Invalid row number [%d]. Rows=[%d]\n", m_name.c_str(), row, getNumRows()));
|
||||
DEBUG_FATAL(column < 0 || column >= getNumColumns(), ("DataTable [%s] getIntValue(): Invalid col number [%d]. Cols=[%d]\n", m_name.c_str(), column, getNumColumns()));
|
||||
@@ -210,7 +210,7 @@ int DataTable::getIntValue(int column, int row) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
int DataTable::getIntDefaultForColumn(const std::string & column) const
|
||||
int32 DataTable::getIntDefaultForColumn(const std::string & column) const
|
||||
{
|
||||
int const columnIndex = findColumnNumber(column);
|
||||
DEBUG_FATAL(columnIndex < 0 || columnIndex >= getNumColumns(), ("DataTable [%s] getIntDefaultForColumn(): Invalid col number [%d]. Cols=[%d]\n", m_name.c_str(), columnIndex, getNumColumns()));
|
||||
@@ -219,7 +219,7 @@ int DataTable::getIntDefaultForColumn(const std::string & column) const
|
||||
|
||||
//----------------------------------------------------------------------------
|
||||
|
||||
int DataTable::getIntDefaultForColumn(int column) const
|
||||
int32 DataTable::getIntDefaultForColumn(int column) const
|
||||
{
|
||||
DEBUG_FATAL(column < 0 || column >= getNumColumns(), ("DataTable [%s] getIntDefaultForColumn(): Invalid col number [%d]. Cols=[%d]\n", m_name.c_str(), column, getNumColumns()));
|
||||
DEBUG_FATAL(m_types[static_cast<size_t>(column)]->getBasicType() != DataTableColumnType::DT_Int, ("Wrong data type for column %d.", column));
|
||||
@@ -405,7 +405,7 @@ void DataTable::_readCell(Iff & iff, int column, int row)
|
||||
{
|
||||
case DataTableColumnType::DT_Int:
|
||||
{
|
||||
int tmp = iff.read_int32();
|
||||
int32 tmp = iff.read_int32();
|
||||
new (cell) DataTableCell(tmp);
|
||||
|
||||
break;
|
||||
@@ -677,7 +677,7 @@ int DataTable::searchColumnFloat( int column, float searchValue ) const
|
||||
|
||||
// ----------
|
||||
|
||||
int DataTable::searchColumnInt( int column, int searchValue ) const
|
||||
int DataTable::searchColumnInt( int column, int32 searchValue ) const
|
||||
{
|
||||
DEBUG_FATAL(column < 0 || column >= getNumColumns(), ("DataTable [%s] searchColumnInt(): Invalid col number [%d]. Cols=[%d]\n", m_name.c_str(), column, getNumColumns()));
|
||||
|
||||
|
||||
@@ -31,10 +31,10 @@ public:
|
||||
DataTableColumnType const &getDataTypeForColumn(const std::string& column) const;
|
||||
DataTableColumnType const &getDataTypeForColumn(int column) const;
|
||||
|
||||
int getIntValue(const std::string & column, int row) const;
|
||||
int getIntValue(int column, int row) const;
|
||||
int getIntDefaultForColumn(const std::string & column) const;
|
||||
int getIntDefaultForColumn(int column) const;
|
||||
int32 getIntValue(const std::string & column, int row) const;
|
||||
int32 getIntValue(int column, int row) const;
|
||||
int32 getIntDefaultForColumn(const std::string & column) const;
|
||||
int32 getIntDefaultForColumn(int column) const;
|
||||
float getFloatValue(const std::string & column, int row) const;
|
||||
float getFloatValue(int column, int row) const;
|
||||
float getFloatDefaultForColumn(const std::string & column) const;
|
||||
@@ -63,7 +63,7 @@ public:
|
||||
|
||||
int searchColumnString(int column, const std::string & searchValue) const;
|
||||
int searchColumnFloat(int column, float searchValue) const;
|
||||
int searchColumnInt(int column, int searchValue) const;
|
||||
int searchColumnInt(int column, int32 searchValue) const;
|
||||
|
||||
std::string const & getName() const;
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ void DataTableCell::operator delete(void *pointer)
|
||||
|
||||
// ----------------------------------------------------------------------
|
||||
|
||||
DataTableCell::DataTableCell(int value)
|
||||
DataTableCell::DataTableCell(int32 value)
|
||||
: m_type(CT_int)
|
||||
{
|
||||
m_value.m_i=value;
|
||||
|
||||
@@ -31,16 +31,16 @@ public:
|
||||
,CT_float
|
||||
};
|
||||
|
||||
explicit DataTableCell(int value);
|
||||
explicit DataTableCell(int32 value);
|
||||
explicit DataTableCell(float value);
|
||||
explicit DataTableCell(const char *value);
|
||||
~DataTableCell();
|
||||
|
||||
CellType getType() const { return m_type; }
|
||||
int getIntValue() const { return m_value.m_i; }
|
||||
float getFloatValue() const { return m_value.m_f; }
|
||||
const char *getStringValue() const;
|
||||
int getStringValueCrc() const { return m_value.m_s.m_crc; }
|
||||
CellType getType() const { return m_type; }
|
||||
int32 getIntValue() const { return m_value.m_i; }
|
||||
float getFloatValue() const { return m_value.m_f; }
|
||||
const char *getStringValue() const;
|
||||
int32 getStringValueCrc() const { return m_value.m_s.m_crc; }
|
||||
|
||||
private:
|
||||
const CellType m_type;
|
||||
@@ -48,12 +48,12 @@ private:
|
||||
{
|
||||
union
|
||||
{
|
||||
int m_i;
|
||||
int32 m_i;
|
||||
float m_f;
|
||||
struct
|
||||
{
|
||||
const char *m_sz;
|
||||
int m_crc;
|
||||
int32 m_crc;
|
||||
} m_s;
|
||||
};
|
||||
} m_value;
|
||||
|
||||
@@ -728,7 +728,7 @@ DataTableCell *DataTableWriter::_getNewCell(DataTableColumnType const &columnTyp
|
||||
switch (columnType.getBasicType())
|
||||
{
|
||||
case DataTableColumnType::DT_Int:
|
||||
return new DataTableCell(static_cast<int>(strtol(value.c_str(), nullptr, 0)));
|
||||
return new DataTableCell(static_cast<int32>(strtol(value.c_str(), nullptr, 0)));
|
||||
break;
|
||||
case DataTableColumnType::DT_Float:
|
||||
return new DataTableCell(static_cast<float>(atof(value.c_str())));
|
||||
@@ -859,7 +859,7 @@ void DataTableWriter::_saveRows(NamedDataTable * ndt, Iff& iff) const
|
||||
iff.insertChunk(TAG(R,O,W,S));
|
||||
|
||||
int numRows = static_cast<int>(ndt->m_rows.size());
|
||||
iff.insertChunkData(&numRows, sizeof(int));
|
||||
iff.insertChunkData(&numRows, sizeof(int32));
|
||||
std::vector<NamedDataTable::DataTableRow* >::iterator i = ndt->m_rows.begin();
|
||||
for (; i!= ndt->m_rows.end(); ++i)
|
||||
{
|
||||
@@ -873,8 +873,8 @@ void DataTableWriter::_saveRows(NamedDataTable * ndt, Iff& iff) const
|
||||
{
|
||||
const DataTableCell * cell = *j;
|
||||
NOT_NULL(cell);
|
||||
int tmp = cell->getIntValue();
|
||||
iff.insertChunkData(&tmp, sizeof(int));
|
||||
int32 tmp = cell->getIntValue();
|
||||
iff.insertChunkData(&tmp, sizeof(int32));
|
||||
break;
|
||||
}
|
||||
case DataTableColumnType::DT_Float:
|
||||
|
||||
+2
-2
@@ -28,8 +28,8 @@ namespace Base
|
||||
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef signed short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
+2
-2
@@ -25,8 +25,8 @@ namespace Base
|
||||
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace Base
|
||||
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef signed short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace Base
|
||||
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace Base
|
||||
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef signed short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace Base
|
||||
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
@@ -28,8 +28,8 @@ namespace Base
|
||||
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef signed short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
@@ -25,8 +25,8 @@ namespace Base
|
||||
|
||||
typedef signed char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
|
||||
typedef int32_t int32;
|
||||
typedef uint32_t uint32;
|
||||
|
||||
@@ -35,8 +35,8 @@ namespace soe
|
||||
{
|
||||
typedef char int8;
|
||||
typedef unsigned char uint8;
|
||||
typedef short int16;
|
||||
typedef unsigned short uint16;
|
||||
typedef int16_t int16;
|
||||
typedef uint16_t uint16;
|
||||
|
||||
#ifdef WIN32
|
||||
typedef int32_t int32;
|
||||
|
||||
+1
-1
@@ -32,7 +32,7 @@ bool TaskObjectTemplateListUpdater::process(DB::Session *session)
|
||||
int i_lines = 0;
|
||||
while(1)
|
||||
{
|
||||
int i_id;
|
||||
uint32 i_id;
|
||||
char s_name[4096];
|
||||
int i_retval = 0;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user