Christian Costa : d3dxof: Add support for string parsing.
Alexandre Julliard
julliard at winehq.org
Fri Oct 17 07:25:52 CDT 2008
Module: wine
Branch: master
Commit: f32511cf278f39cc0585e1a9e7f281703753d6dc
URL: http://source.winehq.org/git/wine.git/?a=commit;h=f32511cf278f39cc0585e1a9e7f281703753d6dc
Author: Christian Costa <titan.costa at wanadoo.fr>
Date: Thu Oct 16 22:23:46 2008 +0200
d3dxof: Add support for string parsing.
---
dlls/d3dxof/d3dxof.c | 68 ++++++++++++++++++++++++++++++++++++++++++++++++++
1 files changed, 68 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dxof/d3dxof.c b/dlls/d3dxof/d3dxof.c
index e92d181..ca4eb73 100644
--- a/dlls/d3dxof/d3dxof.c
+++ b/dlls/d3dxof/d3dxof.c
@@ -639,6 +639,43 @@ static BOOL is_integer(parse_buffer* buf)
return TRUE;
}
+static BOOL is_string(parse_buffer* buf)
+{
+ char tmp[32];
+ DWORD pos = 1;
+ char c;
+ BOOL ok = 0;
+
+ if (*buf->buffer != '"')
+ return FALSE;
+ tmp[0] = '"';
+
+ while (!is_separator(c = *(buf->buffer+pos)) && (pos < 32))
+ {
+ tmp[pos++] = c;
+ if (c == '"')
+ {
+ ok = 1;
+ break;
+ }
+ }
+ tmp[pos] = 0;
+
+ if (!ok)
+ {
+ TRACE("Wrong string %s\n", tmp);
+ return FALSE;
+ }
+
+ buf->buffer += pos;
+ buf->rem_bytes -= pos;
+
+ TRACE("Found string %s\n", tmp);
+ strcpy((char*)buf->value, tmp);
+
+ return TRUE;
+}
+
static WORD parse_TOKEN(parse_buffer * buf)
{
WORD token;
@@ -704,6 +741,11 @@ static WORD parse_TOKEN(parse_buffer * buf)
token = TOKEN_FLOAT;
break;
}
+ if (is_string(buf))
+ {
+ token = TOKEN_LPSTR;
+ break;
+ }
if (is_name(buf))
{
token = TOKEN_NAME;
@@ -1811,8 +1853,34 @@ static BOOL parse_object_members_list(parse_buffer * buf)
return FALSE;
}
}
+ else if (token == TOKEN_LPSTR)
+ {
+ static char fake_string[] = "Fake string";
+ get_TOKEN(buf);
+ TRACE("%s = %s\n", pt->members[i].name, (char*)buf->value);
+ /* Assume larger size */
+ if ((buf->cur_pdata - buf->pxo->pdata + 4) > MAX_DATA_SIZE)
+ {
+ WARN("Buffer too small\n");
+ return FALSE;
+ }
+ if (pt->members[i].type == TOKEN_LPSTR)
+ {
+ /* Use a fake string for now */
+ *(((LPCSTR*)(buf->cur_pdata))) = fake_string;
+ buf->cur_pdata += 4;
+ }
+ else
+ {
+ FIXME("Token %d not supported\n", pt->members[i].type);
+ return FALSE;
+ }
+ }
else
+ {
+ FIXME("Unexpected token %d\n", token);
return FALSE;
+ }
}
}
More information about the wine-cvs
mailing list