(vfs_translate_path): return const char *.

Signed-off-by: Andrew Borodin <aborodin@vmail.ru>
This commit is contained in:
Andrew Borodin 2013-09-17 12:47:10 +04:00
parent ae824a3622
commit 034e973fbf
2 changed files with 3 additions and 7 deletions

View File

@ -336,17 +336,13 @@ vfs_strip_suffix_from_filename (const char *filename)
/* --------------------------------------------------------------------------------------------- */ /* --------------------------------------------------------------------------------------------- */
char * const char *
vfs_translate_path (const char *path) vfs_translate_path (const char *path)
{ {
estr_t state; estr_t state;
g_string_set_size (vfs_str_buffer, 0); g_string_set_size (vfs_str_buffer, 0);
state = _vfs_translate_path (path, -1, str_cnv_from_term, vfs_str_buffer); state = _vfs_translate_path (path, -1, str_cnv_from_term, vfs_str_buffer);
/*
strict version
return (state == 0) ? vfs_str_buffer->data : NULL;
*/
return (state != ESTR_FAILURE) ? vfs_str_buffer->str : NULL; return (state != ESTR_FAILURE) ? vfs_str_buffer->str : NULL;
} }
@ -355,7 +351,7 @@ vfs_translate_path (const char *path)
char * char *
vfs_translate_path_n (const char *path) vfs_translate_path_n (const char *path)
{ {
char *result; const char *result;
result = vfs_translate_path (path); result = vfs_translate_path (path);
return (result != NULL) ? g_strdup (result) : NULL; return (result != NULL) ? g_strdup (result) : NULL;

View File

@ -247,7 +247,7 @@ vfs_class_flags_t vfs_file_class_flags (const vfs_path_t * vpath);
/* translate path back to terminal encoding, remove all #enc: /* translate path back to terminal encoding, remove all #enc:
* every invalid character is replaced with question mark * every invalid character is replaced with question mark
* return static buffer */ * return static buffer */
char *vfs_translate_path (const char *path); const char *vfs_translate_path (const char *path);
/* return new string */ /* return new string */
char *vfs_translate_path_n (const char *path); char *vfs_translate_path_n (const char *path);