From b2481156c358965b9edbd7c011284e83ad5e0e78 Mon Sep 17 00:00:00 2001 From: diego Date: Wed, 29 Aug 2007 09:43:00 +0000 Subject: cosmetics: Fix up whitespace, indentation and similar things. git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@24287 b3059339-0415-0410-9bf9-f77b7e298cf2 --- get_path.c | 57 +++++++++++++++++++++++++++++---------------------------- 1 file changed, 29 insertions(+), 28 deletions(-) (limited to 'get_path.c') diff --git a/get_path.c b/get_path.c index 601f3a9d14..eb889cc01f 100644 --- a/get_path.c +++ b/get_path.c @@ -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 @@ -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); } -- cgit v1.2.3