im.pidgin.pidgin: 4f88abe06fd8a1d074983f3cf8aeb93d06d57f5f

nosnilmot at pidgin.im nosnilmot at pidgin.im
Fri Nov 23 14:45:42 EST 2007


-----------------------------------------------------------------
Revision: 4f88abe06fd8a1d074983f3cf8aeb93d06d57f5f
Ancestor: 8fa8d1ac381cffb7bd0d248780d753b7056d8a43
Author: nosnilmot at pidgin.im
Date: 2007-11-23T19:41:44
Branch: im.pidgin.pidgin

Modified files:
        libpurple/util.c

ChangeLog: 

I had used memcpy to copy the struct tm to where the caller wants it, but
this assumes all callers provide their own allocated struct, which is not
necessarily always the case.
If callers want to keep the values of this struct tm across multiple calls
to purple_str_to_time, they had better copy it themselves. (which is
essentially the same as it was before when we were returning the pointer
to the struct as returned by localtime(), which is also statically
allocated)

-------------- next part --------------
============================================================
--- libpurple/util.c	bcbb6d99730b6eab94b196b0449d826ff148be17
+++ libpurple/util.c	731485e99d122b13965175e9911a3e31ecc20164
@@ -897,7 +897,7 @@ purple_str_to_time(const char *timestamp
 
 	if (tm != NULL)
 	{
-		memcpy(tm, &t, sizeof(struct tm));
+		*tm = t;
 		tm->tm_isdst = -1;
 		mktime(tm);
 	}


More information about the Commits mailing list