Преглед изворни кода

r.thin: avoid integer overflow, continued

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@74444 15284696-431f-4ddb-bdfa-cd5b030d7da7
Markus Metz пре 6 година
родитељ
комит
6c54732af7
2 измењених фајлова са 3 додато и 4 уклоњено
  1. 1 1
      raster/r.thin/local_proto.h
  2. 2 3
      raster/r.thin/thin_lines.c

+ 1 - 1
raster/r.thin/local_proto.h

@@ -11,4 +11,4 @@ int map_size(int *, int *, int *);
 
 /* thin_lines.c */
 int thin_lines(int);
-char encode_neighbours(CELL *, CELL *, CELL *, int, int);
+unsigned char encode_neighbours(CELL *, CELL *, CELL *, int, int);

+ 2 - 3
raster/r.thin/thin_lines.c

@@ -36,8 +36,7 @@ int thin_lines(int iterations)
 {
     int j, i, col, deleted, row;
     CELL *row_buf, *new_med, *med, *bottom, *top, *get_a_row();
-    char W, N_W;
-    unsigned char Templ[8], N_Templ[8];
+    unsigned char W, N_W, Templ[8], N_Templ[8];
 
     map_size(&n_rows, &n_cols, &pad_size);
     box_right = box_bottom = 0;
@@ -183,7 +182,7 @@ int thin_lines(int iterations)
  * 3 4 5
  */
 
-char
+unsigned char
 encode_neighbours(CELL * top, CELL * middle, CELL * bottom, int col, int neg)
 {
     char T;