|
From: <br...@us...> - 2012-05-01 05:36:45
|
Revision: 4287
http://openvrml.svn.sourceforge.net/openvrml/?rev=4287&view=rev
Author: braden
Date: 2012-05-01 05:36:38 +0000 (Tue, 01 May 2012)
Log Message:
-----------
Suppress various warnings from the Microsoft compiler version 16.00.40219.01.
Modified Paths:
--------------
trunk/ChangeLog
trunk/src/libopenvrml/openvrml/basetypes.h
trunk/src/libopenvrml/openvrml/local/component.cpp
trunk/src/libopenvrml/openvrml/local/component.h
trunk/src/libopenvrml/openvrml/local/error.cpp
trunk/src/libopenvrml/openvrml/scene.cpp
trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp
Modified: trunk/ChangeLog
===================================================================
--- trunk/ChangeLog 2012-05-01 05:30:48 UTC (rev 4286)
+++ trunk/ChangeLog 2012-05-01 05:36:38 UTC (rev 4287)
@@ -1,5 +1,17 @@
2012-05-01 Braden McDaniel <br...@en...>
+ Suppress various warnings from the Microsoft compiler
+ version 16.00.40219.01.
+
+ * src/libopenvrml/openvrml/basetypes.h
+ * src/libopenvrml/openvrml/scene.cpp
+ * src/libopenvrml/openvrml/local/component.cpp
+ * src/libopenvrml/openvrml/local/component.h
+ * src/libopenvrml/openvrml/local/error.cpp
+ * src/libopenvrml-gl/openvrml/gl/viewer.cpp
+
+2012-05-01 Braden McDaniel <br...@en...>
+
* src/local/libopenvrml-dl/openvrml/local/dl.cpp
(foreachfile(const std::vector<boost::filesystem::path> &, int
(*)(const std::string &, void *), void *)): Boost.Filesystem 3
Modified: trunk/src/libopenvrml/openvrml/basetypes.h
===================================================================
--- trunk/src/libopenvrml/openvrml/basetypes.h 2012-05-01 05:30:48 UTC (rev 4286)
+++ trunk/src/libopenvrml/openvrml/basetypes.h 2012-05-01 05:36:38 UTC (rev 4287)
@@ -69,7 +69,7 @@
inline const float & color::operator[](const std::size_t index) const
OPENVRML_NOTHROW
{
- assert(index < 3);
+ assert(index < 3UL);
return this->rgb[index];
}
@@ -145,7 +145,7 @@
inline const float & color_rgba::operator[](const std::size_t index) const
OPENVRML_NOTHROW
{
- assert(index < 4);
+ assert(index < 4ul);
return this->rgba[index];
}
@@ -240,7 +240,7 @@
inline const float & vec2f::operator[](const std::size_t index) const
OPENVRML_NOTHROW
{
- assert(index < 2);
+ assert(index < 2ul);
return this->vec[index];
}
@@ -325,7 +325,7 @@
inline const double & vec2d::operator[](const std::size_t index) const
OPENVRML_NOTHROW
{
- assert(index < 2);
+ assert(index < 2ul);
return this->vec[index];
}
@@ -425,7 +425,7 @@
inline const float & vec3f::operator[](const std::size_t index) const
OPENVRML_NOTHROW
{
- assert(index < 3);
+ assert(index < 3ul);
return this->vec[index];
}
@@ -538,7 +538,7 @@
inline const double & vec3d::operator[](const std::size_t index) const
OPENVRML_NOTHROW
{
- assert(index < 3);
+ assert(index < 3ul);
return this->vec[index];
}
@@ -644,7 +644,7 @@
inline const float & rotation::operator[](const std::size_t index) const
OPENVRML_NOTHROW
{
- assert(index < 4);
+ assert(index < 4ul);
return this->rot[index];
}
@@ -734,13 +734,13 @@
inline float (&mat4f::operator[](std::size_t index) OPENVRML_NOTHROW)[4]
{
- assert(index < 4);
+ assert(index < 4ul);
return this->mat[index];
}
inline const float (&mat4f::operator[](std::size_t index) const OPENVRML_NOTHROW)[4]
{
- assert(index < 4);
+ assert(index < 4ul);
return this->mat[index];
}
@@ -813,13 +813,13 @@
inline const float & quatf::operator[](std::size_t index) const OPENVRML_NOTHROW
{
- assert(index < 4);
+ assert(index < 4ul);
return this->quat[index];
}
inline float & quatf::operator[](std::size_t index) OPENVRML_NOTHROW
{
- assert(index < 4);
+ assert(index < 4ul);
return this->quat[index];
}
Modified: trunk/src/libopenvrml/openvrml/local/component.cpp
===================================================================
--- trunk/src/libopenvrml/openvrml/local/component.cpp 2012-05-01 05:30:48 UTC (rev 4286)
+++ trunk/src/libopenvrml/openvrml/local/component.cpp 2012-05-01 05:36:38 UTC (rev 4287)
@@ -379,11 +379,11 @@
void
openvrml::local::profile::
-add_component(const std::string & name, const int level)
+add_component(const std::string & name, const size_t level)
OPENVRML_THROW1(std::bad_alloc)
{
//get the existing/new support level
- int & comp_level = components_[name];
+ size_t & comp_level = components_[name];
//update the support level.
comp_level = std::max(level, comp_level);
Modified: trunk/src/libopenvrml/openvrml/local/component.h
===================================================================
--- trunk/src/libopenvrml/openvrml/local/component.h 2012-05-01 05:30:48 UTC (rev 4286)
+++ trunk/src/libopenvrml/openvrml/local/component.h 2012-05-01 05:36:38 UTC (rev 4287)
@@ -108,11 +108,11 @@
class OPENVRML_LOCAL profile {
- typedef std::map<std::string, int> map_t;
+ typedef std::map<std::string, size_t> map_t;
map_t components_;
protected:
- void add_component(const std::string & name, int level)
+ void add_component(const std::string & name, size_t level)
OPENVRML_THROW1(std::bad_alloc);
public:
Modified: trunk/src/libopenvrml/openvrml/local/error.cpp
===================================================================
--- trunk/src/libopenvrml/openvrml/local/error.cpp 2012-05-01 05:30:48 UTC (rev 4286)
+++ trunk/src/libopenvrml/openvrml/local/error.cpp 2012-05-01 05:36:38 UTC (rev 4287)
@@ -25,7 +25,7 @@
void openvrml::local::throw_runtime_error_from_win32_system_error(LONG result)
OPENVRML_THROW1(std::runtime_error)
{
- static const LPCVOID source;
+ static const LPCVOID source = 0;
LPTSTR buf = 0;
BOOST_SCOPE_EXIT((&buf)) {
LocalFree(buf);
@@ -33,10 +33,10 @@
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM
| FORMAT_MESSAGE_ALLOCATE_BUFFER,
source,
- result,
+ static_cast<DWORD>(result),
LANG_USER_DEFAULT,
- reinterpret_cast< LPTSTR >(&buf),
- DWORD(0),
+ reinterpret_cast<LPTSTR>(&buf),
+ static_cast<DWORD>(0),
0);
throw std::runtime_error(buf);
Modified: trunk/src/libopenvrml/openvrml/scene.cpp
===================================================================
--- trunk/src/libopenvrml/openvrml/scene.cpp 2012-05-01 05:30:48 UTC (rev 4286)
+++ trunk/src/libopenvrml/openvrml/scene.cpp 2012-05-01 05:36:38 UTC (rev 4287)
@@ -423,7 +423,9 @@
const resource_istream::int_type c = this->in_->get();
if (c != resource_istream::traits_type::eof()) {
data.push_back(
- resource_istream::traits_type::to_char_type(c));
+ static_cast<unsigned char>(
+ resource_istream::traits_type::
+ to_char_type(c)));
} else {
break;
}
Modified: trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp
===================================================================
--- trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2012-05-01 05:30:48 UTC (rev 4286)
+++ trunk/src/libopenvrml-gl/openvrml/gl/viewer.cpp 2012-05-01 05:36:38 UTC (rev 4287)
@@ -74,12 +74,6 @@
const double pi_4 = 0.78539816339744830962;
const double inv_pi = 0.31830988618379067154;
- template <typename Float>
- OPENVRML_GL_LOCAL inline Float fabs(const Float f)
- {
- return f < 0.0 ? -f : f;
- }
-
struct OPENVRML_GL_LOCAL fequal_t {
template <typename Float>
bool operator()(Float a, Float b) const
@@ -2138,7 +2132,7 @@
GLdouble v[3];
// Mesa tesselator doesn;t like closed polys
- size_t j = equalEndpts ? 1 : 0;
+ size_t j = equalEndpts ? 1ul : 0ul;
for (; j < cs.size(); ++j) {
v[0] = c[j + n].x();
v[1] = c[j + n].y();
@@ -2525,7 +2519,8 @@
spine_point->x(), spine_point->y(), spine_point->z(), 1.0);
const vector<vec3f>::size_type spine_index =
- std::distance(spine.begin(), spine_point);
+ static_cast<std::size_t>(std::distance(spine.begin(),
+ spine_point));
if (!orientation.empty()) {
const vector<rotation>::size_type index =
@@ -2704,8 +2699,8 @@
glBegin(GL_LINE_STRIP);
if (!color.empty() && color_per_face) {
const size_t color_index = !colorIndex.empty()
- ? colorIndex.front()
- : 0;
+ ? static_cast<std::size_t>(colorIndex.front())
+ : 0ul;
glColor3fv(&color[color_index][0]);
}
@@ -2720,7 +2715,7 @@
? int32(colorIndex[nl])
: int32(nl);
if (size_t(index) < color.size()) {
- glColor3fv(&color[index][0]);
+ glColor3fv(&color[static_cast<std::size_t>(index)][0]);
}
}
} else {
@@ -2729,11 +2724,12 @@
? colorIndex[i]
: coordIndex[i];
if (size_t(index) < color.size()) {
- glColor3fv(&color[index][0]);
+ glColor3fv(&color[static_cast<std::size_t>(index)][0]);
}
}
if (size_t(coordIndex[i]) < coord.size()) {
- glVertex3fv(&coord[coordIndex[i]][0]);
+ glVertex3fv(
+ &coord[static_cast<std::size_t>(coordIndex[i])][0]);
}
}
}
@@ -2887,10 +2883,12 @@
&& s->coordIndex[i1] >= 0
&& s->coordIndex[i1 + 1] >= 0
&& s->coordIndex[i1 + 2] >= 0) {
- N = indexFaceNormal(s->coordIndex[i1],
- s->coordIndex[i1 + 1],
- s->coordIndex[i1 + 2],
- s->coord);
+ N =
+ indexFaceNormal(
+ static_cast<std::size_t>(s->coordIndex[i1]),
+ static_cast<std::size_t>(s->coordIndex[i1 + 1]),
+ static_cast<std::size_t>(s->coordIndex[i1 + 2]),
+ s->coord);
// Flip normal if primitiv-orientation is clockwise
if (!(s->mask & viewer::mask_ccw)) { N = -N; }
@@ -2903,18 +2901,20 @@
if (s->coordIndex[i] >= 0) {
// Per-vertex attributes
- const size_t color_index = (i < s->colorIndex.size())
- ? s->colorIndex[i]
- : s->coordIndex[i];
+ const size_t color_index =
+ static_cast<std::size_t>(
+ (i < s->colorIndex.size()) ? s->colorIndex[i]
+ : s->coordIndex[i]);
if (color_index < s->color.size()
&& (s->mask & viewer::mask_color_per_vertex)) {
glColor3fv(&s->color[color_index][0]);
}
if (s->mask & viewer::mask_normal_per_vertex) {
- const size_t normal_index = (i < s->normalIndex.size())
- ? s->normalIndex[i]
- : s->coordIndex[i];
+ const size_t normal_index =
+ static_cast<std::size_t>(
+ (i < s->normalIndex.size()) ? s->normalIndex[i]
+ : s->coordIndex[i]);
if (normal_index < s->normal.size()) {
glNormal3fv(&s->normal[normal_index][0]);
} else {
@@ -2922,17 +2922,21 @@
}
}
- const vec3f & v = s->coord[s->coordIndex[i]];
- const size_t tex_coord_index = (i < s->texCoordIndex.size())
- ? s->texCoordIndex[i]
- : s->coordIndex[i];
+ const vec3f & v =
+ s->coord[static_cast<std::size_t>(s->coordIndex[i])];
+ const size_t tex_coord_index =
+ static_cast<std::size_t>(
+ (i < s->texCoordIndex.size()) ? s->texCoordIndex[i]
+ : s->coordIndex[i]);
if (tex_coord_index < s->texCoord.size()) {
glTexCoord2fv(&s->texCoord[tex_coord_index][0]);
} else {
float c0, c1;
- c0 = (v[s->texAxes[0]] - s->texParams[0])
+ c0 = (v[static_cast<std::size_t>(s->texAxes[0])]
+ - s->texParams[0])
* s->texParams[1];
- c1 = (v[s->texAxes[1]] - s->texParams[2])
+ c1 = (v[static_cast<std::size_t>(s->texAxes[1])]
+ - s->texParams[2])
* s->texParams[3];
glTexCoord2f(c0, c1);
}
@@ -3011,11 +3015,14 @@
//
while (coord_index[i + 1] != -1) { ++i; }
} else if (coord_index[i] != -1) {
- gluTessVertex(&tessobj,
- const_cast<GLdouble *>(
- vertices[coord_index[i]].coord),
- &const_cast<vertex_data &>(
- vertices[coord_index[i]]));
+ gluTessVertex(
+ &tessobj,
+ const_cast<GLdouble *>(
+ vertices[
+ static_cast<std::size_t>(coord_index[i])].coord),
+ &const_cast<vertex_data &>(
+ vertices[
+ static_cast<std::size_t>(coord_index[i])]));
} else {
gluTessEndContour(&tessobj);
gluTessEndPolygon(&tessobj);
@@ -3143,7 +3150,8 @@
++i) {
if (color_index[i] < 0) { continue; }
if (!(size_t(coord_index[i]) < coord.size())) { continue; }
- vertices[coord_index[i]].color = &color[color_index[i]];
+ vertices[static_cast<std::size_t>(coord_index[i])].color =
+ &color[static_cast<std::size_t>(color_index[i])];
}
}
}
@@ -3160,7 +3168,8 @@
++i) {
if (normal_index[i] < 0) { continue; }
if (!(size_t(coord_index[i]) < coord.size())) { continue; }
- vertices[coord_index[i]].normal = &normal[normal_index[i]];
+ vertices[static_cast<std::size_t>(coord_index[i])].normal =
+ &normal[static_cast<std::size_t>(normal_index[i])];
}
}
}
@@ -3176,8 +3185,10 @@
i < tex_coord_index.size();
++i) {
if (tex_coord_index[i] < 0) { continue; }
- vertices[tex_coord_index[i]].tex_coord =
- &tex_coord[tex_coord_index[i]];
+ vertices[static_cast<std::size_t>(tex_coord_index[i])]
+ .tex_coord =
+ &tex_coord[static_cast<std::size_t>(
+ tex_coord_index[i])];
}
}
@@ -3698,7 +3709,7 @@
const texture_map_t::const_iterator texture = this->texture_map_.find(&n);
if (texture != this->texture_map_.end()) {
// Enable blending if needed.
- const int32 comp = n.image().comp();
+ const int32 comp = static_cast<int32>(n.image().comp());
if (this->blend && (comp == 2 || comp == 4)) { glEnable(GL_BLEND); }
glBindTexture(GL_TEXTURE_2D, texture->second);
return;
@@ -3718,8 +3729,8 @@
if (width > max_texture_size) { width = max_texture_size; }
if (height > max_texture_size) { height = max_texture_size; }
- while (!power_of_2(width)) { --width; }
- while (!power_of_2(height)) { --height; }
+ while (!power_of_2(static_cast<std::size_t>(width))) { --width; }
+ while (!power_of_2(static_cast<std::size_t>(height))) { --height; }
vector<GLubyte> rescaled_pixels;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|