mirror of https://github.com/mpv-player/mpv
core: path: run uncrustify
Even if this is not so bad as other files, I need to add some stuff so... why not!? `uncrustify -l C -c TOOLS/uncrustify.cfg --no-backup --replace core/path.h` `uncrustify -l C -c TOOLS/uncrustify.cfg --no-backup --replace core/path.c` The header was unchanged by the tool.
This commit is contained in:
parent
9201cfe2bd
commit
c7bf5111c7
22
core/path.c
22
core/path.c
|
@ -48,7 +48,8 @@
|
|||
|
||||
#include "osdep/io.h"
|
||||
|
||||
char *get_path(const char *filename){
|
||||
char *get_path(const char *filename)
|
||||
{
|
||||
char *homedir;
|
||||
char *buff;
|
||||
#ifdef __MINGW32__
|
||||
|
@ -78,8 +79,10 @@ char *get_path(const char *filename){
|
|||
int i, imax = 0;
|
||||
len = (int)GetModuleFileNameA(NULL, exedir, 260);
|
||||
for (i = 0; i < len; i++)
|
||||
if (exedir[i] =='\\')
|
||||
{exedir[i]='/'; imax=i;}
|
||||
if (exedir[i] == '\\') {
|
||||
exedir[i] = '/';
|
||||
imax = i;
|
||||
}
|
||||
exedir[imax] = '\0';
|
||||
homedir = exedir;
|
||||
}
|
||||
|
@ -109,13 +112,15 @@ char *get_path(const char *filename){
|
|||
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);
|
||||
}
|
||||
|
@ -126,9 +131,8 @@ char *get_path(const char *filename){
|
|||
}
|
||||
|
||||
if (res_url_path && filename) {
|
||||
if ((strlen(filename)+strlen(res_url_path)+2)>maxlen) {
|
||||
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);
|
||||
|
@ -160,7 +164,9 @@ char *mp_basename(const char *path)
|
|||
|
||||
struct bstr mp_dirname(const char *path)
|
||||
{
|
||||
struct bstr ret = {(uint8_t *)path, mp_basename(path) - path};
|
||||
struct bstr ret = {
|
||||
(uint8_t *)path, mp_basename(path) - path
|
||||
};
|
||||
if (ret.len == 0)
|
||||
return bstr0(".");
|
||||
return ret;
|
||||
|
|
Loading…
Reference in New Issue