[CMD_ROSTEST] Sync batch.c with cmd_winetest' counterpart.

This commit is contained in:
Hermès Bélusca-Maïto 2020-05-27 16:43:55 +02:00
parent 7115d7ba8e
commit d85d991679
No known key found for this signature in database
GPG key ID: 3B2539C65E7B93D0

View file

@ -26,7 +26,7 @@
static char workdir[MAX_PATH];
static DWORD workdir_len;
static char drive[2];
static const DWORD drive_len = sizeof(drive)/sizeof(drive[0]);
static const DWORD drive_len = ARRAY_SIZE(drive);
static char path[MAX_PATH];
static DWORD path_len;
static char shortpath[MAX_PATH];
@ -71,7 +71,11 @@ static const char* convert_input_data(const char *data, DWORD size, DWORD *new_s
}
*ptr = '\0';
#ifdef __REACTOS__
*new_size = lstrlenA(new_data);
#else
*new_size = strlen(new_data);
#endif
return new_data;
}
@ -166,6 +170,7 @@ static const char *compare_line(const char *out_line, const char *out_end, const
static const char path_cmd[] = {'@','p','a','t','h','@'};
static const char shortpath_cmd[] = {'@','s','h','o','r','t','p','a','t','h','@'};
static const char space_cmd[] = {'@','s','p','a','c','e','@'};
static const char spaces_cmd[] = {'@','s','p','a','c','e','s','@'};
static const char tab_cmd[] = {'@','t','a','b','@'};
static const char or_broken_cmd[] = {'@','o','r','_','b','r','o','k','e','n','@'};
@ -224,6 +229,15 @@ static const char *compare_line(const char *out_line, const char *out_end, const
} else {
err = out_end;
}
}else if(exp_ptr+sizeof(spaces_cmd) <= exp_end
&& !memcmp(exp_ptr, spaces_cmd, sizeof(spaces_cmd))) {
exp_ptr += sizeof(spaces_cmd);
if(out_ptr < out_end && *out_ptr == ' ') {
while (out_ptr < out_end && *out_ptr == ' ') out_ptr++;
continue;
} else {
err = out_end;
}
}else if(exp_ptr+sizeof(tab_cmd) <= exp_end
&& !memcmp(exp_ptr, tab_cmd, sizeof(tab_cmd))) {
exp_ptr += sizeof(tab_cmd);
@ -251,10 +265,8 @@ static const char *compare_line(const char *out_line, const char *out_end, const
while(exp_ptr+sizeof(or_broken_cmd) <= exp_end && memcmp(exp_ptr, or_broken_cmd, sizeof(or_broken_cmd)))
exp_ptr++;
if(!exp_ptr)
return err;
exp_ptr += sizeof(or_broken_cmd);
if (exp_ptr > exp_end) return err;
out_ptr = out_line;
err = NULL;
continue;
@ -470,8 +482,7 @@ START_TEST(reactos)
} else {
path_len = 1; /* \ */
}
shortpath_len = GetShortPathNameA(path, shortpath,
sizeof(shortpath)/sizeof(shortpath[0]));
shortpath_len = GetShortPathNameA(path, shortpath, ARRAY_SIZE(shortpath));
argc = winetest_get_mainargs(&argv);
if(argc > 2)