comparison lib64gfx.c @ 517:e2a76bb59888

Return better error values, using DMERR_* enums.
author Matti Hamalainen <ccr@tnsp.org>
date Mon, 19 Nov 2012 17:24:41 +0200
parents 6f141f760c54
children 63849f85db57
comparison
equal deleted inserted replaced
516:6f141f760c54 517:e2a76bb59888
68 { 68 {
69 int yc, widthpx = width * 8; 69 int yc, widthpx = width * 8;
70 Uint8 *dp; 70 Uint8 *dp;
71 71
72 if (img == NULL) 72 if (img == NULL)
73 return -1; 73 return DMERR_NULLPTR;
74 if (xoffs < 0 || yoffs < 0) 74
75 return -2; 75 if (xoffs < 0 || yoffs < 0 ||
76 if (xoffs > img->width - widthpx || 76 xoffs > img->width - widthpx ||
77 yoffs > img->height - height) 77 yoffs > img->height - height)
78 return -3; 78 return DMERR_INVALID_ARGS;
79 79
80 dp = img->data + (yoffs * img->pitch) + xoffs; 80 dp = img->data + (yoffs * img->pitch) + xoffs;
81 81
82 if (multicolor) 82 if (multicolor)
83 { 83 {
119 119
120 dp += img->pitch; 120 dp += img->pitch;
121 } 121 }
122 } 122 }
123 123
124 return 0; 124 return DMERR_OK;
125 } 125 }
126 126
127 127
128 static int fmtProbeDrazPaint20Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt) 128 static int fmtProbeDrazPaint20Packed(const Uint8 *buf, const size_t len, const DMC64ImageFormat *fmt)
129 { 129 {
632 632
633 case DM_C64IFMT_MC_ILACE: 633 case DM_C64IFMT_MC_ILACE:
634 return dmC64ConvertLaceMultiColorBMP(dst, src); 634 return dmC64ConvertLaceMultiColorBMP(dst, src);
635 635
636 default: 636 default:
637 return -1; 637 return DMERR_NOT_SUPPORTED;
638 } 638 }
639 } 639 }
640 640
641 641
642 642