0

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:
Wunkolo
2019-07-12 06:26:45 -07:00
committed by Nicolas F
parent 221b2c6805
commit 4298aea569
6 changed files with 11 additions and 10 deletions

View File

@@ -113,7 +113,8 @@ alpha_over_full(PyObject* dest, PyObject* src, PyObject* mask, float overall_alp
/* source position */
int32_t sx, sy;
/* iteration variables */
uint32_t x, y, i;
int32_t x, y;
uint32_t i;
/* temporary calculation variables */
int32_t tmp1, tmp2, tmp3;
/* integer [0, 255] version of overall_alpha */
@@ -289,7 +290,7 @@ tint_with_mask(PyObject* dest,
/* source position */
int32_t sx, sy;
/* iteration variables */
uint32_t x, y;
int32_t x, y;
/* temporary calculation variables */
int32_t tmp1, tmp2;
@@ -517,7 +518,7 @@ resize_half(PyObject* dest, PyObject* src) {
/* temp color variables */
uint32_t r, g, b, a;
/* 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);
imSrc = imaging_python_to_c(src);

View File

@@ -18,8 +18,8 @@
#include "../overviewer.h"
typedef struct {
uint32_t min;
uint32_t max;
int32_t min;
int32_t max;
} PrimitiveDepth;
static bool

View File

@@ -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);
}
static int32_t
static bool
lighting_start(void* data, RenderState* state, PyObject* support) {
RenderPrimitiveLighting* self;
self = (RenderPrimitiveLighting*)data;

View File

@@ -146,7 +146,7 @@ overlay_biomes_start(void* data, RenderState* state, PyObject* support) {
for (i = 0; i < biomes_size; i++) {
PyObject* biome = PyList_GET_ITEM(opt, i);
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))) {
free(biomes);

View File

@@ -28,7 +28,7 @@ static void get_color(void* data, RenderState* state,
*a = self->color->a;
}
static int32_t
static bool
overlay_start(void* data, RenderState* state, PyObject* support) {
PyObject* opt = NULL;
OverlayColor* color = NULL;