changeset 18892:138e9be2f917

Always use our own msim_round() instead of checking for C99's round and using it, for consistency.
author Jeffrey Connelly <jaconnel@calpoly.edu>
date Sat, 11 Aug 2007 04:40:39 +0000
parents 7db556e97dd1
children cd90423c0a88
files libpurple/protocols/myspace/myspace.c
diffstat 1 files changed, 6 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/libpurple/protocols/myspace/myspace.c	Sat Aug 11 04:38:52 2007 +0000
+++ b/libpurple/protocols/myspace/myspace.c	Sat Aug 11 04:40:39 2007 +0000
@@ -172,13 +172,12 @@
 static void msim_lookup_user(MsimSession *session, const gchar *user, 
 		MSIM_USER_LOOKUP_CB cb, gpointer data);
 
-#ifndef round
-double round(double round);
+double msim_round(double round);
 
 /* round is part of C99, but sometimes is unavailable before then.
  * Based on http://forums.belution.com/en/cpp/000/050/13.shtml
  */
-double round(double value)
+double msim_round(double value)
 {
     if (value < 0) {
         return -(floor(-value + 0.5));
@@ -186,7 +185,6 @@
         return   floor( value + 0.5);
     }
 }
-#endif
 
 /** 
  * Load the plugin.
@@ -842,7 +840,7 @@
             size < sizeof(_font_scale) / sizeof(_font_scale[0]);
             ++size) {
         scale = _font_scale[CLAMP(size, 1, MAX_FONT_SIZE) - 1];
-        this_point = (guint)round(scale * base);
+        this_point = (guint)msim_round(scale * base);
 
         if (this_point >= point) {
             purple_debug_info("msim", "msim_point_to_purple_size: %d pt -> size=%d\n",
@@ -867,7 +865,7 @@
 
     base = purple_account_get_int(session->account, "base_font_size", MSIM_BASE_FONT_POINT_SIZE);
 
-    point = (guint)round(scale * base);
+    point = (guint)msim_round(scale * base);
 
     purple_debug_info("msim", "msim_purple_size_to_point: size=%d -> %d pt\n",
                     size, point);
@@ -883,7 +881,7 @@
 
     dpi = purple_account_get_int(session->account, "port", MSIM_DEFAULT_DPI);
 
-    return (guint)round((POINTS_PER_INCH * 1. / dpi) * height);
+    return (guint)msim_round((POINTS_PER_INCH * 1. / dpi) * height);
 
 	/* See also: libpurple/protocols/bonjour/jabber.c
 	 * _font_size_ichat_to_purple */
@@ -897,7 +895,7 @@
 
     dpi = purple_account_get_int(session->account, "port", MSIM_DEFAULT_DPI);
 
-    return (guint)round((dpi * 1. / POINTS_PER_INCH) * point);
+    return (guint)msim_round((dpi * 1. / POINTS_PER_INCH) * point);
 }
 
 /** Convert the msim markup <f> (font) tag into HTML. */