mirror of
git://source.winehq.org/git/wine.git
synced 2024-08-31 13:44:24 +00:00
d3dxof: Empty arrays can have the semicolon at the end or not so handle both cases and add tests for them.
This fixes a regression introduced by commit 07931f73f0
.
This commit is contained in:
parent
dd65da7dce
commit
6ee15adf4d
|
@ -1315,7 +1315,11 @@ static BOOL parse_object_members_list(parse_buffer * buf)
|
|||
}
|
||||
}
|
||||
|
||||
if (buf->txt && (check_TOKEN(buf) != TOKEN_CBRACE) && (check_TOKEN(buf) != TOKEN_NAME))
|
||||
/* Empty arrays can have the semicolon at the end or not so remove it if any and skip next check */
|
||||
if (!nb_elems && (check_TOKEN(buf) == TOKEN_SEMICOLON))
|
||||
get_TOKEN(buf);
|
||||
|
||||
if (nb_elems && buf->txt && (check_TOKEN(buf) != TOKEN_CBRACE) && (check_TOKEN(buf) != TOKEN_NAME))
|
||||
{
|
||||
token = get_TOKEN(buf);
|
||||
if ((token != TOKEN_SEMICOLON) && (token != TOKEN_COMMA))
|
||||
|
|
|
@ -101,7 +101,7 @@ static char template_syntax_empty_array[] =
|
|||
"DWORD dummy;\n"
|
||||
"}\n";
|
||||
|
||||
static char object_syntax_empty_array[] =
|
||||
static char object_syntax_empty_array_semicolon[] =
|
||||
"xof 0302txt 0064\n"
|
||||
"Buffer\n"
|
||||
"{\n"
|
||||
|
@ -110,6 +110,15 @@ static char object_syntax_empty_array[] =
|
|||
"1234;\n"
|
||||
"}\n";
|
||||
|
||||
static char object_syntax_empty_array_nosemicolon[] =
|
||||
"xof 0302txt 0064\n"
|
||||
"Buffer\n"
|
||||
"{\n"
|
||||
"0;\n"
|
||||
"1234;\n"
|
||||
"}\n";
|
||||
|
||||
|
||||
static void init_function_pointers(void)
|
||||
{
|
||||
/* We have to use LoadLibrary as no d3dxof functions are referenced directly */
|
||||
|
@ -502,8 +511,8 @@ static void test_syntax(void)
|
|||
hr = IDirectXFile_RegisterTemplates(lpDirectXFile, template_syntax_empty_array, sizeof(template_syntax_empty_array) - 1);
|
||||
ok(hr == DXFILE_OK, "IDirectXFileImpl_RegisterTemplates: %x\n", hr);
|
||||
|
||||
dxflm.lpMemory = &object_syntax_empty_array;
|
||||
dxflm.dSize = sizeof(object_syntax_empty_array) - 1;
|
||||
dxflm.lpMemory = &object_syntax_empty_array_semicolon;
|
||||
dxflm.dSize = sizeof(object_syntax_empty_array_semicolon) - 1;
|
||||
hr = IDirectXFile_CreateEnumObject(lpDirectXFile, &dxflm, DXFILELOAD_FROMMEMORY, &lpdxfeo);
|
||||
ok(hr == DXFILE_OK, "IDirectXFile_CreateEnumObject: %x\n", hr);
|
||||
hr = IDirectXFileEnumObject_GetNextDataObject(lpdxfeo, &lpdxfd);
|
||||
|
@ -516,6 +525,22 @@ static void test_syntax(void)
|
|||
ref = IDirectXFileData_Release(lpdxfd);
|
||||
ok(ref == 0, "Got refcount %d, expected 0\n", ref);
|
||||
}
|
||||
|
||||
dxflm.lpMemory = &object_syntax_empty_array_nosemicolon;
|
||||
dxflm.dSize = sizeof(object_syntax_empty_array_nosemicolon) - 1;
|
||||
hr = IDirectXFile_CreateEnumObject(lpDirectXFile, &dxflm, DXFILELOAD_FROMMEMORY, &lpdxfeo);
|
||||
ok(hr == DXFILE_OK, "IDirectXFile_CreateEnumObject: %x\n", hr);
|
||||
hr = IDirectXFileEnumObject_GetNextDataObject(lpdxfeo, &lpdxfd);
|
||||
ok(hr == DXFILE_OK, "IDirectXFileEnumObject_GetNextDataObject: %x\n", hr);
|
||||
|
||||
ref = IDirectXFileEnumObject_Release(lpdxfeo);
|
||||
ok(ref == 0, "Got refcount %d, expected 0\n", ref);
|
||||
if (hr == DXFILE_OK)
|
||||
{
|
||||
ref = IDirectXFileData_Release(lpdxfd);
|
||||
ok(ref == 0, "Got refcount %d, expected 0\n", ref);
|
||||
}
|
||||
|
||||
ref = IDirectXFile_Release(lpDirectXFile);
|
||||
ok(ref == 0, "Got refcount %d, expected 0\n", ref);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue