diff --git a/contrib/src/ai/aiBehaviors.h b/contrib/src/ai/aiBehaviors.h index 3c11b5e7a8..6a20876db8 100644 --- a/contrib/src/ai/aiBehaviors.h +++ b/contrib/src/ai/aiBehaviors.h @@ -11,10 +11,6 @@ * @date 2009-09-08 */ -#pragma warning (disable:4996) -#pragma warning (disable:4005) -#pragma warning(disable:4275) - #ifndef _AIBEHAVIORS_H #define _AIBEHAVIORS_H diff --git a/contrib/src/ai/aiCharacter.h b/contrib/src/ai/aiCharacter.h index 5d2b2c1d51..9fd0833a99 100644 --- a/contrib/src/ai/aiCharacter.h +++ b/contrib/src/ai/aiCharacter.h @@ -11,11 +11,6 @@ * @date 2009-09-08 */ -#pragma warning (disable:4996) -#pragma warning (disable:4005) -#pragma warning(disable:4275) - - #ifndef _AICHARACTER_H #define _AICHARACTER_H diff --git a/contrib/src/ai/aiGlobals.h b/contrib/src/ai/aiGlobals.h index 749cb9ec21..1d8e8a9c41 100644 --- a/contrib/src/ai/aiGlobals.h +++ b/contrib/src/ai/aiGlobals.h @@ -11,10 +11,6 @@ * @date 2009-09-08 */ -#pragma warning (disable:4996) -#pragma warning (disable:4005) -#pragma warning(disable:4275) - #ifndef _AI_GLOBALS_H #define _AI_GLOBALS_H diff --git a/contrib/src/ai/aiWorld.h b/contrib/src/ai/aiWorld.h index 95115355ba..f85e1dc584 100644 --- a/contrib/src/ai/aiWorld.h +++ b/contrib/src/ai/aiWorld.h @@ -11,11 +11,6 @@ * @date 2009-09-08 */ -#pragma warning (disable:4996) -#pragma warning (disable:4005) -#pragma warning(disable:4275) - - #ifndef _AIWORLD_H #define _AIWORLD_H diff --git a/contrib/src/ai/obstacleAvoidance.cxx b/contrib/src/ai/obstacleAvoidance.cxx index 7160baa096..faf8a1ff05 100644 --- a/contrib/src/ai/obstacleAvoidance.cxx +++ b/contrib/src/ai/obstacleAvoidance.cxx @@ -34,7 +34,7 @@ obstacle_detection() { CPT(BoundingSphere) np_sphere = np_bounds->as_bounding_sphere(); LVecBase3 avoidance(0.0, 0.0, 0.0); double distance = 0x7fff ; - double expanded_radius; + double expanded_radius = 0; LVecBase3 to_obstacle; LVecBase3 prev_avoidance; for(unsigned int i = 0; i < _ai_char->_world->_obstacles.size(); ++i) { @@ -89,8 +89,8 @@ do_obstacle_avoidance() { CPT(BoundingSphere) bsphere = bounds->as_bounding_sphere(); PT(BoundingVolume) np_bounds = _ai_char->get_node_path().get_bounds(); CPT(BoundingSphere) np_sphere = np_bounds->as_bounding_sphere(); - double distance_needed = offset.length() - bsphere->get_radius() - np_sphere->get_radius(); - if((obstacle_detection())) { + + if (obstacle_detection()) { LVecBase3 direction = _ai_char->get_char_render().get_relative_vector(_ai_char->get_node_path(), LVector3::forward()); direction.normalize(); float forward_component = offset.dot(direction); diff --git a/dtool/src/cppparser/cppManifest.cxx b/dtool/src/cppparser/cppManifest.cxx index 18a747d241..bb8f315c39 100644 --- a/dtool/src/cppparser/cppManifest.cxx +++ b/dtool/src/cppparser/cppManifest.cxx @@ -370,10 +370,8 @@ save_expansion(const string &exp, const vector_string ¶meter_names) { // Is this identifier one of our parameters? int pnum = -1; - bool va_args = false; if (ident == "__VA_ARGS__") { - va_args = true; // C99-style variadics, ie. #define macro(...) __VA_ARGS__ pnum = _variadic_param; diff --git a/dtool/src/cppparser/cppPreprocessor.cxx b/dtool/src/cppparser/cppPreprocessor.cxx index 24116a240a..f0fe1c9819 100644 --- a/dtool/src/cppparser/cppPreprocessor.cxx +++ b/dtool/src/cppparser/cppPreprocessor.cxx @@ -806,7 +806,7 @@ expand_manifests(const string &input_expr, bool expand_undefined, Manifests::const_iterator mi = _manifests.find(ident); if (mi != _manifests.end()) { const CPPManifest *manifest = (*mi).second; - expand_manifest_inline(expr, q, p, (*mi).second); + expand_manifest_inline(expr, q, p, manifest); manifest_found = true; } else if (expand_undefined && ident != "true" && ident != "false") { @@ -1192,8 +1192,6 @@ skip_c_comment(int c) { } else { CPPFile first_file = get_file(); - int first_line_number = get_line_number(); - int first_col_number = get_col_number() - 2; while (c != EOF) { if (c == '*') { @@ -1816,8 +1814,9 @@ get_identifier(int c) { type = CPPExpression::T_u16string; } else if (name == "U") { type = CPPExpression::T_u32string; + } else { + type = CPPExpression::T_string; } - get(); string str = scan_quoted(c); diff --git a/dtool/src/cppparser/cppToken.cxx b/dtool/src/cppparser/cppToken.cxx index b6f03d8d49..025590113a 100644 --- a/dtool/src/cppparser/cppToken.cxx +++ b/dtool/src/cppparser/cppToken.cxx @@ -40,7 +40,7 @@ CPPToken(int token, int line_number, int col_number, */ CPPToken:: CPPToken(int token, const YYLTYPE &loc, const string &str, const YYSTYPE &val) : - _token(token), _lloc(loc), _lval(val) + _token(token), _lval(val), _lloc(loc) { _lval.str = str; } diff --git a/dtool/src/dtoolbase/dtoolbase.h b/dtool/src/dtoolbase/dtoolbase.h index 7ec1cb6f04..eff05d5022 100644 --- a/dtool/src/dtoolbase/dtoolbase.h +++ b/dtool/src/dtoolbase/dtoolbase.h @@ -70,23 +70,21 @@ #else // #pragma message("VC 6.0") #endif +#endif /* WIN32_VC */ // Use NODEFAULT to optimize a switch() stmt to tell MSVC to automatically go // to the final untested case after it has failed all the other cases (i.e. // 'assume at least one of the cases is always true') #ifdef _DEBUG -# define NODEFAULT default: assert(0); +#define NODEFAULT default: assert(0); break; +#elif defined(_MSC_VER) +#define NODEFAULT default: __assume(0); // special VC keyword +#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 5) || (defined(__has_builtin) && __has_builtin(__builtin_unreachable)) +#define NODEFAULT default: __builtin_unreachable(); #else -# define NODEFAULT default: __assume(0); // special VC keyword +#define NODEFAULT #endif -#else /* if !WIN32_VC */ -#ifdef _DEBUG -# define NODEFAULT default: assert(0); -#else -# define NODEFAULT -#endif -#endif /* WIN32_VC */ /* include win32 defns for everything up to WinServer2003, and assume diff --git a/dtool/src/dtoolbase/typeRegistry.cxx b/dtool/src/dtoolbase/typeRegistry.cxx index 99ac09be10..7349d20dd4 100644 --- a/dtool/src/dtoolbase/typeRegistry.cxx +++ b/dtool/src/dtoolbase/typeRegistry.cxx @@ -341,6 +341,8 @@ get_root_class(int n) { TypeHandle handle; if (n >= 0 && n < (int)_root_classes.size()) { handle = _root_classes[n]->_handle; + } else { + handle = TypeHandle::none(); } _lock->release(); @@ -380,6 +382,8 @@ get_parent_class(TypeHandle child, int index) const { assert(rnode != (TypeRegistryNode *)NULL); if (index >= 0 && index < (int)rnode->_parent_classes.size()) { handle = rnode->_parent_classes[index]->_handle; + } else { + handle = TypeHandle::none(); } _lock->release(); return handle; @@ -415,6 +419,8 @@ get_child_class(TypeHandle child, int index) const { assert(rnode != (TypeRegistryNode *)NULL); if (index >= 0 && index < (int)rnode->_child_classes.size()) { handle = rnode->_child_classes[index]->_handle; + } else { + handle = TypeHandle::none(); } _lock->release(); return handle; diff --git a/dtool/src/dtoolutil/pandaFileStreamBuf.cxx b/dtool/src/dtoolutil/pandaFileStreamBuf.cxx index ca78c0a551..037d421469 100644 --- a/dtool/src/dtoolutil/pandaFileStreamBuf.cxx +++ b/dtool/src/dtoolutil/pandaFileStreamBuf.cxx @@ -323,7 +323,7 @@ seekoff(streamoff off, ios_seekdir dir, ios_openmode which) { // Posix case. { off_t li = lseek(_fd, off, SEEK_END); - if (li == (size_t)-1) { + if (li == (off_t)-1) { return -1; } new_pos = (size_t)li; diff --git a/dtool/src/interrogate/interfaceMakerPythonNative.cxx b/dtool/src/interrogate/interfaceMakerPythonNative.cxx index 5d18fca7be..c9ffd6dcb7 100644 --- a/dtool/src/interrogate/interfaceMakerPythonNative.cxx +++ b/dtool/src/interrogate/interfaceMakerPythonNative.cxx @@ -4196,7 +4196,7 @@ write_function_forset(ostream &out, return; } - FunctionRemap *remap; + FunctionRemap *remap = NULL; std::set::iterator sii; bool all_nonconst = false; diff --git a/dtool/src/interrogate/interrogateBuilder.cxx b/dtool/src/interrogate/interrogateBuilder.cxx index 342ffdd4b9..11ac166440 100644 --- a/dtool/src/interrogate/interrogateBuilder.cxx +++ b/dtool/src/interrogate/interrogateBuilder.cxx @@ -1851,9 +1851,9 @@ get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type, CP } // The getter must either take no arguments, or all defaults. - if (ftype->_parameters->_parameters.size() == (int)is_seq || - (ftype->_parameters->_parameters.size() > (int)is_seq && - ftype->_parameters->_parameters[(int)is_seq]->_initializer != NULL)) { + if (ftype->_parameters->_parameters.size() == (size_t)is_seq || + (ftype->_parameters->_parameters.size() > (size_t)is_seq && + ftype->_parameters->_parameters[(size_t)is_seq]->_initializer != NULL)) { // If this is a sequence getter, it must take an index argument. if (is_seq && !TypeManager::is_integer(ftype->_parameters->_parameters[0]->_type)) { continue; @@ -1909,7 +1909,7 @@ get_make_property(CPPMakeProperty *make_property, CPPStructType *struct_type, CP for (fi = fgroup->_instances.begin(); fi != fgroup->_instances.end(); ++fi) { CPPInstance *function = (*fi); CPPFunctionType *ftype = function->_type->as_function_type(); - if (ftype != NULL && ftype->_parameters->_parameters.size() == (int)is_seq) { + if (ftype != NULL && ftype->_parameters->_parameters.size() == (size_t)is_seq) { deleter = function; break; } diff --git a/dtool/src/interrogate/typeManager.cxx b/dtool/src/interrogate/typeManager.cxx index 7c9b6582a3..ae931742c1 100644 --- a/dtool/src/interrogate/typeManager.cxx +++ b/dtool/src/interrogate/typeManager.cxx @@ -41,7 +41,7 @@ resolve_type(CPPType *type, CPPScope *scope) { scope = &parser; } - CPPType *orig_type = type; + //CPPType *orig_type = type; type = type->resolve_type(scope, &parser); string name = type->get_local_name(&parser); if (name.empty()) { diff --git a/dtool/src/interrogatedb/py_panda.cxx b/dtool/src/interrogatedb/py_panda.cxx index 953b4700d1..9fe9916573 100644 --- a/dtool/src/interrogatedb/py_panda.cxx +++ b/dtool/src/interrogatedb/py_panda.cxx @@ -816,6 +816,7 @@ PyObject *DTOOL_PyObject_RichCompare(PyObject *v1, PyObject *v2, int op) { int cmpval = DTOOL_PyObject_Compare(v1, v2); bool result; switch (op) { + NODEFAULT case Py_LT: result = (cmpval < 0); break; @@ -833,6 +834,7 @@ PyObject *DTOOL_PyObject_RichCompare(PyObject *v1, PyObject *v2, int op) { break; case Py_GE: result = (cmpval >= 0); + break; } return PyBool_FromLong(result); } diff --git a/dtool/src/interrogatedb/py_panda.h b/dtool/src/interrogatedb/py_panda.h index 8491c7529f..f5e77e0dbb 100644 --- a/dtool/src/interrogatedb/py_panda.h +++ b/dtool/src/interrogatedb/py_panda.h @@ -219,9 +219,10 @@ static PyObject *Dtool_new_##CLASS_NAME(PyTypeObject *type, PyObject *args, PyOb } // The following used to be in the above macro, but it doesn't seem to be -// necessary as tp_alloc memsets the object to 0. ((Dtool_PyInstDef -// *)self)->_ptr_to_object = NULL;\ ((Dtool_PyInstDef *)self)->_memory_rules = -// false;\ ((Dtool_PyInstDef *)self)->_is_const = false;\ +// necessary as tp_alloc memsets the object to 0. +// ((Dtool_PyInstDef *)self)->_ptr_to_object = NULL; +// ((Dtool_PyInstDef *)self)->_memory_rules = false; +// ((Dtool_PyInstDef *)self)->_is_const = false; // Delete functions.. #ifdef NDEBUG diff --git a/panda/src/char/character.cxx b/panda/src/char/character.cxx index a57ec2eda6..ed28ac491e 100644 --- a/panda/src/char/character.cxx +++ b/panda/src/char/character.cxx @@ -228,7 +228,7 @@ calc_tight_bounds(LPoint3 &min_point, LPoint3 &max_point, bool &found_any, // around this, we will force-recompute all of the bounding volumes of our // parent nodes immediately. Parents parents = get_parents(); - for (int i = 0; i < parents.get_num_parents(); ++i) { + for (size_t i = 0; i < parents.get_num_parents(); ++i) { PandaNode *parent = parents.get_parent(i); parent->get_bounds(); } diff --git a/panda/src/display/displayRegion.cxx b/panda/src/display/displayRegion.cxx index d0eb6362b2..c8f7626468 100644 --- a/panda/src/display/displayRegion.cxx +++ b/panda/src/display/displayRegion.cxx @@ -638,9 +638,6 @@ do_compute_pixels(int i, int x_size, int y_size, CData *cdata) { Region ®ion = cdata->_regions[i]; - int old_w = region._pixels[1] - region._pixels[0]; - int old_h = region._pixels[3] - region._pixels[2]; - region._pixels[0] = int((region._dimensions[0] * x_size) + 0.5); region._pixels[1] = int((region._dimensions[1] * x_size) + 0.5); region._pixels_i[0] = region._pixels[0]; diff --git a/panda/src/display/graphicsEngine.cxx b/panda/src/display/graphicsEngine.cxx index 7e56778f2c..ad3aa3caa6 100644 --- a/panda/src/display/graphicsEngine.cxx +++ b/panda/src/display/graphicsEngine.cxx @@ -1527,7 +1527,7 @@ draw_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) { // We have to place this collector inside begin_frame, because we need // a current context for PStatGPUTimer to work. { - PStatGPUTimer timer(win->get_gsg(), win->get_draw_window_pcollector(), current_thread); + PStatGPUTimer timer(gsg, win->get_draw_window_pcollector(), current_thread); win->clear(current_thread); if (display_cat.is_spam()) { @@ -1547,8 +1547,8 @@ draw_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) { if (_auto_flip) { #ifdef DO_PSTATS // This is a good time to perform a latency query. - if (win->get_gsg()->get_timer_queries_active()) { - win->get_gsg()->issue_timer_query(GraphicsStateGuardian::_command_latency_pcollector.get_index()); + if (gsg->get_timer_queries_active()) { + gsg->issue_timer_query(GraphicsStateGuardian::_command_latency_pcollector.get_index()); } #endif @@ -1560,7 +1560,7 @@ draw_bins(const GraphicsEngine::Windows &wlist, Thread *current_thread) { win->begin_flip(); } { - PStatGPUTimer timer(win->get_gsg(), GraphicsEngine::_flip_end_pcollector, current_thread); + PStatGPUTimer timer(gsg, GraphicsEngine::_flip_end_pcollector, current_thread); win->end_flip(); } } diff --git a/panda/src/display/graphicsPipeSelection.cxx b/panda/src/display/graphicsPipeSelection.cxx index 9ac0e8aa1f..cef68b22c2 100644 --- a/panda/src/display/graphicsPipeSelection.cxx +++ b/panda/src/display/graphicsPipeSelection.cxx @@ -105,6 +105,8 @@ get_pipe_type(int n) const { LightMutexHolder holder(_lock); if (n >= 0 && n < (int)_pipe_types.size()) { result = _pipe_types[n]._type; + } else { + result = TypeHandle::none(); } } return result; diff --git a/panda/src/display/graphicsStateGuardian.cxx b/panda/src/display/graphicsStateGuardian.cxx index d068a1c4bc..ad532c5643 100644 --- a/panda/src/display/graphicsStateGuardian.cxx +++ b/panda/src/display/graphicsStateGuardian.cxx @@ -2061,8 +2061,6 @@ flush_timer_queries() { _last_num_queried = first; - int frame_index = ClockObject::get_global_clock()->get_frame_count(); - for (int i = 0; i < first; ++i) { CPT(TimerQueryContext) query = _pending_timer_queries[i]; diff --git a/panda/src/egg/eggVertex.cxx b/panda/src/egg/eggVertex.cxx index 973f583b7b..7663fd4eb3 100644 --- a/panda/src/egg/eggVertex.cxx +++ b/panda/src/egg/eggVertex.cxx @@ -138,11 +138,7 @@ has_uvw(const string &name) const { bool EggVertex:: has_aux(const string &name) const { AuxMap::const_iterator xi = _aux_map.find(name); - if (xi != _aux_map.end()) { - EggVertexAux *aux_obj = (*xi).second; - return true; - } - return false; + return (xi != _aux_map.end()); } /** diff --git a/panda/src/express/memoryInfo.cxx b/panda/src/express/memoryInfo.cxx index 815e57448d..d12b7313a0 100644 --- a/panda/src/express/memoryInfo.cxx +++ b/panda/src/express/memoryInfo.cxx @@ -108,7 +108,7 @@ determine_dynamic_type() { return; } - TypeHandle orig_type = _dynamic_type; + //TypeHandle orig_type = _dynamic_type; update_type_handle(_dynamic_type, got_type); } } diff --git a/panda/src/express/nodeReferenceCount.I b/panda/src/express/nodeReferenceCount.I index d27fa0a43a..4273f0b78c 100644 --- a/panda/src/express/nodeReferenceCount.I +++ b/panda/src/express/nodeReferenceCount.I @@ -129,7 +129,7 @@ node_ref() const { #endif ref(); - AtomicAdjust::inc(((NodeReferenceCount *)this)->_node_ref_count); + AtomicAdjust::inc(_node_ref_count); } /** @@ -174,7 +174,7 @@ node_unref_only() const { // you can't use PointerTo's? nassertv(_node_ref_count > 0); - AtomicAdjust::dec(((NodeReferenceCount *)this)->_node_ref_count); + AtomicAdjust::dec(_node_ref_count); } /** diff --git a/panda/src/express/nodeReferenceCount.h b/panda/src/express/nodeReferenceCount.h index 349d66660b..2312508f1b 100644 --- a/panda/src/express/nodeReferenceCount.h +++ b/panda/src/express/nodeReferenceCount.h @@ -42,14 +42,13 @@ PUBLISHED: INLINE void node_ref() const; INLINE bool node_unref() const; INLINE bool test_ref_count_integrity() const; - -protected: INLINE void node_unref_only() const; +protected: bool do_test_ref_count_integrity() const; private: - AtomicAdjust::Integer _node_ref_count; + mutable AtomicAdjust::Integer _node_ref_count; public: static TypeHandle get_class_type() { diff --git a/panda/src/express/ordered_vector.T b/panda/src/express/ordered_vector.T index 6a7100f90f..7ea866e52f 100644 --- a/panda/src/express/ordered_vector.T +++ b/panda/src/express/ordered_vector.T @@ -280,7 +280,6 @@ TYPENAME ordered_vector::SIZE_TYPE ordered_vector::CONST_ITERATOR first, TYPENAME ordered_vector::CONST_ITERATOR last, const TYPENAME ordered_vector::KEY_TYPE &key) const { - typedef pair::CONST_ITERATOR, TYPENAME ordered_vector::CONST_ITERATOR> pair_type; if (first == last) { // The list is empty; the key is not on the list. diff --git a/panda/src/glstuff/glGraphicsBuffer_src.cxx b/panda/src/glstuff/glGraphicsBuffer_src.cxx index d9df1d0be8..ad09596f9c 100644 --- a/panda/src/glstuff/glGraphicsBuffer_src.cxx +++ b/panda/src/glstuff/glGraphicsBuffer_src.cxx @@ -1753,7 +1753,7 @@ resolve_multisamples() { if (_rbm[RTP_depth_stencil] != 0 || _rbm[RTP_depth] != 0) { if (_shared_depth_buffer) { CLP(GraphicsBuffer) *graphics_buffer = NULL; - CLP(GraphicsBuffer) *highest_sort_graphics_buffer = NULL; + //CLP(GraphicsBuffer) *highest_sort_graphics_buffer = NULL; list ::iterator graphics_buffer_iterator; int max_sort_order = 0; @@ -1765,7 +1765,7 @@ resolve_multisamples() { // this call removes the entry from the list if (graphics_buffer->get_sort() >= max_sort_order) { max_sort_order = graphics_buffer->get_sort(); - highest_sort_graphics_buffer = graphics_buffer; + //highest_sort_graphics_buffer = graphics_buffer; } } } diff --git a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx index bba123ea92..d21c4df57b 100644 --- a/panda/src/glstuff/glGraphicsStateGuardian_src.cxx +++ b/panda/src/glstuff/glGraphicsStateGuardian_src.cxx @@ -10804,8 +10804,6 @@ do_issue_tex_matrix() { */ void CLP(GraphicsStateGuardian):: do_issue_tex_gen() { - bool force_normal = false; - nassertv(_num_active_texture_stages <= _max_texture_stages); // These are passed in for the four OBJECT_PLANE or EYE_PLANE values; they @@ -10849,7 +10847,6 @@ do_issue_tex_gen() { glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_SPHERE_MAP); glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); - force_normal = true; break; case TexGenAttrib::M_eye_cube_map: @@ -10872,7 +10869,6 @@ do_issue_tex_gen() { glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); - force_normal = true; } break; @@ -10900,7 +10896,6 @@ do_issue_tex_gen() { glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); - force_normal = true; } break; @@ -10924,7 +10919,6 @@ do_issue_tex_gen() { glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); - force_normal = true; } break; @@ -10952,7 +10946,6 @@ do_issue_tex_gen() { glEnable(GL_TEXTURE_GEN_S); glEnable(GL_TEXTURE_GEN_T); glEnable(GL_TEXTURE_GEN_R); - force_normal = true; } break; diff --git a/panda/src/glxdisplay/glxGraphicsWindow.cxx b/panda/src/glxdisplay/glxGraphicsWindow.cxx index 2a8a44e819..7dd43c8675 100644 --- a/panda/src/glxdisplay/glxGraphicsWindow.cxx +++ b/panda/src/glxdisplay/glxGraphicsWindow.cxx @@ -174,7 +174,6 @@ open_window() { << "No X visual: cannot open window.\n"; return false; } - Visual *visual = _visual_info->visual; if (glxgsg->_fbconfig != None) { setup_colormap(glxgsg->_fbconfig); diff --git a/panda/src/gobj/texture.cxx b/panda/src/gobj/texture.cxx index 8368dcf926..1802a36133 100644 --- a/panda/src/gobj/texture.cxx +++ b/panda/src/gobj/texture.cxx @@ -3374,7 +3374,7 @@ do_read_dds(CData *cdata, istream &in, const string &filename, bool header_only) unsigned int dimension = dds.get_uint32(); unsigned int misc_flag = dds.get_uint32(); unsigned int array_size = dds.get_uint32(); - unsigned int alpha_mode = dds.get_uint32(); + /*unsigned int alpha_mode = */dds.get_uint32(); switch (format) { case 2: // DXGI_FORMAT_R32G32B32A32_FLOAT @@ -4947,8 +4947,8 @@ do_compress_ram_image_bc4(const RamImage &uncompressed_image, // of the secondary interpolation mode supported by BC4. This is not // important for most textures, but it may be added in the future. - nassertv(x_blocks * y_blocks * 4 * 4 <= uncompressed_image._page_size); - nassertv(x_size * y_size == uncompressed_image._page_size); + nassertv((size_t)x_blocks * (size_t)y_blocks * 4 * 4 <= uncompressed_image._page_size); + nassertv((size_t)x_size * (size_t)y_size == uncompressed_image._page_size); static const int remap[] = {1, 7, 6, 5, 4, 3, 2, 0}; @@ -5046,8 +5046,8 @@ do_compress_ram_image_bc5(const RamImage &uncompressed_image, // BC5 uses the same compression algorithm as BC4, except repeated for two // channels. - nassertv(x_blocks * y_blocks * 4 * 4 * 2 <= uncompressed_image._page_size); - nassertv(stride * y_size == uncompressed_image._page_size); + nassertv((size_t)x_blocks * (size_t)y_blocks * 4 * 4 * 2 <= uncompressed_image._page_size); + nassertv((size_t)stride * (size_t)y_size == uncompressed_image._page_size); static const int remap[] = {1, 7, 6, 5, 4, 3, 2, 0}; diff --git a/panda/src/gobj/texturePeeker.I b/panda/src/gobj/texturePeeker.I index d41ee14db9..ccf6bdcc45 100644 --- a/panda/src/gobj/texturePeeker.I +++ b/panda/src/gobj/texturePeeker.I @@ -53,6 +53,6 @@ get_z_size() const { * Returns whether a given coordinate is inside of the texture dimensions. */ INLINE bool TexturePeeker:: -has_pixel(size_t x, size_t y) const { - return x < _x_size && y < _y_size; +has_pixel(int x, int y) const { + return x >= 0 && y >= 0 && x < _x_size && y < _y_size; } diff --git a/panda/src/gobj/texturePeeker.cxx b/panda/src/gobj/texturePeeker.cxx index cbe9003def..42e619e501 100644 --- a/panda/src/gobj/texturePeeker.cxx +++ b/panda/src/gobj/texturePeeker.cxx @@ -176,7 +176,7 @@ lookup(LColor &color, PN_stdfloat u, PN_stdfloat v) const { * coordinates are used. */ void TexturePeeker:: -fetch_pixel(LColor& color, size_t x, size_t y) const { +fetch_pixel(LColor& color, int x, int y) const { nassertv(x >= 0 && x < _x_size && y >= 0 && y < _y_size); const unsigned char *p = _image.p() + (y * _x_size + x) * _pixel_width; (*_get_texel)(color, p, _get_component); diff --git a/panda/src/gobj/texturePeeker.h b/panda/src/gobj/texturePeeker.h index e9af394dec..cb503bf041 100644 --- a/panda/src/gobj/texturePeeker.h +++ b/panda/src/gobj/texturePeeker.h @@ -36,10 +36,10 @@ PUBLISHED: INLINE int get_y_size() const; INLINE int get_z_size() const; - INLINE bool has_pixel(size_t x, size_t y) const; + INLINE bool has_pixel(int x, int y) const; void lookup(LColor &color, PN_stdfloat u, PN_stdfloat v) const; void lookup(LColor &color, PN_stdfloat u, PN_stdfloat v, PN_stdfloat w) const; - void fetch_pixel(LColor &color, size_t x, size_t y) const; + void fetch_pixel(LColor &color, int x, int y) const; bool lookup_bilinear(LColor &color, PN_stdfloat u, PN_stdfloat v) const; void filter_rect(LColor &color, PN_stdfloat min_u, PN_stdfloat min_v, diff --git a/panda/src/grutil/multitexReducer.cxx b/panda/src/grutil/multitexReducer.cxx index ea300e7902..8481444a2d 100644 --- a/panda/src/grutil/multitexReducer.cxx +++ b/panda/src/grutil/multitexReducer.cxx @@ -756,17 +756,13 @@ make_texture_layer(const NodePath &render, case TextureStage::CM_modulate: { TextureStage::CombineSource source0 = stage_info._stage->get_combine_rgb_source0(); - TextureStage::CombineOperand operand0 = stage_info._stage->get_combine_rgb_operand0(); TextureStage::CombineSource source1 = stage_info._stage->get_combine_rgb_source1(); - TextureStage::CombineOperand operand1 = stage_info._stage->get_combine_rgb_operand1(); // Since modulate doesn't care about order, let's establish the // convention that the lowest-numbered source operand is in slot 0 // (just for purposes of comparison). if (source1 < source0) { source0 = stage_info._stage->get_combine_rgb_source1(); - operand0 = stage_info._stage->get_combine_rgb_operand1(); source1 = stage_info._stage->get_combine_rgb_source0(); - operand1 = stage_info._stage->get_combine_rgb_operand0(); } if (source0 == TextureStage::CS_primary_color && diff --git a/panda/src/grutil/pipeOcclusionCullTraverser.cxx b/panda/src/grutil/pipeOcclusionCullTraverser.cxx index ca4316c5cc..91ebeb6559 100644 --- a/panda/src/grutil/pipeOcclusionCullTraverser.cxx +++ b/panda/src/grutil/pipeOcclusionCullTraverser.cxx @@ -673,8 +673,6 @@ show_results(int num_fragments, const Geom *geom, TransparencyAttrib::make(TransparencyAttrib::M_alpha), ColorAttrib::make_flat(color)); - GraphicsStateGuardian *gsg = _buffer->get_gsg(); - CullableObject *internal_viz = new CullableObject(geom, state, internal_transform); _internal_cull_handler->record_object(internal_viz, _internal_trav); diff --git a/panda/src/grutil/shaderTerrainMesh.cxx b/panda/src/grutil/shaderTerrainMesh.cxx index 8e655de000..8c2d03cdd4 100644 --- a/panda/src/grutil/shaderTerrainMesh.cxx +++ b/panda/src/grutil/shaderTerrainMesh.cxx @@ -534,7 +534,7 @@ void ShaderTerrainMesh::add_for_draw(CullTraverser *trav, CullTraverserData &dat // After rendering, increment the view index ++_current_view_index; - if (_current_view_index > stm_max_views) { + if (_current_view_index > (size_t)stm_max_views) { shader_terrain_cat.error() << "More views than supported! Increase the stm-max-views config variable!" << endl; } diff --git a/panda/src/parametrics/curveFitter.cxx b/panda/src/parametrics/curveFitter.cxx index 0cc20c20fa..6592d7aff2 100644 --- a/panda/src/parametrics/curveFitter.cxx +++ b/panda/src/parametrics/curveFitter.cxx @@ -154,11 +154,9 @@ void CurveFitter:: sample(ParametricCurveCollection *curves, int count) { nassertv(curves != (ParametricCurveCollection *)NULL); PN_stdfloat max_t = curves->get_max_t(); - PN_stdfloat t, last_t, d; + PN_stdfloat t; DataPoint dp; - last_t = 0.0f; - d = 0.0f; int i; for (i = 0; i < count; i++) { t = max_t * (PN_stdfloat)i / (PN_stdfloat)(count-1); diff --git a/panda/src/pgraph/clipPlaneAttrib.cxx b/panda/src/pgraph/clipPlaneAttrib.cxx index 7fd2da2d83..e62a3d6e24 100644 --- a/panda/src/pgraph/clipPlaneAttrib.cxx +++ b/panda/src/pgraph/clipPlaneAttrib.cxx @@ -911,7 +911,7 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) { AttribNodeRegistry *areg = AttribNodeRegistry::get_global_ptr(); if (manager->get_file_minor_ver() >= 40) { - for (int i = 0; i < _off_planes.size(); ++i) { + for (size_t i = 0; i < _off_planes.size(); ++i) { pi += _off_planes[i].complete_pointers(p_list + pi, manager); int n = areg->find_node(_off_planes[i]); @@ -921,7 +921,7 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) { } } - for (int i = 0; i < _on_planes.size(); ++i) { + for (size_t i = 0; i < _on_planes.size(); ++i) { pi += _on_planes[i].complete_pointers(p_list + pi, manager); int n = areg->find_node(_on_planes[i]); diff --git a/panda/src/pgraph/lightAttrib.cxx b/panda/src/pgraph/lightAttrib.cxx index a677345b8a..b80eb3b428 100644 --- a/panda/src/pgraph/lightAttrib.cxx +++ b/panda/src/pgraph/lightAttrib.cxx @@ -935,11 +935,11 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) { int pi = RenderAttrib::complete_pointers(p_list, manager); if (manager->get_file_minor_ver() >= 40) { - for (int i = 0; i < _off_lights.size(); ++i) { + for (size_t i = 0; i < _off_lights.size(); ++i) { pi += _off_lights[i].complete_pointers(p_list + pi, manager); } - for (int i = 0; i < _on_lights.size(); ++i) { + for (size_t i = 0; i < _on_lights.size(); ++i) { pi += _on_lights[i].complete_pointers(p_list + pi, manager); } @@ -978,7 +978,7 @@ finalize(BamReader *manager) { // Check if any of the nodes we loaded are mentioned in the // AttribNodeRegistry. If so, replace them. - for (int i = 0; i < _off_lights.size(); ++i) { + for (size_t i = 0; i < _off_lights.size(); ++i) { int n = areg->find_node(_off_lights[i]); if (n != -1) { // If it's in the registry, replace it. @@ -986,7 +986,7 @@ finalize(BamReader *manager) { } } - for (int i = 0; i < _on_lights.size(); ++i) { + for (size_t i = 0; i < _on_lights.size(); ++i) { int n = areg->find_node(_on_lights[i]); if (n != -1) { // If it's in the registry, replace it. @@ -1067,12 +1067,12 @@ fillin(DatagramIterator &scan, BamReader *manager) { if (manager->get_file_minor_ver() >= 40) { _off_lights.resize(scan.get_uint16()); - for (int i = 0; i < _off_lights.size(); ++i) { + for (size_t i = 0; i < _off_lights.size(); ++i) { _off_lights[i].fillin(scan, manager); } _on_lights.resize(scan.get_uint16()); - for (int i = 0; i < _on_lights.size(); ++i) { + for (size_t i = 0; i < _on_lights.size(); ++i) { _on_lights[i].fillin(scan, manager); } } else { diff --git a/panda/src/pgraph/loader.cxx b/panda/src/pgraph/loader.cxx index 671a40c638..32187508e0 100644 --- a/panda/src/pgraph/loader.cxx +++ b/panda/src/pgraph/loader.cxx @@ -431,8 +431,6 @@ save_file(const Filename &filename, const LoaderOptions &options, return false; } - VirtualFileSystem *vfs = VirtualFileSystem::get_global_ptr(); - bool result = try_save_file(this_filename, this_options, node, requested_type); if (!result) { if (report_errors) { @@ -451,10 +449,7 @@ save_file(const Filename &filename, const LoaderOptions &options, bool Loader:: try_save_file(const Filename &pathname, const LoaderOptions &options, PandaNode *node, LoaderFileType *requested_type) const { - bool report_errors = ((options.get_flags() & LoaderOptions::LF_report_errors) != 0 || loader_cat.is_debug()); - - bool result = requested_type->save_file(pathname, options, node); - return result; + return requested_type->save_file(pathname, options, node); } /** diff --git a/panda/src/pgraph/occluderEffect.cxx b/panda/src/pgraph/occluderEffect.cxx index 36c874a1f2..f27c486d88 100644 --- a/panda/src/pgraph/occluderEffect.cxx +++ b/panda/src/pgraph/occluderEffect.cxx @@ -47,10 +47,6 @@ add_on_occluder(const NodePath &occluder) const { nassertr(!occluder.is_empty() && occluder.node()->is_of_type(OccluderNode::get_class_type()), this); OccluderEffect *effect = new OccluderEffect(*this); effect->_on_occluders.insert(occluder); - - pair insert_result = - effect->_on_occluders.insert(Occluders::value_type(occluder)); - return return_new(effect); } @@ -170,7 +166,7 @@ complete_pointers(TypedWritable **p_list, BamReader *manager) { AttribNodeRegistry *areg = AttribNodeRegistry::get_global_ptr(); if (manager->get_file_minor_ver() >= 40) { - for (int i = 0; i < _on_occluders.size(); ++i) { + for (size_t i = 0; i < _on_occluders.size(); ++i) { pi += _on_occluders[i].complete_pointers(p_list + pi, manager); int n = areg->find_node(_on_occluders[i]); diff --git a/panda/src/pgraph/pandaNode.cxx b/panda/src/pgraph/pandaNode.cxx index 38a1c5f096..69e2dcabf7 100644 --- a/panda/src/pgraph/pandaNode.cxx +++ b/panda/src/pgraph/pandaNode.cxx @@ -1597,7 +1597,7 @@ replace_node(PandaNode *other) { // Switch the parents. Thread *current_thread = Thread::get_current_thread(); Parents other_parents = other->get_parents(); - for (int i = 0; i < other_parents.get_num_parents(); ++i) { + for (size_t i = 0; i < other_parents.get_num_parents(); ++i) { PandaNode *parent = other_parents.get_parent(i); if (find_parent(parent) != -1) { // This node was already a child of this parent; don't change it. @@ -1902,7 +1902,7 @@ is_under_scene_root() const { } Parents parents = get_parents(); - for (int i = 0; i < parents.get_num_parents(); ++i) { + for (size_t i = 0; i < parents.get_num_parents(); ++i) { PandaNode *parent = parents.get_parent(i); if (parent->find_stashed((PandaNode *)this) == -1) { if (parent->is_under_scene_root()) { @@ -2401,7 +2401,7 @@ void PandaNode:: r_mark_geom_bounds_stale(Thread *current_thread) { Children children = get_children(current_thread); - int i; + size_t i; for (i = 0; i < children.get_num_children(); i++) { PandaNode *child = children.get_child(i); child->r_mark_geom_bounds_stale(current_thread); @@ -2550,7 +2550,7 @@ r_prepare_scene(GraphicsStateGuardianBase *gsg, const RenderState *node_state, Children children = get_children(current_thread); // We must call get_num_children() each time through the loop, in case we're // running SIMPLE_THREADS and we get interrupted. - int i; + size_t i; for (i = 0; i < children.get_num_children(); i++) { PandaNode *child = children.get_child(i); CPT(RenderState) child_state = node_state->compose(child->get_state()); @@ -2760,7 +2760,7 @@ find_node_above(PandaNode *node) { } Parents parents = get_parents(); - for (int i = 0; i < parents.get_num_parents(); ++i) { + for (size_t i = 0; i < parents.get_num_parents(); ++i) { PandaNode *parent = parents.get_parent(i); if (parent->find_node_above(node)) { return true; diff --git a/panda/src/pipeline/pipelineCyclerTrueImpl.I b/panda/src/pipeline/pipelineCyclerTrueImpl.I index d2e78fca2d..2c393d0546 100644 --- a/panda/src/pipeline/pipelineCyclerTrueImpl.I +++ b/panda/src/pipeline/pipelineCyclerTrueImpl.I @@ -368,7 +368,13 @@ get_write_count() const { INLINE PT(CycleData) PipelineCyclerTrueImpl:: cycle_2() { TAU_PROFILE("PT(CycleData) PipelineCyclerTrueImpl::cycle_2()", " ", TAU_USER); - PT(CycleData) last_val = _data[1]._cdata.p(); + + // This trick moves an NPT into a PT without unnecessarily incrementing and + // subsequently decrementing the regular reference count. + PT(CycleData) last_val; + last_val.swap(_data[1]._cdata); + last_val->node_unref_only(); + nassertr(_lock.debug_is_locked(), last_val); nassertr(_dirty, last_val); nassertr(_num_stages == 2, last_val); @@ -389,7 +395,13 @@ cycle_2() { INLINE PT(CycleData) PipelineCyclerTrueImpl:: cycle_3() { TAU_PROFILE("PT(CycleData) PipelineCyclerTrueImpl::cycle_3()", " ", TAU_USER); - PT(CycleData) last_val = _data[2]._cdata.p(); + + // This trick moves an NPT into a PT without unnecessarily incrementing and + // subsequently decrementing the regular reference count. + PT(CycleData) last_val; + last_val.swap(_data[2]._cdata); + last_val->node_unref_only(); + nassertr(_lock.debug_is_locked(), last_val); nassertr(_dirty, last_val); nassertr(_num_stages == 3, last_val); diff --git a/panda/src/pipeline/pipelineCyclerTrueImpl.cxx b/panda/src/pipeline/pipelineCyclerTrueImpl.cxx index 9610a98bb9..b1466ce155 100644 --- a/panda/src/pipeline/pipelineCyclerTrueImpl.cxx +++ b/panda/src/pipeline/pipelineCyclerTrueImpl.cxx @@ -255,7 +255,12 @@ write_stage_upstream(int pipeline_stage, bool force_to_0, Thread *current_thread */ PT(CycleData) PipelineCyclerTrueImpl:: cycle() { - PT(CycleData) last_val = _data[_num_stages - 1]._cdata.p(); + // This trick moves an NPT into a PT without unnecessarily incrementing and + // subsequently decrementing the regular reference count. + PT(CycleData) last_val; + last_val.swap(_data[_num_stages - 1]._cdata); + last_val->node_unref_only(); + nassertr(_lock.debug_is_locked(), last_val); nassertr(_dirty, last_val); diff --git a/panda/src/pnmimage/pfmFile.cxx b/panda/src/pnmimage/pfmFile.cxx index 75bb06682f..a6d08b5038 100644 --- a/panda/src/pnmimage/pfmFile.cxx +++ b/panda/src/pnmimage/pfmFile.cxx @@ -86,7 +86,8 @@ clear() { void PfmFile:: clear(int x_size, int y_size, int num_channels) { nassertv(x_size >= 0 && y_size >= 0); - nassertv(num_channels > 0 && num_channels <= 4 || (x_size == 0 && y_size == 0 && num_channels == 0)); + nassertv((num_channels > 0 && num_channels <= 4) || + (x_size == 0 && y_size == 0 && num_channels == 0)); _x_size = x_size; _y_size = y_size; @@ -632,7 +633,6 @@ calc_average_point(LPoint3f &result, PN_float32 x, PN_float32 y, PN_float32 radi continue; } - const LPoint3f &p = get_point(xi, yi); int gi = (yi - min_y) * y_size + (xi - min_x); nassertr(gi >= 0 && gi < size, false); mini_grid[gi]._sxi = xi; @@ -1541,7 +1541,7 @@ apply_crop(int x_begin, int x_end, int y_begin, int y_end) { int new_x_size = x_end - x_begin; int new_y_size = y_end - y_begin; Table new_table; - int new_size = new_x_size * new_y_size * _num_channels; + size_t new_size = (size_t)new_x_size * (size_t)new_y_size * (size_t)_num_channels; // We allocate a little bit bigger to allow safe overflow: you can call // get_point3() or get_point4() on the last point of a 1- or 3-channel diff --git a/panda/src/pnmimage/pnm-image-filter-core.cxx b/panda/src/pnmimage/pnm-image-filter-core.cxx index 8907068b50..273a4b0713 100644 --- a/panda/src/pnmimage/pnm-image-filter-core.cxx +++ b/panda/src/pnmimage/pnm-image-filter-core.cxx @@ -25,7 +25,6 @@ FUNCTION_NAME(IMAGETYPE &dest, const IMAGETYPE &source, // the image xelvals scaled in the A direction only. This will hold the // adjusted xel data from our first pass. - typedef StoreType *StoreTypeP; StoreType **matrix = (StoreType **)PANDA_MALLOC_ARRAY(dest.ASIZE() * sizeof(StoreType *)); int a, b; diff --git a/panda/src/pnmimage/pnm-image-filter-sparse-core.cxx b/panda/src/pnmimage/pnm-image-filter-sparse-core.cxx index 0709c25cd3..4edf632ee4 100644 --- a/panda/src/pnmimage/pnm-image-filter-sparse-core.cxx +++ b/panda/src/pnmimage/pnm-image-filter-sparse-core.cxx @@ -27,7 +27,6 @@ FUNCTION_NAME(IMAGETYPE &dest, const IMAGETYPE &source, // the image xelvals scaled in the A direction only. This will hold the // adjusted xel data from our first pass. - typedef StoreType *StoreTypeP; StoreType **matrix = (StoreType **)PANDA_MALLOC_ARRAY(dest.ASIZE() * sizeof(StoreType *)); StoreType **matrix_weight = (StoreType **)PANDA_MALLOC_ARRAY(dest.ASIZE() * sizeof(StoreType *)); diff --git a/panda/src/pnmimagetypes/pnmFileTypeStbImage.cxx b/panda/src/pnmimagetypes/pnmFileTypeStbImage.cxx index 2c8932f7c9..2807ee1b18 100644 --- a/panda/src/pnmimagetypes/pnmFileTypeStbImage.cxx +++ b/panda/src/pnmimagetypes/pnmFileTypeStbImage.cxx @@ -114,10 +114,10 @@ static void cb_skip(void *user, int n) { // Implement skip by just reading and discarding the result. static const int size = 4096; - char data[4096]; - while (n > 4096) { - in->read(data, 4096); - n -= 4096; + char data[size]; + while (n > size) { + in->read(data, size); + n -= size; } if (n > 0) { in->read(data, n); diff --git a/panda/src/pnmtext/freetypeFont.cxx b/panda/src/pnmtext/freetypeFont.cxx index d66bcee868..f42b5b72bc 100644 --- a/panda/src/pnmtext/freetypeFont.cxx +++ b/panda/src/pnmtext/freetypeFont.cxx @@ -241,8 +241,8 @@ copy_bitmap_to_pnmimage(const FT_Bitmap &bitmap, PNMImage &image) { // This is the easy case: we can copy the rendered glyph directly into our // image, one pixel at a time. unsigned char *buffer_row = bitmap.buffer; - for (int yi = 0; yi < bitmap.rows; yi++) { - for (int xi = 0; xi < bitmap.width; xi++) { + for (int yi = 0; yi < (int)bitmap.rows; yi++) { + for (int xi = 0; xi < (int)bitmap.width; xi++) { image.set_gray_val(xi, yi, buffer_row[xi]); } buffer_row += bitmap.pitch; @@ -252,11 +252,11 @@ copy_bitmap_to_pnmimage(const FT_Bitmap &bitmap, PNMImage &image) { // This is a little bit more work: we have to expand the one-bit-per-pixel // bitmap into a one-byte-per-pixel image. unsigned char *buffer_row = bitmap.buffer; - for (int yi = 0; yi < bitmap.rows; yi++) { + for (int yi = 0; yi < (int)bitmap.rows; yi++) { xelval maxval = image.get_maxval(); int bit = 0x80; unsigned char *b = buffer_row; - for (int xi = 0; xi < bitmap.width; xi++) { + for (int xi = 0; xi < (int)bitmap.width; xi++) { if (*b & bit) { image.set_gray_val(xi, yi, maxval); } else { @@ -277,8 +277,8 @@ copy_bitmap_to_pnmimage(const FT_Bitmap &bitmap, PNMImage &image) { // Here we must expand a grayscale pixmap with n levels of gray into our // 256-level texture. unsigned char *buffer_row = bitmap.buffer; - for (int yi = 0; yi < bitmap.rows; yi++) { - for (int xi = 0; xi < bitmap.width; xi++) { + for (int yi = 0; yi < (int)bitmap.rows; yi++) { + for (int xi = 0; xi < (int)bitmap.width; xi++) { image.set_gray(xi, yi, (PN_stdfloat)buffer_row[xi] / (bitmap.num_grays - 1)); } buffer_row += bitmap.pitch; @@ -691,7 +691,6 @@ outline_nurbs(NurbsCurveResult *ncr) { PN_stdfloat st0 = st, st1 = st; if (i > 0) { - PN_stdfloat last_t = ncr->get_sample_t(i - 1); st0 = ncr->get_sample_t(i - 1) * 0.1f + st * 0.9f; } if (i < num_samples - 1) { diff --git a/panda/src/putil/doubleBitMask.I b/panda/src/putil/doubleBitMask.I index 6d21ad2ffb..a6997af549 100644 --- a/panda/src/putil/doubleBitMask.I +++ b/panda/src/putil/doubleBitMask.I @@ -700,7 +700,7 @@ operator ^= (const DoubleBitMask &other) { template INLINE void DoubleBitMask:: operator <<= (int shift) { - _hi = (_hi << shift) | ((_lo >> half_bits - shift) & BitMaskType::lower_on(shift)); + _hi = (_hi << shift) | ((_lo >> (half_bits - shift)) & BitMaskType::lower_on(shift)); _lo <<= shift; } @@ -710,7 +710,7 @@ operator <<= (int shift) { template INLINE void DoubleBitMask:: operator >>= (int shift) { - _lo = (_lo >> shift) | ((_hi & BitMaskType::lower_on(shift)) << half_bits - shift); + _lo = (_lo >> shift) | ((_hi & BitMaskType::lower_on(shift)) << (half_bits - shift)); _hi >>= shift; } diff --git a/panda/src/putil/simpleHashMap.I b/panda/src/putil/simpleHashMap.I index 67db8830b9..d68fae9542 100644 --- a/panda/src/putil/simpleHashMap.I +++ b/panda/src/putil/simpleHashMap.I @@ -553,7 +553,6 @@ expand_table() { nassertv(_num_entries == 0); // Now copy the entries from the old table into the new table. - int num_added = 0; for (size_t i = 0; i < old_table_size; ++i) { if (old_map.has_element(i)) { size_t new_index = get_hash(old_map._table[i]._key); diff --git a/panda/src/putil/weakKeyHashMap.I b/panda/src/putil/weakKeyHashMap.I index ea5aa43e9a..c80e47723d 100644 --- a/panda/src/putil/weakKeyHashMap.I +++ b/panda/src/putil/weakKeyHashMap.I @@ -600,7 +600,6 @@ expand_table() { nassertv(_num_entries == 0); // Now copy the entries from the old table into the new table. - int num_added = 0; for (size_t i = 0; i < old_table_size; ++i) { if (old_map.has_element(i)) { size_t new_index = get_hash(old_map._table[i]._key.get_orig()); diff --git a/panda/src/rocket/rocketInputHandler.cxx b/panda/src/rocket/rocketInputHandler.cxx index 5451beda9e..fcfa6dc2cf 100644 --- a/panda/src/rocket/rocketInputHandler.cxx +++ b/panda/src/rocket/rocketInputHandler.cxx @@ -152,7 +152,6 @@ get_rocket_key(const ButtonHandle handle) { void RocketInputHandler:: do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input, DataNodeTransmit &output) { - Thread *current_thread = trav->get_current_thread(); MutexHolder holder(_lock); if (input.has_data(_pixel_xy_input)) { diff --git a/panda/src/text/dynamicTextFont.cxx b/panda/src/text/dynamicTextFont.cxx index 705bd1a943..09369a12b9 100644 --- a/panda/src/text/dynamicTextFont.cxx +++ b/panda/src/text/dynamicTextFont.cxx @@ -220,7 +220,6 @@ write(ostream &out, int indent_level) const { Cache::const_iterator ci; for (ci = _cache.begin(); ci != _cache.end(); ++ci) { int glyph_index = (*ci).first; - const TextGlyph *glyph = (*ci).second; indent(out, indent_level + 2) << glyph_index; @@ -630,7 +629,7 @@ copy_bitmap_to_texture(const FT_Bitmap &bitmap, DynamicTextGlyph *glyph) { // This is the easy case: we can memcpy the rendered glyph directly into // our texture image, one row at a time. unsigned char *buffer_row = bitmap.buffer; - for (int yi = 0; yi < bitmap.rows; yi++) { + for (int yi = 0; yi < (int)bitmap.rows; yi++) { unsigned char *texture_row = glyph->get_row(yi); nassertv(texture_row != (unsigned char *)NULL); @@ -642,13 +641,13 @@ copy_bitmap_to_texture(const FT_Bitmap &bitmap, DynamicTextGlyph *glyph) { // This is a little bit more work: we have to expand the one-bit-per-pixel // bitmap into a one-byte-per-pixel texture. unsigned char *buffer_row = bitmap.buffer; - for (int yi = 0; yi < bitmap.rows; yi++) { + for (int yi = 0; yi < (int)bitmap.rows; yi++) { unsigned char *texture_row = glyph->get_row(yi); nassertv(texture_row != (unsigned char *)NULL); int bit = 0x80; unsigned char *b = buffer_row; - for (int xi = 0; xi < bitmap.width; xi++) { + for (int xi = 0; xi < (int)bitmap.width; xi++) { if (*b & bit) { texture_row[xi] = 0xff; } else { @@ -669,10 +668,10 @@ copy_bitmap_to_texture(const FT_Bitmap &bitmap, DynamicTextGlyph *glyph) { // Here we must expand a grayscale pixmap with n levels of gray into our // 256-level texture. unsigned char *buffer_row = bitmap.buffer; - for (int yi = 0; yi < bitmap.rows; yi++) { + for (int yi = 0; yi < (int)bitmap.rows; yi++) { unsigned char *texture_row = glyph->get_row(yi); nassertv(texture_row != (unsigned char *)NULL); - for (int xi = 0; xi < bitmap.width; xi++) { + for (int xi = 0; xi < (int)bitmap.width; xi++) { texture_row[xi] = (int)(buffer_row[xi] * 255) / (bitmap.num_grays - 1); } buffer_row += bitmap.pitch; diff --git a/panda/src/text/textAssembler.cxx b/panda/src/text/textAssembler.cxx index 1f8b9dc74e..4829576407 100644 --- a/panda/src/text/textAssembler.cxx +++ b/panda/src/text/textAssembler.cxx @@ -1329,10 +1329,9 @@ assemble_paragraph(TextAssembler::PlacedGlyphs &placed_glyphs) { // width is defined by the wordwrap size with the upper left corner // starting from 0,0,0 if the wordwrap size is unspecified the alignment // could eventually result wrong. - PN_stdfloat xpos; + PN_stdfloat xpos = 0; switch (align) { case TextProperties::A_left: - xpos = 0.0f; _lr[0] = max(_lr[0], row_width); break; @@ -1348,7 +1347,6 @@ assemble_paragraph(TextAssembler::PlacedGlyphs &placed_glyphs) { break; case TextProperties::A_boxed_left: - xpos = 0.0f; _lr[0] = max(_lr[0], max(row_width, wordwrap)); break; diff --git a/panda/src/text/textNode.cxx b/panda/src/text/textNode.cxx index b9bfd22125..454c7dd7f3 100644 --- a/panda/src/text/textNode.cxx +++ b/panda/src/text/textNode.cxx @@ -911,7 +911,7 @@ count_geoms(PandaNode *node) { } Children children = node->get_children(); - for (int i = 0; i < children.get_num_children(); ++i) { + for (size_t i = 0; i < children.get_num_children(); ++i) { num_geoms += count_geoms(children.get_child(i)); } diff --git a/panda/src/tform/mouseWatcher.cxx b/panda/src/tform/mouseWatcher.cxx index 7f6355c135..30f2c4762e 100644 --- a/panda/src/tform/mouseWatcher.cxx +++ b/panda/src/tform/mouseWatcher.cxx @@ -1474,10 +1474,10 @@ do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input, << " seconds of inactivity; releasing held buttons.\n"; } { - for (int i = 0; i < _current_buttons_down.get_num_bits(); ++i) { + for (size_t i = 0; i < _current_buttons_down.get_num_bits(); ++i) { if (_current_buttons_down.get_bit(i)) { - release(ButtonHandle(i)); - new_button_events.add_event(ButtonEvent(ButtonHandle(i), ButtonEvent::T_up)); + release(ButtonHandle((int)i)); + new_button_events.add_event(ButtonEvent(ButtonHandle((int)i), ButtonEvent::T_up)); } } } @@ -1488,10 +1488,10 @@ do_transmit_data(DataGraphTraverser *trav, const DataNodeTransmit &input, case IS_inactive_to_active: // "Press" all of the buttons we "released" before. { - for (int i = 0; i < _current_buttons_down.get_num_bits(); ++i) { + for (size_t i = 0; i < _current_buttons_down.get_num_bits(); ++i) { if (_current_buttons_down.get_bit(i)) { - press(ButtonHandle(i), false); - new_button_events.add_event(ButtonEvent(ButtonHandle(i), ButtonEvent::T_down)); + press(ButtonHandle((int)i), false); + new_button_events.add_event(ButtonEvent(ButtonHandle((int)i), ButtonEvent::T_down)); } } } diff --git a/panda/src/tinydisplay/ztriangle_two.h b/panda/src/tinydisplay/ztriangle_two.h index d1c5a56916..6bb255ce01 100644 --- a/panda/src/tinydisplay/ztriangle_two.h +++ b/panda/src/tinydisplay/ztriangle_two.h @@ -81,7 +81,7 @@ FNAME(smooth_untextured) (ZBuffer *zb, #define EARLY_OUT() \ { \ - int c0, c1, c2; \ + unsigned int c0, c1, c2; \ c0 = RGBA_TO_PIXEL(p0->r, p0->g, p0->b, p0->a); \ c1 = RGBA_TO_PIXEL(p1->r, p1->g, p1->b, p1->a); \ c2 = RGBA_TO_PIXEL(p2->r, p2->g, p2->b, p2->a); \ @@ -223,7 +223,7 @@ FNAME(smooth_textured) (ZBuffer *zb, #define EARLY_OUT() \ { \ - int c0, c1, c2; \ + unsigned int c0, c1, c2; \ c0 = RGBA_TO_PIXEL(p0->r, p0->g, p0->b, p0->a); \ c1 = RGBA_TO_PIXEL(p1->r, p1->g, p1->b, p1->a); \ c2 = RGBA_TO_PIXEL(p2->r, p2->g, p2->b, p2->a); \ diff --git a/panda/src/vision/config_vision.cxx b/panda/src/vision/config_vision.cxx index 91c6acac86..3b53c0ed02 100644 --- a/panda/src/vision/config_vision.cxx +++ b/panda/src/vision/config_vision.cxx @@ -60,8 +60,8 @@ init_libvision() { PandaSystem *ps = PandaSystem::get_global_ptr(); ps->add_system("OpenCV"); - TexturePool *ts = TexturePool::get_global_ptr(); #ifndef HAVE_FFMPEG + TexturePool *ts = TexturePool::get_global_ptr(); ts->register_texture_type(OpenCVTexture::make_texture, "avi"); #endif #endif diff --git a/panda/src/vision/webcamVideoCursorV4L.cxx b/panda/src/vision/webcamVideoCursorV4L.cxx index c12568882d..64090c53aa 100644 --- a/panda/src/vision/webcamVideoCursorV4L.cxx +++ b/panda/src/vision/webcamVideoCursorV4L.cxx @@ -305,7 +305,7 @@ WebcamVideoCursorV4L(WebcamVideoV4L *src) : MovieVideoCursor(src) { // Set up the mmap buffers struct v4l2_buffer buf; - for (int i = 0; i < _bufcount; ++i) { + for (unsigned int i = 0; i < (unsigned int)_bufcount; ++i) { memset(&buf, 0, sizeof buf); buf.type = V4L2_BUF_TYPE_VIDEO_CAPTURE; buf.memory = V4L2_MEMORY_MMAP; @@ -367,7 +367,7 @@ WebcamVideoCursorV4L:: close(_fd); } if (_buffers) { - for (int i = 0; i < _bufcount; ++i) { + for (unsigned int i = 0; i < (unsigned int)_bufcount; ++i) { munmap(_buffers[i], _buflens[i]); } free(_buffers); @@ -455,7 +455,7 @@ fetch_buffer() { } // Flip the image vertically - for (size_t row = 0; row < _size_y; ++row) { + for (int row = 0; row < _size_y; ++row) { memcpy(block + (_size_y - row - 1) * new_bpl, newbuf + row * new_bpl, new_bpl); } free(newbuf); diff --git a/panda/src/vision/webcamVideoOpenCV.cxx b/panda/src/vision/webcamVideoOpenCV.cxx index 92a22dc4a5..d4c68070fa 100644 --- a/panda/src/vision/webcamVideoOpenCV.cxx +++ b/panda/src/vision/webcamVideoOpenCV.cxx @@ -33,7 +33,7 @@ find_all_webcams_opencv() { "numbers that are assumed to be available via OpenCV to the " "WebcamVideo interface. The default camera index is 0. " "Specify empty string if there are no available cameras.")); - for (int i = 0; i < wemcam_opencv_camera_index.get_num_words(); ++i) { + for (size_t i = 0; i < wemcam_opencv_camera_index.get_num_words(); ++i) { PT(WebcamVideo) wc = new WebcamVideoOpenCV(wemcam_opencv_camera_index[i]); WebcamVideoOpenCV::_all_webcams.push_back(wc); } diff --git a/pandatool/src/daeegg/daeCharacter.cxx b/pandatool/src/daeegg/daeCharacter.cxx index 0d6e0d1e39..31d8db02cb 100644 --- a/pandatool/src/daeegg/daeCharacter.cxx +++ b/pandatool/src/daeegg/daeCharacter.cxx @@ -177,7 +177,7 @@ influence_vertex(int index, EggVertex *vertex) { for (size_t pa = 0; pa < influence->GetPairCount(); ++pa) { const FCDJointWeightPair* jwpair = influence->GetPair(pa); - if (jwpair->jointIndex >= 0 && jwpair->jointIndex < _joints.size()) { + if (jwpair->jointIndex >= 0 && jwpair->jointIndex < (int)_joints.size()) { EggGroup *joint = _joints[jwpair->jointIndex]._group.p(); if (joint != NULL) { joint->ref_vertex(vertex, jwpair->weight); diff --git a/pandatool/src/egg-optchar/eggOptchar.cxx b/pandatool/src/egg-optchar/eggOptchar.cxx index d6f541045e..4198a3b84c 100644 --- a/pandatool/src/egg-optchar/eggOptchar.cxx +++ b/pandatool/src/egg-optchar/eggOptchar.cxx @@ -1508,7 +1508,7 @@ do_defpose() { nassertv(anim_index != -1); // Now we can recursively apply the default pose to the hierarchy. - ch->get_root_joint()->apply_default_pose(anim_index, frame); + root_joint->apply_default_pose(anim_index, frame); } int main(int argc, char *argv[]) {