1
0
forked from 0ad/0ad

Linux/GCC/glibc Compat

This was SVN commit r1532.
This commit is contained in:
Simon Brenner 2004-12-18 23:30:28 +00:00
parent c9d89e964b
commit 46f5c61179
12 changed files with 30 additions and 23 deletions

View File

@ -8,6 +8,8 @@
#include "precompiled.h"
#include "lib.h"
#include "Patch.h"
#include "MiniPatch.h"
#include "Terrain.h"

View File

@ -36,4 +36,4 @@ void CGUISpriteInstance::Invalidate()
bool CGUISpriteInstance::IsEmpty() const
{
return m_SpriteName=="";
}
}

View File

@ -21,6 +21,8 @@ gee@pyro.nu
//--------------------------------------------------------
// Includes / Compiler directives
//--------------------------------------------------------
#include <map>
#include <vector>
// I would like to just forward declare CSize, but it doesn't
// seem to be defined anywhere in the predefined header.

View File

@ -41,4 +41,4 @@ TYPE(EAlign)
#endif
#ifndef GUITYPE_IGNORE_EVAlign
TYPE(EVAlign)
#endif
#endif

View File

@ -21,6 +21,7 @@ gee@pyro.nu
//--------------------------------------------------------
// Includes / Compiler directives
//--------------------------------------------------------
#include "GUIbase.h"
#include "Parser.h"
// TODO Gee: New
#include "Overlay.h"

View File

@ -236,7 +236,12 @@ struct DirEnt
// in order of decl in VC2003 sys/stat.h.
mode_t st_mode;
off_t st_size;
// glibc compat hack - they have st_mtime #defined to st_mtim.tv_sec
#ifdef st_mtime
struct timespec st_mtim;
#else
time_t st_mtime;
#endif
DirEnt(const char* _name, mode_t _st_mode, off_t _st_size, time_t _st_mtime)
: name(_name)

View File

@ -329,7 +329,7 @@ struct TLoc
// container must not invalidate iterators after insertion!
// (we keep and pass around pointers to Mount.archive_locs elements)
// see below.
typedef std::list<const TLoc> TLocs;
typedef std::list<TLoc> TLocs;
typedef TLocs::iterator TLocIt;
@ -1902,7 +1902,7 @@ int vfs_unmap(const Handle hf)
// write a representation of the VFS tree to stdout.
inline void vfs_display()
void vfs_display()
{
tree_display();
}

View File

@ -161,13 +161,16 @@ static int z_find_ecdr(const u8* file, size_t size, const u8*& ecdr_)
if(*(u32*)ecdr == *(u32*)&ecdr_id)
goto found_ecdr;
// scan the last 66000 bytes of file for ecdr_id signature
// (the Zip archive comment field, up to 64k, may follow ECDR).
// if the zip file is < 66000 bytes, scan the whole file.
const u8* start = file + size - MIN(66000, size);
ecdr = z_find_id(file, size, start, ecdr_id, ECDR_SIZE);
if(!ecdr)
return ERR_CORRUPTED;
// jump crosses init, blah blah
{
// scan the last 66000 bytes of file for ecdr_id signature
// (the Zip archive comment field, up to 64k, may follow ECDR).
// if the zip file is < 66000 bytes, scan the whole file.
const u8* start = file + size - MIN(66000, size);
ecdr = z_find_id(file, size, start, ecdr_id, ECDR_SIZE);
if(!ecdr)
return ERR_CORRUPTED;
}
found_ecdr:
ecdr_ = ecdr;

View File

@ -23,13 +23,11 @@
extern "C" {
#endif
// high resolution (> 1 µs) timestamp [s], starting at or near 0 s.
extern double get_time();
extern double timer_res();
// calculate fps (call once per frame)
// several smooth filters (tuned for ~100 FPS)
// => less fluctuation, but rapid tracking
@ -38,9 +36,9 @@ extern int fps;
extern void calc_fps();
#ifdef __cplusplus
}
#endif
#include <string>
@ -75,9 +73,4 @@ public:
#define TIMER(name) ScopedTimer name(#name);
#ifdef __cplusplus
}
#endif
#endif // #ifndef TIMER_H

View File

@ -1086,4 +1086,4 @@ CParser& CParserCache::Get(const char* str)
CParser* parser = it->second;
return *parser;
}
}
}

View File

@ -234,6 +234,7 @@ private:
template <typename T, typename P> class SDMap : public std::map<T,P>
{
public:
typedef typename std::map<T,P>::iterator iterator;
~SDMap()
{
for (iterator it = begin(); it != end(); ++it) delete it->second;

View File

@ -265,4 +265,4 @@ jsval JSParseString( const CStrW& Native )
return( BOOLEAN_TO_JSVAL( boolResult ) );
return( ToJSVal( Native ) );
}
}