Skip to content

Commit

Permalink
fix MSVC warnings:
Browse files Browse the repository at this point in the history
src/_webp.c(919): warning C4113: 'PyObject *(__cdecl *)()' differs in parameter lists from 'PyCFunction'
src/_webp.c(921): warning C4113: 'PyObject *(__cdecl *)()' differs in parameter lists from 'PyCFunction'
src/display.c(430): warning C4101: 'clip': unreferenced local variable
src/libImaging\QuantOctree.c(371): warning C4018: '<': signed/unsigned mismatch
src/libImaging\QuantOctree.c(426): warning C4018: '<': signed/unsigned mismatch
src/libImaging\TiffDecode.c(976): warning C4133: 'function': incompatible types - from 'TIFFSTATE *' to 'thandle_t'
C:\Program Files (x86)\Windows Kits\10\Include\10.0.22621.0\ucrt\corecrt_math_defines.h(28) - included from _imaging.c: warning C4005: 'M_PI': macro redefinition
  • Loading branch information
nulano committed Nov 28, 2023
1 parent 07eceb2 commit e43d320
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions src/_webp.c
Original file line number Diff line number Diff line change
Expand Up @@ -873,7 +873,7 @@ WebPDecode_wrapper(PyObject *self, PyObject *args) {
// Return the decoder's version number, packed in hexadecimal using 8bits for
// each of major/minor/revision. E.g: v2.5.7 is 0x020507.
PyObject *
WebPDecoderVersion_wrapper() {
WebPDecoderVersion_wrapper(PyObject *self, PyObject *Py_UNUSED(args)) {
return Py_BuildValue("i", WebPGetDecoderVersion());
}

Expand Down Expand Up @@ -901,7 +901,7 @@ WebPDecoderBuggyAlpha(void) {
}

PyObject *
WebPDecoderBuggyAlpha_wrapper() {
WebPDecoderBuggyAlpha_wrapper(PyObject *self, PyObject *Py_UNUSED(args)) {
return Py_BuildValue("i", WebPDecoderBuggyAlpha());
}

Expand Down
1 change: 0 additions & 1 deletion src/display.c
Original file line number Diff line number Diff line change
Expand Up @@ -427,7 +427,6 @@ PyImaging_GrabScreenWin32(PyObject *self, PyObject *args) {

PyObject *
PyImaging_GrabClipboardWin32(PyObject *self, PyObject *args) {
int clip;
HANDLE handle = NULL;
int size;
void *data;
Expand Down
1 change: 1 addition & 0 deletions src/libImaging/Draw.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@

#include "Imaging.h"

#define _USE_MATH_DEFINES
#include <math.h>
#include <stdint.h>

Expand Down
4 changes: 0 additions & 4 deletions src/libImaging/Imaging.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,6 @@
extern "C" {
#endif

#ifndef M_PI
#define M_PI 3.1415926535897932384626433832795
#endif

/* -------------------------------------------------------------------- */

/*
Expand Down
4 changes: 2 additions & 2 deletions src/libImaging/QuantOctree.c
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@ map_image_pixels(
uint32_t nPixels,
const ColorCube lookupCube,
uint32_t *pixelArray) {
long i;
unsigned long i;
for (i = 0; i < nPixels; i++) {
pixelArray[i] = lookup_color(lookupCube, &pixelData[i]);
}
Expand All @@ -393,7 +393,7 @@ quantize_octree(
ColorBucket paletteBucketsFine = NULL;
ColorBucket paletteBuckets = NULL;
uint32_t *qp = NULL;
long i;
unsigned long i;
unsigned long nCoarseColors, nFineColors, nAlreadySubtracted;
const unsigned int *cubeBits;

Expand Down
1 change: 1 addition & 0 deletions src/libImaging/Resample.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include "Imaging.h"

#define _USE_MATH_DEFINES
#include <math.h>

#define ROUND_UP(f) ((int)((f) >= 0.0 ? (f) + 0.5F : (f)-0.5F))
Expand Down
5 changes: 4 additions & 1 deletion src/libImaging/TiffDecode.c
Original file line number Diff line number Diff line change
Expand Up @@ -973,7 +973,10 @@ ImagingLibTiffEncode(Imaging im, ImagingCodecState state, UINT8 *buffer, int byt
}

if (state->state == 1 && !clientstate->fp) {
int read = (int)_tiffReadProc(clientstate, (tdata_t)buffer, (tsize_t)bytes);
int read = (int)_tiffReadProc(
(thandle_t)clientstate,
(tdata_t)buffer,
(tsize_t)bytes);
TRACE(
("Buffer: %p: %c%c%c%c\n",
buffer,
Expand Down

0 comments on commit e43d320

Please sign in to comment.