Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 13 Nov 2012 22:32:31 GMT
From:      Brooks Davis <brooks@FreeBSD.org>
To:        Perforce Change Reviews <perforce@freebsd.org>
Subject:   PERFORCE change 219773 for review
Message-ID:  <201211132232.qADMWVFR044069@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@219773?ac=10

Change 219773 by brooks@brooks_zenith on 2012/11/13 22:32:25

	Add the ability to pass in alternative read and row_callback
	functions in anticipation of capability specific versions.

Affected files ...

.. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/decode_png.c#2 edit
.. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/iboxpriv.h#2 edit
.. //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/pngbox.c#4 edit
.. //depot/projects/ctsrd/cheribsd/src/ctsrd/libexec/readpng/readpng.c#2 edit

Differences ...

==== //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/decode_png.c#2 (text+ko) ====

@@ -41,7 +41,8 @@
 static void read_png_from_fd(png_structp, png_bytep, png_size_t);
 
 void
-decode_png(struct ibox_decode_state *ids)
+decode_png(struct ibox_decode_state *ids,
+    png_rw_ptr user_read_fn, png_read_status_ptr read_row_fn)
 {
 	int bit_depth, color_type, interlace_type;
 	png_uint_32 r, width, height;
@@ -75,7 +76,10 @@
 	    read_chunk_callback);
 #endif
 
-	png_set_read_status_fn(png_ptr, read_row_callback);
+	if (read_row_fn != NULL)
+		png_set_read_status_fn(png_ptr, read_row_fn);
+	else
+		png_set_read_status_fn(png_ptr, read_row_callback);
 
 	/*
 	 * Reject the image if the parser finds a different size than
@@ -85,7 +89,10 @@
 	png_set_user_limits(png_ptr, width, height);
 #endif
 
-	png_set_read_fn(png_ptr, ids, read_png_from_fd);
+	if (user_read_fn != NULL)
+		png_set_read_fn(png_ptr, ids, user_read_fn);
+	else
+		png_set_read_fn(png_ptr, ids, read_png_from_fd);
 
 	png_read_info(png_ptr, info_ptr);
 

==== //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/iboxpriv.h#2 (text+ko) ====

@@ -38,6 +38,7 @@
 	uint32_t		*buffer;
 };
 
-void decode_png(struct ibox_decode_state *);
+void decode_png(struct ibox_decode_state *ids,
+    png_rw_ptr user_read_fn, png_read_status_ptr read_row_fn);
 
 #endif

==== //depot/projects/ctsrd/cheribsd/src/ctsrd-lib/libimagebox/pngbox.c#4 (text+ko) ====

@@ -62,7 +62,7 @@
 {
 	struct ibox_decode_state *ids = arg;
 
-	decode_png(ids);
+	decode_png(ids, NULL, NULL);
 
 	free(ids);
 

==== //depot/projects/ctsrd/cheribsd/src/ctsrd/libexec/readpng/readpng.c#2 (text+ko) ====

@@ -33,6 +33,7 @@
 #include <sys/mman.h>
 
 #include <err.h>
+#include <png.h>
 #include <stdlib.h>
 
 #include "imagebox.h"
@@ -58,6 +59,6 @@
 	    PROT_READ | PROT_WRITE, MAP_SHARED, bfd, 0)) == MAP_FAILED)
 		err(1, "mmap buffer");
 
-	decode_png(&ids);
+	decode_png(&ids, NULL, NULL);
 	return (0);
 }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201211132232.qADMWVFR044069>