Christian Costa : d3dxof: Make is_keyword handle end of file correctly.

Alexandre Julliard julliard at winehq.org
Tue Feb 10 07:45:35 CST 2009


Module: wine
Branch: master
Commit: db30aa149ed90781973fdf2878d42702b91754cf
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=db30aa149ed90781973fdf2878d42702b91754cf

Author: Christian Costa <titan.costa at wanadoo.fr>
Date:   Tue Feb 10 14:07:19 2009 +0100

d3dxof: Make is_keyword handle end of file correctly.

---

 dlls/d3dxof/parsing.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/dlls/d3dxof/parsing.c b/dlls/d3dxof/parsing.c
index 13fc5bb..c849e5a 100644
--- a/dlls/d3dxof/parsing.c
+++ b/dlls/d3dxof/parsing.c
@@ -273,10 +273,20 @@ static WORD get_operator_token(char c)
 
 static BOOL is_keyword(parse_buffer* buf, const char* keyword)
 {
-  char tmp[9]; /* template keyword size + 1 */
+  char tmp[8]; /* longest keyword size (template) */
   DWORD len = strlen(keyword);
-  read_bytes(buf, tmp, len+1);
-  if (!strncasecmp(tmp, keyword,len) && is_separator(tmp[len]))
+
+  if (!read_bytes(buf, tmp, len))
+    return FALSE;
+  if (strncasecmp(tmp, keyword, len))
+  {
+    rewind_bytes(buf, len);
+    return FALSE;
+  }
+
+  if (!read_bytes(buf, tmp, 1))
+    return TRUE;
+  if (is_separator(tmp[0]))
   {
     rewind_bytes(buf, 1);
     return TRUE;




More information about the wine-cvs mailing list