+
+ if (maxval == 0) {
+ i_push_error(0, "maxval is zero - invalid pnm file");
+ mm_log((1, "i_readpnm: maxval is zero, invalid pnm file\n"));
+ return NULL;
+ }
+ else if (maxval > 65535) {
+ i_push_errorf(0, "maxval of %d is over 65535 - invalid pnm file",
+ maxval);
+ mm_log((1, "i_readpnm: maxval of %d is over 65535 - invalid pnm file\n"));
+ return NULL;
+ }
+ else if (type >= 4 && maxval > 255) {
+ i_push_errorf(0, "maxval of %d is over 255 - not currently supported by Imager for binary pnm", maxval);
+ mm_log((1, "i_readpnm: maxval of %d is over 255 - not currently supported by Imager for binary pnm\n", maxval));
+ return NULL;
+ }