-#include "image.h"
+#include "imager.h"
#include "log.h"
#include "iolayer.h"
+#include "imageri.h"
#include <stdlib.h>
#include <errno.h>
/*
-=item gnext(mbuf *mb)
+=item gpeek(mbuf *mb)
Fetches a character but does NOT advance. Returns a pointer to
the byte or NULL on failure (internal).
/*
-=item skip_spaces(mb)
+=item skip_comment(mb)
Advances in stream over whitespace and a comment if one is found. (internal)
i_clear_error();
- /* char *pp; */
-
mm_log((1,"i_readpnm(ig %p, length %d)\n", ig, length));
- /*
- pp = mymalloc(20);
-
- pp[-1]= 'c';
- pp[-2]= 'c';
-
- bndcheck_all();
-
- myfree(pp);
-
- mm_log((1, "Hack is exiting\n"));
-
-*/
-
io_glue_commit_types(ig);
init_buf(&buf, ig);
channels = (type == 3 || type == 6) ? 3:1;
pcount = width*height*channels;
+ if (!i_int_check_image_file_limits(width, height, channels, sizeof(i_sample_t))) {
+ mm_log((1, "i_readpnm: image size exceeds limits\n"));
+ return NULL;
+ }
+
mm_log((1, "i_readpnm: (%d x %d), channels = %d, maxval = %d\n", width, height, channels, maxval));
im = i_img_empty_ch(NULL, width, height, channels);
i_writeppm_wiol(i_img *im, io_glue *ig) {
char header[255];
int rc;
- writep write_func;
mm_log((1,"i_writeppm(im %p, ig %p)\n", im, ig));
i_clear_error();
unsigned char *data = mymalloc(3 * im->xsize);
if (data != NULL) {
int y = 0;
- int x, ch;
- unsigned char *p;
static int rgb_chan[3] = { 0, 1, 2 };
rc = 0;
unsigned char *data = mymalloc(im->xsize);
if (data != NULL) {
int y = 0;
- int x, ch;
int chan = 0;
- unsigned char *p;
rc = 0;
while (y < im->ysize && rc >= 0) {