From b496d220c65f9a2f6c9b9ae01368f67694b0dba3 Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Thu, 23 Apr 2009 13:42:24 +0000 Subject: [PATCH] Warning fixes --- src/osgPlugins/3ds/readwrite.cpp | 6 +-- src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp | 4 +- src/osgPlugins/ply/plyfile.cpp | 40 ++++++++++---------- src/osgPlugins/ply/vertexData.h | 2 +- 4 files changed, 28 insertions(+), 24 deletions(-) diff --git a/src/osgPlugins/3ds/readwrite.cpp b/src/osgPlugins/3ds/readwrite.cpp index f23b939b8..3f0d3aede 100644 --- a/src/osgPlugins/3ds/readwrite.cpp +++ b/src/osgPlugins/3ds/readwrite.cpp @@ -373,7 +373,7 @@ Lib3dsBool lib3ds_intb_write(Lib3dsIntb b, iostream *strm) { ASSERT(strm); - strm->write((char*)b,1); + strm->write((const char*)b,1); if (strm->fail()) { return(LIB3DS_FALSE); } @@ -400,7 +400,7 @@ lib3ds_intw_write(Lib3dsIntw w, iostream *strm) b[1]=(Lib3dsByte)(((Lib3dsWord)w & 0xFF00) >> 8); b[0]=(Lib3dsByte)((Lib3dsWord)w & 0x00FF); - strm->write((char*)b,2); + strm->write((const char*)b,2); if (strm->fail()) { return(LIB3DS_FALSE); } @@ -429,7 +429,7 @@ lib3ds_intd_write(Lib3dsIntd d, iostream *strm) b[1]=(Lib3dsByte)(((Lib3dsDword)d & 0x0000FF00) >> 8); b[0]=(Lib3dsByte)(((Lib3dsDword)d & 0x000000FF)); - strm->write((char*)b,4); + strm->write((const char*)b,4); if (strm->fail()) { return(LIB3DS_FALSE); } diff --git a/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp b/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp index 450377196..7f2e61322 100644 --- a/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp +++ b/src/osgPlugins/ffmpeg/FFmpegDecoderVideo.cpp @@ -167,7 +167,9 @@ void FFmpegDecoderVideo::decodeLoop() // Find out the frame pts - if (packet.packet.dts == AV_NOPTS_VALUE && m_frame->opaque != 0 && *reinterpret_cast(m_frame->opaque) != AV_NOPTS_VALUE) + if (packet.packet.dts == AV_NOPTS_VALUE && + m_frame->opaque != 0 && + *reinterpret_cast(m_frame->opaque) != AV_NOPTS_VALUE) { pts = *reinterpret_cast(m_frame->opaque); } diff --git a/src/osgPlugins/ply/plyfile.cpp b/src/osgPlugins/ply/plyfile.cpp index 61fbcf6be..b899e1a67 100644 --- a/src/osgPlugins/ply/plyfile.cpp +++ b/src/osgPlugins/ply/plyfile.cpp @@ -46,7 +46,9 @@ WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. #include #include - +#if defined(_MSC_VER) && defined(OSG_DISABLE_MSVC_WARNINGS) + #pragma warning( disable : 4996 ) +#endif #ifdef WIN32 # ifndef LITTLE_ENDIAN @@ -2411,24 +2413,24 @@ void get_binary_item( *uint_val = (unsigned int) *double_val; break; case PLY_DOUBLE: - result = fread (ptr, 8, 1, plyfile->fp); - if(!result < 1) - { - throw ply::MeshException( "Error in reading PLY file." - "fread not succeeded." ); - } - if( plyfile->file_type == PLY_BINARY_BE ) - { - swap8BE(ptr); - } - else - { - swap8LE(ptr); - } - *double_val = *((double *) ptr); - *int_val = (int) *double_val; - *uint_val = (unsigned int) *double_val; - break; + result = fread (ptr, 8, 1, plyfile->fp); + if(result < 1) + { + throw ply::MeshException( "Error in reading PLY file." + "fread not succeeded." ); + } + if( plyfile->file_type == PLY_BINARY_BE ) + { + swap8BE(ptr); + } + else + { + swap8LE(ptr); + } + *double_val = *((double *) ptr); + *int_val = (int) *double_val; + *uint_val = (unsigned int) *double_val; + break; default: char error[100]; sprintf (error, "get_binary_item: bad type = %d\n", type); diff --git a/src/osgPlugins/ply/vertexData.h b/src/osgPlugins/ply/vertexData.h index 173ecefd6..a02c6c97f 100644 --- a/src/osgPlugins/ply/vertexData.h +++ b/src/osgPlugins/ply/vertexData.h @@ -26,7 +26,7 @@ /////////////////////////////////////////////////////////////////////////////// // defined elsewhere -class PlyFile; +struct PlyFile; namespace ply {