Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix warnings for builds with clang compiler #754

Merged
merged 3 commits into from
Oct 14, 2024

Commits on Oct 13, 2024

  1. Fix prototype of local function TestPartition in partition_reg

    This fixes a bug which is reported by the clang compiler on macOS:
    
          CC       partition_reg.o
        prog/partition_reg.c:75:56: warning: implicit conversion from 'double' to 'l_int32' (aka 'int') changes value from 0.4 to 0 [-Wliteral-conversion]
           75 |     TestPartition(rp, "test8.jpg", L_SORT_BY_AREA, 20, 0.4, "test2.pdf",
              |     ~~~~~~~~~~~~~                                      ^~~
    
    Signed-off-by: Stefan Weil <[email protected]>
    stweil committed Oct 13, 2024
    Configuration menu
    Copy the full SHA
    06e2249 View commit details
    Browse the repository at this point in the history
  2. Replace double constants by float constants in scale2

    This fixes a bug reported by the clang compiler on macOS:
    
          CC       scale2.lo
        src/scale2.c:257:28: warning: floating-point comparison is always false; constant cannot be represented exactly in type 'float' [-Wliteral-range]
          257 |     } else if (scalefactor == 0.16667) {
              |                ~~~~~~~~~~~ ^  ~~~~~~~
    
    Signed-off-by: Stefan Weil <[email protected]>
    stweil committed Oct 13, 2024
    Configuration menu
    Copy the full SHA
    4d7645d View commit details
    Browse the repository at this point in the history
  3. Don't take address of packed member in structure BMP_HEADER

    This fixes warnings from the clang compiler:
    
    ../src/bmpio.c:169:37: warning: taking address of packed member 'bmpih' of class or structure 'BMP_HEADER' may result in an unaligned pointer value [-Waddress-of-packed-member]
      169 |     compression = convertOnBigEnd32(bmpih->biCompression);
          |                                     ^~~~~
    ../src/bmpio.c:147:17: note: expanded from macro 'bmpih'
      147 | #define bmpih (&bmph->bmpih)
          |                 ^~~~~~~~~~~
    ../src/bmpio.c:186:31: warning: taking address of packed member 'bmpih' of class or structure 'BMP_HEADER' may result in an unaligned pointer value [-Waddress-of-packed-member]
      186 |     width = convertOnBigEnd32(bmpih->biWidth);
          |                               ^~~~~
    ../src/bmpio.c:147:17: note: expanded from macro 'bmpih'
      147 | #define bmpih (&bmph->bmpih)
          |                 ^~~~~~~~~~~
    [...]
    
    Signed-off-by: Stefan Weil <[email protected]>
    stweil committed Oct 13, 2024
    Configuration menu
    Copy the full SHA
    b322384 View commit details
    Browse the repository at this point in the history