From 4785161374c90f2ab9935fea3a2db5ecbdc893b1 Mon Sep 17 00:00:00 2001 From: David Rose Date: Sat, 18 Jun 2011 00:16:48 +0000 Subject: [PATCH] squelch some more compiler warnings --- dtool/LocalSetup.pp | 2 +- dtool/src/dtoolutil/pandaFileStreamBuf.cxx | 9 +- dtool/src/interrogate/functionRemap.cxx | 4 +- dtool/src/interrogate/interfaceMaker.cxx | 2 - panda/src/audiotraits/openalAudioSound.cxx | 47 +++--- panda/src/chan/movingPartBase.I | 4 +- panda/src/collide/collisionBox.I | 18 +-- panda/src/collide/collisionBox.cxx | 137 +++++++++--------- .../collide/collisionHandlerHighestEvent.cxx | 4 +- panda/src/collide/collisionSphere.cxx | 7 +- panda/src/display/subprocessWindowBuffer.cxx | 4 +- panda/src/egg/eggGroup.cxx | 5 +- panda/src/egg/eggTexture.cxx | 4 +- panda/src/event/asyncTaskChain.cxx | 5 +- panda/src/express/multifile.cxx | 2 +- panda/src/grutil/geoMipTerrain.cxx | 9 +- panda/src/grutil/meshDrawer.cxx | 86 +++++------ panda/src/grutil/movieTexture.cxx | 14 +- panda/src/linmath/lvecBase2_ext_src.I | 4 +- panda/src/linmath/lvecBase3_ext_src.I | 4 +- panda/src/linmath/lvecBase4_ext_src.I | 4 +- panda/src/pgui/pgEntry.cxx | 3 + panda/src/pipeline/thread.cxx | 2 +- panda/src/pnmtext/freetypeFont.cxx | 2 +- panda/src/pstatclient/pStatClient.cxx | 2 +- panda/src/text/textProperties.cxx | 12 ++ 26 files changed, 207 insertions(+), 189 deletions(-) diff --git a/dtool/LocalSetup.pp b/dtool/LocalSetup.pp index 35bd0a4705..c260871f60 100644 --- a/dtool/LocalSetup.pp +++ b/dtool/LocalSetup.pp @@ -714,7 +714,7 @@ $[cdefine USE_DELETED_CHAIN] $[cdefine WANT_NATIVE_NET] /* Turn off warnings for using scanf and such */ -#if $[or $[eq $[USE_COMPILER],MSVC9], $[USE_COMPILER],MSVC9x64] +#if $[or $[eq $[USE_COMPILER],MSVC9], $[eq $[USE_COMPILER],MSVC9x64]] #print Will ignore CRT_SECURE warnings for MSVC9 $[cdefine _CRT_SECURE_NO_WARNINGS] # pragma warning( disable : 4996 4275 4267 4099 4049 4013 4005 ) diff --git a/dtool/src/dtoolutil/pandaFileStreamBuf.cxx b/dtool/src/dtoolutil/pandaFileStreamBuf.cxx index 53aeffe74f..bed15ce9ec 100644 --- a/dtool/src/dtoolutil/pandaFileStreamBuf.cxx +++ b/dtool/src/dtoolutil/pandaFileStreamBuf.cxx @@ -336,9 +336,12 @@ seekoff(streamoff off, ios_seekdir dir, ios_openmode which) { } #else // Posix case. - new_pos = lseek(_fd, off, SEEK_END); - if (new_pos == -1) { - return -1; + { + off_t li = lseek(_fd, off, SEEK_END); + if (li == (size_t)-1) { + return -1; + } + new_pos = (size_t)li; } #endif // _WIN32 break; diff --git a/dtool/src/interrogate/functionRemap.cxx b/dtool/src/interrogate/functionRemap.cxx index 09e7c225c4..aa75f94934 100644 --- a/dtool/src/interrogate/functionRemap.cxx +++ b/dtool/src/interrogate/functionRemap.cxx @@ -398,7 +398,7 @@ get_call_str(const string &container, const vector_string &pexprs) const { if (_cpptype != NULL) { // Fix nested classes by replacing :: with __ char* nested_name = strdup(_cpptype->get_local_name(&parser).c_str()); - for (int i = 0; i < strlen(nested_name); ++i) { + for (size_t i = 0; i < strlen(nested_name); ++i) { if (nested_name[i] == ':') { nested_name[i] = '_'; } @@ -681,7 +681,7 @@ setup_properties(const InterrogateFunction &ifunc, InterfaceMaker *interface_mak } } else if (fname == "size" || fname == "__len__") { - if (_parameters.size() == first_param && + if ((int)_parameters.size() == first_param && TypeManager::is_integer(_return_type->get_new_type())) { // It receives no parameters, and returns an integer. _flags |= F_size; diff --git a/dtool/src/interrogate/interfaceMaker.cxx b/dtool/src/interrogate/interfaceMaker.cxx index ab6354dab0..5e42af3080 100644 --- a/dtool/src/interrogate/interfaceMaker.cxx +++ b/dtool/src/interrogate/interfaceMaker.cxx @@ -118,8 +118,6 @@ InterfaceMaker::Object:: //////////////////////////////////////////////////////////////////// void InterfaceMaker::Object:: check_protocols() { - InterrogateDatabase *idb = InterrogateDatabase::get_ptr(); - int flags = 0; Functions::const_iterator fi; diff --git a/panda/src/audiotraits/openalAudioSound.cxx b/panda/src/audiotraits/openalAudioSound.cxx index 85bfaea9bb..b4df2a5da0 100644 --- a/panda/src/audiotraits/openalAudioSound.cxx +++ b/panda/src/audiotraits/openalAudioSound.cxx @@ -46,38 +46,39 @@ OpenALAudioSound(OpenALAudioManager* manager, int mode) : _movie(movie), _sd(NULL), - _loops_completed(0), - _playing_rate(0.0), _playing_loops(0), + _playing_rate(0.0), + _loops_completed(0), _source(0), _manager(manager), - _basename(movie->get_filename().get_basename()), _volume(1.0f), _balance(0), - _loop_count(1), - _length(0.0), - _start_time(0.0), _play_rate(1.0), + _positional(positional), + _min_dist(3.28f), + _max_dist(1000000000.0f), + _drop_off_factor(1.0f), + _length(0.0), + _loop_count(1), + _desired_mode(mode), + _start_time(0.0), _current_time(0.0), + _basename(movie->get_filename().get_basename()), _active(true), - _paused(false), - _desired_mode(mode) + _paused(false) { - _location[0] = 0; - _location[1] = 0; - _location[2] = 0; - - _velocity[0] = 0; - _velocity[1] = 0; - _velocity[2] = 0; - - _min_dist = 3.28f; _max_dist = 1000000000.0f; - _drop_off_factor = 1.0f; - - _positional = positional; - + _location[0] = 0.0f; + _location[1] = 0.0f; + _location[2] = 0.0f; + _velocity[0] = 0.0f; + _velocity[1] = 0.0f; + _velocity[2] = 0.0f; + require_sound_data(); - if (_manager == 0) return; + if (_manager == NULL) { + return; + } + _length = _sd->_length; if (positional) { if (_sd->_channels != 1) { @@ -506,7 +507,7 @@ push_fresh_buffers() { int rate = cursor->audio_rate(); int fill = 0; - for (int i=0; i<_stream_queued.size(); i++) { + for (size_t i = 0; i < _stream_queued.size(); i++) { fill += _stream_queued[i]._samples; } diff --git a/panda/src/chan/movingPartBase.I b/panda/src/chan/movingPartBase.I index c90b1692be..4ef99ae1dc 100644 --- a/panda/src/chan/movingPartBase.I +++ b/panda/src/chan/movingPartBase.I @@ -22,9 +22,9 @@ INLINE MovingPartBase:: MovingPartBase(const MovingPartBase ©) : PartGroup(copy), - _forced_channel(copy._forced_channel), _num_effective_channels(0), - _effective_control(NULL) + _effective_control(NULL), + _forced_channel(copy._forced_channel) { // We don't copy the bound channels. We do copy the forced_channel, // though this is just a pointerwise copy. diff --git a/panda/src/collide/collisionBox.I b/panda/src/collide/collisionBox.I index 709394ca1c..41f28fa020 100644 --- a/panda/src/collide/collisionBox.I +++ b/panda/src/collide/collisionBox.I @@ -84,12 +84,12 @@ INLINE CollisionBox:: CollisionBox(const CollisionBox ©) : CollisionSolid(copy), _center(copy._center), - _x( copy._x ), - _y( copy._y ), - _z( copy._z ), - _min( copy._min), - _max( copy._max), - _radius( copy._radius ) + _min(copy._min), + _max(copy._max), + _x(copy._x ), + _y(copy._y ), + _z(copy._z ), + _radius(copy._radius ) { for(int v = 0; v < 8; v++) _vertex[v] = copy._vertex[v]; @@ -350,13 +350,13 @@ operator = (const CollisionBox::PointDef ©) { _p = copy._p; _v = copy._v; } + //////////////////////////////////////////////////////////////////// // Function: CollisionBox::get_plane_points // Access: Public // Description: returns the points that form the nth plane //////////////////////////////////////////////////////////////////// - INLINE CollisionBox::Points CollisionBox:: -get_plane_points( int n ){ - return _points[n]; +get_plane_points(int n) { + return _points[n]; } diff --git a/panda/src/collide/collisionBox.cxx b/panda/src/collide/collisionBox.cxx index 571d9ce52b..19a1f6ee13 100644 --- a/panda/src/collide/collisionBox.cxx +++ b/panda/src/collide/collisionBox.cxx @@ -12,8 +12,6 @@ // //////////////////////////////////////////////////////////////////// - -#include "collisionDSSolid.h" #include "collisionBox.h" #include "collisionLine.h" #include "collisionRay.h" @@ -76,7 +74,7 @@ setup_box(){ array[2] = get_point(plane_def[plane][2]); array[3] = get_point(plane_def[plane][3]); setup_points(array, array+4, plane); - } + } } //////////////////////////////////////////////////////////////////// @@ -149,9 +147,9 @@ void CollisionBox:: xform(const LMatrix4f &mat) { _center = _center * mat; for(int v = 0; v < 8; v++) - _vertex[v] = _vertex[v] * mat; + _vertex[v] = _vertex[v] * mat; for(int p = 0; p < 6 ; p++) - _planes[p] = set_plane(p); + _planes[p] = set_plane(p); _x = _vertex[0].get_x()-_center.get_x(); _y = _vertex[0].get_y()-_center.get_y(); _z = _vertex[0].get_z()-_center.get_z(); @@ -171,7 +169,7 @@ xform(const LMatrix4f &mat) { //////////////////////////////////////////////////////////////////// LPoint3f CollisionBox:: get_collision_origin() const { - return _center; + return _center; } //////////////////////////////////////////////////////////////////// @@ -277,7 +275,8 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { float from_radius = csqrt(from_radius_2); int ip; - float max_dist,dist; + float max_dist = 0.0; + float dist = 0.0; bool intersect; Planef plane; LVector3f normal; @@ -288,57 +287,57 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { continue; } if (wrt_prev_space != wrt_space) { - // If we have a delta between the previous position and the - // current position, we use that to determine some more properties - // of the collision. - LPoint3f b = from_center; - LPoint3f a = sphere->get_center() * wrt_prev_space->get_mat(); - LVector3f delta = b - a; + // If we have a delta between the previous position and the + // current position, we use that to determine some more properties + // of the collision. + LPoint3f b = from_center; + LPoint3f a = sphere->get_center() * wrt_prev_space->get_mat(); + LVector3f delta = b - a; - // First, there is no collision if the "from" object is definitely - // moving in the same direction as the plane's normal. - float dot = delta.dot(plane.get_normal()); - if (dot > 0.1f) { - continue; // no intersection - } + // First, there is no collision if the "from" object is definitely + // moving in the same direction as the plane's normal. + float dot = delta.dot(plane.get_normal()); + if (dot > 0.1f) { + continue; // no intersection + } - if (IS_NEARLY_ZERO(dot)) { - // If we're moving parallel to the plane, the sphere is tested - // at its final point. Leave it as it is. + if (IS_NEARLY_ZERO(dot)) { + // If we're moving parallel to the plane, the sphere is tested + // at its final point. Leave it as it is. - } else { - // Otherwise, we're moving into the plane; the sphere is tested - // at the point along its path that is closest to intersecting - // the plane. This may be the actual intersection point, or it - // may be the starting point or the final point. - // dot is equal to the (negative) magnitude of 'delta' along the - // direction of the plane normal - // t = ratio of (distance from start pos to plane) to (distance - // from start pos to end pos), along axis of plane normal - float dist_to_p = plane.dist_to_plane(a); - t = (dist_to_p / -dot); - - // also compute the actual contact point and time of contact - // for handlers that need it - actual_t = ((dist_to_p - from_radius) / -dot); - actual_t = min(1.0f, max(0.0f, actual_t)); - contact_point = a + (actual_t * delta); + } else { + // Otherwise, we're moving into the plane; the sphere is tested + // at the point along its path that is closest to intersecting + // the plane. This may be the actual intersection point, or it + // may be the starting point or the final point. + // dot is equal to the (negative) magnitude of 'delta' along the + // direction of the plane normal + // t = ratio of (distance from start pos to plane) to (distance + // from start pos to end pos), along axis of plane normal + float dist_to_p = plane.dist_to_plane(a); + t = (dist_to_p / -dot); + + // also compute the actual contact point and time of contact + // for handlers that need it + actual_t = ((dist_to_p - from_radius) / -dot); + actual_t = min(1.0f, max(0.0f, actual_t)); + contact_point = a + (actual_t * delta); - if (t >= 1.0f) { - // Leave it where it is. + if (t >= 1.0f) { + // Leave it where it is. - } else if (t < 0.0f) { + } else if (t < 0.0f) { from_center = a; moved_from_center = true; - } else { - from_center = a + t * delta; - moved_from_center = true; - } - } - } + } else { + from_center = a + t * delta; + moved_from_center = true; + } + } + } normal = (has_effective_normal() && sphere->get_respect_effective_normal()) ? get_effective_normal() : plane.get_normal(); - + #ifndef NDEBUG /*if (!IS_THRESHOLD_EQUAL(normal.length_squared(), 1.0f, 0.001), NULL) { std::cout @@ -349,14 +348,14 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { }*/ #endif - // The nearest point within the plane to our center is the - // intersection of the line (center, center - normal) with the plane. - + // The nearest point within the plane to our center is the + // intersection of the line (center, center - normal) with the plane. + if (!plane.intersects_line(dist, from_center, -(plane.get_normal()))) { - // No intersection with plane? This means the plane's effective - // normal was within the plane itself. A useless polygon. - continue; - } + // No intersection with plane? This means the plane's effective + // normal was within the plane itself. A useless polygon. + continue; + } if (dist > from_radius || dist < -from_radius) { // No intersection with the plane. @@ -419,7 +418,7 @@ test_intersection_from_sphere(const CollisionEntry &entry) const { intersect = true; } if( !intersect ) - return NULL; + return NULL; if (collide_cat.is_debug()) { collide_cat.debug() @@ -465,14 +464,15 @@ test_intersection_from_ray(const CollisionEntry &entry) const { LVector3f from_direction = ray->get_direction() * wrt_mat; int i, j; - float t, near_t; + float t; + float near_t = 0.0; bool intersect; Planef plane; Planef near_plane; //Returns the details about the first plane of the box that the ray //intersects. - for(i = 0, intersect = false, t = 0, j = 0; i < 6 && j < 2; i++) { + for (i = 0, intersect = false, t = 0, j = 0; i < 6 && j < 2; i++) { plane = get_plane(i); if (!plane.intersects_line(t, from_origin, from_direction)) { @@ -492,7 +492,7 @@ test_intersection_from_ray(const CollisionEntry &entry) const { continue; } intersect = true; - if(j) { + if (j) { if(t < near_t) { near_plane = plane; near_t = t; @@ -504,11 +504,11 @@ test_intersection_from_ray(const CollisionEntry &entry) const { } ++j; } - + if(!intersect) { - //No intersection with ANY of the box's planes has been detected - return NULL; + //No intersection with ANY of the box's planes has been detected + return NULL; } if (collide_cat.is_debug()) { @@ -548,7 +548,8 @@ test_intersection_from_segment(const CollisionEntry &entry) const { LVector3f from_direction = from_extent - from_origin; int i, j; - float t, near_t; + float t; + float near_t = 0.0; bool intersect; Planef plane; Planef near_plane; @@ -588,11 +589,11 @@ test_intersection_from_segment(const CollisionEntry &entry) const { } ++j; } - + if(!intersect) { - //No intersection with ANY of the box's planes has been detected - return NULL; + //No intersection with ANY of the box's planes has been detected + return NULL; } if (collide_cat.is_debug()) { @@ -986,7 +987,7 @@ point_is_inside(const LPoint2f &p, const CollisionBox::Points &points) const { } } if (is_right(p - points[points.size() - 1]._p, - points[0]._p - points[points.size() - 1]._p)) { + points[0]._p - points[points.size() - 1]._p)) { return false; } diff --git a/panda/src/collide/collisionHandlerHighestEvent.cxx b/panda/src/collide/collisionHandlerHighestEvent.cxx index 3e6997b107..89c9fd525c 100755 --- a/panda/src/collide/collisionHandlerHighestEvent.cxx +++ b/panda/src/collide/collisionHandlerHighestEvent.cxx @@ -49,7 +49,7 @@ begin_group() { } _last_colliding.clear(); if (_closest_collider) { - bool inserted = _last_colliding.insert(_closest_collider).second; + _last_colliding.insert(_closest_collider); } _current_colliding.clear(); _collider_distance = 0; @@ -86,7 +86,7 @@ add_entry(CollisionEntry *entry) { bool CollisionHandlerHighestEvent:: end_group() { if (_closest_collider) { - bool inserted = _current_colliding.insert(_closest_collider).second; + _current_colliding.insert(_closest_collider); } return CollisionHandlerEvent::end_group(); } diff --git a/panda/src/collide/collisionSphere.cxx b/panda/src/collide/collisionSphere.cxx index 39e0f3535b..ed77219981 100644 --- a/panda/src/collide/collisionSphere.cxx +++ b/panda/src/collide/collisionSphere.cxx @@ -478,8 +478,6 @@ test_intersection_from_box(const CollisionEntry &entry) const { LPoint3f orig_center = get_center(); LPoint3f to_center = orig_center; - bool moved_from_center = false; - float t = 1.0f; LPoint3f contact_point(from_center); float actual_t = 1.0f; @@ -487,12 +485,13 @@ test_intersection_from_box(const CollisionEntry &entry) const { float to_radius_2 = to_radius * to_radius; int ip; - float max_dist,dist; + float max_dist = 0.0f; + float dist = 0.0f; // initial assignment to squelch silly compiler warning bool intersect; Planef plane; LVector3f normal; - for( ip = 0, intersect=false; ip < 6 && !intersect; ip++ ){ + for (ip = 0, intersect=false; ip < 6 && !intersect; ip++) { plane = local_b.get_plane( ip ); if (local_b.get_plane_points(ip).size() < 3) { continue; diff --git a/panda/src/display/subprocessWindowBuffer.cxx b/panda/src/display/subprocessWindowBuffer.cxx index e5274ac5a1..4936c03698 100644 --- a/panda/src/display/subprocessWindowBuffer.cxx +++ b/panda/src/display/subprocessWindowBuffer.cxx @@ -64,11 +64,11 @@ SubprocessWindowBuffer(int x_size, int y_size) { //////////////////////////////////////////////////////////////////// SubprocessWindowBuffer:: SubprocessWindowBuffer(const SubprocessWindowBuffer ©) : + _mmap_size(copy._mmap_size), _x_size(copy._x_size), _y_size(copy._y_size), _row_size(copy._row_size), - _framebuffer_size(copy._framebuffer_size), - _mmap_size(copy._mmap_size) + _framebuffer_size(copy._framebuffer_size) { memcpy(_this_magic, _magic_number, magic_number_length); _event_in = 0; diff --git a/panda/src/egg/eggGroup.cxx b/panda/src/egg/eggGroup.cxx index 9d0903e9fa..583b719fb3 100644 --- a/panda/src/egg/eggGroup.cxx +++ b/panda/src/egg/eggGroup.cxx @@ -1004,7 +1004,8 @@ string_cs_type(const string &strval) { return CST_inv_sphere; } else if (cmp_nocase_uh(strval, "tube") == 0) { return CST_tube; - } else if (cmp_nocase_uh(strval, "floor-mesh") == 0) { + } else if (cmp_nocase_uh(strval, "floor-mesh") == 0 || + cmp_nocase_uh(strval, "floormesh") == 0) { return CST_floor_mesh; } else { return CST_none; @@ -1491,6 +1492,8 @@ ostream &operator << (ostream &out, EggGroup::CollisionSolidType t) { return out << "InvSphere"; case EggGroup::CST_tube: return out << "Tube"; + case EggGroup::CST_floor_mesh: + return out << "FloorMesh"; } nassertr(false, out); diff --git a/panda/src/egg/eggTexture.cxx b/panda/src/egg/eggTexture.cxx index a1dd82f584..4928849d00 100644 --- a/panda/src/egg/eggTexture.cxx +++ b/panda/src/egg/eggTexture.cxx @@ -550,7 +550,7 @@ has_alpha_channel(int num_components) const { // Function: EggTexture::affects_polygon_alpha // Access: Published // Description: Returns true if this texture's environment type or -// combine mode allows the texture to have an affect on +// combine mode allows the texture to have an effect on // the polygon's alpha values, false otherwise. //////////////////////////////////////////////////////////////////// bool EggTexture:: @@ -564,13 +564,13 @@ affects_polygon_alpha() const { case ET_blend: case ET_add: case ET_blend_color_scale: - return false; case ET_modulate_glow: case ET_modulate_gloss: case ET_normal: case ET_normal_height: case ET_glow: case ET_gloss: + case ET_height: return false; case ET_selector: diff --git a/panda/src/event/asyncTaskChain.cxx b/panda/src/event/asyncTaskChain.cxx index 8174d62a32..c71d745369 100644 --- a/panda/src/event/asyncTaskChain.cxx +++ b/panda/src/event/asyncTaskChain.cxx @@ -1013,7 +1013,7 @@ finish_sort_group() { filter_timeslice_priority(); } - nassertr(_num_tasks == _active.size() + _this_active.size() + _next_active.size() + _sleeping.size(), true); + nassertr((size_t)_num_tasks == _active.size() + _this_active.size() + _next_active.size() + _sleeping.size(), true); make_heap(_active.begin(), _active.end(), AsyncTaskSortPriority()); _current_sort = -INT_MAX; @@ -1419,12 +1419,11 @@ do_write(ostream &out, int indent_level) const { if (!tasks.empty()) { sort(tasks.begin(), tasks.end(), AsyncTaskSortPriority()); - TaskHeap::reverse_iterator ti; - int current_sort = tasks.back()->get_sort() - 1; // Since AsyncTaskSortPriority() sorts backwards (because of STL's // push_heap semantics), we go through the task list in reverse // order to print them forwards. + TaskHeap::reverse_iterator ti; for (ti = tasks.rbegin(); ti != tasks.rend(); ++ti) { AsyncTask *task = (*ti); write_task_line(out, indent_level, task, now); diff --git a/panda/src/express/multifile.cxx b/panda/src/express/multifile.cxx index 1aba22d7e6..724bffb26c 100644 --- a/panda/src/express/multifile.cxx +++ b/panda/src/express/multifile.cxx @@ -2044,7 +2044,7 @@ read_subfile(int index, pvector &result) { _read->seek_read(pos, buffer, num_bytes, count, eof); while (count != 0) { thread_consider_yield(); - nassertr(count <= max_bytes, false); + nassertr(count <= (streamsize)max_bytes, false); result.insert(result.end(), buffer, buffer + (size_t)count); max_bytes -= (size_t)count; pos += count; diff --git a/panda/src/grutil/geoMipTerrain.cxx b/panda/src/grutil/geoMipTerrain.cxx index baf9720ca1..f930ea8697 100644 --- a/panda/src/grutil/geoMipTerrain.cxx +++ b/panda/src/grutil/geoMipTerrain.cxx @@ -627,10 +627,11 @@ set_heightfield(const Filename &filename, PNMFileType *ftype) { reqy = max(3, (int) pow(2.0, ceil(log((double) max(2, imgheader.get_y_size() - 1)) / log(2.0))) + 1); // If it's not a valid size, tell PNMImage to resize it. - if (reqx != imgheader.get_x_size() || reqy != imgheader.get_y_size()) { - grutil_cat.warning() << "Rescaling heightfield image " << filename - << " from " << imgheader.get_x_size() << "x" << imgheader.get_y_size() - << " to " << reqx << "x" << reqy << " pixels.\n"; + if (reqx != (unsigned int)imgheader.get_x_size() || reqy != (unsigned int)imgheader.get_y_size()) { + grutil_cat.warning() + << "Rescaling heightfield image " << filename + << " from " << imgheader.get_x_size() << "x" << imgheader.get_y_size() + << " to " << reqx << "x" << reqy << " pixels.\n"; _heightfield.set_read_size(reqx, reqy); } } diff --git a/panda/src/grutil/meshDrawer.cxx b/panda/src/grutil/meshDrawer.cxx index e1f74cf217..aac0c052ee 100644 --- a/panda/src/grutil/meshDrawer.cxx +++ b/panda/src/grutil/meshDrawer.cxx @@ -416,7 +416,7 @@ void MeshDrawer::geometry(NodePath draw_node) { prim_vertex_reader->set_row_unsafe(vidx); prim_uv_reader->set_row_unsafe(vidx); vec[indx_over] = _render.get_relative_point( - current_node_path,prim_vertex_reader->get_data3f()); + current_node_path,prim_vertex_reader->get_data3f()); uv[indx_over] = prim_uv_reader->get_data2f(); indx_over++; if (indx_over > 2) break; @@ -424,8 +424,8 @@ void MeshDrawer::geometry(NodePath draw_node) { // draw polygon tri(vec[0],color,uv[0], - vec[1],color,uv[1], - vec[2],color,uv[2]); + vec[1],color,uv[1], + vec[2],color,uv[2]); } // if we are over budget just quit if( _clear_index > _end_clear_index) return; @@ -447,37 +447,38 @@ void MeshDrawer::geometry(NodePath draw_node) { // parameters. // Frame contains u,v,u-size,v-size quadruple. //////////////////////////////////////////////////////////////////// -void MeshDrawer::link_segment(LVector3f pos, LVector4f frame, - float thickness, LVector4f color) { +void MeshDrawer:: +link_segment(LVector3f pos, LVector4f frame, + float thickness, LVector4f color) { assert(_render.get_error_type() == NodePath::ET_ok); assert(_camera.get_error_type() == NodePath::ET_ok); - /* - * X - * ---X - * ===0---X - * ===0===0---X - * ===0===0===O---X - * ===0===0===0===End - * - * first call marks position X - * second call moves position and promises to draw segment - * it can't draw it yet because next segment might bend it - * third call finally draws segment - * and the chain continues till - * link_segment_end to flush the linking segments is called. - */ + /* + * X + * ---X + * ===0---X + * ===0===0---X + * ===0===0===O---X + * ===0===0===0===End + * + * first call marks position X + * second call moves position and promises to draw segment + * it can't draw it yet because next segment might bend it + * third call finally draws segment + * and the chain continues till + * link_segment_end to flush the linking segments is called. + */ - // mark 1st position - if(_at_start==0) { - _last_pos = pos; - _last_thickness = thickness; - _last_color = color; - _at_start=1; - return; - } + // mark 1st position + if(_at_start==0) { + _last_pos = pos; + _last_thickness = thickness; + _last_color = color; + _at_start=1; + return; + } - LVector3f start = _last_pos; - LVector3f stop = pos; + LVector3f start = _last_pos; + LVector3f stop = pos; LVector3f cam_start3d = _camera.get_relative_point(_render, start); LPoint2f cam_start2d = LVector2f(); @@ -487,9 +488,8 @@ void MeshDrawer::link_segment(LVector3f pos, LVector4f frame, PT(Camera) camera = DCAST(Camera, _camera.node()); PT(Lens) lens = camera->get_lens(); - bool start_good = lens->project(cam_start3d, cam_start2d); - bool stop_good = lens->project(cam_stop3d, cam_stop2d); - //if start_good and stop_good: + lens->project(cam_start3d, cam_start2d); + lens->project(cam_stop3d, cam_stop2d); LVector2f dif = cam_stop2d - cam_start2d; float rotation = atan2(dif.get_x(),dif.get_y()); @@ -503,12 +503,12 @@ void MeshDrawer::link_segment(LVector3f pos, LVector4f frame, // we need to draw it when we know what the next segment looks like // because it can bend it a little if(_at_start==1) { - _last_v1 = now_v1; - _last_v2 = now_v2; - _last_v3 = now_v3; - _last_v4 = now_v4; - _at_start = 2; - return; + _last_v1 = now_v1; + _last_v2 = now_v2; + _last_v3 = now_v3; + _last_v4 = now_v4; + _at_start = 2; + return; } // draw the last segment a little bent @@ -524,11 +524,11 @@ void MeshDrawer::link_segment(LVector3f pos, LVector4f frame, float vs = frame.get_w(); tri(v1, _last_color, LVector2f(u,v), - v2, color, LVector2f(u+us,v), - v3, color, LVector2f(u+us,v+vs)); + v2, color, LVector2f(u+us,v), + v3, color, LVector2f(u+us,v+vs)); tri(v3, color, LVector2f(u+us,v+vs), - v4, _last_color, LVector2f(u,v+vs), - v1, _last_color, LVector2f(u,v)); + v4, _last_color, LVector2f(u,v+vs), + v1, _last_color, LVector2f(u,v)); // save this segment _last_v1 = v2; diff --git a/panda/src/grutil/movieTexture.cxx b/panda/src/grutil/movieTexture.cxx index 0244c2f0e9..8c23e59249 100644 --- a/panda/src/grutil/movieTexture.cxx +++ b/panda/src/grutil/movieTexture.cxx @@ -63,11 +63,11 @@ CData() : _video_width(1), _video_height(1), _video_length(1.0), - _playing(false), _clock(0.0), - _play_rate(1.0), + _playing(false), _loop_count(1), - _loops_total(1) + _loops_total(1), + _play_rate(1.0) { } @@ -82,11 +82,11 @@ CData(const CData ©) : _video_width(copy._video_width), _video_height(copy._video_height), _video_length(copy._video_length), - _playing(false), _clock(0.0), - _play_rate(1.0), + _playing(false), _loop_count(1), - _loops_total(1) + _loops_total(1), + _play_rate(1.0) { } @@ -189,8 +189,6 @@ do_recalculate_image_properties(CDWriter &cdata, const LoaderOptions &options) { if (y_max > x_max) x_max = y_max; } - int x_size = x_max; - int y_size = y_max; if (Texture::get_textures_power_2() != ATS_none) { x_max = up_to_power_2(x_max); y_max = up_to_power_2(y_max); diff --git a/panda/src/linmath/lvecBase2_ext_src.I b/panda/src/linmath/lvecBase2_ext_src.I index f7a0a33e29..7de551b291 100644 --- a/panda/src/linmath/lvecBase2_ext_src.I +++ b/panda/src/linmath/lvecBase2_ext_src.I @@ -118,7 +118,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) { nassertr(fast != NULL, -1); // Let's be strict about size mismatches, to prevent user error. - if (PySequence_Fast_GET_SIZE(fast) != attr_name.size()) { + if (PySequence_Fast_GET_SIZE(fast) != (int)attr_name.size()) { PyErr_SetString(PyExc_ValueError, "length mismatch"); Py_DECREF(fast); return -1; @@ -127,7 +127,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) { // Get a pointer to the items, iterate over it and // perform our magic assignment. Fast fast. Oh yeah. PyObject** items = PySequence_Fast_ITEMS(fast); - for (int i = 0; i < attr_name.size(); ++i) { + for (size_t i = 0; i < attr_name.size(); ++i) { PyObject* fl = PyNumber_Float(items[i]); if (fl == NULL) { diff --git a/panda/src/linmath/lvecBase3_ext_src.I b/panda/src/linmath/lvecBase3_ext_src.I index 4306c42895..0ec51335f7 100644 --- a/panda/src/linmath/lvecBase3_ext_src.I +++ b/panda/src/linmath/lvecBase3_ext_src.I @@ -127,7 +127,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) { nassertr(fast != NULL, -1); // Let's be strict about size mismatches, to prevent user error. - if (PySequence_Fast_GET_SIZE(fast) != attr_name.size()) { + if (PySequence_Fast_GET_SIZE(fast) != (int)attr_name.size()) { PyErr_SetString(PyExc_ValueError, "length mismatch"); Py_DECREF(fast); return -1; @@ -136,7 +136,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) { // Get a pointer to the items, iterate over it and // perform our magic assignment. Fast fast. Oh yeah. PyObject** items = PySequence_Fast_ITEMS(fast); - for (int i = 0; i < attr_name.size(); ++i) { + for (size_t i = 0; i < attr_name.size(); ++i) { PyObject* fl = PyNumber_Float(items[i]); if (fl == NULL) { diff --git a/panda/src/linmath/lvecBase4_ext_src.I b/panda/src/linmath/lvecBase4_ext_src.I index 57001d158f..94b2c1337a 100644 --- a/panda/src/linmath/lvecBase4_ext_src.I +++ b/panda/src/linmath/lvecBase4_ext_src.I @@ -141,7 +141,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) { nassertr(fast != NULL, -1); // Let's be strict about size mismatches, to prevent user error. - if (PySequence_Fast_GET_SIZE(fast) != attr_name.size()) { + if (PySequence_Fast_GET_SIZE(fast) != (int)attr_name.size()) { PyErr_SetString(PyExc_ValueError, "length mismatch"); Py_DECREF(fast); return -1; @@ -150,7 +150,7 @@ __setattr__, PyObject *self, const string &attr_name, PyObject *assign) { // Get a pointer to the items, iterate over it and // perform our magic assignment. Fast fast. Oh yeah. PyObject** items = PySequence_Fast_ITEMS(fast); - for (int i = 0; i < attr_name.size(); ++i) { + for (size_t i = 0; i < attr_name.size(); ++i) { PyObject* fl = PyNumber_Float(items[i]); if (fl == NULL) { diff --git a/panda/src/pgui/pgEntry.cxx b/panda/src/pgui/pgEntry.cxx index 345485cf1e..b35b3bc1a0 100644 --- a/panda/src/pgui/pgEntry.cxx +++ b/panda/src/pgui/pgEntry.cxx @@ -592,15 +592,18 @@ setup(float width, int num_lines) { switch (text_node->get_align()) { case TextNode::A_left: + case TextNode::A_boxed_left: // The default case. break; case TextNode::A_center: + case TextNode::A_boxed_center: frame[0] = -width / 2.0; frame[1] = width / 2.0; break; case TextNode::A_right: + case TextNode::A_boxed_right: frame[0] = -width; frame[1] = 0.0f; break; diff --git a/panda/src/pipeline/thread.cxx b/panda/src/pipeline/thread.cxx index f3495b53b3..a845a4f315 100644 --- a/panda/src/pipeline/thread.cxx +++ b/panda/src/pipeline/thread.cxx @@ -302,7 +302,7 @@ call_python_func(PyObject *function, PyObject *args) { // Create a new Python thread state data structure, so Python can // properly lock itself. - PyObject *result; + PyObject *result = NULL; if (this == get_main_thread()) { // In the main thread, just call the function. diff --git a/panda/src/pnmtext/freetypeFont.cxx b/panda/src/pnmtext/freetypeFont.cxx index e2afee26bb..e7d6110acb 100644 --- a/panda/src/pnmtext/freetypeFont.cxx +++ b/panda/src/pnmtext/freetypeFont.cxx @@ -62,7 +62,6 @@ FreetypeFont() { FreetypeFont:: FreetypeFont(const FreetypeFont ©) : Namable(copy), - _face(copy._face), _point_size(copy._point_size), _requested_pixels_per_unit(copy._requested_pixels_per_unit), _tex_pixels_per_unit(copy._tex_pixels_per_unit), @@ -71,6 +70,7 @@ FreetypeFont(const FreetypeFont ©) : _native_antialias(copy._native_antialias), _line_height(copy._line_height), _space_advance(copy._space_advance), + _face(copy._face), _char_size(copy._char_size), _dpi(copy._dpi), _pixel_width(copy._pixel_width), diff --git a/panda/src/pstatclient/pStatClient.cxx b/panda/src/pstatclient/pStatClient.cxx index 395d2084b2..c6d4500881 100644 --- a/panda/src/pstatclient/pStatClient.cxx +++ b/panda/src/pstatclient/pStatClient.cxx @@ -283,7 +283,7 @@ main_tick() { // We have some memory usage on this TypeHandle. See if we // have a collector for it. if (!col.is_valid()) { - const char *category; + const char *category = ""; switch (mc) { case TypeHandle::MC_singleton: category = "Heap:Single"; diff --git a/panda/src/text/textProperties.cxx b/panda/src/text/textProperties.cxx index 78ad76ec75..ae764288dd 100644 --- a/panda/src/text/textProperties.cxx +++ b/panda/src/text/textProperties.cxx @@ -304,6 +304,18 @@ write(ostream &out, int indent_level) const { case A_center: out << "A_center\n"; break; + + case A_boxed_left: + out << "A_boxed_left\n"; + break; + + case A_boxed_right: + out << "A_boxed_right\n"; + break; + + case A_boxed_center: + out << "A_boxed_center\n"; + break; } }