]> mj.ucw.cz Git - libucw.git/blobdiff - images/io-libpng.c
Released as 6.5.16.
[libucw.git] / images / io-libpng.c
index 2095065f189a9c4a198697b3c90081d230a627b2..e39c8b7efd112128daadadae5cc2d31397705462 100644 (file)
@@ -9,13 +9,13 @@
 
 #undef LOCAL_DEBUG
 
-#include "lib/lib.h"
-#include "lib/mempool.h"
-#include "lib/fastbuf.h"
-#include "images/images.h"
-#include "images/error.h"
-#include "images/color.h"
-#include "images/io-main.h"
+#include <ucw/lib.h>
+#include <ucw/mempool.h>
+#include <ucw/fastbuf.h>
+#include <images/images.h>
+#include <images/error.h>
+#include <images/color.h>
+#include <images/io-main.h>
 
 #include <png.h>
 #include <setjmp.h>
@@ -33,7 +33,7 @@ struct libpng_read_data {
 static png_voidp
 libpng_malloc(png_structp png_ptr, png_size_t size)
 {
-  DBG("libpng_malloc(size=%u)", (uns)size);
+  DBG("libpng_malloc(size=%u)", (uint)size);
   return mp_alloc(png_get_mem_ptr(png_ptr), size);
 }
 
@@ -68,7 +68,7 @@ libpng_warning(png_structp png_ptr UNUSED, png_const_charp msg UNUSED)
 static void
 libpng_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
 {
-  DBG("libpng_read_fn(len=%u)", (uns)length);
+  DBG("libpng_read_fn(len=%u)", (uint)length);
   if (unlikely(bread((struct fastbuf *)png_get_io_ptr(png_ptr), (byte *)data, length) < length))
     png_error(png_ptr, "Incomplete data");
 }
@@ -76,7 +76,7 @@ libpng_read_fn(png_structp png_ptr, png_bytep data, png_size_t length)
 static void
 libpng_write_fn(png_structp png_ptr, png_bytep data, png_size_t length)
 {
-  DBG("libpng_write_fn(len=%u)", (uns)length);
+  DBG("libpng_write_fn(len=%u)", (uint)length);
   bwrite((struct fastbuf *)png_get_io_ptr(png_ptr), (byte *)data, length);
 }
 
@@ -200,8 +200,8 @@ libpng_read_data(struct image_io *io)
       return 0;
     }
 
-  uns read_flags = io->flags;
-  
+  uint read_flags = io->flags;
+
   /* Apply transformations */
   if (rd->bit_depth == 16)
     png_set_strip_16(rd->png_ptr);
@@ -254,7 +254,7 @@ libpng_read_data(struct image_io *io)
              read_flags = (read_flags & IMAGE_CHANNELS_FORMAT) | IMAGE_ALPHA;
            else
               png_set_strip_alpha(rd->png_ptr);
-         }  
+         }
        break;
       case PNG_COLOR_TYPE_RGB:
        if ((read_flags & IMAGE_COLOR_SPACE) == COLOR_SPACE_GRAYSCALE)
@@ -291,7 +291,7 @@ libpng_read_data(struct image_io *io)
   struct image *img = rdi.image;
   byte *pixels = img->pixels;
   png_bytep rows[img->rows];
-  for (uns r = 0; r < img->rows; r++, pixels += img->row_size)
+  for (uint r = 0; r < img->rows; r++, pixels += img->row_size)
     rows[r] = (png_bytep)pixels;
   png_read_image(rd->png_ptr, rows);
   png_read_end(rd->png_ptr, rd->end_ptr);
@@ -371,7 +371,7 @@ libpng_write(struct image_io *io)
   /* Write pixels */
   byte *pixels = img->pixels;
   png_bytep rows[img->rows];
-  for (uns r = 0; r < img->rows; r++, pixels += img->row_size)
+  for (uint r = 0; r < img->rows; r++, pixels += img->row_size)
     rows[r] = (png_bytep)pixels;
   png_write_image(png_ptr, rows);
   png_write_end(png_ptr, info_ptr);