comparison tools/lib64gfx.c @ 1548:20cd589366d7

Check C64 bitmap format flags in encode/decode functions.
author Matti Hamalainen <ccr@tnsp.org>
date Sat, 12 May 2018 21:05:52 +0300
parents 69fa95707e65
children 86373ac0861a
comparison
equal deleted inserted replaced
1547:fa4fa9a6e78f 1548:20cd589366d7
1021 1021
1022 if (loadOffs >= len) 1022 if (loadOffs >= len)
1023 return DMERR_INVALID_ARGS; 1023 return DMERR_INVALID_ARGS;
1024 1024
1025 if (*fmt == NULL) 1025 if (*fmt == NULL)
1026 return DMERR_INVALID_DATA; 1026 return DMERR_NOT_SUPPORTED;
1027
1028 if (((*fmt)->flags & DM_FMT_RD) == 0)
1029 return DMERR_NOT_SUPPORTED;
1027 1030
1028 // Allocate memory 1031 // Allocate memory
1029 if ((*img = dmC64ImageAlloc(*fmt)) == NULL) 1032 if ((*img = dmC64ImageAlloc(*fmt)) == NULL)
1030 return DMERR_MALLOC; 1033 return DMERR_MALLOC;
1031 1034
1074 int res; 1077 int res;
1075 1078
1076 if (img == NULL || fmt == NULL) 1079 if (img == NULL || fmt == NULL)
1077 return DMERR_NULLPTR; 1080 return DMERR_NULLPTR;
1078 1081
1082 if ((fmt->flags & DM_FMT_WR) == 0)
1083 return DMERR_NOT_SUPPORTED;
1084
1079 // Allocate a buffer 1085 // Allocate a buffer
1080 if ((res = dmGrowBufAlloc(buf, BUF_SIZE_INITIAL, BUF_SIZE_GROW)) != DMERR_OK) 1086 if ((res = dmGrowBufAlloc(buf, BUF_SIZE_INITIAL, BUF_SIZE_GROW)) != DMERR_OK)
1081 goto err; 1087 goto err;
1082 1088
1083 // Add the loading address 1089 // Add the loading address