Bläddra i källkod

explicit casts and other /W4 fixes

David Rose 21 år sedan
förälder
incheckning
565d3fb84f
2 ändrade filer med 12 tillägg och 12 borttagningar
  1. 2 2
      direct/src/dcparser/dcPackerInterface.cxx
  2. 10 10
      direct/src/dcparser/dcParser.yxx

+ 2 - 2
direct/src/dcparser/dcPackerInterface.cxx

@@ -90,7 +90,7 @@ as_switch() {
 //               is nonzero.
 ////////////////////////////////////////////////////////////////////
 int DCPackerInterface::
-calc_num_nested_fields(size_t length_bytes) const {
+calc_num_nested_fields(size_t) const {
   return 0;
 }
 
@@ -103,7 +103,7 @@ calc_num_nested_fields(size_t length_bytes) const {
 //               the range 0 <= n < get_num_nested_fields()).
 ////////////////////////////////////////////////////////////////////
 DCPackerInterface *DCPackerInterface::
-get_nested_field(int n) const {
+get_nested_field(int) const {
   return NULL;
 }
 

+ 10 - 10
direct/src/dcparser/dcParser.yxx

@@ -385,7 +385,7 @@ type_name:
   if ($3 == 0) {
     yyerror("Invalid divisor.");
 
-  } else if (!simple_param->set_divisor($3)) {
+  } else if (!simple_param->set_divisor((int)$3)) {
     yyerror("A divisor is only valid on a numeric type.");
   }
   $$ = simple_param;
@@ -396,7 +396,7 @@ type_name:
   if ($3 == 0) {
     yyerror("Invalid divisor.");
 
-  } else if (!simple_param->set_divisor($3)) {
+  } else if (!simple_param->set_divisor((int)$3)) {
     yyerror("A divisor is only valid on a numeric type.");
   }
   if (!simple_param->set_range(double_range)) {
@@ -410,7 +410,7 @@ type_name:
   if ($6 == 0) {
     yyerror("Invalid divisor.");
 
-  } else if (!simple_param->set_divisor($6)) {
+  } else if (!simple_param->set_divisor((int)$6)) {
     yyerror("A divisor is only valid on a numeric type.");
   }
   if (!simple_param->set_range(double_range)) {
@@ -500,7 +500,7 @@ uint_range:
     yyerror("Nonnegative values only");
   } else {
     uint_range.clear();
-    if (!uint_range.add_range($1, $1)) {
+    if (!uint_range.add_range((unsigned int)$1, (unsigned int)$1)) {
       yyerror("Overlapping range");
     }
   }
@@ -511,7 +511,7 @@ uint_range:
     yyerror("Nonnegative values only");
   } else {
     uint_range.clear();
-    if (!uint_range.add_range($1, $3)) {
+    if (!uint_range.add_range((unsigned int)$1, (unsigned int)$3)) {
       yyerror("Overlapping range");
     }
   }
@@ -523,7 +523,7 @@ uint_range:
     yyerror("Syntax error");
   } else if ($1 < 0) {
     yyerror("Nonnegative values only");
-  } else if (!uint_range.add_range($1, -$2)) {
+  } else if (!uint_range.add_range((unsigned int)$1, (unsigned int)-$2)) {
     yyerror("Overlapping range");
   }
 }
@@ -531,7 +531,7 @@ uint_range:
 {
   if ($3 < 0) {
     yyerror("Nonnegative values only");
-  } else if (!uint_range.add_range($3, $3)) {
+  } else if (!uint_range.add_range((unsigned int)$3, (unsigned int)$3)) {
     yyerror("Overlapping range");
   }
 }
@@ -539,7 +539,7 @@ uint_range:
 {
   if ($3 < 0 || $5 < 0) {
     yyerror("Nonnegative values only");
-  } else if (!uint_range.add_range($3, $5)) {
+  } else if (!uint_range.add_range((unsigned int)$3, (unsigned int)$5)) {
     yyerror("Overlapping range");
   }
 }
@@ -549,7 +549,7 @@ uint_range:
     yyerror("Syntax error");
   } else if ($3 < 0) {
     yyerror("Nonnegative values only");
-  } else if (!uint_range.add_range($3, -$4)) {
+  } else if (!uint_range.add_range((unsigned int)$3, (unsigned int)-$4)) {
     yyerror("Overlapping range");
   }
 }
@@ -578,7 +578,7 @@ parameter_definition:
     yyerror("A divisor is only allowed on a primitive type.");
 
   } else {
-    if (!$1->as_simple_parameter()->set_divisor($3)) {
+    if (!$1->as_simple_parameter()->set_divisor((int)$3)) {
       yyerror("A divisor is only valid on a numeric type.");
     }
   }