pidgin.next.minor: 9d0624fe: Kill off unneeded GLIB_CHECK_VERSION che...

rekkanoryo at pidgin.im rekkanoryo at pidgin.im
Sat Aug 22 18:33:29 EDT 2009


-----------------------------------------------------------------
Revision: 9d0624fe30a826b26606d2908052b5aa37fa0fb3
Ancestor: e15bf46248858cbe06d825e44afd631e355741ee
Author: rekkanoryo at pidgin.im
Date: 2009-08-22T21:47:20
Branch: im.pidgin.pidgin.next.minor
URL: http://d.pidgin.im/viewmtn/revision/info/9d0624fe30a826b26606d2908052b5aa37fa0fb3

Modified files:
        libpurple/core.c libpurple/internal.h libpurple/plugin.c
        libpurple/plugins/autoaccept.c
        libpurple/protocols/jabber/jingle/session.c
        libpurple/protocols/msn/nexus.c
        libpurple/protocols/msn/state.c
        libpurple/protocols/yahoo/libymsg.c libpurple/util.c
        libpurple/win32/libc_interface.c
        libpurple/win32/libc_interface.h
        libpurple/win32/libc_internal.h

ChangeLog: 

Kill off unneeded GLIB_CHECK_VERSION checks in libpurple.  Refs #10024.

-------------- next part --------------
============================================================
--- libpurple/core.c	a0ee0ae07125dacdf124e1f5ee0d122e6b7b0915
+++ libpurple/core.c	aa2e885987b690696535745283d9f24cf8fa7a8c
@@ -496,7 +496,6 @@ purple_core_migrate(void)
 			if (purple_strequal(entry, "logs"))
 			{
 				char *link;
-#if GLIB_CHECK_VERSION(2,4,0)
 				GError *err = NULL;
 
 				if ((link = g_file_read_link(name, &err)) == NULL)
@@ -512,28 +511,7 @@ purple_core_migrate(void)
 					g_free(old_user_dir);
 					return FALSE;
 				}
-#else
-				char buf[MAXPATHLEN];
-				size_t linklen;
 
-				if ((linklen = readlink(name, buf, sizeof(buf) - 1) == -1))
-				{
-					char *name_utf8 = g_filename_to_utf8(name, -1, NULL, NULL, NULL);
-					purple_debug_error("core", "Error reading symlink %s: %s. Please report this at " PURPLE_DEVEL_WEBSITE "\n",
-					                   name_utf8, g_strerror(errno));
-					g_free(name_utf8);
-					g_free(name);
-					g_dir_close(dir);
-					g_free(status_file);
-					g_free(old_user_dir);
-					return FALSE;
-				}
-				buf[linklen] = '\0';
-
-				/* This way we don't have to GLIB_VERSION_CHECK every g_free(link) below. */
-				link = g_strdup(buf);
-#endif
-
 				logs_dir = g_build_filename(user_dir, "logs", NULL);
 
 				if (purple_strequal(link, "../.purple/logs") ||
============================================================
--- libpurple/internal.h	6138eb29830bac36f5004cfdad2069036b0b7c1f
+++ libpurple/internal.h	0eca1a9615e1e02d72d139eba8a70fbc54a9bb9e
@@ -118,36 +118,13 @@
 # include <unistd.h>
 #endif
 
-/* MAXPATHLEN should only be used with readlink() on glib < 2.4.0.  For
- * anything else, use g_file_read_link() or other dynamic functions.  This is
- * important because Hurd has no hard limits on path length. */
-#if !GLIB_CHECK_VERSION(2,4,0)
-# ifndef MAXPATHLEN
-#  ifdef PATH_MAX
-#   define MAXPATHLEN PATH_MAX
-#  else
-#   define MAXPATHLEN 1024
-#  endif
-# endif
-#endif
-
 #ifndef HOST_NAME_MAX
 # define HOST_NAME_MAX 255
 #endif
 
 #include <glib.h>
-#if !GLIB_CHECK_VERSION(2,4,0)
-#	define G_MAXUINT32 ((guint32) 0xffffffff)
-#endif
 
-#ifndef G_MAXSIZE
-#	if GLIB_SIZEOF_LONG == 8
-#		define G_MAXSIZE ((gsize) 0xffffffffffffffff)
-#	else
-#		define G_MAXSIZE ((gsize) 0xffffffff)
-#	endif
-#endif
-
+/* This wasn't introduced until Glib 2.14 :( */
 #ifndef G_MAXSSIZE
 #	if GLIB_SIZEOF_LONG == 8
 #		define G_MAXSSIZE ((gssize) 0x7fffffffffffffff)
@@ -156,80 +133,12 @@
 #	endif
 #endif
 
-#if GLIB_CHECK_VERSION(2,6,0)
-#	include <glib/gstdio.h>
-#endif
+#include <glib/gstdio.h>
 
-#if !GLIB_CHECK_VERSION(2,6,0)
-#	define g_freopen freopen
-#	define g_fopen fopen
-#	define g_rmdir rmdir
-#	define g_remove remove
-#	define g_unlink unlink
-#	define g_lstat lstat
-#	define g_stat stat
-#	define g_mkdir mkdir
-#	define g_rename rename
-#	define g_open open
-#endif
-
-#if !GLIB_CHECK_VERSION(2,8,0) && !defined _WIN32
-#	define g_access access
-#endif
-
-#if !GLIB_CHECK_VERSION(2,10,0)
-#	define g_slice_new(type) g_new(type, 1)
-#	define g_slice_new0(type) g_new0(type, 1)
-#	define g_slice_free(type, mem) g_free(mem)
-#endif
-
 #ifdef _WIN32
 #include "win32dep.h"
 #endif
 
-/* ugly ugly ugly */
-/* This is a workaround for the fact that G_GINT64_MODIFIER and G_GSIZE_FORMAT
- * are only defined in Glib >= 2.4 */
-#ifndef G_GINT64_MODIFIER
-#	if GLIB_SIZEOF_LONG == 8
-#		define G_GINT64_MODIFIER "l"
-#	else
-#		define G_GINT64_MODIFIER "ll"
-#	endif
-#endif
-
-#ifndef G_GSIZE_MODIFIER
-#	if GLIB_SIZEOF_LONG == 8
-#		define G_GSIZE_MODIFIER "l"
-#	else
-#		define G_GSIZE_MODIFIER ""
-#	endif
-#endif
-
-#ifndef G_GSIZE_FORMAT
-#	if GLIB_SIZEOF_LONG == 8
-#		define G_GSIZE_FORMAT "lu"
-#	else
-#		define G_GSIZE_FORMAT "u"
-#	endif
-#endif
-
-#ifndef G_GSSIZE_FORMAT
-#	if GLIB_SIZEOF_LONG == 8
-#		define G_GSSIZE_FORMAT "li"
-#	else
-#		define G_GSSIZE_FORMAT "i"
-#	endif
-#endif
-
-#ifndef G_GNUC_NULL_TERMINATED
-#	if     __GNUC__ >= 4
-#		define G_GNUC_NULL_TERMINATED __attribute__((__sentinel__))
-#	else
-#		define G_GNUC_NULL_TERMINATED
-#	endif
-#endif
-
 #ifdef HAVE_CONFIG_H
 #if SIZEOF_TIME_T == 4
 #	define PURPLE_TIME_T_MODIFIER "lu"
@@ -242,38 +151,6 @@
 
 #include <glib-object.h>
 
-#ifndef G_DEFINE_TYPE
-#define G_DEFINE_TYPE(TypeName, type_name, TYPE_PARENT) \
-\
-static void     type_name##_init              (TypeName        *self); \
-static void     type_name##_class_init        (TypeName##Class *klass); \
-static gpointer type_name##_parent_class = NULL; \
-static void     type_name##_class_intern_init (gpointer klass) \
-{ \
-  type_name##_parent_class = g_type_class_peek_parent (klass); \
-  type_name##_class_init ((TypeName##Class*) klass); \
-} \
-\
-GType \
-type_name##_get_type (void) \
-{ \
-  static GType g_define_type_id = 0; \
-  if (G_UNLIKELY (g_define_type_id == 0)) \
-    { \
-      g_define_type_id = \
-        g_type_register_static_simple (TYPE_PARENT, \
-                                       g_intern_static_string (#TypeName), \
-                                       sizeof (TypeName##Class), \
-                                       (GClassInitFunc)type_name##_class_intern_init, \
-                                       sizeof (TypeName), \
-                                       (GInstanceInitFunc)type_name##_init, \
-                                       (GTypeFlags) 0); \
-    }					\
-  return g_define_type_id;		\
-} /* closes type_name##_get_type() */
-
-#endif
-
 /* Safer ways to work with static buffers. When using non-static
  * buffers, either use g_strdup_* functions (preferred) or use
  * g_strlcpy/g_strlcpy directly. */
============================================================
--- libpurple/plugin.c	7d729cefebe4f0f5cab74904dae3fb53cb260a27
+++ libpurple/plugin.c	1dea199e1aa5529847ce92d2b4a557a5d91069f2
@@ -254,11 +254,7 @@ purple_plugin_probe(const char *filename
 		 *
 		 * G_MODULE_BIND_LOCAL was added in glib 2.3.3.
 		 */
-#if GLIB_CHECK_VERSION(2,3,3)
 		plugin->handle = g_module_open(filename, G_MODULE_BIND_LOCAL);
-#else
-		plugin->handle = g_module_open(filename, 0);
-#endif
 
 		if (plugin->handle == NULL)
 		{
@@ -287,11 +283,7 @@ purple_plugin_probe(const char *filename
 				purple_debug_error("plugins", "%s is not loadable: %s\n",
 						 plugin->path, plugin->error);
 			}
-#if GLIB_CHECK_VERSION(2,3,3)
 			plugin->handle = g_module_open(filename, G_MODULE_BIND_LAZY | G_MODULE_BIND_LOCAL);
-#else
-			plugin->handle = g_module_open(filename, G_MODULE_BIND_LAZY);
-#endif
 
 			if (plugin->handle == NULL)
 			{
============================================================
--- libpurple/plugins/autoaccept.c	ff4a6d0c679dedcfb4196f4e42e91e31ad5dc75d
+++ libpurple/plugins/autoaccept.c	02d82ceced83994ed19e7493b2abb03370d5f2b3
@@ -28,13 +28,7 @@
 
 /* System headers */
 #include <glib.h>
-#if GLIB_CHECK_VERSION(2,6,0)
-#	include <glib/gstdio.h>
-#else
-#	include <sys/types.h>
-#	include <sys/stat.h>
-#	define	g_mkdir mkdir
-#endif
+#include <glib/gstdio.h>
 
 /* Purple headers */
 #include <plugin.h>
============================================================
--- libpurple/protocols/jabber/jingle/session.c	0ed477ef2e6c3b80020687222aa19078bc8087fc
+++ libpurple/protocols/jabber/jingle/session.c	3f2ca89ac46532cd00decc83a7c3e20135dbd806
@@ -367,7 +367,6 @@ jingle_session_find_by_sid(JabberStream 
 			  g_hash_table_lookup(js->sessions, sid) : NULL;
 }
 
-#if GLIB_CHECK_VERSION(2,4,0)
 static gboolean find_by_jid_ghr(gpointer key,
 		gpointer value, gpointer user_data)
 {
@@ -387,58 +386,12 @@ static gboolean find_by_jid_ghr(gpointer
 	return FALSE;
 }
 
-#else /* GLIB_CHECK_VERSION 2.4.0 */
-
-/* Ugly code; g_hash_table_find version above is much nicer */
-struct session_find_jid
-{
-	const gchar *jid;
-	JingleSession *ret;
-	gboolean use_bare;
-};
-
-static void find_by_jid_ghr(gpointer key, gpointer value, gpointer user_data)
-{
-	JingleSession *session = (JingleSession *)value;
-	struct session_find_jid *data = user_data;
-	gchar *remote_jid;
-	gchar *cmp_jid;
-
-	if (data->ret != NULL)
-		return;
-
-	remote_jid = jingle_session_get_remote_jid(session);
-	cmp_jid = data->use_bare ? jabber_get_bare_jid(remote_jid)
-				: g_strdup(remote_jid);
-	g_free(remote_jid);
-
-	if (g_str_equal(data->jid, cmp_jid))
-		data->ret = session;
-
-	g_free(cmp_jid);
-}
-#endif /* GLIB_CHECK_VERSION 2.4.0 */
-
 JingleSession *
 jingle_session_find_by_jid(JabberStream *js, const gchar *jid)
 {
-#if GLIB_CHECK_VERSION(2,4,0)
 	return js->sessions != NULL ?
 			g_hash_table_find(js->sessions,
 			find_by_jid_ghr, (gpointer)jid) : NULL; 
-#else
-	struct session_find_jid data;
-
-	if (js->sessions == NULL)
-		return NULL;
-
-	data.jid = jid;
-	data.ret = NULL;
-	data.use_bare = g_utf8_strchr(jid, -1, '/') == NULL;
-
-	g_hash_table_foreach(js->sessions, find_by_jid_ghr, &data);
-	return data.ret;
-#endif
 }
 
 static xmlnode *
============================================================
--- libpurple/protocols/msn/nexus.c	db32d8eb05eec3ac77c0aeadb282fa7dc1c1ca3f
+++ libpurple/protocols/msn/nexus.c	4b6e7abb1161b7b51f492546a9209401a53dfd5e
@@ -244,16 +244,7 @@ struct _MsnNexusUpdateCallback {
 	gpointer data;
 };
 
-#if !GLIB_CHECK_VERSION(2, 12, 0)
 static gboolean
-nexus_remove_all_cb(gpointer key, gpointer val, gpointer data)
-{
-	return TRUE;
-}
-#endif
-
-
-static gboolean
 nexus_parse_token(MsnNexus *nexus, int id, xmlnode *node)
 {
 	char *token_str, *expiry_str;
@@ -281,12 +272,7 @@ nexus_parse_token(MsnNexus *nexus, int i
 	if (token_str == NULL)
 		return FALSE;
 
-#if GLIB_CHECK_VERSION(2, 12, 0)
 	g_hash_table_remove_all(nexus->tokens[id].token);
-#else
-	g_hash_table_foreach_remove(nexus->tokens[id].token,
-		nexus_remove_all_cb, NULL);
-#endif
 
 	elems = g_strsplit(token_str, "&", 0);
 
============================================================
--- libpurple/protocols/msn/state.c	fafd08c40588a2ede758a1ce9521876e5fe2261c
+++ libpurple/protocols/msn/state.c	9cbcb774eb4dfff011dc33c0170486488a42592e
@@ -114,11 +114,7 @@ msn_parse_currentmedia(const char *cmedi
 	 *  6: Album
 	 *  7: ?
 	 */
-#if GLIB_CHECK_VERSION(2,6,0)
 	strings  = g_strv_length(cmedia_array);
-#else
-	while (cmedia_array[++strings] != NULL);
-#endif
 
 	if (strings >= 4 && !strcmp(cmedia_array[2], "1")) {
 		parsed = TRUE;
============================================================
--- libpurple/protocols/yahoo/libymsg.c	784ea1f5c48533a4d0caa0bb180484436ba111a3
+++ libpurple/protocols/yahoo/libymsg.c	7a22d9bd4f31cb4a5f39ef0fb708fa42e0ca41a6
@@ -1679,11 +1679,8 @@ static void yahoo_auth16_stage2(PurpleUt
 		char *crumb = NULL;
 		char *crypt = NULL;
 
-#if GLIB_CHECK_VERSION(2,6,0)
 		totalelements = g_strv_length(split_data);
-#else
-		while (split_data[++totalelements] != NULL);
-#endif
+
 		if (totalelements >= 4) {
 			response_no = strtol(split_data[0], NULL, 10);
 			crumb = g_strdup(split_data[1] + strlen("crumb="));
@@ -1765,11 +1762,8 @@ static void yahoo_auth16_stage1_cb(Purpl
 		int response_no = -1;
 		char *token = NULL;
 
-#if GLIB_CHECK_VERSION(2,6,0)
 		totalelements = g_strv_length(split_data);
-#else
-		while (split_data[++totalelements] != NULL);
-#endif
+
 		if(totalelements == 1)
 			response_no = strtol(split_data[0], NULL, 10);
 		else if(totalelements >= 2) {
============================================================
--- libpurple/util.c	c4d036a2d4968d1873234c4e0f034c4ee84b1055
+++ libpurple/util.c	02f7b496c17e384ba0972869c136e9fabe342d3b
@@ -220,50 +220,12 @@ purple_base64_encode(const guchar *data,
 gchar *
 purple_base64_encode(const guchar *data, gsize len)
 {
-#if GLIB_CHECK_VERSION(2,12,0)
 	return g_base64_encode(data, len);
-#else
-	char *out, *rv;
-
-	g_return_val_if_fail(data != NULL, NULL);
-	g_return_val_if_fail(len > 0,  NULL);
-
-	rv = out = g_malloc(((len/3)+1)*4 + 1);
-
-	for (; len >= 3; len -= 3)
-	{
-		*out++ = alphabet[data[0] >> 2];
-		*out++ = alphabet[((data[0] << 4) & 0x30) | (data[1] >> 4)];
-		*out++ = alphabet[((data[1] << 2) & 0x3c) | (data[2] >> 6)];
-		*out++ = alphabet[data[2] & 0x3f];
-		data += 3;
-	}
-
-	if (len > 0)
-	{
-		unsigned char fragment;
-
-		*out++ = alphabet[data[0] >> 2];
-		fragment = (data[0] << 4) & 0x30;
-
-		if (len > 1)
-			fragment |= data[1] >> 4;
-
-		*out++ = alphabet[fragment];
-		*out++ = (len < 2) ? '=' : alphabet[(data[1] << 2) & 0x3c];
-		*out++ = '=';
-	}
-
-	*out = '\0';
-
-	return rv;
-#endif /* GLIB < 2.12.0 */
 }
 
 guchar *
 purple_base64_decode(const char *str, gsize *ret_len)
 {
-#if GLIB_CHECK_VERSION(2,12,0)
 	/*
 	 * We want to allow ret_len to be NULL for backward compatibility,
 	 * but g_base64_decode() requires a valid length variable.  So if
@@ -271,69 +233,6 @@ purple_base64_decode(const char *str, gs
 	 */
 	gsize unused;
 	return g_base64_decode(str, ret_len != NULL ? ret_len : &unused);
-#else
-	guchar *out = NULL;
-	char tmp = 0;
-	const char *c;
-	gint32 tmp2 = 0;
-	int len = 0, n = 0;
-
-	g_return_val_if_fail(str != NULL, NULL);
-
-	c = str;
-
-	while (*c) {
-		if (*c >= 'A' && *c <= 'Z') {
-			tmp = *c - 'A';
-		} else if (*c >= 'a' && *c <= 'z') {
-			tmp = 26 + (*c - 'a');
-		} else if (*c >= '0' && *c <= 57) {
-			tmp = 52 + (*c - '0');
-		} else if (*c == '+') {
-			tmp = 62;
-		} else if (*c == '/') {
-			tmp = 63;
-		} else if (*c == '\r' || *c == '\n') {
-			c++;
-			continue;
-		} else if (*c == '=') {
-			if (n == 3) {
-				out = g_realloc(out, len + 2);
-				out[len] = (guchar)(tmp2 >> 10) & 0xff;
-				len++;
-				out[len] = (guchar)(tmp2 >> 2) & 0xff;
-				len++;
-			} else if (n == 2) {
-				out = g_realloc(out, len + 1);
-				out[len] = (guchar)(tmp2 >> 4) & 0xff;
-				len++;
-			}
-			break;
-		}
-		tmp2 = ((tmp2 << 6) | (tmp & 0xff));
-		n++;
-		if (n == 4) {
-			out = g_realloc(out, len + 3);
-			out[len] = (guchar)((tmp2 >> 16) & 0xff);
-			len++;
-			out[len] = (guchar)((tmp2 >> 8) & 0xff);
-			len++;
-			out[len] = (guchar)(tmp2 & 0xff);
-			len++;
-			tmp2 = 0;
-			n = 0;
-		}
-		c++;
-	}
-
-	out = g_realloc(out, len + 1);
-	out[len] = 0;
-
-	if (ret_len != NULL)
-		*ret_len = len;
-
-	return out;
-#endif /* GLIB < 2.12.0 */
 }
 
 /**************************************************************************
@@ -2656,56 +2555,7 @@ int purple_build_dir (const char *path, 
 
 int purple_build_dir (const char *path, int mode)
 {
-#if GLIB_CHECK_VERSION(2,8,0)
 	return g_mkdir_with_parents(path, mode);
-#else
-	char *dir, **components, delim[] = { G_DIR_SEPARATOR, '\0' };
-	int cur, len;
-
-	g_return_val_if_fail(path != NULL, -1);
-
-	dir = g_new0(char, strlen(path) + 1);
-	components = g_strsplit(path, delim, -1);
-	len = 0;
-	for (cur = 0; components[cur] != NULL; cur++) {
-		/* If you don't know what you're doing on both
-		 * win32 and *NIX, stay the hell away from this code */
-		if(cur > 1)
-			dir[len++] = G_DIR_SEPARATOR;
-		strcpy(dir + len, components[cur]);
-		len += strlen(components[cur]);
-		if(cur == 0)
-			dir[len++] = G_DIR_SEPARATOR;
-
-		if(g_file_test(dir, G_FILE_TEST_IS_DIR)) {
-			continue;
-#ifdef _WIN32
-		/* allow us to create subdirs on UNC paths
-		 * (\\machinename\path\to\blah)
-		 * g_file_test() doesn't work on "\\machinename" */
-		} else if (cur == 2 && dir[0] == '\\' && dir[1] == '\\'
-				&& components[cur + 1] != NULL) {
-			continue;
-#endif
-		} else if(g_file_test(dir, G_FILE_TEST_EXISTS)) {
-			purple_debug_warning("build_dir", "bad path: %s\n", path);
-			g_strfreev(components);
-			g_free(dir);
-			return -1;
-		}
-
-		if (g_mkdir(dir, mode) < 0) {
-			purple_debug_warning("build_dir", "mkdir: %s\n", g_strerror(errno));
-			g_strfreev(components);
-			g_free(dir);
-			return -1;
-		}
-	}
-
-	g_strfreev(components);
-	g_free(dir);
-	return 0;
-#endif
 }
 
 /*
@@ -3215,30 +3065,13 @@ purple_str_has_prefix(const char *s, con
 gboolean
 purple_str_has_prefix(const char *s, const char *p)
 {
-#if GLIB_CHECK_VERSION(2,2,0)
 	return g_str_has_prefix(s, p);
-#else
-	g_return_val_if_fail(s != NULL, FALSE);
-	g_return_val_if_fail(p != NULL, FALSE);
-
-	return (!strncmp(s, p, strlen(p)));
-#endif
 }
 
 gboolean
 purple_str_has_suffix(const char *s, const char *x)
 {
-#if GLIB_CHECK_VERSION(2,2,0)
 	return g_str_has_suffix(s, x);
-#else
-	int off;
-
-	g_return_val_if_fail(s != NULL, FALSE);
-	g_return_val_if_fail(x != NULL, FALSE);
-
-	off = strlen(s) - strlen(x);
-	return (off >= 0 && purple_strequal(s + off, x));
-#endif
 }
 
 char *
@@ -5134,18 +4967,5 @@ purple_get_host_name(void)
 const gchar *
 purple_get_host_name(void)
 {
-#if GLIB_CHECK_VERSION(2,8,0)
 	return g_get_host_name();
-#else
-	static char hostname[256];
-	int ret = gethostname(hostname, sizeof(hostname));
-	hostname[sizeof(hostname) - 1] = '\0';
-
-	if (ret == -1 || hostname[0] == '\0') {
-		purple_debug_info("purple_get_host_name: ", "could not find host name");
-		return "localhost";
-	} else {
-		return hostname;
-	}
-#endif
 }
============================================================
--- libpurple/win32/libc_interface.c	1936eceecbd9824702dca7009484a4c21bd41997
+++ libpurple/win32/libc_interface.c	62618a2f7cab760c8aa7b62243e392bc13f6f140
@@ -469,65 +469,7 @@ int wpurple_rename (const char *oldname,
 /* stdio.h */
 
 int wpurple_rename (const char *oldname, const char *newname) {
-
-#if GLIB_CHECK_VERSION(2,8,5)
-
 	return g_rename(oldname, newname);
-
-#else
-
-	/* This is a ugly, but we still compile with 2.6.10 but use newer runtimes */
-	struct stat oldstat, newstat;
-
-	/* As of Glib 2.8.5, g_rename() uses MoveFileEx() with MOVEFILE_REPLACE_EXISTING to behave more sanely */
-	if (glib_check_version(2, 8, 5) == NULL) {
-		return g_rename(oldname, newname);
-	}
-
-	if(g_stat(oldname, &oldstat) == 0) {
-		/* newname exists */
-		if(g_stat(newname, &newstat) == 0) {
-			/* oldname is a dir */
-			if(S_ISDIR(oldstat.st_mode)) {
-				if(!S_ISDIR(newstat.st_mode)) {
-					return g_rename(oldname, newname);
-				}
-				/* newname is a dir */
-				else {
-					/* This is not quite right.. If newname is empty and
-					   is not a sub dir of oldname, newname should be
-					   deleted and oldname should be renamed.
-					*/
-					purple_debug(PURPLE_DEBUG_WARNING, "wpurple", "wpurple_rename does not behave here as it should\n");
-					return g_rename(oldname, newname);
-				}
-			}
-			/* oldname is not a dir */
-			else {
-				/* newname is a dir */
-				if(S_ISDIR(newstat.st_mode)) {
-					errno = EISDIR;
-					return -1;
-				}
-				/* newname is not a dir */
-				else {
-					g_remove(newname);
-					return g_rename(oldname, newname);
-				}
-			}
-		}
-		/* newname doesn't exist */
-		else
-			return g_rename(oldname, newname);
-	}
-	else {
-		/* oldname doesn't exist */
-		errno = ENOENT;
-		return -1;
-	}
-
-#endif
-
 }
 
 /* time.h */
@@ -1129,54 +1071,7 @@ wpurple_g_access (const gchar *filename,
 wpurple_g_access (const gchar *filename,
 	  int          mode)
 {
-#if GLIB_CHECK_VERSION(2,8,0)
-
 	return g_access(filename, mode);
-
-#else
-
-  if (G_WIN32_HAVE_WIDECHAR_API ())
-    {
-      wchar_t *wfilename = g_utf8_to_utf16 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-
-      if (wfilename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = _waccess (wfilename, mode);
-      save_errno = errno;
-
-      g_free (wfilename);
-
-      errno = save_errno;
-      return retval;
-    }
-  else
-    {
-      gchar *cp_filename = g_locale_from_utf8 (filename, -1, NULL, NULL, NULL);
-      int retval;
-      int save_errno;
-
-      if (cp_filename == NULL)
-	{
-	  errno = EINVAL;
-	  return -1;
-	}
-
-      retval = access (cp_filename, mode);
-      save_errno = errno;
-
-      g_free (cp_filename);
-
-      errno = save_errno;
-      return retval;
-    }
-
-#endif
 }
 
 
============================================================
--- libpurple/win32/libc_interface.h	57be7dbd90fe45d62f31edf205e4bb3fa37e701f
+++ libpurple/win32/libc_interface.h	2e18c8a46e679503205617530ac62cae1ef199d3
@@ -115,11 +115,6 @@ wpurple_close( fd )
 #define close( fd ) \
 wpurple_close( fd )
 
-#if !GLIB_CHECK_VERSION(2,8,0)
-#define g_access( filename, mode) \
-wpurple_g_access( filename, mode )
-#endif
-
 #ifndef sleep
 #define sleep(x) Sleep((x)*1000)
 #endif
@@ -140,14 +135,12 @@ wpurple_rename( oldname, newname )
 #define rename( oldname, newname ) \
 wpurple_rename( oldname, newname )
 
-#if GLIB_CHECK_VERSION(2,6,0)
 #ifdef g_rename
 # undef g_rename
 #endif
 /* This is necessary because we want rename on win32 to be able to overwrite an existing file, it is done in internal.h if GLib < 2.6*/
 #define g_rename(oldname, newname) \
 wpurple_rename(oldname, newname)
-#endif
 
 /* sys/stat.h */
 #define fchmod(a,b)
============================================================
--- libpurple/win32/libc_internal.h	4dd06adb13e0c556ed1afc243f3d0cb23320a750
+++ libpurple/win32/libc_internal.h	baffee0cc7987bf2a86f9e4e8df3c77f7bc31167
@@ -141,10 +141,6 @@ int wpurple_gethostname(char *name, size
 int wpurple_gethostname(char *name, size_t size);
 
 
-#if !GLIB_CHECK_VERSION(2,8,0)
-int wpurple_g_access(const gchar *filename, int mode);
-#endif
-
 /* stdio.h */
 int wpurple_rename(const char *oldname, const char *newname);
 


More information about the Commits mailing list