Merge pull request #187 from manisandro/warnings

Fix compilation warnings
This commit is contained in:
Alex Clark ☺ 2013-04-12 10:34:28 -07:00
commit b8ee57f10d
4 changed files with 8 additions and 13 deletions

View File

@ -408,7 +408,6 @@ static PyObject *
SaneDev_set_auto_option(SaneDevObject *self, PyObject *args) SaneDev_set_auto_option(SaneDevObject *self, PyObject *args)
{ {
SANE_Status st; SANE_Status st;
const SANE_Option_Descriptor *d;
SANE_Int i; SANE_Int i;
int n; int n;
@ -419,7 +418,6 @@ SaneDev_set_auto_option(SaneDevObject *self, PyObject *args)
PyErr_SetString(ErrorObject, "SaneDev object is closed"); PyErr_SetString(ErrorObject, "SaneDev object is closed");
return NULL; return NULL;
} }
d=sane_get_option_descriptor(self->h, n);
st=sane_control_option(self->h, n, SANE_ACTION_SET_AUTO, st=sane_control_option(self->h, n, SANE_ACTION_SET_AUTO,
NULL, &i); NULL, &i);
if (st) {return PySane_Error(st);} if (st) {return PySane_Error(st);}

View File

@ -48,9 +48,8 @@
for the Tcl_CreateCommand command. */ for the Tcl_CreateCommand command. */
#define USE_COMPAT_CONST #define USE_COMPAT_CONST
#include "tk.h"
#include "Imaging.h" #include "Imaging.h"
#include "tk.h"
#include <stdlib.h> #include <stdlib.h>

12
_webp.c
View File

@ -20,7 +20,7 @@ PyObject* WebPEncodeRGB_wrapper(PyObject* self, PyObject* args)
return Py_None; return Py_None;
} }
PyBytes_AsStringAndSize((PyObject *) rgb_string, &rgb, &size); PyBytes_AsStringAndSize((PyObject *) rgb_string, (char**)&rgb, &size);
if (stride * height > size) { if (stride * height > size) {
Py_INCREF(Py_None); Py_INCREF(Py_None);
@ -29,7 +29,7 @@ PyObject* WebPEncodeRGB_wrapper(PyObject* self, PyObject* args)
ret_size = WebPEncodeRGB(rgb, width, height, stride, quality_factor, &output); ret_size = WebPEncodeRGB(rgb, width, height, stride, quality_factor, &output);
if (ret_size > 0) { if (ret_size > 0) {
PyObject *ret = PyBytes_FromStringAndSize(output, ret_size); PyObject *ret = PyBytes_FromStringAndSize((char*)output, ret_size);
free(output); free(output);
return ret; return ret;
} }
@ -41,7 +41,6 @@ PyObject* WebPEncodeRGB_wrapper(PyObject* self, PyObject* args)
PyObject* WebPDecodeRGB_wrapper(PyObject* self, PyObject* args) PyObject* WebPDecodeRGB_wrapper(PyObject* self, PyObject* args)
{ {
PyBytesObject *webp_string; PyBytesObject *webp_string;
float quality_factor;
int width; int width;
int height; int height;
uint8_t *webp; uint8_t *webp;
@ -54,11 +53,11 @@ PyObject* WebPDecodeRGB_wrapper(PyObject* self, PyObject* args)
return Py_None; return Py_None;
} }
PyBytes_AsStringAndSize((PyObject *) webp_string, &webp, &size); PyBytes_AsStringAndSize((PyObject *) webp_string, (char**)&webp, &size);
output = WebPDecodeRGB(webp, size, &width, &height); output = WebPDecodeRGB(webp, size, &width, &height);
ret = PyBytes_FromStringAndSize(output, width * height * 3); ret = PyBytes_FromStringAndSize((char*)output, width * height * 3);
free(output); free(output);
return Py_BuildValue("Sii", ret, width, height); return Py_BuildValue("Sii", ret, width, height);
} }
@ -90,7 +89,6 @@ PyInit__webp(void) {
PyMODINIT_FUNC PyMODINIT_FUNC
init_webp() init_webp()
{ {
PyObject* m; Py_InitModule("_webp", webpMethods);
m = Py_InitModule("_webp", webpMethods);
} }
#endif #endif

View File

@ -221,7 +221,7 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
context->extra_offset = context->extra_size; context->extra_offset = context->extra_size;
//add exif header //add exif header
if (context->rawExifLen > 0) if (context->rawExifLen > 0)
jpeg_write_marker(&context->cinfo, JPEG_APP0+1, context->rawExif, context->rawExifLen); jpeg_write_marker(&context->cinfo, JPEG_APP0+1, (unsigned char*)context->rawExif, context->rawExifLen);
break; break;
default: default:
@ -229,7 +229,7 @@ ImagingJpegEncode(Imaging im, ImagingCodecState state, UINT8* buf, int bytes)
jpeg_start_compress(&context->cinfo, TRUE); jpeg_start_compress(&context->cinfo, TRUE);
//add exif header //add exif header
if (context->rawExifLen > 0) if (context->rawExifLen > 0)
jpeg_write_marker(&context->cinfo, JPEG_APP0+1, context->rawExif, context->rawExifLen); jpeg_write_marker(&context->cinfo, JPEG_APP0+1, (unsigned char*)context->rawExif, context->rawExifLen);
break; break;
} }