]> git.donarmstrong.com Git - lilypond.git/commitdiff
[flower] Remove compiler warnings.
authorWerner Lemberg <wl@gnu.org>
Wed, 3 Nov 2010 07:19:58 +0000 (08:19 +0100)
committerWerner Lemberg <wl@gnu.org>
Wed, 3 Nov 2010 07:19:58 +0000 (08:19 +0100)
This has been tested with g++ 4.5.0 (20100722).

flower/libc-extension.cc
flower/rational.cc
flower/string-convert.cc

index 78cd6be16062210dbbf4fab0d58121bfc3b67190..4cc8412da8d81489dc94d85656587687cd3d88eb 100644 (file)
@@ -34,7 +34,7 @@ strnlwr (char *start, int n)
   char *p = start + n;
   while (--p >= start)
     {
-      *p = tolower (*p);    /* a macro on some compilers */
+      *p = (char)tolower (*p);    /* a macro on some compilers */
     }
   return start;
 }
@@ -45,7 +45,7 @@ strnupr (char *start, int n)
   char *p = start + n;
   while (--p >= start)
     {
-      *p = toupper (*p);    /* a macro on some compilers */
+      *p = (char)toupper (*p);    /* a macro on some compilers */
     }
   return start;
 }
index 048d45fcbe112b9f3d66f3853abc58bea6dec747..cf1c9850bf3cfe68ec16b983b23238eae60279d2 100644 (file)
@@ -31,7 +31,7 @@ double
 Rational::to_double () const
 {
   if (sign_ == -1 || sign_ == 1 || sign_ == 0)
-    return ((double)sign_) * num_ / den_;
+    return (double)sign_ * (double)num_ / (double)den_;
   if (sign_ == -2)
     return -HUGE_VAL;
   else if (sign_ == 2)
@@ -365,7 +365,7 @@ Rational::to_string () const
 int
 Rational::to_int () const
 {
-  return (int) num () / den ();
+  return (int)(num () / den ());
 }
 
 int
index 03bb05b319c57b291c11d2146170c630569957fc..c372520c16f3acb26d53b8f2bbd983ca1f943379 100644 (file)
@@ -37,7 +37,7 @@ string
 String_convert::bin2hex (Byte bin_char)
 {
   string str;
-  str += to_string ((char) nibble2hex_byte (bin_char >> 4));
+  str += to_string ((char) nibble2hex_byte ((Byte)(bin_char >> 4)));
   str += to_string ((char) nibble2hex_byte (bin_char++));
   return str;
 }
@@ -49,7 +49,7 @@ String_convert::bin2hex (string bin_string)
   Byte const *byte = (Byte const*)bin_string.data ();
   for (ssize i = 0; i < bin_string.length (); i++)
     {
-      str += to_string ((char)nibble2hex_byte (*byte >> 4));
+      str += to_string ((char)nibble2hex_byte ((Byte)(*byte >> 4)));
       str += to_string ((char)nibble2hex_byte (*byte++));
     }
   return str;
@@ -206,9 +206,9 @@ Byte
 String_convert::nibble2hex_byte (Byte byte)
 {
   if ((byte & 0x0f) <= 9)
-    return (byte & 0x0f) + '0';
+    return (Byte)((byte & 0x0f) + '0');
   else
-    return (byte & 0x0f) - 10 + 'a';
+    return (Byte)((byte & 0x0f) - 10 + 'a');
 }
 /**
    Convert an integer to a string