This is an automated email from the git hooks/post-receive script.

git pushed a commit to branch master
in repository legacy-imlib2.

View the commit online.

commit 2d210b9af3865b18b7ccf0698f4f2e2710f3bd0f
Author: Kim Woelders <k...@woelders.dk>
AuthorDate: Mon Jan 1 22:01:55 2024 +0100

    Y4M loader: Fix warning in non-debug build
    
    Also simplify error text handling.
---
 src/modules/loaders/loader_y4m.c | 14 +++++++++-----
 1 file changed, 9 insertions(+), 5 deletions(-)

diff --git a/src/modules/loaders/loader_y4m.c b/src/modules/loaders/loader_y4m.c
index 7e4e73a..43987f2 100644
--- a/src/modules/loaders/loader_y4m.c
+++ b/src/modules/loaders/loader_y4m.c
@@ -112,12 +112,17 @@ y4m__match(const char *match, ptrdiff_t mlen,
 static enum Y4mParseStatus
 y4m__parse_params(Y4mParse * res, const uint8_t ** start, const uint8_t * end)
 {
-   const uint8_t      *p = *start, *pp;
+   const uint8_t      *p = *start;
 
    for (;;)
      {
+#if IMLIB2_DEBUG
+        const char      *pp = (const char *)p;
+#endif
+
         if (end - p <= 0)
            return Y4M_PARSE_CORRUPTED;
+
         switch (*p++)
           {
           case ' ':
@@ -137,14 +142,13 @@ y4m__parse_params(Y4mParse * res, const uint8_t ** start, const uint8_t * end)
                 return Y4M_PARSE_CORRUPTED;
              break;
           case 'F':
-             pp = p;
              if (!y4m__int(&res->fps_num, &p, end) ||
                  !y4m__match(":", 1, &p, end) ||
                  !y4m__int(&res->fps_den, &p, end))
              {
 #if IMLIB2_DEBUG
                char str[1024];
-               sscanf((const char *)(pp-1), "%s", str);
+               sscanf(pp, "%s", str);
                D("%s: unknown frame rate: '%s'\n", __func__, str);
 #endif
                 return Y4M_PARSE_CORRUPTED;
@@ -162,7 +166,7 @@ y4m__parse_params(Y4mParse * res, const uint8_t ** start, const uint8_t * end)
              else {
 #if IMLIB2_DEBUG
                char str[1024];
-               sscanf((const char *)(p-1), "%s", str);
+               sscanf(pp, "%s", str);
                D("%s: unknown interlace type: '%s'\n", __func__, str);
 #endif
                 return Y4M_PARSE_CORRUPTED;
@@ -186,7 +190,7 @@ y4m__parse_params(Y4mParse * res, const uint8_t ** start, const uint8_t * end)
              else {
 #if IMLIB2_DEBUG
                 char str[1024];
-                sscanf((const char *)(p-1), "%s", str);
+                sscanf(pp, "%s", str);
                 D("%s: unknown color type: '%s'\n", __func__, str);
 #endif
                 return Y4M_PARSE_CORRUPTED;

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.

Reply via email to