Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit a439191

Browse files
committed
Fix some warnings from MSVC
1 parent 35b40c6 commit a439191

4 files changed

Lines changed: 4 additions & 7 deletions

File tree

Modules/_ctypes/_ctypes.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3067,7 +3067,7 @@ static PyGetSetDef PyCFuncPtr_getsets[] = {
30673067
};
30683068

30693069
#ifdef MS_WIN32
3070-
static PPROC FindAddress(void *handle, char *name, PyObject *type)
3070+
static PPROC FindAddress(void *handle, const char *name, PyObject *type)
30713071
{
30723072
#ifdef MS_WIN64
30733073
/* win64 has no stdcall calling conv, so it should

Modules/_decimal/libmpdec/vccompat.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,6 @@
4848
#undef strtoll
4949
#define strtoll _strtoi64
5050
#define strdup _strdup
51-
#define PRIi64 "I64i"
52-
#define PRIu64 "I64u"
53-
#define PRIi32 "I32i"
54-
#define PRIu32 "I32u"
5551
#endif
5652

5753

Modules/audioop.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
#define PY_SSIZE_T_CLEAN
55

66
#include "Python.h"
7+
#include <inttypes.h>
78

89
typedef short PyInt16;
910

@@ -448,7 +449,7 @@ audioop_max_impl(PyObject *module, Py_buffer *fragment, int width)
448449
int val = GETRAWSAMPLE(width, fragment->buf, i);
449450
/* Cast to unsigned before negating. Unsigned overflow is well-
450451
defined, but signed overflow is not. */
451-
if (val < 0) absval = -(unsigned int)val;
452+
if (val < 0) absval = (unsigned int)-(int64_t)val;
452453
else absval = val;
453454
if (absval > max) max = absval;
454455
}

Programs/_freeze_importlib.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ main(int argc, char *argv[])
5858
fprintf(stderr, "cannot fstat '%s'\n", inpath);
5959
goto error;
6060
}
61-
text_size = status.st_size;
61+
text_size = (size_t)status.st_size;
6262
text = (char *) malloc(text_size + 1);
6363
if (text == NULL) {
6464
fprintf(stderr, "could not allocate %ld bytes\n", (long) text_size);

0 commit comments

Comments
 (0)