Tabs-to-spaces patch by James Turk.
authorRyan C. Gordon <icculus@icculus.org>
Sun, 20 Jul 2003 21:08:24 +0000
changeset 578 bff1af8455ca
parent 577 90a06832dcf3
child 579 4170811a0439
Tabs-to-spaces patch by James Turk.
archivers/zip.c
extras/abs-file.h
physfs.c
physfs_byteorder.c
physfs_internal.h
platform/pocketpc.c
--- a/archivers/zip.c	Sun Jul 20 21:07:53 2003 +0000
+++ b/archivers/zip.c	Sun Jul 20 21:08:24 2003 +0000
@@ -899,9 +899,9 @@
 static PHYSFS_sint64 zip_dos_time_to_physfs_time(PHYSFS_uint32 dostime)
 {
 #ifdef _WIN32_WCE
-	/* We have no struct tm and no mktime right now.
-	   FIXME: This should probably be fixed at some point.
-	*/
+    /* We have no struct tm and no mktime right now.
+       FIXME: This should probably be fixed at some point.
+    */
     return -1;
 #else
     PHYSFS_uint32 dosdate;
--- a/extras/abs-file.h	Sun Jul 20 21:07:53 2003 +0000
+++ b/extras/abs-file.h	Sun Jul 20 21:08:24 2003 +0000
@@ -118,8 +118,8 @@
   }
   return c;
 }
-static char * MY_GETS(char * const str, const int size,
-		      MY_FILETYPE *const fp) {
+static char * MY_GETS(char * const str, const int size, 
+                      MY_FILETYPE *const fp) {
   int i = 0;
   int c;
   do {
@@ -131,9 +131,9 @@
       break;
     }
     str[i++] = c;
-  } while (c != '\0' &&
-	   c != -1 &&
-	   c != '\n');
+  } while (c != '\0' && 
+      c != -1 && 
+      c != '\n');
   str[i] = '\0';
   if (i == 0) {
     return NULL;
--- a/physfs.c	Sun Jul 20 21:07:53 2003 +0000
+++ b/physfs.c	Sun Jul 20 21:08:24 2003 +0000
@@ -165,32 +165,32 @@
     PHYSFS_uint32 j;
     PHYSFS_uint32 v;
 
-	if ((hi - lo) <= PHYSFS_QUICKSORT_THRESHOLD)
+    if ((hi - lo) <= PHYSFS_QUICKSORT_THRESHOLD)
         __PHYSFS_bubble_sort(a, lo, hi, cmpfn, swapfn);
     else
-	{
-		i = (hi + lo) / 2;
+    {
+        i = (hi + lo) / 2;
 
         if (cmpfn(a, lo, i) > 0) swapfn(a, lo, i);
-		if (cmpfn(a, lo, hi) > 0) swapfn(a, lo, hi);
-		if (cmpfn(a, i, hi) > 0) swapfn(a, i, hi);
+        if (cmpfn(a, lo, hi) > 0) swapfn(a, lo, hi);
+        if (cmpfn(a, i, hi) > 0) swapfn(a, i, hi);
 
-		j = hi - 1;
-		swapfn(a, i, j);
-		i = lo;
-		v = j;
-		while (1)
-		{
-			while(cmpfn(a, ++i, v) < 0) { /* do nothing */ }
-			while(cmpfn(a, --j, v) > 0) { /* do nothing */ }
-			if (j < i)
+        j = hi - 1;
+        swapfn(a, i, j);
+        i = lo;
+        v = j;
+        while (1)
+        {
+            while(cmpfn(a, ++i, v) < 0) { /* do nothing */ }
+            while(cmpfn(a, --j, v) > 0) { /* do nothing */ }
+            if (j < i)
                 break;
-			swapfn(a, i, j);
-		} /* while */
-		swapfn(a, i, hi-1);
-		__PHYSFS_quick_sort(a, lo, j, cmpfn, swapfn);
-		__PHYSFS_quick_sort(a, i+1, hi, cmpfn, swapfn);
-	} /* else */
+            swapfn(a, i, j);
+        } /* while */
+        swapfn(a, i, hi-1);
+        __PHYSFS_quick_sort(a, lo, j, cmpfn, swapfn);
+        __PHYSFS_quick_sort(a, i+1, hi, cmpfn, swapfn);
+    } /* else */
 } /* __PHYSFS_quick_sort */
 
 
@@ -675,7 +675,7 @@
      */
     retval = __PHYSFS_platformCurrentDir();
     if(retval != NULL) {
-	return(retval);
+    return(retval);
     }
 
     /*
@@ -1851,7 +1851,7 @@
 int PHYSFS_setBuffer(PHYSFS_file *handle, PHYSFS_uint64 _bufsize)
 {
     FileHandle *h = (FileHandle *) handle->opaque;
-	PHYSFS_uint32 bufsize = (PHYSFS_uint32) _bufsize;
+    PHYSFS_uint32 bufsize = (PHYSFS_uint32) _bufsize;
 
     BAIL_IF_MACRO(_bufsize > 0xFFFFFFFF, "buffer must fit in 32-bits", 0);
     BAIL_IF_MACRO(!PHYSFS_flush(handle), NULL, 0);
--- a/physfs_byteorder.c	Sun Jul 20 21:07:53 2003 +0000
+++ b/physfs_byteorder.c	Sun Jul 20 21:08:24 2003 +0000
@@ -54,28 +54,28 @@
 #ifndef PHYSFS_Swap16
 static __inline__ PHYSFS_uint16 PHYSFS_Swap16(PHYSFS_uint16 D)
 {
-	return((D<<8)|(D>>8));
+    return((D<<8)|(D>>8));
 }
 #endif
 #ifndef PHYSFS_Swap32
 static __inline__ PHYSFS_uint32 PHYSFS_Swap32(PHYSFS_uint32 D)
 {
-	return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24));
+    return((D<<24)|((D<<8)&0x00FF0000)|((D>>8)&0x0000FF00)|(D>>24));
 }
 #endif
 #ifndef PHYSFS_NO_64BIT_SUPPORT
 #ifndef PHYSFS_Swap64
 static __inline__ PHYSFS_uint64 PHYSFS_Swap64(PHYSFS_uint64 val) {
-	PHYSFS_uint32 hi, lo;
+    PHYSFS_uint32 hi, lo;
 
-	/* Separate into high and low 32-bit values and swap them */
-	lo = (PHYSFS_uint32)(val&0xFFFFFFFF);
-	val >>= 32;
-	hi = (PHYSFS_uint32)(val&0xFFFFFFFF);
-	val = PHYSFS_Swap32(lo);
-	val <<= 32;
-	val |= PHYSFS_Swap32(hi);
-	return(val);
+    /* Separate into high and low 32-bit values and swap them */
+    lo = (PHYSFS_uint32)(val&0xFFFFFFFF);
+    val >>= 32;
+    hi = (PHYSFS_uint32)(val&0xFFFFFFFF);
+    val = PHYSFS_Swap32(lo);
+    val <<= 32;
+    val |= PHYSFS_Swap32(hi);
+    return(val);
 }
 #endif
 #else
@@ -84,7 +84,7 @@
    If there is no real 64-bit datatype, then compilers will complain about
    the fake 64-bit datatype that PHYSFS provides when it compiles user code.
 */
-#define PHYSFS_Swap64(X)	(X)
+#define PHYSFS_Swap64(X)    (X)
 #endif
 #endif /* PHYSFS_NO_64BIT_SUPPORT */
 
--- a/physfs_internal.h	Sun Jul 20 21:07:53 2003 +0000
+++ b/physfs_internal.h	Sun Jul 20 21:08:24 2003 +0000
@@ -622,15 +622,15 @@
     int (*isSymLink)(DirHandle *r, const char *name, int *fileExists);
 
         /*
-	     * Retrieve the last modification time (mtime) of a file.
-    	 *  Returns -1 on failure, or the file's mtime in seconds since
-    	 *  the epoch (Jan 1, 1970) on success.
+         * Retrieve the last modification time (mtime) of a file.
+         *  Returns -1 on failure, or the file's mtime in seconds since
+         *  the epoch (Jan 1, 1970) on success.
          *  This filename is in platform-independent notation.
          *
          * Regardless of success or failure, please set *exists to
          *  non-zero if the file existed (even if it's a broken symlink!),
          *  zero if it did not.
-    	 */
+         */
     PHYSFS_sint64 (*getLastModTime)(DirHandle *r, const char *fnm, int *exist);
 
         /*
--- a/platform/pocketpc.c	Sun Jul 20 21:07:53 2003 +0000
+++ b/platform/pocketpc.c	Sun Jul 20 21:08:24 2003 +0000
@@ -16,8 +16,8 @@
 #define __PHYSICSFS_INTERNAL__
 #include "physfs_internal.h"
 
-#define INVALID_FILE_ATTRIBUTES		0xFFFFFFFF
-#define INVALID_SET_FILE_POINTER	0xFFFFFFFF
+#define INVALID_FILE_ATTRIBUTES  0xFFFFFFFF
+#define INVALID_SET_FILE_POINTER 0xFFFFFFFF
 typedef struct
 {
     HANDLE handle;
@@ -41,15 +41,15 @@
     TCHAR *ptr = msgbuf;
 
     FormatMessage(
-		  FORMAT_MESSAGE_FROM_SYSTEM |
-		  FORMAT_MESSAGE_IGNORE_INSERTS,
-		  NULL,
-		  GetLastError(),
-		  MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
-		  msgbuf,
-		  sizeof (msgbuf) / sizeof (TCHAR),
-		  NULL 
-		  );
+        FORMAT_MESSAGE_FROM_SYSTEM |
+        FORMAT_MESSAGE_IGNORE_INSERTS,
+        NULL,
+        GetLastError(),
+        MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), /* Default language */
+        msgbuf,
+        sizeof (msgbuf) / sizeof (TCHAR),
+        NULL 
+        );
 
     /* chop off newlines. */
     for (ptr = msgbuf; *ptr; ptr++)
@@ -71,23 +71,23 @@
 
     if(w_str!=NULL)
     {
-	int len=wcslen(w_str)+1;
-	str=(char *)malloc(len);
+    int len=wcslen(w_str)+1;
+    str=(char *)malloc(len);
 
-	if(WideCharToMultiByte(CP_ACP,0,w_str,-1,str,len,NULL,NULL)==0)
-	{	//Conversion failed
-	    free(str);
-	    return NULL;
-	}
-	else
-	{	//Conversion successful
-	    return(str);
-	}
+    if(WideCharToMultiByte(CP_ACP,0,w_str,-1,str,len,NULL,NULL)==0)
+    {    //Conversion failed
+        free(str);
+        return NULL;
+    }
+    else
+    {    //Conversion successful
+        return(str);
+    }
 
     }
     else
-    {	//Given NULL string
-	return NULL;
+    {    //Given NULL string
+    return NULL;
     }
 }
 
@@ -96,21 +96,21 @@
     wchar_t *w_str=NULL;
     if(str!=NULL)
     {
-	int len=strlen(str)+1;
-	w_str=(wchar_t *)malloc(sizeof(wchar_t)*len);
-	if(MultiByteToWideChar(CP_ACP,0,str,-1,w_str,len)==0)
-	{
-	    free(w_str);
-	    return NULL;
-	}
-	else
-	{
-	    return(w_str);
-	}
+    int len=strlen(str)+1;
+    w_str=(wchar_t *)malloc(sizeof(wchar_t)*len);
+    if(MultiByteToWideChar(CP_ACP,0,str,-1,w_str,len)==0)
+    {
+        free(w_str);
+        return NULL;
     }
     else
     {
-	return NULL;
+        return(w_str);
+    }
+    }
+    else
+    {
+    return NULL;
     }
 }
 
@@ -130,16 +130,16 @@
         __PHYSFS_setError(win32strerror());
     } else {
         retval[buflen] = '\0';  /* does API always null-terminate this? */
-	ptr = retval+buflen;
-	while( ptr != retval )
-	{
-	    if( *ptr != _T('\\') ) {
-		*ptr-- = _T('\0');
-	    } else {
-		break;
-	    }
-	}
-	success = 1;
+    ptr = retval+buflen;
+    while( ptr != retval )
+    {
+        if( *ptr != _T('\\') ) {
+        *ptr-- = _T('\0');
+        } else {
+        break;
+        }
+    }
+    success = 1;
     } /* else */
 
     if (!success)
@@ -156,7 +156,7 @@
     charretval = UnicodeToAsc(retval);
     free(retval);
     if(charretval == NULL) {
-	BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
+    BAIL_IF_MACRO(retval == NULL, ERR_OUT_OF_MEMORY, NULL);
     }
     
     return(charretval);   /* w00t. */
@@ -220,11 +220,11 @@
     int retval=0;
 
     wchar_t *w_fname=AscToUnicode(fname);
-	
+    
     if(w_fname!=NULL)
     {
-	retval=(GetFileAttributes(w_fname) != INVALID_FILE_ATTRIBUTES);
-	free(w_fname);
+    retval=(GetFileAttributes(w_fname) != INVALID_FILE_ATTRIBUTES);
+    free(w_fname);
     }
 
     return(retval);
@@ -245,8 +245,8 @@
 
     if(w_fname!=NULL)
     {
-	retval=((GetFileAttributes(w_fname) & FILE_ATTRIBUTE_DIRECTORY) != 0);
-	free(w_fname);
+    retval=((GetFileAttributes(w_fname) & FILE_ATTRIBUTE_DIRECTORY) != 0);
+    free(w_fname);
     }
 
     return(retval);
@@ -258,8 +258,8 @@
                                       const char *append)
 {
     int len = ((prepend) ? strlen(prepend) : 0) +
-	((append) ? strlen(append) : 0) +
-	strlen(dirName) + 1;
+    ((append) ? strlen(append) : 0) +
+    strlen(dirName) + 1;
     char *retval = malloc(len);
     char *p;
 
@@ -302,7 +302,7 @@
 
     /* Allocate a new string for path, maybe '\\', "*", and NULL terminator */
     SearchPath = (char *) alloca(len + 3);
-    BAIL_IF_MACRO(SearchPath == NULL, ERR_OUT_OF_MEMORY, NULL);	
+    BAIL_IF_MACRO(SearchPath == NULL, ERR_OUT_OF_MEMORY, NULL);    
 
     /* Copy current dirname */
     strcpy(SearchPath, dirname);
@@ -325,7 +325,7 @@
 
     if(dir == INVALID_HANDLE_VALUE)
     {
-	return NULL;
+    return NULL;
     }
 
     do
@@ -340,7 +340,7 @@
         if (l == NULL)
             break;
 
-	l->str=UnicodeToAsc(ent.cFileName);
+    l->str=UnicodeToAsc(ent.cFileName);
 
         if (l->str == NULL)
         {
@@ -385,17 +385,17 @@
     wchar_t *w_path = AscToUnicode(path);
     if(w_path!=NULL)
     {
-	DWORD rc = CreateDirectory(w_path, NULL);
-	free(w_path);
-	if(rc==0)
-	{
-	    return(0);
-	}
-	return(1);
+    DWORD rc = CreateDirectory(w_path, NULL);
+    free(w_path);
+    if(rc==0)
+    {
+        return(0);
+    }
+    return(1);
     }
     else
     {
-	return(0);
+    return(0);
     }
 } /* __PHYSFS_platformMkDir */
 
@@ -413,7 +413,7 @@
 
     if(fileHandle==INVALID_HANDLE_VALUE)
     {
-	return NULL;
+    return NULL;
     }
 
     BAIL_IF_MACRO(fileHandle == INVALID_HANDLE_VALUE, win32strerror(), NULL);
@@ -421,8 +421,8 @@
     retval = malloc(sizeof (winCEfile));
     if (retval == NULL)
     {
-	CloseHandle(fileHandle);
-	BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
+    CloseHandle(fileHandle);
+    BAIL_MACRO(ERR_OUT_OF_MEMORY, NULL);
     } /* if */
 
     retval->readonly = rdonly;
@@ -474,7 +474,7 @@
     /*!!! - uint32 might be a greater # than DWORD */
     if(!ReadFile(FileHandle, buffer, count * size, &CountOfBytesRead, NULL))
     {
-	retval=-1;
+    retval=-1;
     } /* if */
     else
     {
@@ -499,7 +499,7 @@
     /*!!! - uint32 might be a greater # than DWORD */
     if(!WriteFile(FileHandle, buffer, count * size, &CountOfBytesWritten, NULL))
     {
-	retval=-1;
+    retval=-1;
     } /* if */
     else
     {
@@ -626,14 +626,14 @@
     /* If filename is a folder */
     if (GetFileAttributes(w_path) == FILE_ATTRIBUTE_DIRECTORY)
     {
-	int retval=!RemoveDirectory(w_path);
-	free(w_path);
+    int retval=!RemoveDirectory(w_path);
+    free(w_path);
         BAIL_IF_MACRO(retval, win32strerror(), 0);
     } /* if */
     else
     {
-	int retval=!DeleteFile(w_path);
-	free(w_path);
+    int retval=!DeleteFile(w_path);
+    free(w_path);
         BAIL_IF_MACRO(retval, win32strerror(), 0);
     } /* else */