platform/pocketpc.c
changeset 578 bff1af8455ca
parent 566 1e640d4acab9
child 596 381b6ca0dd85
--- 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 */