1
0
forked from 0ad/0ad

# Fixed Linux build

Use noncopyable instead of boost::noncopyable. (But maybe this should be
changed to the NONCOPYABLE macro instead?)
Use boost::filesystem::wpath::file_string instead of
external_file_string, since the latter varies between std::string on
Linux and std::wstring on Windows.
Use wcstombs instead of wcstombs_s.
Use rtl_AllocateAligned instead of _mm_malloc.

This was SVN commit r6574.
This commit is contained in:
Ykkrosh 2009-01-02 21:19:41 +00:00
parent b7585c1cd4
commit 5228800b73
32 changed files with 44 additions and 42 deletions

View File

@ -54,7 +54,7 @@ const float CGameView::defaultFOV = DEGTORAD(20.f);
const float CGameView::defaultNear = 4.f;
const float CGameView::defaultFar = 4096.f;
class CGameViewImpl : public CJSObject<CGameViewImpl>, boost::noncopyable
class CGameViewImpl : public CJSObject<CGameViewImpl>, noncopyable
{
public:
CGameViewImpl(CGame* game)

View File

@ -21,7 +21,7 @@ struct JSObject;
class CGameViewImpl;
class CGameView : private Scene, public boost::noncopyable
class CGameView : private Scene, public noncopyable
{
public:
static const float defaultFOV, defaultNear, defaultFar;

View File

@ -239,7 +239,7 @@ int CMapReader::ApplyData()
// Holds various state data while reading maps, so that loading can be
// interrupted (e.g. to update the progress display) then later resumed.
class CXMLReader : boost::noncopyable
class CXMLReader : noncopyable
{
public:
CXMLReader(const CStr& xml_filename, CMapReader& mapReader)

View File

@ -11,7 +11,7 @@ typedef shared_ptr<CModelDef> CModelDefPtr;
class CColladaManager;
class CMeshManager : boost::noncopyable
class CMeshManager : noncopyable
{
public:
CMeshManager(CColladaManager& colladaManager);

View File

@ -28,7 +28,7 @@ class CSkeletonAnimManager;
///////////////////////////////////////////////////////////////////////////////
// CModel: basically, a mesh object - holds the texturing and skinning
// information for a model in game
class CModel : public CRenderableObject, boost::noncopyable
class CModel : public CRenderableObject, noncopyable
{
friend class CUnitAnimation;
// HACK - we should probably move the rest of this class's animation state

View File

@ -10,7 +10,7 @@ class CObjectManager;
#include <map>
#include "ps/CStr.h"
class CObjectBase : boost::noncopyable
class CObjectBase : noncopyable
{
public:

View File

@ -15,7 +15,7 @@ class CSkeletonAnimManager;
///////////////////////////////////////////////////////////////////////////////////////////
// CObjectManager: manager class for all possible actor types
class CObjectManager : boost::noncopyable
class CObjectManager : noncopyable
{
public:
struct ObjectKey

View File

@ -19,7 +19,7 @@ class CStr8;
///////////////////////////////////////////////////////////////////////////////
// CSkeletonAnimManager : owner class of all skeleton anims - manages creation,
// loading and destruction of animation data
class CSkeletonAnimManager : boost::noncopyable
class CSkeletonAnimManager : noncopyable
{
public:
// constructor, destructor

View File

@ -22,7 +22,7 @@ const size_t invalidUnitId = ~size_t(0);
/////////////////////////////////////////////////////////////////////////////////////////////
// CUnit: simple "actor" definition - defines a sole object within the world
class CUnit : boost::noncopyable
class CUnit : noncopyable
{
private:
// Private constructor. Needs complete list of selections for the variation.

View File

@ -5,7 +5,7 @@
class CUnit;
class CUnitAnimation : boost::noncopyable
class CUnitAnimation : noncopyable
{
public:
CUnitAnimation(CUnit& unit);

View File

@ -27,7 +27,7 @@ namespace I18n
};
class TSComponentString : public TSComponent, boost::noncopyable
class TSComponentString : public TSComponent, noncopyable
{
public:
TSComponentString(const wchar_t* s) : String(s) {}
@ -39,7 +39,7 @@ namespace I18n
};
class TSComponentVariable : public TSComponent, boost::noncopyable
class TSComponentVariable : public TSComponent, noncopyable
{
public:
TSComponentVariable(unsigned char id) : ID(id) {}
@ -51,7 +51,7 @@ namespace I18n
};
class TSComponentFunction : public TSComponent, boost::noncopyable
class TSComponentFunction : public TSComponent, noncopyable
{
public:
TSComponentFunction(const char* name) : Name(name) {}

View File

@ -2,6 +2,7 @@
#define INCLUDED_SHARED_PTR
#include "lib/sysdep/arch/x86_x64/x86_x64.h"
#include "lib/sysdep/rtl.h" // rtl_AllocateAligned
struct DummyDeleter
{
@ -41,7 +42,7 @@ struct AlignedDeleter
template<class T>
shared_ptr<T> AllocateAligned(size_t size)
{
return shared_ptr<T>((T*)_mm_malloc(size, x86_x64_L1CacheLineSize()), AlignedDeleter());
return shared_ptr<T>((T*)rtl_AllocateAligned(size, x86_x64_L1CacheLineSize()), AlignedDeleter());
}
#endif // #ifndef INCLUDED_SHARED_PTR

View File

@ -1095,4 +1095,4 @@ LibError trace_run(const char* osPathname)
return INFO::OK;
}
#endif
#endif

View File

@ -46,10 +46,9 @@ public:
virtual LibError Open(const fs::wpath& pathname, char mode)
{
size_t numConverted;
char pathname_c[PATH_MAX];
const errno_t ret = wcstombs_s(&numConverted, pathname_c, pathname.external_file_string().c_str(), PATH_MAX);
debug_assert(ret == 0);
size_t numConverted = wcstombs(pathname_c, pathname.file_string().c_str(), PATH_MAX);
debug_assert(numConverted < PATH_MAX);
return Open(pathname_c, mode);
}

View File

@ -222,13 +222,13 @@ errno_t _wfopen_s(FILE** pfile, const wchar_t* filename, const wchar_t* mode)
{
*pfile = NULL;
size_t numConverted; errno_t ret;
size_t numConverted;
char filename_c[PATH_MAX];
ret = wcstombs_s(&numConverted, filename_c, filename, PATH_MAX);
debug_assert(ret == 0);
numConverted = wcstombs(filename_c, filename, PATH_MAX);
debug_assert(numConverted < PATH_MAX);
char mode_c[PATH_MAX];
ret = wcstombs_s(&numConverted, mode_c, mode, PATH_MAX);
debug_assert(ret == 0);
numConverted = wcstombs(mode_c, mode, PATH_MAX);
debug_assert(numConverted < PATH_MAX);
return fopen_s(pfile, filename_c, mode_c);
}

View File

@ -58,4 +58,4 @@ void rtl_FreeAligned(void* alignedPointer)
free(((void**)alignedPointer)[-1]);
}
#endif
#endif

View File

@ -17,6 +17,8 @@
# include "lib/sysdep/os_cpu.h" // os_cpu_ClockFrequency
#endif
#include <sstream> // std::stringstream
/**
* timer_Time will subsequently return values relative to the current time.
**/

View File

@ -12,7 +12,7 @@ extern CLogger* g_Logger;
#define LOG (g_Logger->Log)
#define LOG_ONCE (g_Logger->LogOnce)
class CLogger : boost::noncopyable
class CLogger : noncopyable
{
public:
enum ELogMethod
@ -72,7 +72,7 @@ private:
* Helper class for unit tests - captures all log output while it is in scope,
* and returns it as a single string.
*/
class TestLogger : boost::noncopyable
class TestLogger : noncopyable
{
public:
TestLogger();

View File

@ -29,7 +29,7 @@ class CGameAttributes;
* a set of attributes provided. The CGame object is also responsible for
* maintaining the relations between CPlayer and CWorld, CSimulation and CWorld.
**/
class CGame : boost::noncopyable
class CGame : noncopyable
{
/**
* pointer to the CWorld object representing the game world.

View File

@ -1613,4 +1613,4 @@ bool CBuildingPlacer::IsWithinLimit( CVector3D pos )
}
}
}

View File

@ -24,7 +24,7 @@ static bool ldr_was_interrupted(int ret)
return (0 < ret && ret <= 100);
}
template<class T> struct MemFun_t : boost::noncopyable
template<class T> struct MemFun_t : noncopyable
{
T* const this_;
int (T::*func)(void);
@ -53,7 +53,7 @@ template<class T> void RegMemFun(T* this_, int(T::*func)(void),
////////////////////////////////////////////////////////
template<class T, class Arg> struct MemFun1_t : boost::noncopyable
template<class T, class Arg> struct MemFun1_t : noncopyable
{
T* const this_;
Arg arg;

View File

@ -179,4 +179,4 @@ jsval_t CPlayer::JSI_GetDiplomaticStance(JSContext *cx, uintN UNUSED(argc), jsva
JS_ReportError( cx, "Could not convert argument 1 to a Player object" );
return JSVAL_VOID;
}
}
}

View File

@ -135,7 +135,7 @@ public:
// CScopeLock
// ---------------------------------------------------------------------| Class
// Locks a CMutex over the objects lifetime
class CScopeLock : boost::noncopyable
class CScopeLock : noncopyable
{
public:
inline CScopeLock(pthread_mutex_t &mutex): m_Mutex(mutex)

View File

@ -29,7 +29,7 @@ class CTerrain;
* CWorld is a general data class containing whatever is needed to accurately represent the world.
* This includes the map, entities, influence maps, tiles, heightmap, etc.
**/
class CWorld : boost::noncopyable
class CWorld : noncopyable
{
/**
* pointer to the CGame object representing the game.

View File

@ -65,7 +65,7 @@
* Accesses CRenderer::m_Stats by keeping the reference passed to the
* constructor.
*/
class CRendererStatsTable : public AbstractProfileTable, boost::noncopyable
class CRendererStatsTable : public AbstractProfileTable, noncopyable
{
public:
CRendererStatsTable(const CRenderer::Stats& st);
@ -187,7 +187,7 @@ enum {
* Struct CRendererInternals: Truly hide data that is supposed to be hidden
* in this structure so it won't even appear in header files.
*/
struct CRendererInternals : public boost::noncopyable
struct CRendererInternals : public noncopyable
{
/// true if CRenderer::Open has been called
bool IsOpen;

View File

@ -74,7 +74,7 @@ enum EntityFlags
// TODO MT: Put this is /some/ sort of order...
class CEntity : public CJSComplex<CEntity>, public IEventTarget, boost::noncopyable
class CEntity : public CJSComplex<CEntity>, public IEventTarget, noncopyable
{
friend class CEntityManager;
friend class CUnit;

View File

@ -27,7 +27,7 @@ class CPlayer;
class CXeromyces;
class XMBElement;
class CEntityTemplate : public CJSComplex<CEntityTemplate>, public IEventTarget, boost::noncopyable
class CEntityTemplate : public CJSComplex<CEntityTemplate>, public IEventTarget, noncopyable
{
public:
CPlayer* m_player; // Which player this template is for, or null for the no-player template

View File

@ -30,7 +30,7 @@ enum EPathType
};
class CPathfindEngine : public Singleton<CPathfindEngine>, boost::noncopyable
class CPathfindEngine : public Singleton<CPathfindEngine>, noncopyable
{
public:

View File

@ -34,7 +34,7 @@ public:
~CTechnology() {}
// noncopyable (avoid VC7.1 warning); don't derive from
// boost::noncopyable, so that multiple inheritance is avoided
// noncopyable, so that multiple inheritance is avoided
private:
CTechnology(const CTechnology&);
const CTechnology& operator=(const CTechnology&);

View File

@ -24,7 +24,7 @@
#include "renderer/Scene.h"
#include "renderer/SkyManager.h"
struct ActorViewerImpl : public Scene, boost::noncopyable
struct ActorViewerImpl : public Scene, noncopyable
{
ActorViewerImpl()
: Unit(NULL), ColladaManager(), MeshManager(ColladaManager), SkeletonAnimManager(ColladaManager),

View File

@ -6,7 +6,7 @@ struct SColor4ub;
class CUnit;
class CStrW;
class ActorViewer : boost::noncopyable
class ActorViewer : noncopyable
{
public:
ActorViewer();

View File

@ -4,7 +4,7 @@
#include "ps/CStr.h"
#include <queue>
class MessagePasserImpl : public AtlasMessage::MessagePasser, boost::noncopyable
class MessagePasserImpl : public AtlasMessage::MessagePasser, noncopyable
{
public:
MessagePasserImpl();