misc: clean up use of exit() in the backends.

This commit is contained in:
Solomon Peachy 2013-07-19 09:53:05 -04:00
parent 660cd2f3b0
commit 4598c5cd6b
3 changed files with 9 additions and 9 deletions

View file

@ -305,7 +305,7 @@ static int kodak1400_read_parse(void *vctx, int data_fd) {
ctx->hdr.hdr[2] != 'H' ||
ctx->hdr.hdr[3] != 'D') {
ERROR("Unrecognized data format!\n");
exit(1);
return 1;
}
ctx->hdr.planesize = le32_to_cpu(ctx->hdr.planesize);
ctx->hdr.rows = le16_to_cpu(ctx->hdr.rows);
@ -317,7 +317,7 @@ static int kodak1400_read_parse(void *vctx, int data_fd) {
ctx->plane_b = malloc(ctx->hdr.planesize);
if (!ctx->plane_r || !ctx->plane_g || !ctx->plane_b) {
ERROR("Memory allocation failure!\n");
exit(1);
return 1;
}
for (i = 0 ; i < ctx->hdr.rows ; i++) {
int j;
@ -339,7 +339,7 @@ static int kodak1400_read_parse(void *vctx, int data_fd) {
ret, remain, ctx->hdr.columns,
i, ctx->hdr.rows, j);
perror("ERROR: Read failed");
exit(1);
return ret;
}
ptr += ret;
remain -= ret;

View file

@ -357,7 +357,7 @@ static int kodak6800_read_parse(void *vctx, int data_fd) {
ERROR("Read failed (%d/%d/%d)\n",
ret, remain, ctx->datalen);
perror("ERROR: Read failed");
exit(1);
return ret;
}
ptr += ret;
remain -= ret;

View file

@ -1171,14 +1171,14 @@ static int shinkos2145_read_parse(void *vctx, int data_fd) {
le32_to_cpu(ctx->hdr.len2) != 0x64 ||
le32_to_cpu(ctx->hdr.dpi) != 300) {
ERROR("Unrecognized header data format!\n");
exit(1);
return 1;
}
ctx->datalen = le32_to_cpu(ctx->hdr.rows) * le32_to_cpu(ctx->hdr.columns) * 3;
ctx->databuf = malloc(ctx->datalen);
if (!ctx->databuf) {
ERROR("Memory allocation failure!\n");
exit(1);
return 1;
}
{
@ -1190,7 +1190,7 @@ static int shinkos2145_read_parse(void *vctx, int data_fd) {
ERROR("Read failed (%d/%d/%d)\n",
ret, remain, ctx->datalen);
perror("ERROR: Read failed");
exit(1);
return ret;
}
ptr += ret;
remain -= ret;
@ -1203,14 +1203,14 @@ static int shinkos2145_read_parse(void *vctx, int data_fd) {
ERROR("Read failed (%d/%d/%d)\n",
ret, 4, 4);
perror("ERROR: Read failed");
exit(1);
return ret;
}
if (tmpbuf[0] != 0x04 ||
tmpbuf[1] != 0x03 ||
tmpbuf[2] != 0x02 ||
tmpbuf[3] != 0x01) {
ERROR("Unrecognized footer data format!\n");
exit(1);
return 1;
}
return 0;