From 5228800b738a86b5fa34642f99b0c7ca7c4b991b Mon Sep 17 00:00:00 2001 From: Ykkrosh Date: Fri, 2 Jan 2009 21:19:41 +0000 Subject: [PATCH] # 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. --- source/graphics/GameView.cpp | 2 +- source/graphics/GameView.h | 2 +- source/graphics/MapReader.cpp | 2 +- source/graphics/MeshManager.h | 2 +- source/graphics/Model.h | 2 +- source/graphics/ObjectBase.h | 2 +- source/graphics/ObjectManager.h | 2 +- source/graphics/SkeletonAnimManager.h | 2 +- source/graphics/Unit.h | 2 +- source/graphics/UnitAnimation.h | 2 +- source/i18n/TSComponent.h | 6 +++--- source/lib/allocators/shared_ptr.h | 3 ++- source/lib/file/archive/archive_builder.cpp | 2 +- source/lib/file/file.cpp | 5 ++--- source/lib/secure_crt.cpp | 10 +++++----- source/lib/sysdep/rtl/gcc/gcc.cpp | 2 +- source/lib/timer.h | 2 ++ source/ps/CLogger.h | 4 ++-- source/ps/Game.h | 2 +- source/ps/Interact.cpp | 2 +- source/ps/LoaderThunks.h | 4 ++-- source/ps/Player.cpp | 2 +- source/ps/ThreadUtil.h | 2 +- source/ps/World.h | 2 +- source/renderer/Renderer.cpp | 4 ++-- source/simulation/Entity.h | 2 +- source/simulation/EntityTemplate.h | 2 +- source/simulation/PathfindEngine.h | 2 +- source/simulation/Technology.h | 2 +- source/tools/atlas/GameInterface/ActorViewer.cpp | 2 +- source/tools/atlas/GameInterface/ActorViewer.h | 2 +- source/tools/atlas/GameInterface/MessagePasserImpl.h | 2 +- 32 files changed, 44 insertions(+), 42 deletions(-) diff --git a/source/graphics/GameView.cpp b/source/graphics/GameView.cpp index fa473a8400..04da5fb753 100644 --- a/source/graphics/GameView.cpp +++ b/source/graphics/GameView.cpp @@ -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, boost::noncopyable +class CGameViewImpl : public CJSObject, noncopyable { public: CGameViewImpl(CGame* game) diff --git a/source/graphics/GameView.h b/source/graphics/GameView.h index feb06d6fd5..35f39ca564 100644 --- a/source/graphics/GameView.h +++ b/source/graphics/GameView.h @@ -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; diff --git a/source/graphics/MapReader.cpp b/source/graphics/MapReader.cpp index 2250d0d5bc..56dcdce1f7 100644 --- a/source/graphics/MapReader.cpp +++ b/source/graphics/MapReader.cpp @@ -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) diff --git a/source/graphics/MeshManager.h b/source/graphics/MeshManager.h index c6bc96064a..e254b4c830 100644 --- a/source/graphics/MeshManager.h +++ b/source/graphics/MeshManager.h @@ -11,7 +11,7 @@ typedef shared_ptr CModelDefPtr; class CColladaManager; -class CMeshManager : boost::noncopyable +class CMeshManager : noncopyable { public: CMeshManager(CColladaManager& colladaManager); diff --git a/source/graphics/Model.h b/source/graphics/Model.h index 0c5b7a8a13..85b2b959dd 100644 --- a/source/graphics/Model.h +++ b/source/graphics/Model.h @@ -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 diff --git a/source/graphics/ObjectBase.h b/source/graphics/ObjectBase.h index 70fe63c026..6457b4e2a0 100644 --- a/source/graphics/ObjectBase.h +++ b/source/graphics/ObjectBase.h @@ -10,7 +10,7 @@ class CObjectManager; #include #include "ps/CStr.h" -class CObjectBase : boost::noncopyable +class CObjectBase : noncopyable { public: diff --git a/source/graphics/ObjectManager.h b/source/graphics/ObjectManager.h index 697c3f6067..ac25a3e808 100644 --- a/source/graphics/ObjectManager.h +++ b/source/graphics/ObjectManager.h @@ -15,7 +15,7 @@ class CSkeletonAnimManager; /////////////////////////////////////////////////////////////////////////////////////////// // CObjectManager: manager class for all possible actor types -class CObjectManager : boost::noncopyable +class CObjectManager : noncopyable { public: struct ObjectKey diff --git a/source/graphics/SkeletonAnimManager.h b/source/graphics/SkeletonAnimManager.h index 0348213bfa..f154e24a98 100644 --- a/source/graphics/SkeletonAnimManager.h +++ b/source/graphics/SkeletonAnimManager.h @@ -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 diff --git a/source/graphics/Unit.h b/source/graphics/Unit.h index 0e9a72f876..936ca6288d 100644 --- a/source/graphics/Unit.h +++ b/source/graphics/Unit.h @@ -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. diff --git a/source/graphics/UnitAnimation.h b/source/graphics/UnitAnimation.h index 24f18da21c..47df47b3b2 100644 --- a/source/graphics/UnitAnimation.h +++ b/source/graphics/UnitAnimation.h @@ -5,7 +5,7 @@ class CUnit; -class CUnitAnimation : boost::noncopyable +class CUnitAnimation : noncopyable { public: CUnitAnimation(CUnit& unit); diff --git a/source/i18n/TSComponent.h b/source/i18n/TSComponent.h index 6ce2a292e0..9702a19609 100644 --- a/source/i18n/TSComponent.h +++ b/source/i18n/TSComponent.h @@ -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) {} diff --git a/source/lib/allocators/shared_ptr.h b/source/lib/allocators/shared_ptr.h index 209b9f013b..c822bcd883 100644 --- a/source/lib/allocators/shared_ptr.h +++ b/source/lib/allocators/shared_ptr.h @@ -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 shared_ptr AllocateAligned(size_t size) { - return shared_ptr((T*)_mm_malloc(size, x86_x64_L1CacheLineSize()), AlignedDeleter()); + return shared_ptr((T*)rtl_AllocateAligned(size, x86_x64_L1CacheLineSize()), AlignedDeleter()); } #endif // #ifndef INCLUDED_SHARED_PTR diff --git a/source/lib/file/archive/archive_builder.cpp b/source/lib/file/archive/archive_builder.cpp index 3580e6152a..d976c6cc03 100644 --- a/source/lib/file/archive/archive_builder.cpp +++ b/source/lib/file/archive/archive_builder.cpp @@ -1095,4 +1095,4 @@ LibError trace_run(const char* osPathname) return INFO::OK; } -#endif \ No newline at end of file +#endif diff --git a/source/lib/file/file.cpp b/source/lib/file/file.cpp index 5202df1083..49fa88e271 100644 --- a/source/lib/file/file.cpp +++ b/source/lib/file/file.cpp @@ -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); } diff --git a/source/lib/secure_crt.cpp b/source/lib/secure_crt.cpp index 776fc4d8e6..71969214b1 100644 --- a/source/lib/secure_crt.cpp +++ b/source/lib/secure_crt.cpp @@ -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); } diff --git a/source/lib/sysdep/rtl/gcc/gcc.cpp b/source/lib/sysdep/rtl/gcc/gcc.cpp index 5833ae3da9..220adbeae1 100644 --- a/source/lib/sysdep/rtl/gcc/gcc.cpp +++ b/source/lib/sysdep/rtl/gcc/gcc.cpp @@ -58,4 +58,4 @@ void rtl_FreeAligned(void* alignedPointer) free(((void**)alignedPointer)[-1]); } -#endif \ No newline at end of file +#endif diff --git a/source/lib/timer.h b/source/lib/timer.h index a2ff7d7c66..009699fc80 100644 --- a/source/lib/timer.h +++ b/source/lib/timer.h @@ -17,6 +17,8 @@ # include "lib/sysdep/os_cpu.h" // os_cpu_ClockFrequency #endif +#include // std::stringstream + /** * timer_Time will subsequently return values relative to the current time. **/ diff --git a/source/ps/CLogger.h b/source/ps/CLogger.h index e87e59c53f..2466b8ca50 100644 --- a/source/ps/CLogger.h +++ b/source/ps/CLogger.h @@ -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(); diff --git a/source/ps/Game.h b/source/ps/Game.h index 7711df85f4..f13f58123f 100644 --- a/source/ps/Game.h +++ b/source/ps/Game.h @@ -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. diff --git a/source/ps/Interact.cpp b/source/ps/Interact.cpp index 4f19ffc473..5b114ac274 100644 --- a/source/ps/Interact.cpp +++ b/source/ps/Interact.cpp @@ -1613,4 +1613,4 @@ bool CBuildingPlacer::IsWithinLimit( CVector3D pos ) } -} \ No newline at end of file +} diff --git a/source/ps/LoaderThunks.h b/source/ps/LoaderThunks.h index a247aae06d..e0ade92394 100644 --- a/source/ps/LoaderThunks.h +++ b/source/ps/LoaderThunks.h @@ -24,7 +24,7 @@ static bool ldr_was_interrupted(int ret) return (0 < ret && ret <= 100); } -template struct MemFun_t : boost::noncopyable +template struct MemFun_t : noncopyable { T* const this_; int (T::*func)(void); @@ -53,7 +53,7 @@ template void RegMemFun(T* this_, int(T::*func)(void), //////////////////////////////////////////////////////// -template struct MemFun1_t : boost::noncopyable +template struct MemFun1_t : noncopyable { T* const this_; Arg arg; diff --git a/source/ps/Player.cpp b/source/ps/Player.cpp index 5ab936a111..8a21068a21 100644 --- a/source/ps/Player.cpp +++ b/source/ps/Player.cpp @@ -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; } -} \ No newline at end of file +} diff --git a/source/ps/ThreadUtil.h b/source/ps/ThreadUtil.h index 0be2916271..454c9ba2eb 100644 --- a/source/ps/ThreadUtil.h +++ b/source/ps/ThreadUtil.h @@ -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) diff --git a/source/ps/World.h b/source/ps/World.h index 5a060330ec..c00cdc4f57 100644 --- a/source/ps/World.h +++ b/source/ps/World.h @@ -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. diff --git a/source/renderer/Renderer.cpp b/source/renderer/Renderer.cpp index 95361dbcc8..3366951915 100644 --- a/source/renderer/Renderer.cpp +++ b/source/renderer/Renderer.cpp @@ -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; diff --git a/source/simulation/Entity.h b/source/simulation/Entity.h index 528202c0c2..c3734e7e97 100644 --- a/source/simulation/Entity.h +++ b/source/simulation/Entity.h @@ -74,7 +74,7 @@ enum EntityFlags // TODO MT: Put this is /some/ sort of order... -class CEntity : public CJSComplex, public IEventTarget, boost::noncopyable +class CEntity : public CJSComplex, public IEventTarget, noncopyable { friend class CEntityManager; friend class CUnit; diff --git a/source/simulation/EntityTemplate.h b/source/simulation/EntityTemplate.h index 085eb24e51..c9a5122991 100644 --- a/source/simulation/EntityTemplate.h +++ b/source/simulation/EntityTemplate.h @@ -27,7 +27,7 @@ class CPlayer; class CXeromyces; class XMBElement; -class CEntityTemplate : public CJSComplex, public IEventTarget, boost::noncopyable +class CEntityTemplate : public CJSComplex, public IEventTarget, noncopyable { public: CPlayer* m_player; // Which player this template is for, or null for the no-player template diff --git a/source/simulation/PathfindEngine.h b/source/simulation/PathfindEngine.h index 8a34f2af3f..ed771f2c60 100644 --- a/source/simulation/PathfindEngine.h +++ b/source/simulation/PathfindEngine.h @@ -30,7 +30,7 @@ enum EPathType }; -class CPathfindEngine : public Singleton, boost::noncopyable +class CPathfindEngine : public Singleton, noncopyable { public: diff --git a/source/simulation/Technology.h b/source/simulation/Technology.h index 82c78678a6..edc7fa6dba 100644 --- a/source/simulation/Technology.h +++ b/source/simulation/Technology.h @@ -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&); diff --git a/source/tools/atlas/GameInterface/ActorViewer.cpp b/source/tools/atlas/GameInterface/ActorViewer.cpp index bf0686d958..da4d643fd1 100644 --- a/source/tools/atlas/GameInterface/ActorViewer.cpp +++ b/source/tools/atlas/GameInterface/ActorViewer.cpp @@ -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), diff --git a/source/tools/atlas/GameInterface/ActorViewer.h b/source/tools/atlas/GameInterface/ActorViewer.h index 336e53c916..85d33f72da 100644 --- a/source/tools/atlas/GameInterface/ActorViewer.h +++ b/source/tools/atlas/GameInterface/ActorViewer.h @@ -6,7 +6,7 @@ struct SColor4ub; class CUnit; class CStrW; -class ActorViewer : boost::noncopyable +class ActorViewer : noncopyable { public: ActorViewer(); diff --git a/source/tools/atlas/GameInterface/MessagePasserImpl.h b/source/tools/atlas/GameInterface/MessagePasserImpl.h index 4d48c3ae56..af071d82d9 100644 --- a/source/tools/atlas/GameInterface/MessagePasserImpl.h +++ b/source/tools/atlas/GameInterface/MessagePasserImpl.h @@ -4,7 +4,7 @@ #include "ps/CStr.h" #include -class MessagePasserImpl : public AtlasMessage::MessagePasser, boost::noncopyable +class MessagePasserImpl : public AtlasMessage::MessagePasser, noncopyable { public: MessagePasserImpl();