From 4ed199cece1843453cce95205ed1f9e3affa47e6 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 9 Jan 2017 18:45:23 +0100 Subject: [PATCH] Fix various compile warnings and a few code consistency issues --- direct/src/plugin/p3dInstance.cxx | 8 ++++---- direct/src/plugin/p3dOsxSplashWindow.cxx | 16 ++++++++-------- dtool/src/dtoolbase/dlmalloc_src.cxx | 9 +++++++-- .../interrogate/interfaceMakerPythonNative.cxx | 2 +- dtool/src/parser-inc/arpa/inet.h | 4 ++++ dtool/src/parser-inc/netdb.h | 9 +++++++++ panda/src/audiotraits/fmodAudioManager.cxx | 4 ++-- panda/src/audiotraits/openalAudioManager.cxx | 1 - panda/src/collide/collisionBox.cxx | 8 ++++---- panda/src/collide/collisionFloorMesh.cxx | 4 ++-- .../src/collide/collisionHandlerFluidPusher.cxx | 2 +- panda/src/collide/collisionInvSphere.cxx | 8 ++++---- panda/src/collide/collisionPlane.cxx | 14 +++++++------- panda/src/collide/collisionPolygon.cxx | 12 ++++++------ panda/src/collide/collisionSphere.cxx | 14 +++++++------- panda/src/collide/collisionTube.cxx | 10 +++++----- panda/src/downloader/httpClient.cxx | 2 +- panda/src/gobj/texture_ext.cxx | 4 ++-- panda/src/ode/odeTriMeshData.cxx | 2 +- panda/src/ode/odeTriMeshGeom.I | 2 +- panda/src/pgraph/clipPlaneAttrib.cxx | 4 ++-- panda/src/pgraph/portalClipper.cxx | 2 +- panda/src/physx/physxControllerDesc.h | 3 ++- pandatool/src/xfile/xParser.cxx.prebuilt | 2 +- pandatool/src/xfile/xParser.yxx | 2 +- 25 files changed, 83 insertions(+), 65 deletions(-) create mode 100644 dtool/src/parser-inc/arpa/inet.h create mode 100644 dtool/src/parser-inc/netdb.h diff --git a/direct/src/plugin/p3dInstance.cxx b/direct/src/plugin/p3dInstance.cxx index b3f96b3f9c..0eabdaafd5 100644 --- a/direct/src/plugin/p3dInstance.cxx +++ b/direct/src/plugin/p3dInstance.cxx @@ -3450,8 +3450,8 @@ paint_window_osx_port() { int y_size = min(_wparams.get_win_height(), _swbuffer->get_y_size()); size_t rowsize = _swbuffer->get_row_size(); - Rect src_rect = {0, 0, y_size, x_size}; - Rect ddrc_rect = {0, 0, y_size, x_size}; + Rect src_rect = {0, 0, (short)y_size, (short)x_size}; + Rect ddrc_rect = {0, 0, (short)y_size, (short)x_size}; QDErr err; @@ -3502,7 +3502,7 @@ paint_window_osx_cgcontext(CGContextRef context) { int y_size = min(_wparams.get_win_height(), _swbuffer->get_y_size()); if (_buffer_image != NULL) { - CGRect region = { { 0, 0 }, { x_size, y_size } }; + CGRect region = { { 0, 0 }, { (CGFloat)x_size, (CGFloat)y_size } }; CGContextDrawImage(context, region, _buffer_image); } } @@ -3538,7 +3538,7 @@ handle_event_osx_event_record(const P3D_event_data &event) { // First, convert the coordinates from screen coordinates to browser // window coordinates. WindowRef window = handle._handle._osx_cgcontext._window; - CGPoint cgpt = { pt.h, pt.v }; + CGPoint cgpt = { (CGFloat)pt.h, (CGFloat)pt.v }; HIPointConvert(&cgpt, kHICoordSpaceScreenPixel, NULL, kHICoordSpaceWindow, window); diff --git a/direct/src/plugin/p3dOsxSplashWindow.cxx b/direct/src/plugin/p3dOsxSplashWindow.cxx index 2014251149..c8fc969679 100644 --- a/direct/src/plugin/p3dOsxSplashWindow.cxx +++ b/direct/src/plugin/p3dOsxSplashWindow.cxx @@ -267,7 +267,7 @@ refresh() { return; } if (_toplevel_window != NULL) { - Rect r = { 0, 0, _win_height, _win_width }; + Rect r = { 0, 0, (short)_win_height, (short)_win_width }; InvalWindowRect(_toplevel_window, &r); } else { @@ -345,7 +345,7 @@ paint_window_osx_cgcontext(CGContextRef context) { CGColorSpaceRef rgb_space = CGColorSpaceCreateDeviceRGB(); CGColorRef bg = CGColorCreate(rgb_space, bg_components); - CGRect region = { { 0, 0 }, { _win_width, _win_height } }; + CGRect region = { { 0, 0 }, { (CGFloat)_win_width, (CGFloat)_win_height } }; CGContextSetFillColorWithColor(context, bg); CGContextFillRect(context, region); @@ -407,7 +407,7 @@ handle_event_osx_event_record(const P3D_event_data &event) { // First, convert the coordinates from screen coordinates to browser // window coordinates. WindowRef window = handle._handle._osx_cgcontext._window; - CGPoint cgpt = { pt.h, pt.v }; + CGPoint cgpt = { (CGFloat)pt.h, (CGFloat)pt.v }; HIPointConvert(&cgpt, kHICoordSpaceScreenPixel, NULL, kHICoordSpaceWindow, window); @@ -617,7 +617,7 @@ paint_progress_bar(CGContextRef context) { int bar_x, bar_y, bar_width, bar_height; get_bar_placement(bar_x, bar_y, bar_width, bar_height); - CGRect bar_rect = { { bar_x, bar_y }, { bar_width, bar_height } }; + CGRect bar_rect = { { (CGFloat)bar_x, (CGFloat)bar_y }, { (CGFloat)bar_width, (CGFloat)bar_height } }; // Clear the entire progress bar to white (or the background color). CGContextSetFillColorWithColor(context, bar_bg); @@ -627,7 +627,7 @@ paint_progress_bar(CGContextRef context) { if (_progress_known) { int progress_width = (int)(bar_width * _install_progress + 0.5); if (progress_width != 0) { - CGRect prog = { { bar_x, bar_y }, { progress_width, bar_height } }; + CGRect prog = { { (CGFloat)bar_x, (CGFloat)bar_y }, { (CGFloat)progress_width, (CGFloat)bar_height } }; CGContextSetFillColorWithColor(context, bar); CGContextFillRect(context, prog); } @@ -642,7 +642,7 @@ paint_progress_bar(CGContextRef context) { progress = block_travel * 2 - progress; } - CGRect prog = { { bar_x + progress, bar_y }, { block_width, bar_height } }; + CGRect prog = { { (CGFloat)(bar_x + progress), (CGFloat)bar_y }, { (CGFloat)block_width, (CGFloat)bar_height } }; CGContextSetFillColorWithColor(context, bar); CGContextFillRect(context, prog); } @@ -652,8 +652,8 @@ paint_progress_bar(CGContextRef context) { // We offset the border by half a pixel, so we'll be drawing the one-pixel // line through the middle of a pixel, and it won't try to antialias // itself into a half-black two-pixel line. - CGRect border_rect = { { bar_x - 0.5, bar_y - 0.5 }, - { bar_width + 1, bar_height + 1 } }; + CGRect border_rect = { { (CGFloat)(bar_x - 0.5), (CGFloat)(bar_y - 0.5) }, + { (CGFloat)(bar_width + 1), (CGFloat)(bar_height + 1) } }; CGContextBeginPath(context); CGContextSetLineWidth(context, 1); diff --git a/dtool/src/dtoolbase/dlmalloc_src.cxx b/dtool/src/dtoolbase/dlmalloc_src.cxx index 008350de73..a26fcd28cd 100644 --- a/dtool/src/dtoolbase/dlmalloc_src.cxx +++ b/dtool/src/dtoolbase/dlmalloc_src.cxx @@ -587,8 +587,11 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP #define MAX_SIZE_T (~(size_t)0) #ifndef USE_LOCKS /* ensure true if spin or recursive locks set */ -#define USE_LOCKS ((defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || \ - (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0)) +#if (defined(USE_SPIN_LOCKS) && USE_SPIN_LOCKS != 0) || (defined(USE_RECURSIVE_LOCKS) && USE_RECURSIVE_LOCKS != 0) +#define USE_LOCKS 1 +#else +#define USE_LOCKS 0 +#endif #endif /* USE_LOCKS */ #if USE_LOCKS /* Spin locks for gcc >= 4.1, older gcc on x86, MSC >= 1310 */ @@ -647,7 +650,9 @@ MAX_RELEASE_CHECK_RATE default: 4095 unless not HAVE_MMAP #ifndef HAVE_MREMAP #ifdef linux #define HAVE_MREMAP 1 +#ifndef _GNU_SOURCE #define _GNU_SOURCE /* Turns on mremap() definition */ +#endif #else /* linux */ #define HAVE_MREMAP 0 #endif /* linux */ diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index a844771fa6..f24839d331 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -6198,7 +6198,7 @@ write_make_seq(ostream &out, Object *obj, const std::string &ClassName, // the assumption that the called method doesn't do anything with this // tuple other than unpack it (which is a fairly safe assumption to make). out << " PyTupleObject args;\n"; - out << " PyObject_INIT_VAR(&args, &PyTuple_Type, 1);\n"; + out << " (void)PyObject_INIT_VAR(&args, &PyTuple_Type, 1);\n"; } out << diff --git a/dtool/src/parser-inc/arpa/inet.h b/dtool/src/parser-inc/arpa/inet.h new file mode 100644 index 0000000000..a3ed68c461 --- /dev/null +++ b/dtool/src/parser-inc/arpa/inet.h @@ -0,0 +1,4 @@ +#pragma once + +#include +#include diff --git a/dtool/src/parser-inc/netdb.h b/dtool/src/parser-inc/netdb.h new file mode 100644 index 0000000000..367025cd3a --- /dev/null +++ b/dtool/src/parser-inc/netdb.h @@ -0,0 +1,9 @@ +#pragma once + +#include +#include + +struct hostent; +struct netent; +struct protoent; +struct servent; diff --git a/panda/src/audiotraits/fmodAudioManager.cxx b/panda/src/audiotraits/fmodAudioManager.cxx index 7d7ae246e3..dc98e76287 100644 --- a/panda/src/audiotraits/fmodAudioManager.cxx +++ b/panda/src/audiotraits/fmodAudioManager.cxx @@ -424,8 +424,8 @@ get_sound(const string &file_name, bool positional, int) { vfs->resolve_filename(path, get_model_path()); // Build a new AudioSound from the audio data. - PT(AudioSound) audioSound = 0; - PT(FmodAudioSound) fmodAudioSound = new FmodAudioSound(this, path, positional ); + PT(AudioSound) audioSound; + PT(FmodAudioSound) fmodAudioSound = new FmodAudioSound(this, path, positional); _all_sounds.insert(fmodAudioSound); diff --git a/panda/src/audiotraits/openalAudioManager.cxx b/panda/src/audiotraits/openalAudioManager.cxx index ba1b4684a3..b6d68a0ec0 100644 --- a/panda/src/audiotraits/openalAudioManager.cxx +++ b/panda/src/audiotraits/openalAudioManager.cxx @@ -1022,7 +1022,6 @@ cleanup() { OpenALAudioManager::SoundData:: SoundData() : _manager(0), - _movie(0), _sample(0), _stream(NULL), _length(0.0), diff --git a/panda/src/collide/collisionBox.cxx b/panda/src/collide/collisionBox.cxx index b358d8b359..b55988c352 100644 --- a/panda/src/collide/collisionBox.cxx +++ b/panda/src/collide/collisionBox.cxx @@ -199,7 +199,7 @@ PT(CollisionEntry) CollisionBox:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); CPT(TransformState) wrt_space = entry.get_wrt_space(); CPT(TransformState) wrt_prev_space = entry.get_wrt_prev_space(); @@ -402,7 +402,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionBox:: test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); LPoint3 from_origin = ray->get_origin() * wrt_mat; @@ -483,7 +483,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionBox:: test_intersection_from_segment(const CollisionEntry &entry) const { const CollisionSegment *seg; - DCAST_INTO_R(seg, entry.get_from(), 0); + DCAST_INTO_R(seg, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); LPoint3 from_origin = seg->get_point_a() * wrt_mat; @@ -564,7 +564,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionBox:: test_intersection_from_box(const CollisionEntry &entry) const { const CollisionBox *box; - DCAST_INTO_R(box, entry.get_from(), 0); + DCAST_INTO_R(box, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); diff --git a/panda/src/collide/collisionFloorMesh.cxx b/panda/src/collide/collisionFloorMesh.cxx index fcec727778..d523875727 100644 --- a/panda/src/collide/collisionFloorMesh.cxx +++ b/panda/src/collide/collisionFloorMesh.cxx @@ -125,7 +125,7 @@ compute_internal_bounds() const { PT(CollisionEntry) CollisionFloorMesh:: test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); LPoint3 from_origin = ray->get_origin() * entry.get_wrt_mat(); double fx = from_origin[0]; @@ -190,7 +190,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionFloorMesh:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); LPoint3 from_origin = sphere->get_center() * entry.get_wrt_mat(); double fx = from_origin[0]; diff --git a/panda/src/collide/collisionHandlerFluidPusher.cxx b/panda/src/collide/collisionHandlerFluidPusher.cxx index eea0cc1f22..0a48381d01 100644 --- a/panda/src/collide/collisionHandlerFluidPusher.cxx +++ b/panda/src/collide/collisionHandlerFluidPusher.cxx @@ -136,7 +136,7 @@ handle_entries() { // currently we only support spheres as the collider const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entries.front()->get_from(), 0); + DCAST_INTO_R(sphere, entries.front()->get_from(), false); from_node_path.set_pos(wrt_node, 0,0,0); LPoint3 sphere_offset = (sphere->get_center() * diff --git a/panda/src/collide/collisionInvSphere.cxx b/panda/src/collide/collisionInvSphere.cxx index 913ef32589..35a73225dd 100644 --- a/panda/src/collide/collisionInvSphere.cxx +++ b/panda/src/collide/collisionInvSphere.cxx @@ -92,7 +92,7 @@ compute_internal_bounds() const { PT(CollisionEntry) CollisionInvSphere:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -144,7 +144,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionInvSphere:: test_intersection_from_line(const CollisionEntry &entry) const { const CollisionLine *line; - DCAST_INTO_R(line, entry.get_from(), 0); + DCAST_INTO_R(line, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -185,7 +185,7 @@ test_intersection_from_line(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionInvSphere:: test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -228,7 +228,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionInvSphere:: test_intersection_from_segment(const CollisionEntry &entry) const { const CollisionSegment *segment; - DCAST_INTO_R(segment, entry.get_from(), 0); + DCAST_INTO_R(segment, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); diff --git a/panda/src/collide/collisionPlane.cxx b/panda/src/collide/collisionPlane.cxx index c551464960..d722adde7b 100644 --- a/panda/src/collide/collisionPlane.cxx +++ b/panda/src/collide/collisionPlane.cxx @@ -107,7 +107,7 @@ compute_internal_bounds() const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -146,7 +146,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_line(const CollisionEntry &entry) const { const CollisionLine *line; - DCAST_INTO_R(line, entry.get_from(), 0); + DCAST_INTO_R(line, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -191,7 +191,7 @@ test_intersection_from_line(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -243,7 +243,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_segment(const CollisionEntry &entry) const { const CollisionSegment *segment; - DCAST_INTO_R(segment, entry.get_from(), 0); + DCAST_INTO_R(segment, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -300,7 +300,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_tube(const CollisionEntry &entry) const { const CollisionTube *tube; - DCAST_INTO_R(tube, entry.get_from(), 0); + DCAST_INTO_R(tube, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -371,7 +371,7 @@ test_intersection_from_tube(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_parabola(const CollisionEntry &entry) const { const CollisionParabola *parabola; - DCAST_INTO_R(parabola, entry.get_from(), 0); + DCAST_INTO_R(parabola, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -437,7 +437,7 @@ test_intersection_from_parabola(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPlane:: test_intersection_from_box(const CollisionEntry &entry) const { const CollisionBox *box; - DCAST_INTO_R(box, entry.get_from(), 0); + DCAST_INTO_R(box, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); diff --git a/panda/src/collide/collisionPolygon.cxx b/panda/src/collide/collisionPolygon.cxx index ff64dcc298..646a7b9439 100644 --- a/panda/src/collide/collisionPolygon.cxx +++ b/panda/src/collide/collisionPolygon.cxx @@ -364,7 +364,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { } const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); CPT(TransformState) wrt_space = entry.get_wrt_space(); CPT(TransformState) wrt_prev_space = entry.get_wrt_prev_space(); @@ -545,7 +545,7 @@ test_intersection_from_line(const CollisionEntry &entry) const { } const CollisionLine *line; - DCAST_INTO_R(line, entry.get_from(), 0); + DCAST_INTO_R(line, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -613,7 +613,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { } const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -686,7 +686,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const { } const CollisionSegment *segment; - DCAST_INTO_R(segment, entry.get_from(), 0); + DCAST_INTO_R(segment, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -761,7 +761,7 @@ test_intersection_from_parabola(const CollisionEntry &entry) const { } const CollisionParabola *parabola; - DCAST_INTO_R(parabola, entry.get_from(), 0); + DCAST_INTO_R(parabola, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -846,7 +846,7 @@ test_intersection_from_parabola(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionPolygon:: test_intersection_from_box(const CollisionEntry &entry) const { const CollisionBox *box; - DCAST_INTO_R(box, entry.get_from(), 0); + DCAST_INTO_R(box, entry.get_from(), NULL); // To make things easier, transform the box into the coordinate space of the // plane. diff --git a/panda/src/collide/collisionSphere.cxx b/panda/src/collide/collisionSphere.cxx index 2e0802b350..139a39a4b1 100644 --- a/panda/src/collide/collisionSphere.cxx +++ b/panda/src/collide/collisionSphere.cxx @@ -120,7 +120,7 @@ compute_internal_bounds() const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); CPT(TransformState) wrt_space = entry.get_wrt_space(); @@ -231,7 +231,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_line(const CollisionEntry &entry) const { const CollisionLine *line; - DCAST_INTO_R(line, entry.get_from(), 0); + DCAST_INTO_R(line, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -271,7 +271,7 @@ test_intersection_from_line(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_box(const CollisionEntry &entry) const { const CollisionBox *box; - DCAST_INTO_R(box, entry.get_from(), 0); + DCAST_INTO_R(box, entry.get_from(), NULL); // Instead of transforming the box into the sphere's coordinate space, we do // it the other way around. It's easier that way. @@ -347,7 +347,7 @@ test_intersection_from_box(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -394,7 +394,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_segment(const CollisionEntry &entry) const { const CollisionSegment *segment; - DCAST_INTO_R(segment, entry.get_from(), 0); + DCAST_INTO_R(segment, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -443,7 +443,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_tube(const CollisionEntry &entry) const { const CollisionTube *tube; - DCAST_INTO_R(tube, entry.get_from(), 0); + DCAST_INTO_R(tube, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -499,7 +499,7 @@ test_intersection_from_tube(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionSphere:: test_intersection_from_parabola(const CollisionEntry &entry) const { const CollisionParabola *parabola; - DCAST_INTO_R(parabola, entry.get_from(), 0); + DCAST_INTO_R(parabola, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); diff --git a/panda/src/collide/collisionTube.cxx b/panda/src/collide/collisionTube.cxx index cb3f24f737..8e3b188aab 100644 --- a/panda/src/collide/collisionTube.cxx +++ b/panda/src/collide/collisionTube.cxx @@ -146,7 +146,7 @@ compute_internal_bounds() const { PT(CollisionEntry) CollisionTube:: test_intersection_from_sphere(const CollisionEntry &entry) const { const CollisionSphere *sphere; - DCAST_INTO_R(sphere, entry.get_from(), 0); + DCAST_INTO_R(sphere, entry.get_from(), NULL); CPT(TransformState) wrt_space = entry.get_wrt_space(); CPT(TransformState) wrt_prev_space = entry.get_wrt_prev_space(); @@ -224,7 +224,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionTube:: test_intersection_from_line(const CollisionEntry &entry) const { const CollisionLine *line; - DCAST_INTO_R(line, entry.get_from(), 0); + DCAST_INTO_R(line, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -272,7 +272,7 @@ test_intersection_from_line(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionTube:: test_intersection_from_ray(const CollisionEntry &entry) const { const CollisionRay *ray; - DCAST_INTO_R(ray, entry.get_from(), 0); + DCAST_INTO_R(ray, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -333,7 +333,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionTube:: test_intersection_from_segment(const CollisionEntry &entry) const { const CollisionSegment *segment; - DCAST_INTO_R(segment, entry.get_from(), 0); + DCAST_INTO_R(segment, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); @@ -397,7 +397,7 @@ test_intersection_from_segment(const CollisionEntry &entry) const { PT(CollisionEntry) CollisionTube:: test_intersection_from_parabola(const CollisionEntry &entry) const { const CollisionParabola *parabola; - DCAST_INTO_R(parabola, entry.get_from(), 0); + DCAST_INTO_R(parabola, entry.get_from(), NULL); const LMatrix4 &wrt_mat = entry.get_wrt_mat(); diff --git a/panda/src/downloader/httpClient.cxx b/panda/src/downloader/httpClient.cxx index 63ba1c6258..129d5fb6be 100644 --- a/panda/src/downloader/httpClient.cxx +++ b/panda/src/downloader/httpClient.cxx @@ -807,7 +807,7 @@ load_client_certificate() { // Rewind the "file" to the beginning in order to read the public key // (which might appear first in the file). - BIO_reset(mbio); + (void)BIO_reset(mbio); ERR_clear_error(); _client_certificate_pub = diff --git a/panda/src/gobj/texture_ext.cxx b/panda/src/gobj/texture_ext.cxx index 1e661e960a..507fa41fc4 100644 --- a/panda/src/gobj/texture_ext.cxx +++ b/panda/src/gobj/texture_ext.cxx @@ -66,7 +66,7 @@ set_ram_image(PyObject *image, Texture::CompressionMode compression, if (view.len % component_width != 0) { PyErr_Format(PyExc_ValueError, - "byte buffer is not a multiple of %zu bytes", + "byte buffer is not a multiple of %d bytes", component_width); return; } @@ -131,7 +131,7 @@ set_ram_image_as(PyObject *image, const string &provided_format) { if (view.len % component_width != 0) { PyErr_Format(PyExc_ValueError, - "byte buffer is not a multiple of %zu bytes", + "byte buffer is not a multiple of %d bytes", component_width); return; } diff --git a/panda/src/ode/odeTriMeshData.cxx b/panda/src/ode/odeTriMeshData.cxx index afae75b753..5f02cefa56 100644 --- a/panda/src/ode/odeTriMeshData.cxx +++ b/panda/src/ode/odeTriMeshData.cxx @@ -29,7 +29,7 @@ get_data(dGeomID id) { if (iter != data_map.end()) { return iter->second; } - return 0; + return NULL; } void OdeTriMeshData:: diff --git a/panda/src/ode/odeTriMeshGeom.I b/panda/src/ode/odeTriMeshGeom.I index 8bfd233bbf..b0a2e6177c 100644 --- a/panda/src/ode/odeTriMeshGeom.I +++ b/panda/src/ode/odeTriMeshGeom.I @@ -34,7 +34,7 @@ set_tri_mesh_data(OdeTriMeshData &data) { INLINE PT(OdeTriMeshData) OdeTriMeshGeom:: get_tri_mesh_data() const { - nassertr(_id != 0 ,0); + nassertr(_id != 0, NULL); return OdeTriMeshData::get_data(_id); } diff --git a/panda/src/pgraph/clipPlaneAttrib.cxx b/panda/src/pgraph/clipPlaneAttrib.cxx index e62a3d6e24..c95f9437c4 100644 --- a/panda/src/pgraph/clipPlaneAttrib.cxx +++ b/panda/src/pgraph/clipPlaneAttrib.cxx @@ -487,7 +487,7 @@ filter_to_max(int max_clip_planes) const { CPT(RenderAttrib) ClipPlaneAttrib:: compose_off(const RenderAttrib *other) const { const ClipPlaneAttrib *ta; - DCAST_INTO_R(ta, other, 0); + DCAST_INTO_R(ta, other, NULL); if (_off_all_planes || (!ta->_off_all_planes && ta->_off_planes.empty())) { // If we turn off all planes, or the other turns none off, the result is @@ -701,7 +701,7 @@ get_hash_impl() const { CPT(RenderAttrib) ClipPlaneAttrib:: compose_impl(const RenderAttrib *other) const { const ClipPlaneAttrib *ta; - DCAST_INTO_R(ta, other, 0); + DCAST_INTO_R(ta, other, NULL); if (ta->_off_all_planes) { // If the other type turns off all planes, it doesn't matter what we are. diff --git a/panda/src/pgraph/portalClipper.cxx b/panda/src/pgraph/portalClipper.cxx index 7b9e55556b..f6d45aab8f 100644 --- a/panda/src/pgraph/portalClipper.cxx +++ b/panda/src/pgraph/portalClipper.cxx @@ -39,7 +39,7 @@ PortalClipper:: PortalClipper(GeometricBoundingVolume *frustum, SceneSetup *scene_setup): _reduced_viewport_min(-1,-1), _reduced_viewport_max(1,1), -_clip_state(0) +_clip_state(NULL) { _previous = new GeomNode("my_frustum"); diff --git a/panda/src/physx/physxControllerDesc.h b/panda/src/physx/physxControllerDesc.h index 7919b60118..4624938ffd 100644 --- a/panda/src/physx/physxControllerDesc.h +++ b/panda/src/physx/physxControllerDesc.h @@ -23,8 +23,9 @@ * Descriptor class for a character controller. */ class EXPCL_PANDAPHYSX PhysxControllerDesc { - PUBLISHED: + virtual ~PhysxControllerDesc() {}; + virtual void set_to_default() = 0; virtual bool is_valid() const = 0; diff --git a/pandatool/src/xfile/xParser.cxx.prebuilt b/pandatool/src/xfile/xParser.cxx.prebuilt index 606ead1db3..42c65a72a6 100644 --- a/pandatool/src/xfile/xParser.cxx.prebuilt +++ b/pandatool/src/xfile/xParser.cxx.prebuilt @@ -98,7 +98,7 @@ static XFile *x_file = (XFile *)NULL; static XFileNode *current_node = (XFileNode *)NULL; -static PT(XFileDataDef) current_data_def = (XFileDataDef *)NULL; +static PT(XFileDataDef) current_data_def; //////////////////////////////////////////////////////////////////// // Defining the interface to the parser. diff --git a/pandatool/src/xfile/xParser.yxx b/pandatool/src/xfile/xParser.yxx index 4aa8ffd3b3..a98f39d177 100644 --- a/pandatool/src/xfile/xParser.yxx +++ b/pandatool/src/xfile/xParser.yxx @@ -32,7 +32,7 @@ static XFile *x_file = (XFile *)NULL; static XFileNode *current_node = (XFileNode *)NULL; -static PT(XFileDataDef) current_data_def = (XFileDataDef *)NULL; +static PT(XFileDataDef) current_data_def; //////////////////////////////////////////////////////////////////// // Defining the interface to the parser.