Skip to content

Commit

Permalink
Fix implicit signedness conversion between pointers of integer types (O…
Browse files Browse the repository at this point in the history
…SGeo#1265)

Addresses -Wpointer-sign compiler warnings.
  • Loading branch information
nilason authored and ninsbl committed Feb 17, 2023
1 parent 5252d09 commit f212d3f
Show file tree
Hide file tree
Showing 10 changed files with 15 additions and 14 deletions.
2 changes: 1 addition & 1 deletion lib/cairodriver/read_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ static int read_bmp_header(const unsigned char *p)

void cairo_read_bmp(void)
{
char header[HEADER_SIZE];
unsigned char header[HEADER_SIZE];
FILE *input;

input = fopen(ca.file_name, "rb");
Expand Down
4 changes: 2 additions & 2 deletions lib/cairodriver/text.c
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ static void set_font_fc(const char *name)
face = NULL;
}

pattern = FcNameParse(name);
pattern = FcNameParse((FcChar8 *)name);
FcDefaultSubstitute(pattern);
FcConfigSubstitute(FcConfigGetCurrent(), pattern, FcMatchPattern);
pattern = FcFontMatch(FcConfigGetCurrent(), pattern, &result);
Expand Down Expand Up @@ -223,7 +223,7 @@ static void font_list_fc(char ***list, int *count, int verbose)
for (i = 0; i < fontset->nfont; i++) {
char buf[1024];
FcPattern *pat = fontset->fonts[i];
FcChar8 *family = "", *style = "";
FcChar8 *family = (FcChar8 *)"", *style = (FcChar8 *)"";

FcPatternGetString(pat, FC_FAMILY, 0, &family);
FcPatternGetString(pat, FC_STYLE , 0, &style );
Expand Down
2 changes: 1 addition & 1 deletion lib/cairodriver/write_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ static void make_bmp_header(unsigned char *p)

void cairo_write_bmp(void)
{
char header[HEADER_SIZE];
unsigned char header[HEADER_SIZE];
FILE *output;

output = fopen(ca.file_name, "wb");
Expand Down
4 changes: 2 additions & 2 deletions lib/dspf/cube_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ int read_cube(Cube_data * Cube, file_info * headfax)
int t_cnt;
int ret;
int i, j, size;
unsigned char inchar;
char inchar;
poly_info *Poly_info;
static int first = 1;
FILE *fp;
Expand Down Expand Up @@ -193,7 +193,7 @@ int read_cube(Cube_data * Cube, file_info * headfax)
my_fread(&inchar, 1, 1, fp);
size |= inchar;

if (0 >= (ret = my_fread(Buffer, 1, size, fp))) {
if (0 >= (ret = my_fread((char *)Buffer, 1, size, fp))) {
fprintf(stderr, "Error reading display file offset %"PRI_OFF_T"\n", G_ftell(fp));
return (-1);
}
Expand Down
6 changes: 3 additions & 3 deletions lib/ogsf/gvl_calc.c
Original file line number Diff line number Diff line change
Expand Up @@ -738,9 +738,9 @@ void gvl_write_char(int pos, unsigned char **data, unsigned char c)
{
/* check to need allocation memory */
if ((pos % BUFFER_SIZE) == 0) {
*data = (char *)G_realloc(*data,
sizeof(char) * ((pos / BUFFER_SIZE) +
1) * BUFFER_SIZE);
*data = G_realloc(*data,
sizeof(char) * ((pos / BUFFER_SIZE) +
1) * BUFFER_SIZE);
if (!(*data)) {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion lib/pngdriver/draw_bitmap.c
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ void PNG_draw_bitmap(int ncols, int nrows, int threshold,
int x = cur_x + i;
unsigned int k = buf[j * ncols + i];
unsigned int *p = &png.grid[y * png.width + x];
unsigned int a0, r0, g0, b0;
int a0, r0, g0, b0;
unsigned int a, r, g, b;

png_get_pixel(*p, &r0, &g0, &b0, &a0);
Expand Down
2 changes: 1 addition & 1 deletion lib/pngdriver/read_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ static int read_bmp_header(const unsigned char *p)

void read_bmp(void)
{
char header[HEADER_SIZE];
unsigned char header[HEADER_SIZE];
FILE *input;
int x, y;
unsigned int *p;
Expand Down
2 changes: 1 addition & 1 deletion lib/pngdriver/write_bmp.c
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ static void make_bmp_header(unsigned char *p)

void write_bmp(void)
{
char header[HEADER_SIZE];
unsigned char header[HEADER_SIZE];
FILE *output;
int x, y;
unsigned int *p;
Expand Down
2 changes: 1 addition & 1 deletion lib/raster3d/index.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ static int Rast3d_readIndex(RASTER3D_Map * map)
return 0;
}

Rast3d_rle_decode(tmp2, tmp, map->indexLongNbytes * map->nTiles, 1,
Rast3d_rle_decode((char *)tmp2, (char *)tmp, map->indexLongNbytes * map->nTiles, 1,
&dummy1, &dummy2);

if (indexLength > sizeof(long) * map->nTiles)
Expand Down
3 changes: 2 additions & 1 deletion lib/raster3d/open.c
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,8 @@ void *Rast3d_open_cell_old(const char *name, const char *mapset,
int rows, cols, depths, precision;
double ew_res, ns_res, tb_res;
int nofHeaderBytes, dataOffset, useXdr, hasIndex;
char *ltmp, *unit;
char *unit;
unsigned char *ltmp;
int vertical_unit;
int version;
double north, south, east, west, top, bottom;
Expand Down

0 comments on commit f212d3f

Please sign in to comment.