Fix the compilation of gutils on CE by removing a bunch of stuff that we don't use.
authorFlorian Quèze <florian@instantbird.org>
Wed, 15 Apr 2009 14:47:38 +0200
changeset 294 bcf2b012f79a
parent 293 c2092987e66a
child 295 b7fb02efb902
push id1
push userflorian@queze.net
push dateThu, 27 Feb 2014 22:39:51 +0000
Fix the compilation of gutils on CE by removing a bunch of stuff that we don't use.
libpurple/util.c
libpurple/util.h
libpurple/win32/win32dep.c
libraries/glib/glib.symbols
libraries/glib/gutils.c
--- a/libpurple/util.c
+++ b/libpurple/util.c
@@ -2946,16 +2946,17 @@ purple_util_get_image_filename(gconstpoi
 	/* Return the filename */
 	char *checksum = purple_util_get_image_checksum(image_data, image_len);
 	char *filename = g_strdup_printf("%s.%s", checksum,
 	                       purple_util_get_image_extension(image_data, image_len));
 	g_free(checksum);
 	return filename;
 }
 
+#if 0
 gboolean
 purple_program_is_valid(const char *program)
 {
 	GError *error = NULL;
 	char **argv;
 	gchar *progname;
 	gboolean is_valid = FALSE;
 
@@ -2977,17 +2978,17 @@ purple_program_is_valid(const char *prog
 	progname = g_find_program_in_path(argv[0]);
 	is_valid = (progname != NULL);
 
 	g_strfreev(argv);
 	g_free(progname);
 
 	return is_valid;
 }
-
+#endif
 
 gboolean
 purple_running_gnome(void)
 {
 #ifndef _WIN32
 	gchar *tmp = g_find_program_in_path("gnome-open");
 
 	if (tmp == NULL)
--- a/libpurple/util.h
+++ b/libpurple/util.h
@@ -729,17 +729,17 @@ char *purple_util_get_image_filename(gco
 
 /**
  * Checks if the given program name is valid and executable.
  *
  * @param program The file name of the application.
  *
  * @return TRUE if the program is runable.
  */
-gboolean purple_program_is_valid(const char *program);
+/* gboolean purple_program_is_valid(const char *program); */
 
 /**
  * Check if running GNOME.
  *
  * @return TRUE if running GNOME, FALSE otherwise.
  */
 gboolean purple_running_gnome(void);
 
--- a/libpurple/win32/win32dep.c
+++ b/libpurple/win32/win32dep.c
@@ -442,26 +442,28 @@ void wpurple_init(void) {
 	/* Note that if the DLL supports versions greater than
 	   2.2 in addition to 2.2, it will still return 2.2 in
 	   wVersion since that is the version we requested. */
 	if(LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2) {
 		purple_debug_error("wpurple", "Could not find a usable WinSock DLL.  Oh well.\n");
 		WSACleanup();
 	}
 
+#if 0
 	/* Set Environmental Variables */
 	/* Tell perl where to find Purple's perl modules */
 	perlenv = g_getenv("PERL5LIB");
 	newenv = g_strdup_printf("%s%s%s" G_DIR_SEPARATOR_S "perlmod;",
 		perlenv ? perlenv : "",
 		perlenv ? ";" : "",
 		wpurple_install_dir());
 	if (!g_setenv("PERL5LIB", newenv, TRUE))
 		purple_debug_warning("wpurple", "putenv failed for PERL5LIB\n");
 	g_free(newenv);
+#endif
 
 	purple_debug_info("wpurple", "wpurple_init end\n");
 }
 
 /* Windows Cleanup */
 
 void wpurple_cleanup(void) {
 	purple_debug_info("wpurple", "wpurple_cleanup\n");
--- a/libraries/glib/glib.symbols
+++ b/libraries/glib/glib.symbols
@@ -1486,51 +1486,27 @@ g_direct_hash G_GNUC_CONST
 
 #if IN_HEADER(__G_UTILS_H__)
 #if IN_FILE(__G_UTILS_C__)
 g_atexit
 #ifndef G_DISABLE_DEPRECATED
 g_basename
 #endif
 g_get_application_name
-g_find_program_in_path PRIVATE
-g_get_current_dir PRIVATE
 g_getenv PRIVATE
-g_unsetenv PRIVATE
-g_get_home_dir PRIVATE
 g_get_host_name
-g_setenv PRIVATE
-g_listenv
 #ifdef G_OS_WIN32
-g_find_program_in_path_utf8
-g_get_current_dir_utf8
 g_getenv_utf8
-g_unsetenv_utf8
-g_setenv_utf8
-g_get_home_dir_utf8
 #endif
 g_get_language_names
 g_get_prgname
 g_get_real_name PRIVATE
 #ifdef G_OS_WIN32
 g_get_real_name_utf8
 #endif
-g_get_system_config_dirs
-g_get_system_data_dirs
-#ifdef G_OS_WIN32
-g_win32_get_system_data_dirs_for_module
-#endif
-g_get_tmp_dir PRIVATE
-#ifdef G_OS_WIN32
-g_get_tmp_dir_utf8
-#endif
-g_get_user_cache_dir
-g_get_user_config_dir
-g_get_user_data_dir
-g_get_user_special_dir
 g_get_user_name PRIVATE
 #ifdef G_OS_WIN32
 g_get_user_name_utf8
 #endif
 glib_check_version
 g_nullify_pointer
 g_parse_debug_string
 g_path_get_basename G_GNUC_MALLOC
--- a/libraries/glib/gutils.c
+++ b/libraries/glib/gutils.c
@@ -83,16 +83,17 @@
 #  ifndef GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS
 #    define GET_MODULE_HANDLE_EX_FLAG_UNCHANGED_REFCOUNT 2
 #    define GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS 4
 #  endif
 #  include <lmcons.h>		/* For UNLEN */
 #endif /* G_PLATFORM_WIN32 */
 
 #ifdef G_OS_WIN32
+#  include <winsock.h> /* For gethostname */
 #  include <direct.h>
 #  include <shlobj.h>
    /* older SDK (e.g. msvc 5.0) does not have these*/
 #  ifndef CSIDL_MYMUSIC
 #    define CSIDL_MYMUSIC 13
 #  endif
 #  ifndef CSIDL_MYVIDEO
 #    define CSIDL_MYVIDEO 14
@@ -332,17 +333,17 @@ my_strchrnul (const gchar *str,
 {
   gchar *p = (gchar*)str;
   while (*p && (*p != c))
     ++p;
 
   return p;
 }
 
-#ifdef G_OS_WIN32
+#if 0
 
 static gchar *inner_find_program_in_path (const gchar *program);
 
 gchar*
 g_find_program_in_path (const gchar *program)
 {
   const gchar *last_dot = strrchr (program, '.');
 
@@ -381,17 +382,16 @@ g_find_program_in_path (const gchar *pro
 	} while (*p++ != '\0');
       g_free (pathext);
       return NULL;
     }
   else
     return inner_find_program_in_path (program);
 }
 
-#endif
 
 /**
  * g_find_program_in_path:
  * @program: a program name in the GLib file name encoding
  * 
  * Locates the first executable named @program in the user's path, in the
  * same way that execvp() would locate it. Returns an allocated string
  * with the absolute path name, or %NULL if the program is not found in
@@ -564,16 +564,17 @@ g_find_program_in_path (const gchar *pro
   
   g_free (freeme);
 #ifdef G_OS_WIN32
   g_free ((gchar *) path_copy);
 #endif
 
   return NULL;
 }
+#endif
 
 static gboolean
 debug_key_matches (const gchar *key,
 		   const gchar *token,
 		   guint        length)
 {
   for (; length; length--, key++, token++)
     {
@@ -937,16 +938,17 @@ g_path_get_dirname (const gchar	   *file
   
   base = g_new (gchar, len + 1);
   g_memmove (base, file_name, len);
   base[len] = 0;
   
   return base;
 }
 
+#if 0
 /**
  * g_get_current_dir:
  *
  * Gets the current directory.
  * The returned string should be freed when no longer needed. The encoding 
  * of the returned string is system defined. On Windows, it is always UTF-8.
  * 
  * Returns: the current directory.
@@ -1014,16 +1016,17 @@ g_get_current_dir (void)
     }
 
   dir = g_strdup (buffer);
   g_free (buffer);
   
   return dir;
 #endif /* !Win32 */
 }
+#endif
 
 /**
  * g_getenv:
  * @variable: the environment variable to get, in the GLib file name encoding.
  * 
  * Returns the value of an environment variable. The name and value
  * are in the GLib file name encoding. On UNIX, this means the actual
  * bytes which might or might not be in some consistent character set
@@ -1138,16 +1141,17 @@ const gchar*
           strncpy (buffer, retval, l);
           buffer[l] = 0;
           return buffer;
         }
     }
   return NULL;
 }
 
+#if 0
 /**
  * g_setenv:
  * @variable: the environment variable to set, must not contain '='.
  * @value: the value for to set the variable to.
  * @overwrite: whether to change the variable if it already exists.
  *
  * Sets an environment variable. Both the variable's name and value
  * should be in the GLib file name encoding. On UNIX, this means that
@@ -1397,35 +1401,37 @@ g_listenv (void)
       q += wcslen (q) + 1;
     }
   result[j] = NULL;
   FreeEnvironmentStringsW (p);
 
   return result;
 #endif
 }
+#endif
 
 G_LOCK_DEFINE_STATIC (g_utils_global);
 
-static	gchar	*g_tmp_dir = NULL;
+/* static	gchar	*g_tmp_dir = NULL; */
 static	gchar	*g_user_name = NULL;
 static	gchar	*g_real_name = NULL;
-static	gchar	*g_home_dir = NULL;
+/* static	gchar	*g_home_dir = NULL; */
 static	gchar	*g_host_name = NULL;
 
 #ifdef G_OS_WIN32
 /* System codepage versions of the above, kept at file level so that they,
  * too, are produced only once.
  */
-static	gchar	*g_tmp_dir_cp = NULL;
+/* static	gchar	*g_tmp_dir_cp = NULL; */
 static	gchar	*g_user_name_cp = NULL;
 static	gchar	*g_real_name_cp = NULL;
-static	gchar	*g_home_dir_cp = NULL;
+/* static	gchar	*g_home_dir_cp = NULL; */
 #endif
 
+#if 0
 static  gchar   *g_user_data_dir = NULL;
 static  gchar  **g_system_data_dirs = NULL;
 static  gchar   *g_user_cache_dir = NULL;
 static  gchar   *g_user_config_dir = NULL;
 static  gchar  **g_system_config_dirs = NULL;
 
 static  gchar  **g_user_special_dirs = NULL;
 
@@ -1476,23 +1482,25 @@ get_windows_directory_root (void)
       *p = '\0';
       return windowsdir;
     }
   else
     return g_strdup ("C:\\");
 }
 
 #endif
+#endif
 
 /* HOLDS: g_utils_global_lock */
 static void
 g_get_any_init_do (void)
 {
   gchar hostname[100];
 
+#if 0
   g_tmp_dir = g_strdup (g_getenv ("TMPDIR"));
   if (!g_tmp_dir)
     g_tmp_dir = g_strdup (g_getenv ("TMP"));
   if (!g_tmp_dir)
     g_tmp_dir = g_strdup (g_getenv ("TEMP"));
 
 #ifdef G_OS_WIN32
   if (!g_tmp_dir)
@@ -1509,17 +1517,17 @@ g_get_any_init_do (void)
     }
 #endif
   
   if (!g_tmp_dir)
     {
       g_tmp_dir = g_strdup ("/tmp");
     }
 #endif	/* !G_OS_WIN32 */
-  
+
 #ifdef G_OS_WIN32
   /* We check $HOME first for Win32, though it is a last resort for Unix
    * where we prefer the results of getpwuid().
    */
   g_home_dir = g_strdup (g_getenv ("HOME"));
 
   /* Only believe HOME if it is an absolute path and exists */
   if (g_home_dir)
@@ -1550,17 +1558,18 @@ g_get_any_init_do (void)
     }
 
   if (!g_home_dir)
     g_home_dir = get_special_folder (CSIDL_PROFILE);
   
   if (!g_home_dir)
     g_home_dir = get_windows_directory_root ();
 #endif /* G_OS_WIN32 */
-  
+#endif
+ 
 #ifdef HAVE_PWD_H
   {
     struct passwd *pw = NULL;
     gpointer buffer = NULL;
     gint error;
     gchar *logname;
 
 #  if defined (HAVE_POSIX_GETPWUID_R) || defined (HAVE_NONPOSIX_GETPWUID_R)
@@ -1661,89 +1670,97 @@ g_get_any_init_do (void)
 	    gecos_fields = g_strsplit (pw->pw_gecos, ",", 0);
 	    name_parts = g_strsplit (gecos_fields[0], "&", 0);
 	    pw->pw_name[0] = g_ascii_toupper (pw->pw_name[0]);
 	    g_real_name = g_strjoinv (pw->pw_name, name_parts);
 	    g_strfreev (gecos_fields);
 	    g_strfreev (name_parts);
 	  }
 
+#if 0
 	if (!g_home_dir)
 	  g_home_dir = g_strdup (pw->pw_dir);
+#endif
       }
     g_free (buffer);
   }
   
 #else /* !HAVE_PWD_H */
   
 #ifdef G_OS_WIN32
   {
     guint len = UNLEN+1;
     wchar_t buffer[UNLEN+1];
     
-    if (GetUserNameW (buffer, (LPDWORD) &len))
+    if (GetUserNameExW (NameSamCompatible, buffer, (LPDWORD) &len))
       {
 	g_user_name = g_utf16_to_utf8 (buffer, -1, NULL, NULL, NULL);
 	g_real_name = g_strdup (g_user_name);
       }
   }
 #endif /* G_OS_WIN32 */
 
 #endif /* !HAVE_PWD_H */
 
-#ifndef G_OS_WIN32
+#if 0
   if (!g_home_dir)
     g_home_dir = g_strdup (g_getenv ("HOME"));
 #endif
 
 #ifdef __EMX__
   /* change '\\' in %HOME% to '/' */
   g_strdelimit (g_home_dir, "\\",'/');
 #endif
   if (!g_user_name)
     g_user_name = g_strdup ("somebody");
   if (!g_real_name)
     g_real_name = g_strdup ("Unknown");
 
   {
-#ifndef G_OS_WIN32
+#if 1
     gboolean hostname_fail = (gethostname (hostname, sizeof (hostname)) == -1);
 #else
     DWORD size = sizeof (hostname);
     gboolean hostname_fail = (!GetComputerName (hostname, &size));
 #endif
     g_host_name = g_strdup (hostname_fail ? "localhost" : hostname);
   }
 
 #ifdef G_OS_WIN32
+#if 0
   g_tmp_dir_cp = g_locale_from_utf8 (g_tmp_dir, -1, NULL, NULL, NULL);
+#endif
   g_user_name_cp = g_locale_from_utf8 (g_user_name, -1, NULL, NULL, NULL);
   g_real_name_cp = g_locale_from_utf8 (g_real_name, -1, NULL, NULL, NULL);
 
+#if 0
   if (!g_tmp_dir_cp)
     g_tmp_dir_cp = g_strdup ("\\");
+#endif
   if (!g_user_name_cp)
     g_user_name_cp = g_strdup ("somebody");
   if (!g_real_name_cp)
     g_real_name_cp = g_strdup ("Unknown");
 
+#if 0
   /* home_dir might be NULL, unlike tmp_dir, user_name and
    * real_name.
    */
   if (g_home_dir)
     g_home_dir_cp = g_locale_from_utf8 (g_home_dir, -1, NULL, NULL, NULL);
   else
     g_home_dir_cp = NULL;
+#endif
 #endif /* G_OS_WIN32 */
 }
 
 static inline void
 g_get_any_init (void)
 {
-  if (!g_tmp_dir)
+  if (!g_user_name)
     g_get_any_init_do ();
 }
 
 static inline void
 g_get_any_init_locked (void)
 {
   G_LOCK (g_utils_global);
   g_get_any_init ();
@@ -1781,16 +1798,17 @@ g_get_user_name (void)
  */
 G_CONST_RETURN gchar*
 g_get_real_name (void)
 {
   g_get_any_init_locked ();
   return g_real_name;
 }
 
+#if 0
 /**
  * g_get_home_dir:
  *
  * Gets the current user's home directory as defined in the 
  * password database.
  *
  * Note that in contrast to traditional UNIX tools, this function 
  * prefers <filename>passwd</filename> entries over the <envar>HOME</envar> 
@@ -1837,16 +1855,17 @@ g_get_home_dir (void)
  * Returns: the directory to use for temporary files.
  */
 G_CONST_RETURN gchar*
 g_get_tmp_dir (void)
 {
   g_get_any_init_locked ();
   return g_tmp_dir;
 }
+#endif
 
 /**
  * g_get_host_name:
  *
  * Return a name for the machine. 
  *
  * The returned name is not necessarily a fully-qualified domain name,
  * or even present in DNS or some other name service at all. It need
@@ -1999,16 +2018,17 @@ g_set_application_name (const gchar *app
   else
     g_application_name = g_strdup (application_name);
   G_UNLOCK (g_application_name);
 
   if (already_set)
     g_warning ("g_set_application() name called multiple times");
 }
 
+#if 0
 /**
  * g_get_user_data_dir:
  * 
  * Returns a base directory in which to access application data such
  * as icons that is customized for a particular user.  
  *
  * On UNIX platforms this is determined using the mechanisms described in
  * the <ulink url="http://www.freedesktop.org/Standards/basedir-spec">
@@ -2705,16 +2725,17 @@ g_get_system_config_dirs (void)
       g_system_config_dirs = conf_dir_vector;
     }
   else
     conf_dir_vector = g_system_config_dirs;
   G_UNLOCK (g_utils_global);
 
   return (G_CONST_RETURN gchar * G_CONST_RETURN *) conf_dir_vector;
 }
+#endif
 
 #ifndef G_OS_WIN32
 
 static GHashTable *alias_table = NULL;
 
 /* read an alias file for the locales */
 static void
 read_aliases (gchar *file)
@@ -3239,16 +3260,17 @@ glib_gettext (const gchar *str)
 }
 
 #ifdef G_OS_WIN32
 
 /* Binary compatibility versions. Not for newly compiled code. */
 
 #undef g_find_program_in_path
 
+#if 0
 gchar*
 g_find_program_in_path (const gchar *program)
 {
   gchar *utf8_program = g_locale_to_utf8 (program, -1, NULL, NULL, NULL);
   gchar *utf8_retval = g_find_program_in_path_utf8 (utf8_program);
   gchar *retval;
 
   g_free (utf8_program);
@@ -3265,16 +3287,17 @@ g_find_program_in_path (const gchar *pro
 gchar*
 g_get_current_dir (void)
 {
   gchar *utf8_dir = g_get_current_dir_utf8 ();
   gchar *dir = g_locale_from_utf8 (utf8_dir, -1, NULL, NULL, NULL);
   g_free (utf8_dir);
   return dir;
 }
+#endif
 
 #undef g_getenv
 
 G_CONST_RETURN gchar*
 g_getenv (const gchar *variable)
 {
   gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL);
   const gchar *utf8_value = g_getenv_utf8 (utf8_variable);
@@ -3288,16 +3311,17 @@ g_getenv (const gchar *variable)
   quark = g_quark_from_string (value);
   g_free (value);
 
   return g_quark_to_string (quark);
 }
 
 #undef g_setenv
 
+#if 0
 gboolean
 g_setenv (const gchar *variable, 
 	  const gchar *value, 
 	  gboolean     overwrite)
 {
   gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL);
   gchar *utf8_value = g_locale_to_utf8 (value, -1, NULL, NULL, NULL);
   gboolean retval = g_setenv_utf8 (utf8_variable, utf8_value, overwrite);
@@ -3314,16 +3338,17 @@ void
 g_unsetenv (const gchar *variable)
 {
   gchar *utf8_variable = g_locale_to_utf8 (variable, -1, NULL, NULL, NULL);
 
   g_unsetenv_utf8 (utf8_variable);
 
   g_free (utf8_variable);
 }
+#endif
 
 #undef g_get_user_name
 
 G_CONST_RETURN gchar*
 g_get_user_name (void)
 {
   g_get_any_init_locked ();
   return g_user_name_cp;
@@ -3333,16 +3358,17 @@ g_get_user_name (void)
 
 G_CONST_RETURN gchar*
 g_get_real_name (void)
 {
   g_get_any_init_locked ();
   return g_real_name_cp;
 }
 
+#if 0
 #undef g_get_home_dir
 
 G_CONST_RETURN gchar*
 g_get_home_dir (void)
 {
   g_get_any_init_locked ();
   return g_home_dir_cp;
 }
@@ -3350,13 +3376,14 @@ g_get_home_dir (void)
 #undef g_get_tmp_dir
 
 G_CONST_RETURN gchar*
 g_get_tmp_dir (void)
 {
   g_get_any_init_locked ();
   return g_tmp_dir_cp;
 }
+#endif
 
 #endif
 
 #define __G_UTILS_C__
 #include "galiasdef.c"