static int tfax_put_params(gx_device * dev, gs_param_list * plist) { gx_device_tfax *const tfdev = (gx_device_tfax *)dev; int ecode = 0; int code; long mss = tfdev->MaxStripSize; int fill_order = tfdev->FillOrder; const char *param_name; bool big_endian = tfdev->BigEndian; uint16 compr = tfdev->Compression; gs_param_string comprstr; switch (code = param_read_long(plist, (param_name = "MaxStripSize"), &mss)) { case 0: /* * Strip must be large enough to accommodate a raster line. * If the max strip size is too small, we still write a single * line per strip rather than giving an error. */ if (mss >= 0) break; code = gs_error_rangecheck; default: ecode = code; param_signal_error(plist, param_name, ecode); case 1: break; } /* Following TIFF spec, FillOrder is integer */ switch (code = param_read_int(plist, (param_name = "FillOrder"), &fill_order)) { case 0: if (fill_order == 1 || fill_order == 2) break; code = gs_error_rangecheck; default: ecode = code; param_signal_error(plist, param_name, ecode); case 1: break; } /* Read BigEndian option as bool */ switch (code = param_read_bool(plist, (param_name = "BigEndian"), &big_endian)) { default: ecode = code; param_signal_error(plist, param_name, ecode); case 0: case 1: break; } /* Read Compression */ switch (code = param_read_string(plist, (param_name = "Compression"), &comprstr)) { case 0: if ((ecode = tiff_compression_id(&compr, &comprstr)) < 0 || !tiff_compression_allowed(compr, dev->color_info.depth)) param_signal_error(plist, param_name, ecode); break; case 1: break; default: ecode = code; param_signal_error(plist, param_name, ecode); } if (ecode < 0) return ecode; code = gdev_fax_put_params(dev, plist); if (code < 0) return code; tfdev->MaxStripSize = mss; tfdev->FillOrder = fill_order; tfdev->BigEndian = big_endian; tfdev->Compression = compr; return code; }
static int tfax_put_params(gx_device * dev, gs_param_list * plist) { gx_device_tfax *const tfdev = (gx_device_tfax *)dev; int ecode = 0; int code; long mss = tfdev->MaxStripSize; int fill_order = tfdev->FillOrder; const char *param_name; bool big_endian = tfdev->BigEndian; bool usebigtiff = tfdev->UseBigTIFF; bool write_datetime = tfdev->write_datetime; uint16 compr = tfdev->Compression; gs_param_string comprstr; switch (code = param_read_long(plist, (param_name = "MaxStripSize"), &mss)) { case 0: /* * Strip must be large enough to accommodate a raster line. * If the max strip size is too small, we still write a single * line per strip rather than giving an error. */ if (mss >= 0) break; code = gs_error_rangecheck; default: ecode = code; param_signal_error(plist, param_name, ecode); case 1: break; } /* Following TIFF spec, FillOrder is integer */ switch (code = param_read_int(plist, (param_name = "FillOrder"), &fill_order)) { case 0: if (fill_order == 1 || fill_order == 2) break; code = gs_error_rangecheck; default: ecode = code; param_signal_error(plist, param_name, ecode); case 1: break; } /* Read BigEndian option as bool */ switch (code = param_read_bool(plist, (param_name = "BigEndian"), &big_endian)) { default: ecode = code; param_signal_error(plist, param_name, ecode); case 0: case 1: break; } /* Read UseBigTIFF option as bool */ switch (code = param_read_bool(plist, (param_name = "UseBigTIFF"), &usebigtiff)) { default: ecode = code; param_signal_error(plist, param_name, ecode); case 0: case 1: break; } #if !(TIFFLIB_VERSION >= 20111221) if (usebigtiff) dmlprintf(dev->memory, "Warning: this version of libtiff does not support BigTIFF, ignoring parameter\n"); usebigtiff = false; #endif switch (code = param_read_bool(plist, (param_name = "TIFFDateTime"), &write_datetime)) { default: ecode = code; param_signal_error(plist, param_name, ecode); case 0: case 1: break; } /* Read Compression */ switch (code = param_read_string(plist, (param_name = "Compression"), &comprstr)) { case 0: if ((ecode = tiff_compression_id(&compr, &comprstr)) < 0 || !tiff_compression_allowed(compr, dev->color_info.depth)) param_signal_error(plist, param_name, ecode); break; case 1: break; default: ecode = code; param_signal_error(plist, param_name, ecode); } if (ecode < 0) return ecode; code = gdev_fax_put_params(dev, plist); if (code < 0) return code; tfdev->MaxStripSize = mss; tfdev->FillOrder = fill_order; tfdev->BigEndian = big_endian; tfdev->UseBigTIFF = usebigtiff; tfdev->Compression = compr; return code; }