Commit 3002fd18 authored by Max Kellermann's avatar Max Kellermann

path: no CamelCase

Rename variables and functions.
parent 259c6ed1
...@@ -230,7 +230,7 @@ db_save(void) ...@@ -230,7 +230,7 @@ db_save(void)
/* block signals when writing the db so we don't get a corrupted db */ /* block signals when writing the db so we don't get a corrupted db */
fprintf(fp, "%s\n", DIRECTORY_INFO_BEGIN); fprintf(fp, "%s\n", DIRECTORY_INFO_BEGIN);
fprintf(fp, "%s%s\n", DIRECTORY_MPD_VERSION, VERSION); fprintf(fp, "%s%s\n", DIRECTORY_MPD_VERSION, VERSION);
fprintf(fp, "%s%s\n", DIRECTORY_FS_CHARSET, getFsCharset()); fprintf(fp, "%s%s\n", DIRECTORY_FS_CHARSET, path_get_fs_charset());
fprintf(fp, "%s\n", DIRECTORY_INFO_END); fprintf(fp, "%s\n", DIRECTORY_INFO_END);
if (directory_save(fp, music_root) < 0) { if (directory_save(fp, music_root) < 0) {
...@@ -302,7 +302,7 @@ db_load(void) ...@@ -302,7 +302,7 @@ db_load(void)
fsCharset, tempCharset); fsCharset, tempCharset);
WARNING("maybe you need to " WARNING("maybe you need to "
"recreate the db?\n"); "recreate the db?\n");
setFsCharset(fsCharset); path_set_fs_charset(fsCharset);
} }
} else } else
FATAL("directory: unknown line in db info: %s\n", FATAL("directory: unknown line in db info: %s\n",
......
...@@ -403,7 +403,7 @@ int main(int argc, char *argv[]) ...@@ -403,7 +403,7 @@ int main(int argc, char *argv[])
open_log_files(options.stdOutput); open_log_files(options.stdOutput);
initPaths(); path_global_init();
mapper_init(); mapper_init();
initPermissions(); initPermissions();
initPlaylist(); initPlaylist();
...@@ -474,7 +474,7 @@ int main(int argc, char *argv[]) ...@@ -474,7 +474,7 @@ int main(int argc, char *argv[])
finishAudioConfig(); finishAudioConfig();
finishVolume(); finishVolume();
mapper_finish(); mapper_finish();
finishPaths(); path_global_finish();
finishPermissions(); finishPermissions();
dc_deinit(); dc_deinit();
pc_deinit(); pc_deinit();
......
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
#include <glib.h> #include <glib.h>
static char *fsCharset; static char *fs_charset;
char *fs_charset_to_utf8(char *dst, const char *str) char *fs_charset_to_utf8(char *dst, const char *str)
{ {
...@@ -40,7 +40,7 @@ char *fs_charset_to_utf8(char *dst, const char *str) ...@@ -40,7 +40,7 @@ char *fs_charset_to_utf8(char *dst, const char *str)
GError *error = NULL; GError *error = NULL;
p = g_convert(str, -1, p = g_convert(str, -1,
fsCharset, "utf-8", fs_charset, "utf-8",
NULL, NULL, &error); NULL, NULL, &error);
if (p == NULL) { if (p == NULL) {
/* no fallback */ /* no fallback */
...@@ -59,7 +59,7 @@ char *utf8_to_fs_charset(char *dst, const char *str) ...@@ -59,7 +59,7 @@ char *utf8_to_fs_charset(char *dst, const char *str)
GError *error = NULL; GError *error = NULL;
p = g_convert(str, -1, p = g_convert(str, -1,
"utf-8", fsCharset, "utf-8", fs_charset,
NULL, NULL, &error); NULL, NULL, &error);
if (p == NULL) { if (p == NULL) {
/* fall back to UTF-8 */ /* fall back to UTF-8 */
...@@ -72,38 +72,36 @@ char *utf8_to_fs_charset(char *dst, const char *str) ...@@ -72,38 +72,36 @@ char *utf8_to_fs_charset(char *dst, const char *str)
return dst; return dst;
} }
void setFsCharset(const char *charset) void path_set_fs_charset(const char *charset)
{ {
int error = 0; int error = 0;
if (fsCharset) g_free(fs_charset);
free(fsCharset); fs_charset = g_strdup(charset);
fsCharset = xstrdup(charset); DEBUG("path_set_fs_charset: fs charset is: %s\n", fs_charset);
DEBUG("setFsCharset: fs charset is: %s\n", fsCharset);
if (error) { if (error) {
free(fsCharset); free(fs_charset);
WARNING("setting fs charset to ISO-8859-1!\n"); WARNING("setting fs charset to ISO-8859-1!\n");
fsCharset = xstrdup("ISO-8859-1"); fs_charset = xstrdup("ISO-8859-1");
} }
} }
const char *getFsCharset(void) const char *path_get_fs_charset(void)
{ {
return fsCharset; return fs_charset;
} }
void initPaths(void) void path_global_init(void)
{ {
ConfigParam *fsCharsetParam = getConfigParam(CONF_FS_CHARSET); ConfigParam *fs_charset_param = getConfigParam(CONF_FS_CHARSET);
char *charset = NULL; char *charset = NULL;
char *originalLocale; char *originalLocale;
if (fsCharsetParam) { if (fs_charset_param) {
charset = xstrdup(fsCharsetParam->value); charset = xstrdup(fs_charset_param->value);
} }
#ifdef HAVE_LOCALE #ifdef HAVE_LOCALE
#ifdef HAVE_LANGINFO_CODESET #ifdef HAVE_LANGINFO_CODESET
...@@ -138,18 +136,17 @@ void initPaths(void) ...@@ -138,18 +136,17 @@ void initPaths(void)
#endif #endif
if (charset) { if (charset) {
setFsCharset(charset); path_set_fs_charset(charset);
free(charset); free(charset);
} else { } else {
WARNING("setting filesystem charset to ISO-8859-1\n"); WARNING("setting filesystem charset to ISO-8859-1\n");
setFsCharset("ISO-8859-1"); path_set_fs_charset("ISO-8859-1");
} }
} }
void finishPaths(void) void path_global_finish(void)
{ {
free(fsCharset); g_free(fs_charset);
fsCharset = NULL;
} }
char *pfx_dir(char *dst, char *pfx_dir(char *dst,
......
...@@ -31,17 +31,17 @@ ...@@ -31,17 +31,17 @@
# endif # endif
#endif #endif
void initPaths(void); void path_global_init(void);
void finishPaths(void); void path_global_finish(void);
char *fs_charset_to_utf8(char *dst, const char *str); char *fs_charset_to_utf8(char *dst, const char *str);
char *utf8_to_fs_charset(char *dst, const char *str); char *utf8_to_fs_charset(char *dst, const char *str);
void setFsCharset(const char *charset); void path_set_fs_charset(const char *charset);
const char *getFsCharset(void); const char *path_get_fs_charset(void);
/* /*
* pfx_dir - sets dst="$pfx/$path" and returns a pointer to path inside * dst * pfx_dir - sets dst="$pfx/$path" and returns a pointer to path inside * dst
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment