[PATCH] wined3d: Display correctly TEXT comments by printing lines separately

Henri Verbeet hverbeet at gmail.com
Mon Mar 1 06:47:03 CST 2010


On 1 March 2010 09:39, Christian Costa <titan.costa at wanadoo.fr> wrote:
>

Still not quite right, I'm afraid. For example, the following doesn't work:
> +                    while (i < size)
> +                    {
> +                        /* Find end of line */
> +                        while ((str[i] != 0) && (str[i] != 0x0a))
> +                            i++;

How does something like the attached patch work (untested)?
-------------- next part --------------
diff --git a/dlls/wined3d/shader.c b/dlls/wined3d/shader.c
index 06c49ab..bb6f9f5 100644
--- a/dlls/wined3d/shader.c
+++ b/dlls/wined3d/shader.c
@@ -1231,7 +1231,27 @@ static void shader_trace_init(const struct wined3d_shader_frontend *fe, void *fe
         fe->shader_read_comment(&ptr, &comment, &comment_size);
         if (comment)
         {
-            TRACE("// %s\n", debugstr_an(comment, comment_size));
+            if (comment_size > 4 && *(const DWORD *)comment == WINEMAKEFOURCC('T', 'E', 'X', 'T'))
+            {
+                const char *end = comment + comment_size;
+                const char *ptr = comment + 4;
+                const char *line = ptr;
+
+                TRACE("// TEXT\n");
+                while (ptr != end)
+                {
+                    if (*ptr == '\n')
+                    {
+                        UINT len = ptr - line;
+                        if (len && *(ptr - 1) == '\r') --len;
+                        TRACE("// %s\n", debugstr_an(line, len));
+                        line = ++ptr;
+                    }
+                    else ++ptr;
+                }
+                if (line != ptr) TRACE("// %s\n", debugstr_an(line, ptr - line));
+            }
+            else TRACE("// %s\n", debugstr_an(comment, comment_size));
             continue;
         }
 


More information about the wine-devel mailing list