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

Test MSVC warnings #26

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/problem-matchers/msvc.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
{
"__comment": "Based on vscode's vs/workbench/contrib/tasks/common/problemMatcher.ts msCompile rule",
"problemMatcher": [
{
"owner": "msvc-problem-matcher",
"pattern": [
{
"regexp": "^\\s*(?:\\d+\\>)?(\\S.*)\\((\\d+),?(\\d+)?(?:,\\d+,\\d+)?\\)\\s*:\\s+((?:fatal +)?error|warning|info)\\s+((?!C4244|C4267)\\w+\\d+)\\s*:\\s*(.*)$",
"file": 1,
"line": 2,
"column": 3,
"severity": 4,
"code": 5,
"message": 6
}
]
}
]
}
4 changes: 4 additions & 0 deletions .github/workflows/test-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,10 @@ jobs:
run: rmdir /S /Q winbuild\build\src
shell: cmd

- name: Register MSVC problem matcher
if: "matrix.python-version == '3.12'"
run: echo "::add-matcher::.github/problem-matchers/msvc.json"

- name: Build Pillow
run: |
$FLAGS="-C raqm=vendor -C fribidi=vendor"
Expand Down
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
2 changes: 1 addition & 1 deletion src/libImaging/QuantPngQuant.c
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ const char *
ImagingImageQuantVersion(void) {
static char version[20];
int number = liq_version();
sprintf(version, "%d.%d.%d", number / 10000, (number / 100) % 100, number % 100);
snprintf(version, 20, "%d.%d.%d", number / 10000, (number / 100) % 100, number % 100);
return version;
}

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
Loading