From 41d26284d75e47749c4488a948e038aea06c16e6 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Jan 2017 13:40:09 -0500 Subject: [PATCH 1/7] Fix various compilation issues on Mac. Work around bugs in Apple Clang that ships with XCode 4 with C++11 by disabling constexpr Use move() instead of std::move() It also looks like we'll have to continue using pystub for tools that use libp3interrogatedb for now. --- dtool/src/dtoolbase/dtoolbase_cc.h | 6 +++- dtool/src/interrogate/interrogate.cxx | 3 ++ dtool/src/interrogate/interrogate_module.cxx | 3 ++ dtool/src/interrogate/parse_file.cxx | 3 ++ .../src/test_interrogate/test_interrogate.cxx | 3 ++ panda/src/display/displayRegion.I | 4 +-- panda/src/linmath/lvecBase2_src.I | 16 ---------- panda/src/linmath/lvecBase2_src.h | 4 +-- panda/src/linmath/lvecBase3_src.I | 16 ---------- panda/src/linmath/lvecBase3_src.h | 4 +-- panda/src/linmath/lvecBase4_src.I | 32 ------------------- panda/src/linmath/lvecBase4_src.h | 8 ++--- panda/src/putil/weakKeyHashMap.I | 2 +- 13 files changed, 28 insertions(+), 76 deletions(-) diff --git a/dtool/src/dtoolbase/dtoolbase_cc.h b/dtool/src/dtoolbase/dtoolbase_cc.h index eb7afc9048..486eaa00ba 100644 --- a/dtool/src/dtoolbase/dtoolbase_cc.h +++ b/dtool/src/dtoolbase/dtoolbase_cc.h @@ -118,6 +118,8 @@ typedef ios::seekdir ios_seekdir; // Apple has an outdated libstdc++. Not all is lost, though, as we can fill // in some important missing functions. #if defined(__GLIBCXX__) && __GLIBCXX__ <= 20070719 +typedef decltype(nullptr) nullptr_t; + template struct remove_reference {typedef T type;}; template struct remove_reference {typedef T type;}; template struct remove_reference{typedef T type;}; @@ -147,7 +149,9 @@ template typename remove_reference::type &&move(T &&t) { // Determine the availability of C++11 features. #if defined(__has_extension) // Clang magic. # if __has_extension(cxx_constexpr) -# define CONSTEXPR constexpr +# if !defined(__apple_build_version__) || __apple_build_version__ >= 5000000 +# define CONSTEXPR constexpr +# endif # endif # if __has_extension(cxx_noexcept) # define NOEXCEPT noexcept diff --git a/dtool/src/interrogate/interrogate.cxx b/dtool/src/interrogate/interrogate.cxx index 206132bb31..94175b9d2b 100644 --- a/dtool/src/interrogate/interrogate.cxx +++ b/dtool/src/interrogate/interrogate.cxx @@ -19,6 +19,7 @@ #include "pnotify.h" #include "panda_getopt_long.h" #include "preprocess_argv.h" +#include "pystub.h" #include CPPParser parser; @@ -305,6 +306,8 @@ predefine_macro(CPPParser& parser, const string& inoption) { int main(int argc, char **argv) { + pystub(); + preprocess_argv(argc, argv); string command_line; int i; diff --git a/dtool/src/interrogate/interrogate_module.cxx b/dtool/src/interrogate/interrogate_module.cxx index 8e397d8b9e..5feae341b7 100644 --- a/dtool/src/interrogate/interrogate_module.cxx +++ b/dtool/src/interrogate/interrogate_module.cxx @@ -19,6 +19,7 @@ #include "interrogate_interface.h" #include "interrogate_request.h" #include "load_dso.h" +#include "pystub.h" #include "pnotify.h" #include "panda_getopt_long.h" #include "preprocess_argv.h" @@ -379,6 +380,8 @@ int main(int argc, char *argv[]) { extern int optind; int flag; + pystub(); + preprocess_argv(argc, argv); flag = getopt_long_only(argc, argv, short_options, long_options, NULL); while (flag != EOF) { diff --git a/dtool/src/interrogate/parse_file.cxx b/dtool/src/interrogate/parse_file.cxx index 2b32f39561..6670bcbe44 100644 --- a/dtool/src/interrogate/parse_file.cxx +++ b/dtool/src/interrogate/parse_file.cxx @@ -22,6 +22,7 @@ #include "cppGlobals.h" #include "panda_getopt_long.h" #include "preprocess_argv.h" +#include "pystub.h" #include CPPParser parser; @@ -193,6 +194,8 @@ show_nested_types(const string &str) { int main(int argc, char **argv) { + pystub(); + extern char *optarg; extern int optind; const char *optstr = "I:S:D:o:l:vp"; diff --git a/dtool/src/test_interrogate/test_interrogate.cxx b/dtool/src/test_interrogate/test_interrogate.cxx index f9aa7c1ab4..6c2b961ff3 100644 --- a/dtool/src/test_interrogate/test_interrogate.cxx +++ b/dtool/src/test_interrogate/test_interrogate.cxx @@ -17,6 +17,7 @@ #include "interrogate_request.h" #include "load_dso.h" #include "filename.h" +#include "pystub.h" #include "panda_getopt.h" #include "preprocess_argv.h" @@ -520,6 +521,8 @@ main(int argc, char **argv) { extern int optind; const char *optstr = "p:ftqh"; + pystub(); + bool all_functions = false; bool all_types = false; bool quick_load = false; diff --git a/panda/src/display/displayRegion.I b/panda/src/display/displayRegion.I index 11492a3a5e..6004791d31 100644 --- a/panda/src/display/displayRegion.I +++ b/panda/src/display/displayRegion.I @@ -480,8 +480,8 @@ set_cull_result(PT(CullResult) cull_result, PT(SceneSetup) scene_setup, Thread *current_thread) { CDCullWriter cdata(_cycler_cull, true, current_thread); #ifdef USE_MOVE_SEMANTICS - cdata->_cull_result = std::move(cull_result); - cdata->_scene_setup = std::move(scene_setup); + cdata->_cull_result = move(cull_result); + cdata->_scene_setup = move(scene_setup); #else swap(cdata->_cull_result, cull_result); swap(cdata->_scene_setup, scene_setup); diff --git a/panda/src/linmath/lvecBase2_src.I b/panda/src/linmath/lvecBase2_src.I index 9ddce8966c..401e2e346a 100644 --- a/panda/src/linmath/lvecBase2_src.I +++ b/panda/src/linmath/lvecBase2_src.I @@ -72,14 +72,6 @@ operator [](int i) { return _v(i); } -/** - * Returns 2: the number of components of a LVecBase2. - */ -CONSTEXPR int FLOATNAME(LVecBase2):: -size() { - return 2; -} - /** * Returns true if any component of the vector is not-a-number, false * otherwise. @@ -178,14 +170,6 @@ get_data() const { return &_v(0); } -/** - * Returns the number of elements in the vector, two. - */ -CONSTEXPR int FLOATNAME(LVecBase2):: -get_num_components() { - return 2; -} - /** * Returns an iterator that may be used to traverse the elements of the * matrix, STL-style. diff --git a/panda/src/linmath/lvecBase2_src.h b/panda/src/linmath/lvecBase2_src.h index 0167855c65..d0c0693f55 100644 --- a/panda/src/linmath/lvecBase2_src.h +++ b/panda/src/linmath/lvecBase2_src.h @@ -50,7 +50,7 @@ PUBLISHED: INLINE_LINMATH FLOATTYPE operator [](int i) const; INLINE_LINMATH FLOATTYPE &operator [](int i); - CONSTEXPR static int size(); + CONSTEXPR static int size() { return 2; } INLINE_LINMATH bool is_nan() const; @@ -74,7 +74,7 @@ PUBLISHED: INLINE_LINMATH void add_y(FLOATTYPE value); INLINE_LINMATH const FLOATTYPE *get_data() const; - CONSTEXPR static int get_num_components(); + CONSTEXPR static int get_num_components() { return 2; } public: INLINE_LINMATH iterator begin(); diff --git a/panda/src/linmath/lvecBase3_src.I b/panda/src/linmath/lvecBase3_src.I index b7011da0ca..eeaea584d5 100644 --- a/panda/src/linmath/lvecBase3_src.I +++ b/panda/src/linmath/lvecBase3_src.I @@ -89,14 +89,6 @@ operator [](int i) { return _v(i); } -/** - * Returns 3: the number of components of a LVecBase3. - */ -CONSTEXPR int FLOATNAME(LVecBase3):: -size() { - return 3; -} - /** * Returns true if any component of the vector is not-a-number, false * otherwise. @@ -246,14 +238,6 @@ get_data() const { return &_v(0); } -/** - * Returns the number of elements in the vector, three. - */ -CONSTEXPR int FLOATNAME(LVecBase3):: -get_num_components() { - return 3; -} - /** * Returns an iterator that may be used to traverse the elements of the * matrix, STL-style. diff --git a/panda/src/linmath/lvecBase3_src.h b/panda/src/linmath/lvecBase3_src.h index fdc39c7819..fb9b67ca27 100644 --- a/panda/src/linmath/lvecBase3_src.h +++ b/panda/src/linmath/lvecBase3_src.h @@ -52,7 +52,7 @@ PUBLISHED: INLINE_LINMATH FLOATTYPE operator [](int i) const; INLINE_LINMATH FLOATTYPE &operator [](int i); - CONSTEXPR static int size(); + CONSTEXPR static int size() { return 3; } INLINE_LINMATH bool is_nan() const; @@ -87,7 +87,7 @@ PUBLISHED: INLINE_LINMATH void add_z(FLOATTYPE value); INLINE_LINMATH const FLOATTYPE *get_data() const; - CONSTEXPR static int get_num_components(); + CONSTEXPR static int get_num_components() { return 3; } public: INLINE_LINMATH iterator begin(); diff --git a/panda/src/linmath/lvecBase4_src.I b/panda/src/linmath/lvecBase4_src.I index 7890a6f8f0..70a376a3bf 100644 --- a/panda/src/linmath/lvecBase4_src.I +++ b/panda/src/linmath/lvecBase4_src.I @@ -118,14 +118,6 @@ operator [](int i) { return _v(i); } -/** - * Returns 4: the number of components of a LVecBase4. - */ -CONSTEXPR int FLOATNAME(LVecBase4):: -size() { - return 4; -} - /** * Returns true if any component of the vector is not-a-number, false * otherwise. @@ -288,14 +280,6 @@ get_data() const { return &_v(0); } -/** - * Returns the number of elements in the vector, four. - */ -CONSTEXPR int FLOATNAME(LVecBase4):: -get_num_components() { - return 4; -} - /** * Returns an iterator that may be used to traverse the elements of the * matrix, STL-style. @@ -958,14 +942,6 @@ operator [](int i) { return _v(i); } -/** - * Returns 4: the number of components of a LVecBase4. - */ -CONSTEXPR int FLOATNAME(UnalignedLVecBase4):: -size() { - return 4; -} - /** * Returns the address of the first of the three data elements in the vector. * The remaining elements occupy the next positions consecutively in memory. @@ -974,11 +950,3 @@ INLINE_LINMATH const FLOATTYPE *FLOATNAME(UnalignedLVecBase4):: get_data() const { return &_v(0); } - -/** - * Returns the number of elements in the vector, 4. - */ -CONSTEXPR int FLOATNAME(UnalignedLVecBase4):: -get_num_components() { - return 4; -} diff --git a/panda/src/linmath/lvecBase4_src.h b/panda/src/linmath/lvecBase4_src.h index 1d4a16e961..b6e1a4df35 100644 --- a/panda/src/linmath/lvecBase4_src.h +++ b/panda/src/linmath/lvecBase4_src.h @@ -62,7 +62,7 @@ PUBLISHED: INLINE_LINMATH FLOATTYPE operator [](int i) const; INLINE_LINMATH FLOATTYPE &operator [](int i); - CONSTEXPR static int size(); + CONSTEXPR static int size() { return 4; } INLINE_LINMATH bool is_nan() const; @@ -100,7 +100,7 @@ PUBLISHED: INLINE_LINMATH void add_w(FLOATTYPE value); INLINE_LINMATH const FLOATTYPE *get_data() const; - CONSTEXPR static int get_num_components(); + CONSTEXPR static int get_num_components() { return 4; } INLINE_LINMATH void extract_data(float*){}; public: @@ -236,10 +236,10 @@ PUBLISHED: INLINE_LINMATH FLOATTYPE operator [](int i) const; INLINE_LINMATH FLOATTYPE &operator [](int i); - CONSTEXPR static int size(); + CONSTEXPR static int size() { return 4; } INLINE_LINMATH const FLOATTYPE *get_data() const; - CONSTEXPR static int get_num_components(); + CONSTEXPR static int get_num_components() { return 4; } public: typedef FLOATTYPE numeric_type; diff --git a/panda/src/putil/weakKeyHashMap.I b/panda/src/putil/weakKeyHashMap.I index c80e47723d..b4b007f998 100644 --- a/panda/src/putil/weakKeyHashMap.I +++ b/panda/src/putil/weakKeyHashMap.I @@ -307,7 +307,7 @@ template INLINE void WeakKeyHashMap:: set_data(int n, Value &&data) { nassertv(has_element(n)); - _table[n]._data = std::move(data); + _table[n]._data = move(data); } #endif // USE_MOVE_SEMANTICS From 58c1581c0c7520311f72ba07e908f56e99efdf33 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Jan 2017 17:20:17 -0500 Subject: [PATCH 2/7] Fix .whl version when no explicit --version is specified --- makepanda/makepanda.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index 4faa683f87..ac528371c7 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -368,6 +368,9 @@ if VERSION is None: else: VERSION = ParsePandaVersion("dtool/PandaVersion.pp") +if WHLVERSION is None: + WHLVERSION = VERSION + print("Version: %s" % VERSION) if RUNTIME or RTDIST: print("Core API Version: %s" % COREAPI_VERSION) From 72a1a9820baf640fc9d06d6fd73f7f4785d4ce07 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Jan 2017 17:50:48 -0500 Subject: [PATCH 3/7] Fix issues in ancient ffmpeg versions (Eg. Ubuntu Precise) --- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index 8e2d0b0e47..c9cee499cd 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -40,6 +40,10 @@ PStatCollector FfmpegVideoCursor::_export_frame_pcollector("*:FFMPEG Convert Vid #define AVMEDIA_TYPE_VIDEO CODEC_TYPE_VIDEO #endif +#if LIBAVCODEC_VERSION_MAJOR < 54 +#define AV_CODEC_ID_VP8 CODEC_ID_VP8 +#endif + #if LIBAVUTIL_VERSION_INT < AV_VERSION_INT(51, 74, 100) #define AV_PIX_FMT_NONE PIX_FMT_NONE #define AV_PIX_FMT_BGR24 PIX_FMT_BGR24 @@ -116,6 +120,7 @@ init_from(FfmpegVideo *source) { _eof_known = false; _eof_frame = 0; +#if LIBAVUTIL_VERSION_MAJOR >= 52 // Check if we got an alpha format. Please note that some video codecs // (eg. libvpx) change the pix_fmt after decoding the first frame, which is // why we didn't do this earlier. @@ -123,7 +128,9 @@ init_from(FfmpegVideo *source) { if (desc && (desc->flags & AV_PIX_FMT_FLAG_ALPHA) != 0) { _num_components = 4; _pixel_format = (int)AV_PIX_FMT_BGRA; - } else { + } else +#endif + { _num_components = 3; _pixel_format = (int)AV_PIX_FMT_BGR24; } From ba5bba42b019fdf35e34577ac839bc7a16cefa66 Mon Sep 17 00:00:00 2001 From: rdb Date: Sun, 8 Jan 2017 17:51:09 -0500 Subject: [PATCH 4/7] Fix interrogate warnings, flesh out iterator header --- dtool/src/parser-inc/iterator | 72 ++++++++++++++++++++++++++++++++++- dtool/src/parser-inc/memory | 2 +- 2 files changed, 71 insertions(+), 3 deletions(-) diff --git a/dtool/src/parser-inc/iterator b/dtool/src/parser-inc/iterator index 40b8e2f479..c6cdf654fa 100644 --- a/dtool/src/parser-inc/iterator +++ b/dtool/src/parser-inc/iterator @@ -1,6 +1,74 @@ #pragma once +#include +#include + namespace std { - template class iterator; - template class reverse_iterator; + // Iterator tags + struct input_iterator_tag {}; + struct output_iterator_tag {}; + struct forward_iterator_tag : public input_iterator_tag {}; + struct bidirectional_iterator_tag : public forward_iterator_tag {}; + struct random_access_iterator_tag : public bidirectional_iterator_tag {}; + + // Iterator traits + template struct iterator_traits { + typedef typename Iterator::difference_type difference_type; + typedef typename Iterator::value_type value_type; + typedef typename Iterator::pointer pointer; + typedef typename Iterator::reference reference; + typedef typename Iterator::iterator_category iterator_category; + }; + + template struct iterator_traits { + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef T *pointer; + typedef T &reference; + typedef random_access_iterator_tag iterator_category; + }; + + template struct iterator_traits { + typedef ptrdiff_t difference_type; + typedef T value_type; + typedef const T *pointer; + typedef const T &reference; + typedef random_access_iterator_tag iterator_category; + }; + + // Iterators + template struct iterator { + typedef T value_type; + typedef Distance difference_type; + typedef Pointer pointer; + typedef Reference reference; + typedef Category iterator_category; + }; + + template + class reverse_iterator : public + iterator::iterator_category, + typename iterator_traits::value_type, + typename iterator_traits::difference_type, + typename iterator_traits::pointer, + typename iterator_traits::reference> { + public: + typedef Iterator iterator_type; + typedef typename iterator_traits::difference_type difference_type; + typedef typename iterator_traits::reference reference; + typedef typename iterator_traits::pointer pointer; + }; + + template, + class Distance = ptrdiff_t> + class istream_iterator; + + template> + class ostream_iterator; + + template> + class istreambuf_iterator; + template > + class ostreambuf_iterator; }; diff --git a/dtool/src/parser-inc/memory b/dtool/src/parser-inc/memory index 30a54d006a..8c3a7b1b1d 100644 --- a/dtool/src/parser-inc/memory +++ b/dtool/src/parser-inc/memory @@ -122,7 +122,7 @@ namespace std { struct is_always_equal; template using rebind_alloc = size_t; - template using rebind_traits = allocator_traits >; + //template using rebind_traits = allocator_traits >; }; template class allocator; From 4ed199cece1843453cce95205ed1f9e3affa47e6 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 9 Jan 2017 18:45:23 +0100 Subject: [PATCH 5/7] 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. From 43a5f2a9f20118db9fcbeec14467c97a711d37b6 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 9 Jan 2017 20:38:33 +0100 Subject: [PATCH 6/7] Fixes for Python 3.5: - Disable conversion to Windows newlines, which is causing double Windows newlines for Config.prc - We need to copy vcruntime140.dll to the bin directory for Python 3.5+ build using MSVC 2010 to work --- makepanda/makepanda.py | 6 +++--- makepanda/makepandacore.py | 5 ++++- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/makepanda/makepanda.py b/makepanda/makepanda.py index ac528371c7..6a7d8ce521 100755 --- a/makepanda/makepanda.py +++ b/makepanda/makepanda.py @@ -2887,8 +2887,8 @@ if tp_dir is not None: pydll += ".dll" CopyFile(GetOutputDir() + "/bin" + pydll, SDK["PYTHON"] + pydll) - #for fn in glob.glob(SDK["PYTHON"] + "/vcruntime*.dll"): - # CopyFile(GetOutputDir() + "/bin/", fn) + for fn in glob.glob(SDK["PYTHON"] + "/vcruntime*.dll"): + CopyFile(GetOutputDir() + "/bin/", fn) # Copy the whole Python directory. CopyTree(GetOutputDir() + "/python", SDK["PYTHON"]) @@ -2907,7 +2907,7 @@ if tp_dir is not None: else: idents = () - for ident in tree.findall('./{urn:schemas-microsoft-com:asm.v1}dependency/{urn:schemas-microsoft-com:asm.v1}dependentAssembly/{urn:schemas-microsoft-com:asm.v1}assemblyIdentity'): + for ident in idents: sxs_name = '_'.join([ ident.get('processorArchitecture'), ident.get('name').lower(), diff --git a/makepanda/makepandacore.py b/makepanda/makepandacore.py index ee903a3940..24f3614337 100644 --- a/makepanda/makepandacore.py +++ b/makepanda/makepandacore.py @@ -980,7 +980,10 @@ def WriteFile(wfile, data, newline=None): data = data.replace('\n', newline) try: - dsthandle = open(wfile, "w") + if sys.version_info >= (3, 0): + dsthandle = open(wfile, "w", newline='') + else: + dsthandle = open(wfile, "w") dsthandle.write(data) dsthandle.close() except: From 749e09d49ecc31a5235a4af46849626b483f5936 Mon Sep 17 00:00:00 2001 From: rdb Date: Mon, 9 Jan 2017 23:10:51 +0100 Subject: [PATCH 7/7] ffmpeg: don't hide last frame of video This is not quite a complete fix, since the last frame of the video won't be shown long enough for it to matter when looping the video. A more complete fix may be needed later. --- panda/src/ffmpeg/ffmpegVideoCursor.cxx | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/panda/src/ffmpeg/ffmpegVideoCursor.cxx b/panda/src/ffmpeg/ffmpegVideoCursor.cxx index c9cee499cd..8a23853811 100644 --- a/panda/src/ffmpeg/ffmpegVideoCursor.cxx +++ b/panda/src/ffmpeg/ffmpegVideoCursor.cxx @@ -327,13 +327,13 @@ set_time(double timestamp, int loop_count) { if (_eof_known) { if (loop_count == 0) { - frame = frame % _eof_frame; + frame = frame % (_eof_frame + 1); } else { - int last_frame = _eof_frame * loop_count; + int last_frame = (_eof_frame + 1) * loop_count; if (frame < last_frame) { - frame = frame % _eof_frame; + frame = frame % (_eof_frame + 1); } else { - frame = _eof_frame - 1; + frame = _eof_frame; } } }