From Harald Welte:
[obnox/wireshark/wip.git] / tempfile.c
index 720804e2ec5ba1b35b6582d9ef30626cccfa4666..5f19b78d50bd82bca6000be3449f422069fc8de5 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <glib.h>
 
+#include <time.h>
 #include <stdlib.h>
 #include <string.h>
 #include <stdio.h>
@@ -65,8 +66,7 @@
    they are replaced with a string that makes the filename unique.
    Returns a file descriptor open on the file for reading and writing.  */
 static int
-mkstemp (template)
-     char *template;
+mkstemp (char *template)
 {
   static const char letters[]
     = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
@@ -110,8 +110,7 @@ mkstemp (template)
    they are replaced with a string that makes the filename unique.
    Returns 0 on success or -1 on error (from mkdir(2)).  */
 char *
-mkdtemp (template)
-     char *template;
+mkdtemp (char *template)
 {
   static const char letters[]
     = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
@@ -199,7 +198,7 @@ create_tempfile(char **namebuf, const char *pfx)
        sep[0] = G_DIR_SEPARATOR;
        tmp_file = g_strconcat(tmp_dir, sep, pfx, "_", timestr, "_", TMP_FILE_SUFFIX, NULL);
        if (strlen(tmp_file) > tf[idx].len) {
-               tf[idx].len = strlen(tmp_file) + 1;
+               tf[idx].len = (int)strlen(tmp_file) + 1;
                tf[idx].path = (char *)g_realloc(tf[idx].path, tf[idx].len);
        }
        g_strlcpy(tf[idx].path, tmp_file, tf[idx].len);