]> git.donarmstrong.com Git - lilypond.git/blobdiff - flower/libc-extension.cc
*** empty log message ***
[lilypond.git] / flower / libc-extension.cc
index 97d59c68c16cde0c283f847a7a50268a92c2d090..efa544be6364b45fdd610a7c37a9308f58457d20 100644 (file)
@@ -4,18 +4,17 @@
 
   source file of the flowerlib
 
-  (c)  1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
          Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
-#include <stdio.h>
-#include <string.h>
-#include <ctype.h>
 #include "libc-extension.hh"
 
-/*
-  urg: why soo wierd?
- */
+#include <cmath>
+#include <cstdio>
+#include <cstring>
+#include <cctype>
+
 char* 
 strnlwr (char* start ,int n)
 {
@@ -38,6 +37,24 @@ strnupr (char* start, int n)
   return start;
 }
 
+/*
+  There are some strange problems with round() on early glibcs.
+ */
+double
+my_round (double x)
+{
+  return floor (x -0.5)+ 1.0 ;
+}
+
+#ifndef isinf
+#if !HAVE_ISINF
+int
+isinf (double x)
+{
+  return x && ( x == x/ 2) ;
+}
+#endif
+#endif
 
 #if !HAVE_MEMMEM
 
@@ -64,7 +81,7 @@ _memmem (Byte const *haystack, int haystack_len,
         if (*subneedle++ != *subhaystack++)
          goto next;
        
-      // completed the needle. Gotcha.
+      /* Completed the needle.  Gotcha.  */
       return (Byte *) haystack;
       next:
        haystack++;
@@ -140,13 +157,3 @@ vsnprintf (char *str, size_t, char const *format, va_list args)
   return i;
 }
 #endif
-
-
-#if !HAVE_ISINF
-int
-isinf (double x)
-{
-  return x && ( x == x/ 2) ;
-}
-
-#endif