Skip to content
This repository was archived by the owner on Oct 14, 2025. It is now read-only.

Fix printf compiler warning#201

Open
rfl890 wants to merge 1 commit into
google:masterfrom
rfl890:fix-warning
Open

Fix printf compiler warning#201
rfl890 wants to merge 1 commit into
google:masterfrom
rfl890:fix-warning

Conversation

@rfl890
Copy link
Copy Markdown

@rfl890 rfl890 commented Aug 10, 2024

An incorrect format specifier is used in cache.c (%lu instead of %zu for size_t) causing a compiler warning in Clang:

C:/Users/RFL890/zopfli/src/zopfli/cache.c:37:9: warning: format specifies type 'unsigned long' but the argument has type 'size_t' (aka 'unsigned long long') [-Wformat]
   36 |         "Error: Out of memory. Tried allocating %lu bytes of memory.\n",
      |                                                 ~~~
      |                                                 %zu
   37 |         (unsigned long)ZOPFLI_CACHE_LENGTH * 3 * blocksize);
      |         ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1 warning generated.

This PR fixes it by using the correct format specifier

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant