From Albert Chin: get rid of C99/GCCisms (initializing automatic
[obnox/wireshark/wip.git] / util.c
diff --git a/util.c b/util.c
index 25766b2ae005d9d4047e2a173d5c32c516221412..807e5aa029449ce79d2632786fb1732147646148 100644 (file)
--- a/util.c
+++ b/util.c
@@ -161,7 +161,7 @@ try_tempfile(char *namebuf, int namebuflen, const char *dir, const char *pfx)
 }
 
 static char *tmpdir = NULL;
-#ifdef WIN32
+#ifdef _WIN32
 static char *temp = NULL;
 #endif
 static char *E_tmpdir;
@@ -180,7 +180,7 @@ create_tempfile(char *namebuf, int namebuflen, const char *pfx)
        if (!initialized) {
                if ((dir = getenv("TMPDIR")) != NULL)
                        tmpdir = setup_tmpdir(dir);
-#ifdef WIN32
+#ifdef _WIN32
                if ((dir = getenv("TEMP")) != NULL)
                        temp = setup_tmpdir(dir);
 #endif
@@ -195,7 +195,7 @@ create_tempfile(char *namebuf, int namebuflen, const char *pfx)
                        return fd;
        }
 
-#ifdef WIN32
+#ifdef _WIN32
        if (temp != NULL) {
                fd = try_tempfile(namebuf, namebuflen, temp, pfx);
                if (fd != -1)
@@ -254,39 +254,6 @@ compute_timestamp_diff(gint *diffsec, gint *diffusec,
   }
 }
 
-/* Decode a base64 string in-place - simple and slow algorithm.
-   Return length of result. Taken from rproxy/librsync/base64.c by
-   Andrew Tridgell. */
-
-size_t epan_base64_decode(char *s)
-{
-       static const char b64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
-       int bit_offset, byte_offset, idx, i, n;
-       unsigned char *d = (unsigned char *)s;
-       char *p;
-
-       n=i=0;
-
-       while (*s && (p=strchr(b64, *s))) {
-               idx = (int)(p - b64);
-               byte_offset = (i*6)/8;
-               bit_offset = (i*6)%8;
-               d[byte_offset] &= ~((1<<(8-bit_offset))-1);
-               if (bit_offset < 3) {
-                       d[byte_offset] |= (idx << (2-bit_offset));
-                       n = byte_offset+1;
-               } else {
-                       d[byte_offset] |= (idx >> (bit_offset-2));
-                       d[byte_offset+1] = 0;
-                       d[byte_offset+1] |= (idx << (8-(bit_offset-2))) & 0xFF;
-                       n = byte_offset+2;
-               }
-               s++; i++;
-       }
-
-       return n;
-}
-
 /* Try to figure out if we're remotely connected, e.g. via ssh or
    Terminal Server, and create a capture filter that matches aspects of the
    connection.  We match the following environment variables: