Henri Verbeet : wined3d: Slightly simplify get_info_log_line().

Alexandre Julliard julliard at wine.codeweavers.com
Tue Apr 21 09:57:27 CDT 2015


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Tue Apr 21 12:25:53 2015 +0200

wined3d: Slightly simplify get_info_log_line().

---

 dlls/wined3d/glsl_shader.c | 17 +++++++----------
 1 file changed, 7 insertions(+), 10 deletions(-)

diff --git a/dlls/wined3d/glsl_shader.c b/dlls/wined3d/glsl_shader.c
index 84fc1a2..655bb33 100644
--- a/dlls/wined3d/glsl_shader.c
+++ b/dlls/wined3d/glsl_shader.c
@@ -279,11 +279,9 @@ static void shader_glsl_append_imm_vec4(struct wined3d_shader_buffer *buffer, co
     shader_addline(buffer, "vec4(%s, %s, %s, %s)", str[0], str[1], str[2], str[3]);
 }
 
-/* Extract a line from the info log.
- * Note that this modifies the source string. */
-static char *get_info_log_line(char **ptr)
+static const char *get_info_log_line(const char **ptr)
 {
-    char *p, *q;
+    const char *p, *q;
 
     p = *ptr;
     if (!(q = strstr(p, "\n")))
@@ -292,7 +290,6 @@ static char *get_info_log_line(char **ptr)
         *ptr += strlen(p);
         return p;
     }
-    *q = '\0';
     *ptr = q + 1;
 
     return p;
@@ -316,7 +313,7 @@ static void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLuint id
      * that if there are errors. */
     if (length > 1)
     {
-        char *ptr, *line;
+        const char *ptr, *line;
 
         log = HeapAlloc(GetProcessHeap(), 0, length);
         /* The info log is supposed to be zero-terminated, but at least some
@@ -333,12 +330,12 @@ static void print_glsl_info_log(const struct wined3d_gl_info *gl_info, GLuint id
         if (gl_info->quirks & WINED3D_QUIRK_INFO_LOG_SPAM)
         {
             WARN("Info log received from GLSL shader #%u:\n", id);
-            while ((line = get_info_log_line(&ptr))) WARN("    %s\n", line);
+            while ((line = get_info_log_line(&ptr))) WARN("    %.*s", (int)(ptr - line), line);
         }
         else
         {
             FIXME("Info log received from GLSL shader #%u:\n", id);
-            while ((line = get_info_log_line(&ptr))) FIXME("    %s\n", line);
+            while ((line = get_info_log_line(&ptr))) FIXME("    %.*s", (int)(ptr - line), line);
         }
         HeapFree(GetProcessHeap(), 0, log);
     }
@@ -373,7 +370,7 @@ static void shader_glsl_dump_program_source(const struct wined3d_gl_info *gl_inf
     GL_EXTCALL(glGetAttachedShaders(program, shader_count, NULL, shaders));
     for (i = 0; i < shader_count; ++i)
     {
-        char *ptr, *line;
+        const char *ptr, *line;
         GLint tmp;
 
         GL_EXTCALL(glGetShaderiv(shaders[i], GL_SHADER_SOURCE_LENGTH, &tmp));
@@ -401,7 +398,7 @@ static void shader_glsl_dump_program_source(const struct wined3d_gl_info *gl_inf
 
         ptr = source;
         GL_EXTCALL(glGetShaderSource(shaders[i], source_size, NULL, source));
-        while ((line = get_info_log_line(&ptr))) FIXME("    %s\n", line);
+        while ((line = get_info_log_line(&ptr))) FIXME("    %.*s", (int)(ptr - line), line);
         FIXME("\n");
     }
 




More information about the wine-cvs mailing list