changeset 10203:7ff9b8b22e7d

[gaim-migrate @ 11324] gaim_mkstemp can now create binary files committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Thu, 18 Nov 2004 17:05:40 +0000
parents ddf002ce58b6
children 393f85d9f8dd
files src/gtkprefs.c src/protocols/msn/notification.c src/util.c src/util.h
diffstat 4 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/src/gtkprefs.c	Wed Nov 17 23:54:24 2004 +0000
+++ b/src/gtkprefs.c	Thu Nov 18 17:05:40 2004 +0000
@@ -530,7 +530,7 @@
 	FILE *f;
 	gchar *path;
 
-	f = gaim_mkstemp(&path);
+	f = gaim_mkstemp(&path, TRUE);
 	fwrite(themedata, len, 1, f);
 	fclose(f);
 
--- a/src/protocols/msn/notification.c	Wed Nov 17 23:54:24 2004 +0000
+++ b/src/protocols/msn/notification.c	Thu Nov 18 17:05:40 2004 +0000
@@ -778,7 +778,7 @@
 		g_free(session->passport_info.file);
 	}
 
-	if ((fd = gaim_mkstemp(&session->passport_info.file)) == NULL)
+	if ((fd = gaim_mkstemp(&session->passport_info.file, FALSE)) == NULL)
 	{
 		gaim_debug(GAIM_DEBUG_ERROR, "msn",
 				   "Error opening temp passport file: %s\n",
--- a/src/util.c	Wed Nov 17 23:54:24 2004 +0000
+++ b/src/util.c	Thu Nov 18 17:05:40 2004 +0000
@@ -1942,7 +1942,7 @@
 static const char *gaim_mkstemp_templ = {"gaimXXXXXX"};
 
 FILE *
-gaim_mkstemp(char **fpath)
+gaim_mkstemp(char **fpath, gboolean binary)
 {
 	const gchar *tmpdir;
 #ifndef _WIN32
@@ -1961,7 +1961,7 @@
 						   "Problem creating the template\n");
 			else
 			{
-				if( (fp = fopen( result, "w+" )) == NULL ) {
+				if( (fp = fopen( result, binary?"wb+":"w+")) == NULL ) {
 					gaim_debug(GAIM_DEBUG_ERROR, "gaim_mkstemp",
 							   "Couldn't fopen() %s\n", result);
 				}
--- a/src/util.h	Wed Nov 17 23:54:24 2004 +0000
+++ b/src/util.h	Thu Nov 18 17:05:40 2004 +0000
@@ -387,11 +387,12 @@
  * done, as well as freeing the space pointed to by @a path with
  * g_free().
  *
- * @param path The returned path to the temp file.
+ * @param path   The returned path to the temp file.
+ * @param binary Text or binary, for platforms where it matters.
  *
  * @return A file pointer to the temporary file, or @c NULL on failure.
  */
-FILE *gaim_mkstemp(char **path);
+FILE *gaim_mkstemp(char **path, gboolean binary);
 
 /**
  * Checks if the given program name is valid and executable.