mirror of
https://github.com/MidnightCommander/mc
synced 2025-01-22 03:02:06 +03:00
Deprecated parser now used just in Hotlist widget.
Signed-off-by: Slava Zanko <slavazanko@gmail.com>
This commit is contained in:
parent
12af8e5db0
commit
32a9f8257d
@ -69,47 +69,6 @@ test_chdir(const vfs_path_t * vpath)
|
||||
strcmp(etalon, mc_get_current_wd(buffer,MC_MAXPATHLEN)) == 0, \
|
||||
"\n expected(%s) doesn't equal \nto actual(%s)", etalon, buffer);
|
||||
|
||||
START_TEST (set_up_current_dir)
|
||||
{
|
||||
static struct vfs_s_subclass test_subclass;
|
||||
static struct vfs_class vfs_test_ops;
|
||||
char buffer[MC_MAXPATHLEN];
|
||||
|
||||
vfs_s_init_class (&vfs_test_ops, &test_subclass);
|
||||
|
||||
vfs_test_ops.name = "testfs";
|
||||
vfs_test_ops.flags = VFSF_NOLINKS;
|
||||
vfs_test_ops.prefix = "test";
|
||||
vfs_test_ops.chdir = test_chdir;
|
||||
|
||||
vfs_register_class (&vfs_test_ops);
|
||||
|
||||
cd_and_check ("/dev/some.file#test", "/dev/some.file/test://");
|
||||
|
||||
cd_and_check ("/dev/some.file#test/bla-bla", "/dev/some.file/test://bla-bla");
|
||||
|
||||
cd_and_check ("..", "/dev/some.file/test://");
|
||||
|
||||
cd_and_check ("..", "/dev");
|
||||
|
||||
cd_and_check ("..", "/");
|
||||
|
||||
cd_and_check ("..", "/");
|
||||
|
||||
cd_and_check ("/dev/some.file/#test/bla-bla", "/dev/some.file/test://bla-bla");
|
||||
|
||||
cd_and_check ("..", "/dev/some.file/test://");
|
||||
|
||||
cd_and_check ("..", "/dev");
|
||||
|
||||
cd_and_check ("..", "/");
|
||||
|
||||
cd_and_check ("..", "/");
|
||||
}
|
||||
END_TEST
|
||||
|
||||
/* --------------------------------------------------------------------------------------------- */
|
||||
|
||||
START_TEST (set_up_current_dir_url)
|
||||
{
|
||||
static struct vfs_s_subclass test_subclass;
|
||||
@ -161,7 +120,6 @@ main (void)
|
||||
tcase_add_checked_fixture (tc_core, setup, teardown);
|
||||
|
||||
/* Add new tests here: *************** */
|
||||
tcase_add_test (tc_core, set_up_current_dir);
|
||||
tcase_add_test (tc_core, set_up_current_dir_url);
|
||||
/* *********************************** */
|
||||
|
||||
|
@ -115,7 +115,7 @@ START_TEST (test_path_serialize_deserialize)
|
||||
char *serialized_vpath;
|
||||
GError *error = NULL;
|
||||
|
||||
vpath = vfs_path_from_str (ETALON_PATH_STR);
|
||||
vpath = vfs_path_from_str_flags (ETALON_PATH_STR, VPF_USE_DEPRECATED_PARSER);
|
||||
serialized_vpath = vfs_path_serialize (vpath, &error);
|
||||
vfs_path_free (vpath);
|
||||
|
||||
|
@ -87,7 +87,7 @@ START_TEST (test_vfs_path_from_to_string)
|
||||
vfs_path_t *vpath;
|
||||
size_t vpath_len;
|
||||
char *result;
|
||||
vpath = vfs_path_from_str (ETALON_PATH_STR);
|
||||
vpath = vfs_path_from_str_flags (ETALON_PATH_STR, VPF_USE_DEPRECATED_PARSER);
|
||||
|
||||
|
||||
vpath_len = vfs_path_elements_count(vpath);
|
||||
@ -133,7 +133,7 @@ START_TEST (test_vfs_path_from_to_partial_string_by_class)
|
||||
{
|
||||
vfs_path_t *vpath;
|
||||
char *result;
|
||||
vpath = vfs_path_from_str (ETALON_PATH_STR);
|
||||
vpath = vfs_path_from_str_flags (ETALON_PATH_STR, VPF_USE_DEPRECATED_PARSER);
|
||||
|
||||
|
||||
result = vfs_path_to_str_elements_count(vpath, -1);
|
||||
@ -203,7 +203,7 @@ END_TEST
|
||||
vfs_path_t *vpath; \
|
||||
char *result; \
|
||||
\
|
||||
vpath = vfs_path_from_str (input); \
|
||||
vpath = vfs_path_from_str_flags (input, VPF_USE_DEPRECATED_PARSER); \
|
||||
result = vfs_path_to_str(vpath); \
|
||||
fail_unless( result != NULL && strcmp(result, etalon) ==0, \
|
||||
"\ninput : %s\nactual: %s\netalon: %s", input, result , etalon ); \
|
||||
@ -262,7 +262,7 @@ START_TEST (test_vfs_path_encoding_at_end)
|
||||
mc_global.sysconfig_dir = (char *) TEST_SHARE_DIR;
|
||||
load_codepages_list ();
|
||||
|
||||
vpath = vfs_path_from_str ("/path/to/file.ext#test1:/#enc:KOI8-R");
|
||||
vpath = vfs_path_from_str_flags ("/path/to/file.ext#test1:/#enc:KOI8-R", VPF_USE_DEPRECATED_PARSER);
|
||||
result = vfs_path_to_str(vpath);
|
||||
|
||||
element = vfs_path_get_by_index(vpath, -1);
|
||||
|
@ -125,7 +125,8 @@ START_TEST (test_vfs_s_get_path)
|
||||
struct vfs_s_super *archive;
|
||||
|
||||
const char *result;
|
||||
vfs_path_t *vpath = vfs_path_from_str("/" ETALON_VFS_NAME ARCH_NAME "#test1:/" ETALON_PATH);
|
||||
vfs_path_t *vpath = vfs_path_from_str_flags ("/" ETALON_VFS_NAME ARCH_NAME "#test1:/" ETALON_PATH,
|
||||
VPF_USE_DEPRECATED_PARSER);
|
||||
|
||||
result = vfs_s_get_path (vpath, &archive, 0);
|
||||
|
||||
|
@ -632,7 +632,7 @@ vfs_path_from_str_flags (const char *path_str, vfs_path_flag_t flags)
|
||||
if (path == NULL)
|
||||
return NULL;
|
||||
|
||||
if (vfs_path_is_str_path_deprecated (path))
|
||||
if ((flags & VPF_USE_DEPRECATED_PARSER) != 0 && vfs_path_is_str_path_deprecated (path))
|
||||
vpath = vfs_path_from_str_deprecated_parser (path);
|
||||
else
|
||||
vpath = vfs_path_from_str_uri_parser (path);
|
||||
|
@ -10,7 +10,8 @@
|
||||
typedef enum
|
||||
{
|
||||
VPF_NONE = 0,
|
||||
VPF_NO_CANON = 1
|
||||
VPF_NO_CANON = 1,
|
||||
VPF_USE_DEPRECATED_PARSER = 2
|
||||
} vfs_path_flag_t;
|
||||
|
||||
/*** structures declarations (and typedefs of structures)*****************************************/
|
||||
|
@ -1429,13 +1429,18 @@ hot_load_group (struct hotlist *grp)
|
||||
current_group = grp;
|
||||
break;
|
||||
case TKN_ENTRY:
|
||||
CHECK_TOKEN (TKN_STRING);
|
||||
label = g_strdup (tkn_buf->str);
|
||||
CHECK_TOKEN (TKN_URL);
|
||||
CHECK_TOKEN (TKN_STRING);
|
||||
url = g_strdup (tkn_buf->str);
|
||||
add2hotlist (label, url, HL_TYPE_ENTRY, LISTBOX_APPEND_AT_END);
|
||||
SKIP_TO_EOL;
|
||||
{
|
||||
vfs_path_t *vpath;
|
||||
CHECK_TOKEN (TKN_STRING);
|
||||
label = g_strdup (tkn_buf->str);
|
||||
CHECK_TOKEN (TKN_URL);
|
||||
CHECK_TOKEN (TKN_STRING);
|
||||
vpath = vfs_path_from_str_flags (tkn_buf->str, VPF_USE_DEPRECATED_PARSER);
|
||||
url = vfs_path_to_str (vpath);
|
||||
vfs_path_free (vpath);
|
||||
add2hotlist (label, url, HL_TYPE_ENTRY, LISTBOX_APPEND_AT_END);
|
||||
SKIP_TO_EOL;
|
||||
}
|
||||
break;
|
||||
case TKN_COMMENT:
|
||||
label = g_strdup (tkn_buf->str);
|
||||
@ -1481,13 +1486,18 @@ hot_load_file (struct hotlist *grp)
|
||||
current_group = grp;
|
||||
break;
|
||||
case TKN_ENTRY:
|
||||
CHECK_TOKEN (TKN_STRING);
|
||||
label = g_strdup (tkn_buf->str);
|
||||
CHECK_TOKEN (TKN_URL);
|
||||
CHECK_TOKEN (TKN_STRING);
|
||||
url = g_strdup (tkn_buf->str);
|
||||
add2hotlist (label, url, HL_TYPE_ENTRY, LISTBOX_APPEND_AT_END);
|
||||
SKIP_TO_EOL;
|
||||
{
|
||||
vfs_path_t *vpath;
|
||||
CHECK_TOKEN (TKN_STRING);
|
||||
label = g_strdup (tkn_buf->str);
|
||||
CHECK_TOKEN (TKN_URL);
|
||||
CHECK_TOKEN (TKN_STRING);
|
||||
vpath = vfs_path_from_str_flags (tkn_buf->str, VPF_USE_DEPRECATED_PARSER);
|
||||
url = vfs_path_to_str (vpath);
|
||||
vfs_path_free (vpath);
|
||||
add2hotlist (label, url, HL_TYPE_ENTRY, LISTBOX_APPEND_AT_END);
|
||||
SKIP_TO_EOL;
|
||||
}
|
||||
break;
|
||||
case TKN_COMMENT:
|
||||
label = g_strdup (tkn_buf->str);
|
||||
|
Loading…
Reference in New Issue
Block a user