Browse Source

Fix some compile warnings

rdb 9 years ago
parent
commit
bf26cecb32

+ 8 - 4
panda/src/gobj/shader.cxx

@@ -1492,11 +1492,15 @@ cg_compile_entry_point(const char *entry, const ShaderCaps &caps,
     compiler_args[nargs++] = "ATI_draw_buffers";
   }
 
-  char version_arg[16];
-  if (!cg_glsl_version.empty() && cgGetProfileProperty((CGprofile) active, CG_IS_GLSL_PROFILE)) {
-    snprintf(version_arg, 16, "version=%s", cg_glsl_version.c_str());
+  string version_arg;
+  if (!cg_glsl_version.empty() && active != CG_PROFILE_UNKNOWN &&
+      cgGetProfileProperty((CGprofile) active, CG_IS_GLSL_PROFILE)) {
+
+    version_arg = "version=";
+    version_arg += cg_glsl_version;
+
     compiler_args[nargs++] = "-po";
-    compiler_args[nargs++] = version_arg;
+    compiler_args[nargs++] = version_arg.c_str();
   }
 
   compiler_args[nargs] = 0;

+ 2 - 3
panda/src/linmath/lvecBase2_src.I

@@ -514,9 +514,8 @@ INLINE_LINMATH size_t FLOATNAME(LVecBase2)::
 add_hash(size_t hash) const {
   TAU_PROFILE("size_t LVecBase2::add_hash(size_t)", " ", TAU_USER);
 #ifdef FLOATTYPE_IS_INT
-  int_hash ihasher;
-  hash = ihasher.add_hash(hash, _v(0));
-  hash = ihasher.add_hash(hash, _v(1));
+  hash = int_hash::add_hash(hash, _v(0));
+  hash = int_hash::add_hash(hash, _v(1));
   return hash;
 #else
   return add_hash(hash, NEARLY_ZERO(FLOATTYPE));

+ 3 - 4
panda/src/linmath/lvecBase3_src.I

@@ -674,10 +674,9 @@ INLINE_LINMATH size_t FLOATNAME(LVecBase3)::
 add_hash(size_t hash) const {
   TAU_PROFILE("size_t LVecBase3::add_hash(size_t)", " ", TAU_USER);
 #ifdef FLOATTYPE_IS_INT
-  int_hash ihasher;
-  hash = ihasher.add_hash(hash, _v(0));
-  hash = ihasher.add_hash(hash, _v(1));
-  hash = ihasher.add_hash(hash, _v(2));
+  hash = int_hash::add_hash(hash, _v(0));
+  hash = int_hash::add_hash(hash, _v(1));
+  hash = int_hash::add_hash(hash, _v(2));
   return hash;
 #else
   return add_hash(hash, NEARLY_ZERO(FLOATTYPE));

+ 4 - 5
panda/src/linmath/lvecBase4_src.I

@@ -663,11 +663,10 @@ INLINE_LINMATH size_t FLOATNAME(LVecBase4)::
 add_hash(size_t hash) const {
   TAU_PROFILE("size_t LVecBase4::add_hash(size_t)", " ", TAU_USER);
 #ifdef FLOATTYPE_IS_INT
-  int_hash ihasher;
-  hash = ihasher.add_hash(hash, _v(0));
-  hash = ihasher.add_hash(hash, _v(1));
-  hash = ihasher.add_hash(hash, _v(2));
-  hash = ihasher.add_hash(hash, _v(3));
+  hash = int_hash::add_hash(hash, _v(0));
+  hash = int_hash::add_hash(hash, _v(1));
+  hash = int_hash::add_hash(hash, _v(2));
+  hash = int_hash::add_hash(hash, _v(3));
   return hash;
 #else
   return add_hash(hash, NEARLY_ZERO(FLOATTYPE));

+ 1 - 1
panda/src/pnmimagetypes/pnmFileTypeBMPReader.cxx

@@ -227,7 +227,7 @@ BMPreadinfoheader(
          * for the required total.
          */
         if (classv != C_OS2) {
-            for (int i = 0; i < cbFix - 16; i += 4) {
+            for (int i = 0; i < (int)cbFix - 16; i += 4) {
                 GetLong(fp);
             }
         }

+ 2 - 2
panda/src/pnmimagetypes/pnmFileTypePNM.cxx

@@ -650,10 +650,10 @@ writePackedRawRow(ostream *                const fileP,
                   const unsigned char * const packed_bits,
                   int                   const cols) {
 
-  int bytesWritten;
   fileP->write((const char *)packed_bits, pbm_packed_bytes(cols));
-  if (fileP->fail())
+  if (fileP->fail()) {
     pm_error("I/O error writing packed row to raw PBM file.");
+  }
 }
 
 static void

+ 2 - 1
panda/src/rocket/rocketRegion_ext.cxx

@@ -45,7 +45,8 @@ get_context() const {
     context->AddReference();
     return py_context.ptr();
 
-  } catch (const python::error_already_set& e) {
+  } catch (const python::error_already_set &e) {
+    (void)e;
     // Return NULL, which will trigger the exception in Python
   }
   return NULL;