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 "precompiled.h"
#include "lib.h"
#include "Patch.h" #include "Patch.h"
#include "MiniPatch.h" #include "MiniPatch.h"
#include "Terrain.h" #include "Terrain.h"

View File

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

View File

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

View File

@ -236,7 +236,12 @@ struct DirEnt
// in order of decl in VC2003 sys/stat.h. // in order of decl in VC2003 sys/stat.h.
mode_t st_mode; mode_t st_mode;
off_t st_size; 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; time_t st_mtime;
#endif
DirEnt(const char* _name, mode_t _st_mode, off_t _st_size, time_t _st_mtime) DirEnt(const char* _name, mode_t _st_mode, off_t _st_size, time_t _st_mtime)
: name(_name) : name(_name)

View File

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

View File

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

View File

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

View File

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