changeset 5149:387aafe957c4

[gaim-migrate @ 5513] Hmm. So I couldn't really find out what was wrong with lround, so I just wrote a function in oscar.c to round to the nearest integer from a double and return an int. My man page for lround says it's in math.h, and it compiled fine, and it ran fine, but it gave me a function undeclared warning or whatever for lround, which made me unhappy. I tried including math.h and tgmath.h to no avail. If anyone wants to find out what's up with that, or just tell me about some new and trendy round function, please be a doll and do so. Until then, this is ace reporter Mark "The Spark Plug" Doliner, signing off. committer: Tailor Script <tailor@pidgin.im>
author Mark Doliner <mark@kingant.net>
date Thu, 17 Apr 2003 05:34:16 +0000
parents 6a9a76870779
children 9a19c0a1e1be
files src/protocols/oscar/oscar.c
diffstat 1 files changed, 11 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/protocols/oscar/oscar.c	Thu Apr 17 04:47:38 2003 +0000
+++ b/src/protocols/oscar/oscar.c	Thu Apr 17 05:34:16 2003 +0000
@@ -289,6 +289,13 @@
 /* for icons */
 static gboolean gaim_icon_timerfunc(gpointer data);
 
+int ill_just_write_my_own_damn_round_function(double val) {
+	if ((val - (int)val) > 0.5)
+		return val+1;
+	else
+		return val;
+}
+
 static void gaim_free_name_data(struct name_data *data) {
 	g_free(data->name);
 	g_free(data->nick);
@@ -1771,7 +1778,7 @@
 		free(b16);
 	}
 
-	serv_got_update(gc, info->sn, 1, info->warnlevel/10, signon, time_idle, type);
+	serv_got_update(gc, info->sn, 1, ill_just_write_my_own_damn_round_function(info->warnlevel/10.0), signon, time_idle, type);
 
 	return 1;
 }
@@ -3042,7 +3049,7 @@
 			"%s\n"
 			"<hr>\n"),
 			info->sn, images(info->flags),
-			info->warnlevel/10,
+			ill_just_write_my_own_damn_round_function(info->warnlevel/10.0),
 			onlinesince ? onlinesince : "",
 			membersince ? membersince : "",
 			idle ? idle : "");
@@ -3478,7 +3485,7 @@
 	userinfo = va_arg(ap, aim_userinfo_t *);
 	va_end(ap);
 
-	serv_got_eviled(gc, (userinfo && userinfo->sn[0]) ? userinfo->sn : NULL, newevil / 10);
+	serv_got_eviled(gc, (userinfo && userinfo->sn[0]) ? userinfo->sn : NULL, ill_just_write_my_own_damn_round_function(newevil/10.0));
 
 	return 1;
 }
@@ -3492,7 +3499,7 @@
 	info = va_arg(ap, aim_userinfo_t *);
 	va_end(ap);
 
-	gc->evil = info->warnlevel/10;
+	gc->evil = ill_just_write_my_own_damn_round_function(info->warnlevel/10.0);
 
 	if (info->onlinesince)
 		gc->login_time_official = info->onlinesince;