Tweaks to keep the Microsoft compiler quier.
diff --git a/Modules/audioop.c b/Modules/audioop.c
index 0e95c91..003f8af 100644
--- a/Modules/audioop.c
+++ b/Modules/audioop.c
@@ -255,7 +255,7 @@
signed char *cp;
int len, size, val = 0;
int i;
- float avg = 0.0;
+ double avg = 0.0;
if ( !PyArg_Parse(args, "(s#i)", &cp, &len, &size) )
return 0;
@@ -272,7 +272,7 @@
if ( len == 0 )
val = 0;
else
- val = (int)(avg / (float)(len/size));
+ val = (int)(avg / (double)(len/size));
return PyInt_FromLong(val);
}
@@ -284,7 +284,7 @@
signed char *cp;
int len, size, val = 0;
int i;
- float sum_squares = 0.0;
+ double sum_squares = 0.0;
if ( !PyArg_Parse(args, "(s#i)", &cp, &len, &size) )
return 0;
@@ -296,12 +296,12 @@
if ( size == 1 ) val = (int)*CHARP(cp, i);
else if ( size == 2 ) val = (int)*SHORTP(cp, i);
else if ( size == 4 ) val = (int)*LONGP(cp, i);
- sum_squares += (float)val*(float)val;
+ sum_squares += (double)val*(double)val;
}
if ( len == 0 )
val = 0;
else
- val = (int)sqrt(sum_squares / (float)(len/size));
+ val = (int)sqrt(sum_squares / (double)(len/size));
return PyInt_FromLong(val);
}
@@ -498,7 +498,7 @@
int len, size, val = 0, prevval = 0, prevextremevalid = 0,
prevextreme = 0;
int i;
- float avg = 0.0;
+ double avg = 0.0;
int diff, prevdiff, extremediff, nextreme = 0;
if ( !PyArg_Parse(args, "(s#i)", &cp, &len, &size) )
@@ -544,7 +544,7 @@
if ( nextreme == 0 )
val = 0;
else
- val = (int)(avg / (float)nextreme);
+ val = (int)(avg / (double)nextreme);
return PyInt_FromLong(val);
}
diff --git a/Modules/imageop.c b/Modules/imageop.c
index 0f8e0ed..007c83e 100644
--- a/Modules/imageop.c
+++ b/Modules/imageop.c
@@ -572,7 +572,7 @@
b = (int) (((value >> 16) & 0xff) / 255. * 3. + .5);
#endif
nvalue = (r<<5) | (b<<3) | g;
- *ncp++ = nvalue;
+ *ncp++ = (unsigned char)nvalue;
}
return rv;
}
@@ -653,7 +653,7 @@
b = (value >> 16) & 0xff;
nvalue = (int)(0.30*r + 0.59*g + 0.11*b);
if ( nvalue > 255 ) nvalue = 255;
- *ncp++ = nvalue;
+ *ncp++ = (unsigned char)nvalue;
}
return rv;
}
diff --git a/Modules/signalmodule.c b/Modules/signalmodule.c
index 7ca697a..e62be1f 100644
--- a/Modules/signalmodule.c
+++ b/Modules/signalmodule.c
@@ -31,9 +31,15 @@
/* Signal module -- many thanks to Lance Ellinghaus */
+/* XXX Signals should be recorded per thread, now we have thread state. */
+
#include "Python.h"
#include "intrcheck.h"
+#ifdef MS_WIN32
+#include <process.h>
+#endif
+
#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
@@ -119,7 +125,8 @@
#endif
is_tripped++;
Handlers[sig_num].tripped = 1;
- Py_AddPendingCall((int (*) Py_PROTO((ANY *)))PyErr_CheckSignals, NULL);
+ Py_AddPendingCall(
+ (int (*) Py_PROTO((ANY *)))PyErr_CheckSignals, NULL);
#ifdef WITH_THREAD
}
#endif
diff --git a/Modules/socketmodule.c b/Modules/socketmodule.c
index 27eb313..7b73b63 100644
--- a/Modules/socketmodule.c
+++ b/Modules/socketmodule.c
@@ -417,7 +417,7 @@
if (setipaddr(host, addr) < 0)
return 0;
addr->sin_family = AF_INET;
- addr->sin_port = htons(port);
+ addr->sin_port = htons((short)port);
*addr_ret = (struct sockaddr *) addr;
*len_ret = sizeof *addr;
return 1;
@@ -516,7 +516,9 @@
BUILD_FUNC_DEF_2(PySocketSock_setblocking,PySocketSockObject*,s,PyObject*,args)
{
int block;
+#ifndef MS_WINDOWS
int delay_flag;
+#endif
if (!PyArg_GetInt(args, &block))
return NULL;
Py_BEGIN_ALLOW_THREADS