changeset 24267:70437b99ccee

cosmetics: Fix up whitespace, indentation and similar things.
author diego
date Wed, 29 Aug 2007 09:43:00 +0000
parents 0fad7c7596be
children 6b0e5503ca7a
files get_path.c
diffstat 1 files changed, 29 insertions(+), 28 deletions(-) [+]
line wrap: on
line diff
--- a/get_path.c	Wed Aug 29 09:31:44 2007 +0000
+++ b/get_path.c	Wed Aug 29 09:43:00 2007 +0000
@@ -1,4 +1,3 @@
-
 /*
  * Get path to config dir/file.
  *
@@ -6,7 +5,6 @@
  *   Returns the pointer to the ALLOCATED buffer containing the
  *   zero terminated path string. This buffer has to be FREED
  *   by the caller.
- *
  */
 
 #include <stdio.h>
@@ -28,8 +26,8 @@
 char *get_path(const char *filename){
 	char *homedir;
 	char *buff;
-#if defined(__MINGW32__)
-    static char *config_dir = "/mplayer";
+#ifdef __MINGW32__
+	static char *config_dir = "/mplayer";
 #else
 	static char *config_dir = "/.mplayer";
 #endif
@@ -46,18 +44,21 @@
 	if ((homedir = getenv("MPLAYER_HOME")) != NULL)
 		config_dir = "";
 	else if ((homedir = getenv("HOME")) == NULL)
-#if defined(__MINGW32__)||defined(__CYGWIN__) /*hack to get fonts etc. loaded outside of cygwin environment*/
+#if defined(__MINGW32__) || defined(__CYGWIN__)
+	/* Hack to get fonts etc. loaded outside of Cygwin environment. */
 	{
-        int i,imax=0;       
-        char exedir[260];       
-        GetModuleFileNameA(NULL, exedir, 260);
-        for(i=0; i< strlen(exedir);i++)if(exedir[i] =='\\'){exedir[i]='/';imax=i;}
-        exedir[imax]='\0';
-	    homedir = exedir;
+		int i,imax=0;
+		char exedir[260];
+		GetModuleFileNameA(NULL, exedir, 260);
+		for (i=0; i< strlen(exedir); i++)
+			if (exedir[i] =='\\')
+				{exedir[i]='/'; imax=i;}
+		exedir[imax]='\0';
+		homedir = exedir;
 	}
 #else
-		return NULL;
-#endif       
+	return NULL;
+#endif
 	len = strlen(homedir) + strlen(config_dir) + 1;
 	if (filename == NULL) {
 		if ((buff = malloc(len)) == NULL)
@@ -71,40 +72,40 @@
 	}
 
 #ifdef MACOSX_BUNDLE
-	if(stat(buff, &dummy)) {
-	
+	if (stat(buff, &dummy)) {
+
 		res_url_ref=CFBundleCopyResourcesDirectoryURL(CFBundleGetMainBundle());
 		bdl_url_ref=CFBundleCopyBundleURL(CFBundleGetMainBundle());
-		
-		if(res_url_ref&&bdl_url_ref) {
+
+		if (res_url_ref&&bdl_url_ref) {
 
 			res_url_path=malloc(maxlen);
 			bdl_url_path=malloc(maxlen);
 
-			while(!CFURLGetFileSystemRepresentation(res_url_ref, true, res_url_path, maxlen)) {
+			while (!CFURLGetFileSystemRepresentation(res_url_ref, true, res_url_path, maxlen)) {
 				maxlen*=2;
 				res_url_path=realloc(res_url_path, maxlen);
 			}
 			CFRelease(res_url_ref);
-			
-			while(!CFURLGetFileSystemRepresentation(bdl_url_ref, true, bdl_url_path, maxlen)) {
+
+			while (!CFURLGetFileSystemRepresentation(bdl_url_ref, true, bdl_url_path, maxlen)) {
 				maxlen*=2;
 				bdl_url_path=realloc(bdl_url_path, maxlen);
 			}
 			CFRelease(bdl_url_ref);
-				
-			if( strcmp(res_url_path, bdl_url_path) == 0)
+
+			if (strcmp(res_url_path, bdl_url_path) == 0)
 				res_url_path = NULL;
 		}
-			
-		if(res_url_path&&filename) {
-			if((strlen(filename)+strlen(res_url_path)+2)>maxlen) {
+
+		if (res_url_path&&filename) {
+			if ((strlen(filename)+strlen(res_url_path)+2)>maxlen) {
 				maxlen=strlen(filename)+strlen(res_url_path)+2;
 			}
 			free(buff);
 			buff = malloc(maxlen);
 			strcpy(buff, res_url_path);
-				
+
 			strcat(buff,"/");
 			strcat(buff, filename);
 		}
@@ -130,7 +131,7 @@
 #endif /*USE_REALCODECS*/
 #else /*__CYGWIN__*/
 	/* Expand to absolute path unless it's already absolute */
-	if(!strstr(WIN32_PATH,":") && WIN32_PATH[0] != '\\'){
+	if (!strstr(WIN32_PATH,":") && WIN32_PATH[0] != '\\'){
 		GetModuleFileNameA(NULL, win32path, MAX_PATH);
 		strcpy(strrchr(win32path, '\\') + 1, WIN32_PATH);
 	}
@@ -138,7 +139,7 @@
 	strcpy(tmppath,win32path);
 #ifdef USE_REALCODECS
 	/* Expand to absolute path unless it's already absolute */
-	if(!strstr(REALCODEC_PATH,":") && REALCODEC_PATH[0] != '\\'){
+	if (!strstr(REALCODEC_PATH,":") && REALCODEC_PATH[0] != '\\'){
 		GetModuleFileNameA(NULL, realpath, MAX_PATH);
 		strcpy(strrchr(realpath, '\\') + 1, REALCODEC_PATH);
 	}