Fix GCC signed-unsigned and pointer-warnings (#1608)
* Fix GCC signed-unsigned and pointer-warnings A lot of the signed/unsigned issues are related to the fact that I converted a lot of indexing values to use unsigned types, little did I know that a lot of other values used when indexing actually come from the python-end. Python does not have built-in unsigned types so all integers coming from Python are signed implicitly so a lot of things like image-size and x, y coordiantes are specially handling negative-integer cases. Guess we'll just take our `int32_t i = 0; i < blah; ++i` and like it. Code now compiles with no warnings or nagging.
This commit is contained in:
@@ -113,7 +113,8 @@ alpha_over_full(PyObject* dest, PyObject* src, PyObject* mask, float overall_alp
|
|||||||
/* source position */
|
/* source position */
|
||||||
int32_t sx, sy;
|
int32_t sx, sy;
|
||||||
/* iteration variables */
|
/* iteration variables */
|
||||||
uint32_t x, y, i;
|
int32_t x, y;
|
||||||
|
uint32_t i;
|
||||||
/* temporary calculation variables */
|
/* temporary calculation variables */
|
||||||
int32_t tmp1, tmp2, tmp3;
|
int32_t tmp1, tmp2, tmp3;
|
||||||
/* integer [0, 255] version of overall_alpha */
|
/* integer [0, 255] version of overall_alpha */
|
||||||
@@ -289,7 +290,7 @@ tint_with_mask(PyObject* dest,
|
|||||||
/* source position */
|
/* source position */
|
||||||
int32_t sx, sy;
|
int32_t sx, sy;
|
||||||
/* iteration variables */
|
/* iteration variables */
|
||||||
uint32_t x, y;
|
int32_t x, y;
|
||||||
/* temporary calculation variables */
|
/* temporary calculation variables */
|
||||||
int32_t tmp1, tmp2;
|
int32_t tmp1, tmp2;
|
||||||
|
|
||||||
@@ -517,7 +518,7 @@ resize_half(PyObject* dest, PyObject* src) {
|
|||||||
/* temp color variables */
|
/* temp color variables */
|
||||||
uint32_t r, g, b, a;
|
uint32_t r, g, b, a;
|
||||||
/* size values for source and destination */
|
/* size values for source and destination */
|
||||||
int32_t src_width, src_height, dest_width, dest_height;
|
uint32_t src_width, src_height, dest_width, dest_height;
|
||||||
|
|
||||||
imDest = imaging_python_to_c(dest);
|
imDest = imaging_python_to_c(dest);
|
||||||
imSrc = imaging_python_to_c(src);
|
imSrc = imaging_python_to_c(src);
|
||||||
|
|||||||
@@ -18,8 +18,8 @@
|
|||||||
#include "../overviewer.h"
|
#include "../overviewer.h"
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t min;
|
int32_t min;
|
||||||
uint32_t max;
|
int32_t max;
|
||||||
} PrimitiveDepth;
|
} PrimitiveDepth;
|
||||||
|
|
||||||
static bool
|
static bool
|
||||||
|
|||||||
@@ -241,7 +241,7 @@ do_shading_with_mask(RenderPrimitiveLighting* self, RenderState* state,
|
|||||||
tint_with_mask(state->img, r, g, b, 255, mask, state->imgx, state->imgy, 0, 0);
|
tint_with_mask(state->img, r, g, b, 255, mask, state->imgx, state->imgy, 0, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t
|
static bool
|
||||||
lighting_start(void* data, RenderState* state, PyObject* support) {
|
lighting_start(void* data, RenderState* state, PyObject* support) {
|
||||||
RenderPrimitiveLighting* self;
|
RenderPrimitiveLighting* self;
|
||||||
self = (RenderPrimitiveLighting*)data;
|
self = (RenderPrimitiveLighting*)data;
|
||||||
|
|||||||
@@ -146,7 +146,7 @@ overlay_biomes_start(void* data, RenderState* state, PyObject* support) {
|
|||||||
for (i = 0; i < biomes_size; i++) {
|
for (i = 0; i < biomes_size; i++) {
|
||||||
PyObject* biome = PyList_GET_ITEM(opt, i);
|
PyObject* biome = PyList_GET_ITEM(opt, i);
|
||||||
char* tmpname = NULL;
|
char* tmpname = NULL;
|
||||||
int32_t j = 0;
|
uint32_t j = 0;
|
||||||
|
|
||||||
if (!PyArg_ParseTuple(biome, "s(bbb)", &tmpname, &(biomes[i].r), &(biomes[i].g), &(biomes[i].b))) {
|
if (!PyArg_ParseTuple(biome, "s(bbb)", &tmpname, &(biomes[i].r), &(biomes[i].g), &(biomes[i].b))) {
|
||||||
free(biomes);
|
free(biomes);
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ static void get_color(void* data, RenderState* state,
|
|||||||
*a = self->color->a;
|
*a = self->color->a;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t
|
static bool
|
||||||
overlay_start(void* data, RenderState* state, PyObject* support) {
|
overlay_start(void* data, RenderState* state, PyObject* support) {
|
||||||
PyObject* opt = NULL;
|
PyObject* opt = NULL;
|
||||||
OverlayColor* color = NULL;
|
OverlayColor* color = NULL;
|
||||||
|
|||||||
Reference in New Issue
Block a user