[MPlayer-cvslog] r24287 - trunk/get_path.c

diego subversion at mplayerhq.hu
Wed Aug 29 11:43:00 CEST 2007


Author: diego
Date: Wed Aug 29 11:43:00 2007
New Revision: 24287

Log:
cosmetics: Fix up whitespace, indentation and similar things.


Modified:
   trunk/get_path.c

Modified: trunk/get_path.c
==============================================================================
--- trunk/get_path.c	(original)
+++ trunk/get_path.c	Wed Aug 29 11:43:00 2007
@@ -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 @@ char *get_path(const char *filename){
 	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 @@ char *get_path(const char *filename){
 	}
 
 #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 @@ void set_path_env()
 #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 @@ void set_path_env()
 	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);
 	}



More information about the MPlayer-cvslog mailing list