path.*: cleanups

utf8.c: add some static's

git-svn-id: https://svn.musicpd.org/mpd/trunk@4311 09075e82-0dd4-0310-85a5-a0d7c8717e4f
This commit is contained in:
Avuton Olrich 2006-07-13 18:09:25 +00:00
parent db2f843995
commit fca9a92ba6
3 changed files with 8 additions and 19 deletions

View File

@ -42,23 +42,16 @@ char * playlistDir;
char * fsCharset = NULL;
char * pathConvCharset(char * to, char * from, char * str, char * ret) {
if(ret) {
free(ret);
ret = NULL;
}
static char * pathConvCharset(char * to, char * from, char * str) {
if(setCharSetConversion(to,from)==0) {
ret = convStrDup(str);
return convStrDup(str);
}
return ret;
return NULL;
}
char * fsCharsetToUtf8(char * str) {
static char * ret = NULL;
ret = pathConvCharset("UTF-8",fsCharset,str,ret);
char * ret = pathConvCharset("UTF-8",fsCharset,str);
if(ret && !validUtf8String(ret)) {
free(ret);
@ -69,9 +62,7 @@ char * fsCharsetToUtf8(char * str) {
}
char * utf8ToFsCharset(char * str) {
static char * ret = NULL;
ret = pathConvCharset(fsCharset,"UTF-8",str,ret);
char * ret = pathConvCharset(fsCharset,"UTF-8",str);
if(!ret) ret = strdup(str);

View File

@ -51,6 +51,4 @@ char * parentPath(char * path);
/* strips extra "///" and leading "/" and trailing "/" */
char * sanitizePathDup(char * path);
char * prependCwdToPathDup(char * path);
#endif

View File

@ -22,7 +22,7 @@
#include <string.h>
#include <stdlib.h>
unsigned char * latin1ToUtf8(unsigned char c) {
static unsigned char * latin1ToUtf8(unsigned char c) {
static unsigned char utf8[3];
memset(utf8,0,3);
@ -63,7 +63,7 @@ unsigned char * latin1StrToUtf8Dup(unsigned char * latin1) {
return realloc(ret,len+1);
}
unsigned char utf8ToLatin1(unsigned char * utf8) {
static unsigned char utf8ToLatin1(unsigned char * utf8) {
unsigned char c = 0;
if(utf8[0]<128) return utf8[0];
@ -72,7 +72,7 @@ unsigned char utf8ToLatin1(unsigned char * utf8) {
return c+utf8[1];
}
int validateUtf8Char(unsigned char * utf8Char) {
static int validateUtf8Char(unsigned char * utf8Char) {
if(utf8Char[0]<0x80) return 1;
if(utf8Char[0]>=0xC0 && utf8Char[0]<=0xFD) {