From 8192e96ef6233f1d0ca96601ceea69c5e0df227a Mon Sep 17 00:00:00 2001 From: kervala Date: Wed, 9 Feb 2011 14:34:05 +0100 Subject: [PATCH] Changed: #825 Remove all warnings when compiling Ryzom --- code/nel/include/nel/misc/smart_ptr.h | 2 +- code/nel/samples/3d/shape_viewer/main.cpp | 1 + code/nel/samples/misc/command/CMakeLists.txt | 4 ++++ code/nel/src/3d/packed_zone.cpp | 2 +- code/nel/src/3d/skeleton_model.cpp | 4 ++-- code/nel/src/misc/bitmap_png.cpp | 14 +++++++++----- code/nel/src/misc/task_manager.cpp | 2 +- code/nel/src/misc/time_nl.cpp | 4 ++-- 8 files changed, 21 insertions(+), 12 deletions(-) diff --git a/code/nel/include/nel/misc/smart_ptr.h b/code/nel/include/nel/misc/smart_ptr.h index 779fc1e11..50fbf4a4a 100644 --- a/code/nel/include/nel/misc/smart_ptr.h +++ b/code/nel/include/nel/misc/smart_ptr.h @@ -52,7 +52,7 @@ public: */ struct CPtrInfoBase { - CRefCount const* Ptr; // to know if the instance is valid. + const CRefCount* Ptr; // to know if the instance is valid. sint RefCount; // RefCount of ptrinfo (!= instance) bool IsNullPtrInfo; // For dll problems, must use a flag to mark NullPtrInfo. }; diff --git a/code/nel/samples/3d/shape_viewer/main.cpp b/code/nel/samples/3d/shape_viewer/main.cpp index 9b22275b7..7a5e472fc 100644 --- a/code/nel/samples/3d/shape_viewer/main.cpp +++ b/code/nel/samples/3d/shape_viewer/main.cpp @@ -75,6 +75,7 @@ sint WINAPI WinMain(HINSTANCE /* hInstance */, HINSTANCE /* hPrevInstance */, LP sint main(int argc, char **argv) { #endif + NLMISC::CApplicationContext myApplicationContext; try { diff --git a/code/nel/samples/misc/command/CMakeLists.txt b/code/nel/samples/misc/command/CMakeLists.txt index c60b4e63b..fd730ffec 100644 --- a/code/nel/samples/misc/command/CMakeLists.txt +++ b/code/nel/samples/misc/command/CMakeLists.txt @@ -2,6 +2,10 @@ FILE(GLOB SRC *.cpp) ADD_EXECUTABLE(nl_sample_command ${SRC}) +IF(WITH_STLPORT) + TARGET_LINK_LIBRARIES(nl_sample_command ${CMAKE_THREAD_LIBS_INIT}) +ENDIF(WITH_STLPORT) + TARGET_LINK_LIBRARIES(nl_sample_command nelmisc) NL_DEFAULT_PROPS(nl_sample_command "NeL, Samples, Misc: Commands") NL_ADD_RUNTIME_FLAGS(nl_sample_command) diff --git a/code/nel/src/3d/packed_zone.cpp b/code/nel/src/3d/packed_zone.cpp index f1b96b7a7..d56f34400 100644 --- a/code/nel/src/3d/packed_zone.cpp +++ b/code/nel/src/3d/packed_zone.cpp @@ -1290,7 +1290,7 @@ template bool raytrace(T &packedZone, const NLMISC::CVector &start, co CTriangle tri; CPlane triPlane; float bestInterDist = FLT_MAX; - NLMISC::CVector bestNormal; + CVector bestNormal(0.f, 0.f, 0.f); CVector currInter; do { diff --git a/code/nel/src/3d/skeleton_model.cpp b/code/nel/src/3d/skeleton_model.cpp index 8cd55ec3c..708ec1cd1 100644 --- a/code/nel/src/3d/skeleton_model.cpp +++ b/code/nel/src/3d/skeleton_model.cpp @@ -1741,7 +1741,7 @@ bool CSkeletonModel::computeRenderedBBoxWithBoneSphere(NLMISC::CAABBox &bbox, b updateSkinRenderLists(); // **** Compute The BBox with Bones of the skeleton - CVector minBB, maxBB; + CVector minBB(0.f, 0.f, 0.f), maxBB(0.f, 0.f, 0.f); for(uint i=0;i<_BoneToCompute.size();i++) { CBone *bone= _BoneToCompute[i].Bone; @@ -2225,7 +2225,7 @@ bool CSkeletonModel::computeWorldBBoxForShadow(NLMISC::CAABBox &worldBB) return false; // **** Compute The BBox with Bones of the skeleton - CVector minBB, maxBB; + CVector minBB(0.f, 0.f, 0.f), maxBB(0.f, 0.f, 0.f); for(i=0;i<_BoneToCompute.size();i++) { CBone *bone= _BoneToCompute[i].Bone; diff --git a/code/nel/src/misc/bitmap_png.cpp b/code/nel/src/misc/bitmap_png.cpp index 622316b41..19ae435cc 100644 --- a/code/nel/src/misc/bitmap_png.cpp +++ b/code/nel/src/misc/bitmap_png.cpp @@ -33,12 +33,16 @@ namespace NLMISC static void readPNGData(png_structp png_ptr, png_bytep data, png_size_t length) { - ((IStream*) png_ptr->io_ptr)->serialBuffer((uint8*)data, (uint)length); + IStream *stream = static_cast(png_get_io_ptr(png_ptr)); + if (stream) + stream->serialBuffer((uint8*)data, (uint)length); } static void writePNGData(png_structp png_ptr, png_bytep data, png_size_t length) { - ((IStream*) png_ptr->io_ptr)->serialBuffer((uint8*)data, (uint)length); + IStream *stream = static_cast(png_get_io_ptr(png_ptr)); + if (stream) + stream->serialBuffer((uint8*)data, (uint)length); } static void setPNGWarning(png_struct * /* png_ptr */, const char* message) @@ -50,7 +54,7 @@ static void setPNGError(png_struct *png_ptr, const char* message) { setPNGWarning(png_ptr, message); - longjmp(png_ptr->jmpbuf, 1); + longjmp(png_jmpbuf(png_ptr), 1); } /*-------------------------------------------------------------------*\ @@ -79,7 +83,7 @@ uint8 CBitmap::readPNG( NLMISC::IStream &f ) return 0; } - if (setjmp(png_ptr->jmpbuf)) + if (setjmp(png_jmpbuf(png_ptr))) { // free all of the memory associated with the png_ptr and info_ptr png_destroy_read_struct(&png_ptr, &info_ptr, NULL); @@ -237,7 +241,7 @@ bool CBitmap::writePNG( NLMISC::IStream &f, uint32 d) return false; } - if (setjmp(png_ptr->jmpbuf)) + if (setjmp(png_jmpbuf(png_ptr))) { png_destroy_write_struct( &png_ptr, (png_info**)NULL ); nlwarning("couldn't set setjmp"); diff --git a/code/nel/src/misc/task_manager.cpp b/code/nel/src/misc/task_manager.cpp index 10b8ef556..0ae045440 100644 --- a/code/nel/src/misc/task_manager.cpp +++ b/code/nel/src/misc/task_manager.cpp @@ -61,7 +61,7 @@ CTaskManager::~CTaskManager() void CTaskManager::run(void) { IRunnable *runnableTask; - float priorityTask; + float priorityTask = 0.f; while(_ThreadRunning) { { diff --git a/code/nel/src/misc/time_nl.cpp b/code/nel/src/misc/time_nl.cpp index 4b86ee761..4df746720 100644 --- a/code/nel/src/misc/time_nl.cpp +++ b/code/nel/src/misc/time_nl.cpp @@ -178,11 +178,11 @@ TTicks CTime::getPerformanceTime () return mach_absolute_time(); #else #if defined(HAVE_X86_64) - unsigned long long int hi, lo; + uint64 hi, lo; __asm__ volatile (".byte 0x0f, 0x31" : "=a" (lo), "=d" (hi)); return (hi << 32) | (lo & 0xffffffff); #elif defined(HAVE_X86) and !defined(NL_OS_MAC) - unsigned long long int x; + uint64 x; // RDTSC - Read time-stamp counter into EDX:EAX. __asm__ volatile (".byte 0x0f, 0x31" : "=A" (x)); return x;