Module: wine Branch: master Commit: b5158497a6ebb3a393336d360701af7ba643ab32 URL: http://source.winehq.org/git/wine.git/?a=commit;h=b5158497a6ebb3a393336d3607...
Author: Christian Costa titan.costa@wanadoo.fr Date: Sun Nov 30 12:18:46 2008 +0100
d3dxof: Handle comments when going to next template or object.
---
dlls/d3dxof/d3dxof.c | 46 ++++++++++++++++++++++++++++++++++++---------- 1 files changed, 36 insertions(+), 10 deletions(-)
diff --git a/dlls/d3dxof/d3dxof.c b/dlls/d3dxof/d3dxof.c index 69060ed..eb80cdc 100644 --- a/dlls/d3dxof/d3dxof.c +++ b/dlls/d3dxof/d3dxof.c @@ -1177,6 +1177,40 @@ static BOOL parse_template_parts(parse_buffer * buf) return TRUE; }
+static void go_to_next_definition(parse_buffer * buf) +{ + while (buf->rem_bytes) + { + char c = *buf->buffer; + if ((c == '#') || (c == '/')) + { + read_bytes(buf, &c, 1); + /* Handle comment (# or //) */ + if (c == '/') + { + if (!read_bytes(buf, &c, 1)) + return; + if (c != '/') + return; + } + c = 0; + while (c != 0x0A) + { + if (!read_bytes(buf, &c, 1)) + return; + } + continue; + } + else if (is_space(*buf->buffer)) + { + buf->buffer++; + buf->rem_bytes--; + } + else + break; + } +} + static BOOL parse_template(parse_buffer * buf) { if (get_TOKEN(buf) != TOKEN_TEMPLATE) @@ -1196,11 +1230,7 @@ static BOOL parse_template(parse_buffer * buf) if (buf->txt) { /* Go to the next template */ - while (buf->rem_bytes && is_space(*buf->buffer)) - { - buf->buffer++; - buf->rem_bytes--; - } + go_to_next_definition(buf); }
TRACE("%d - %s - %s\n", buf->pdxf->nb_xtemplates, buf->pdxf->xtemplates[buf->pdxf->nb_xtemplates].name, debugstr_guid(&buf->pdxf->xtemplates[buf->pdxf->nb_xtemplates].class_id)); @@ -2136,11 +2166,7 @@ static BOOL parse_object(parse_buffer * buf) if (buf->txt) { /* Go to the next object */ - while (buf->rem_bytes && is_space(*buf->buffer)) - { - buf->buffer++; - buf->rem_bytes--; - } + go_to_next_definition(buf); }
return TRUE;