From 565d3fb84f4d047216b534c348da764392f575f8 Mon Sep 17 00:00:00 2001 From: David Rose Date: Thu, 24 Jun 2004 16:42:34 +0000 Subject: [PATCH] explicit casts and other /W4 fixes --- direct/src/dcparser/dcPackerInterface.cxx | 4 ++-- direct/src/dcparser/dcParser.yxx | 20 ++++++++++---------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/direct/src/dcparser/dcPackerInterface.cxx b/direct/src/dcparser/dcPackerInterface.cxx index 308e217e09..aac933df43 100755 --- a/direct/src/dcparser/dcPackerInterface.cxx +++ b/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; } diff --git a/direct/src/dcparser/dcParser.yxx b/direct/src/dcparser/dcParser.yxx index b25c32fe1f..fb532e63a6 100644 --- a/direct/src/dcparser/dcParser.yxx +++ b/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."); } }