chiark / gitweb /
constify CanonImage->rgb and make a copy in find_islandname
[ypp-sc-tools.db-test.git] / pctb / structure.h
index ec7b4bf5b2490411141b66eb2e996d0423b80fe3..84fdcae2e2a1fb75c004634301b008e4c859cba4 100644 (file)
@@ -61,14 +61,15 @@ static inline char canon_lookup_colour(unsigned char r,
      * each pixel in reading order.                            \
      */                                                                \
     (im)= alloc_canon_image((w), (h));                         \
-    (im)->rgb= alloc_rgb_image((w), (h));                      \
+    RgbImage *rgb_save;                                                \
+    (im)->rgb= rgb_save= alloc_rgb_image((w), (h));            \
                                                                \
     int x,y;                                                   \
     for (y=0; y<(h); y++) {                                    \
       for (x=0; x<(w); x++) {                                  \
         unsigned char r,g,b;                                   \
        COMPUTE_RGB;                                            \
-        CANONIMG_ALSO_STORERGB((im)->rgb);                     \
+        CANONIMG_ALSO_STORERGB(rgb_save);                      \
        (im)->d[y*(w) + x]= canon_lookup_colour(r,g,b);         \
       }                                                                \
       if (DEBUGP(rect)) {                                      \