changeset 13370:cf292e05a6cc

[gaim-migrate @ 15743] Don't re-cache the cached value. strcpy() is fine because the src and dest are the same size and src is always nul terminated. committer: Tailor Script <tailor@pidgin.im>
author Daniel Atallah <daniel.atallah@gmail.com>
date Wed, 01 Mar 2006 13:20:59 +0000
parents d34730f73777
children 1299f8f51b07
files src/win32/libc_interface.c
diffstat 1 files changed, 25 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/src/win32/libc_interface.c	Wed Mar 01 12:51:36 2006 +0000
+++ b/src/win32/libc_interface.c	Wed Mar 01 13:20:59 2006 +0000
@@ -804,11 +804,11 @@
 const char *
 wgaim_get_timezone_abbreviation(const struct tm *tm)
 {
-	int			i;
-	char		tzname[128];
-	char		localtzname[256];
-	HKEY		rootKey;
-	int			idx;
+	int i;
+	char tzname[128];
+	char localtzname[256];
+	HKEY rootKey;
+	int idx;
 
 	if (!tm)
 	{
@@ -831,10 +831,12 @@
 			                win32_tzmap[i].ustd, tzname);
 #endif
 			/* Cache the Result */
-			if (win32_tzmap[0].wstd[0] != '\0')
-				g_free(win32_tzmap[0].wstd);
-			win32_tzmap[0].wstd = g_strdup(tzname);
-			win32_tzmap[0].ustd = win32_tzmap[i].ustd;
+			if (i > 0) {
+				if (win32_tzmap[0].wstd[0] != '\0')
+					g_free(win32_tzmap[0].wstd);
+				win32_tzmap[0].wstd = g_strdup(tzname);
+				win32_tzmap[0].ustd = win32_tzmap[i].ustd;
+			}
 
 			return win32_tzmap[i].ustd;
 		}
@@ -845,10 +847,12 @@
 			                win32_tzmap[i].udst, tzname);
 #endif
 			/* Cache the Result */
-			if (win32_tzmap[0].wdst[0] != '\0')
-				g_free(win32_tzmap[0].wdst);
-			win32_tzmap[0].wdst = g_strdup(tzname);
-			win32_tzmap[0].udst = win32_tzmap[i].udst;
+			if (i > 0) {
+				if (win32_tzmap[0].wdst[0] != '\0')
+					g_free(win32_tzmap[0].wdst);
+				win32_tzmap[0].wdst = g_strdup(tzname);
+				win32_tzmap[0].udst = win32_tzmap[i].udst;
+			}
 
 			return win32_tzmap[i].udst;
 		}
@@ -872,12 +876,12 @@
 
 	for (idx = 0;; idx++)
 	{
-		char		keyname[256];
-		char		zonename[256];
-		DWORD		namesize;
-		FILETIME	lastwrite;
-		HKEY		key;
-		LONG		r;
+		char keyname[256];
+		char zonename[256];
+		DWORD namesize;
+		FILETIME lastwrite;
+		HKEY key;
+		LONG r;
 
 		memset(keyname, 0, sizeof(keyname));
 		namesize = sizeof(keyname);
@@ -913,7 +917,7 @@
 		if (strcmp(tzname, zonename) == 0)
 		{
 			/* Matched zone */
-			gaim_strlcpy(localtzname, keyname);
+			strcpy(localtzname, keyname);
 			RegCloseKey(key);
 			break;
 		}
@@ -928,7 +932,7 @@
 		if (strcmp(tzname, zonename) == 0)
 		{
 			/* Matched DST zone */
-			gaim_strlcpy(localtzname, keyname);
+			strcpy(localtzname, keyname);
 			RegCloseKey(key);
 			break;
 		}