{MEDIA_FORMAT_MAX, NULL}
};
-static void __ms_check_ini_status(void)
-{
- FILE *fp = fopen(MEDIA_STREAMER_INI_PATH, "r");
- int file_size = 0;
- int status = 0;
-
- ms_debug_fenter();
-
- if (fp == NULL) {
- ms_debug("Failed to get media streamer ini file.");
- } else {
- fseek(fp, 0, SEEK_END);
- file_size = ftell(fp);
- fclose(fp);
- if (file_size < 5) {
- ms_debug("media_streamer.ini file size=%d, Corrupted! Removed", file_size);
- status = g_remove(MEDIA_STREAMER_INI_PATH);
- if (status == -1)
- ms_error("failed to delete corrupted ini");
- }
- }
-
- ms_debug_fleave();
-}
-
static dictionary *__ms_get_ini_instance(void)
{
static dictionary *instance = NULL;
+ dictionary *ms_dict = NULL;
ms_debug_fenter();
- if (NULL == instance) {
- dictionary *ms_dict = NULL;
- __ms_check_ini_status();
-
+ if (!instance) {
/* loading existing ini file */
ms_dict = iniparser_load(MEDIA_STREAMER_INI_PATH);
return instance;
}
-gchar *__ms_ini_get_string(const char *ini_path, char *default_str)
+gchar *__ms_ini_get_string(const char *ini_path, const char *default_str)
{
const char *result_str = default_str;
ms_debug_fleave();
- return result_str ? g_strdup(result_str) : NULL;
+ return g_strdup(result_str);
}
void __ms_ini_read_list(const char *key, gchar ***list)