# HG changeset patch # User Matti Hamalainen # Date 1560221062 -10800 # Node ID 4c3fdc9c005654cdee6b97f351e6058c1b3e7c08 # Parent 3d3094ba21c5b1da20af9e50401e4548f527b595 Clean up some variable and constant names. diff -r 3d3094ba21c5 -r 4c3fdc9c0056 tools/lib64fmts.c --- a/tools/lib64fmts.c Tue Jun 11 05:11:31 2019 +0300 +++ b/tools/lib64fmts.c Tue Jun 11 05:44:22 2019 +0300 @@ -24,12 +24,12 @@ // XXX TODO: Research what these values actually mean. It would seem probable // that these may not be static values at all, as there are 8 more that change // before actual image data, but do not seem to be used in the image itself. -static const Uint8 fmtMicroIllustratorMagicID_1[] = +static const Uint8 fmtMicroIllustrator_MagicID_1[] = { 0xff, 0x80, 0x69, 0x67, 0x14, 0x00, }; -static const Uint8 fmtMicroIllustratorMagicID_2[] = +static const Uint8 fmtMicroIllustrator_MagicID_2[] = { 0xe8, 0x03, 0xe8, 0x03, 0x40, 0x1f, }; @@ -37,9 +37,9 @@ static int fmtProbeMicroIllustrator(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) { if (buf->len == fmt->size && - DM_MEMCMP_SIZE(buf->data + 2, fmtMicroIllustratorMagicID_1) == 0 + DM_MEMCMP_SIZE(buf->data + 2, fmtMicroIllustrator_MagicID_1) == 0 && - DM_MEMCMP_SIZE(buf->data + 9, fmtMicroIllustratorMagicID_2) == 0 + DM_MEMCMP_SIZE(buf->data + 9, fmtMicroIllustrator_MagicID_2) == 0 ) return DM_PROBE_SCORE_MAX; @@ -54,8 +54,8 @@ (void) img; (void) fmt; - memcpy(buf->data + 2, fmtMicroIllustratorMagicID_1, sizeof(fmtMicroIllustratorMagicID_1)); - memcpy(buf->data + 9, fmtMicroIllustratorMagicID_2, sizeof(fmtMicroIllustratorMagicID_2)); + memcpy(buf->data + 2, fmtMicroIllustrator_MagicID_1, sizeof(fmtMicroIllustrator_MagicID_1)); + memcpy(buf->data + 9, fmtMicroIllustrator_MagicID_2, sizeof(fmtMicroIllustrator_MagicID_2)); return DMERR_OK; } @@ -456,13 +456,13 @@ } -static const char *fmtBDP5MagicID = "BDP 5.00"; +static const char *fmtBDP5_MagicID = "BDP 5.00"; static int fmtProbeBDP5Packed(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) { if (buf->len > 20 && dmCompareAddr16(buf, 0, fmt->addr) && - DM_MEMCMP_LEN(buf->data + 2, fmtBDP5MagicID) == 0) + DM_MEMCMP_LEN(buf->data + 2, fmtBDP5_MagicID) == 0) return DM_PROBE_SCORE_MAX; return DM_PROBE_SCORE_FALSE; @@ -523,7 +523,7 @@ dmGenericRLEAnalyze(&mem, &cfg); // Add the header bits - if (!dmGrowBufPut(buf, (Uint8 *) fmtBDP5MagicID, strlen(fmtBDP5MagicID)) || + if (!dmGrowBufPut(buf, (Uint8 *) fmtBDP5_MagicID, strlen(fmtBDP5_MagicID)) || !dmGrowBufPutU8(buf, cfg.rleMarkerB) || !dmGrowBufPutU8(buf, cfg.rleMarkerW)) { @@ -540,15 +540,15 @@ } -static const char *fmtGunPaintMagicID = "GUNPAINT (JZ) "; -#define fmtGunPaintMagicLen (14) -#define fmtGunPaintMagicOffs (0x3e8) +static const char *fmtGunPaint_MagicID = "GUNPAINT (JZ) "; +#define fmtGunPaint_MagicLen (14) +#define fmtGunPaint_MagicOffs (0x3e8) static int fmtProbeGunPaint(const DMGrowBuf *buf, const DMC64ImageFormat *fmt) { - if (buf->len > fmtGunPaintMagicOffs + fmtGunPaintMagicLen && + if (buf->len > fmtGunPaint_MagicOffs + fmtGunPaint_MagicLen && dmCompareAddr16(buf, 0, fmt->addr) && - memcmp(buf->data + fmtGunPaintMagicOffs + 2, fmtGunPaintMagicID, fmtGunPaintMagicLen) == 0) + memcmp(buf->data + fmtGunPaint_MagicOffs + 2, fmtGunPaint_MagicID, fmtGunPaint_MagicLen) == 0) return DM_PROBE_SCORE_MAX; return DM_PROBE_SCORE_FALSE; @@ -564,7 +564,7 @@ // Here we assume that the op triggering this function is // at the end of the oplist, so the memory is allocated, - memcpy(buf->data + fmtGunPaintMagicOffs + 2, fmtGunPaintMagicID, fmtGunPaintMagicLen); + memcpy(buf->data + fmtGunPaint_MagicOffs + 2, fmtGunPaint_MagicID, fmtGunPaint_MagicLen); return DMERR_OK; } @@ -1227,8 +1227,8 @@ const int spr_y = rasterY / D64_SPR_HEIGHT_PX; const int spr_yd = rasterY % D64_SPR_HEIGHT_PX; const int spr_x = rasterX / D64_SPR_WIDTH_PX; - const int spr_xd = rasterX % D64_SPR_WIDTH_PX; - const int offs = (spr_y * 8 + spr_x) * D64_SPR_SIZE + (spr_yd * D64_SPR_WIDTH_UT) + (spr_xd / 8); + const int spr_xd = (rasterX % D64_SPR_WIDTH_PX) / 8; + const int offs = (spr_y * 8 + spr_x) * D64_SPR_SIZE + (spr_yd * D64_SPR_WIDTH_UT) + spr_xd; const int mask = 1 << (7 - (rasterX & 7)); int res; @@ -2262,7 +2262,7 @@ // XXX TODO: According to some, the last 4 should be same .. { DO_SET_MEM , DS_EXTRA_DATA , 0 , 0, 3 , 20+177, NULL, NULL }, { DO_FUNC , 0 , 0x2742, 0, 1 , 0, fmtTruePaintGetLaceType, NULL }, - { DO_FUNC , 0 , fmtGunPaintMagicOffs, 0, fmtGunPaintMagicLen, 0, NULL, fmtEncodeGunPaint }, + { DO_FUNC , 0 , fmtGunPaint_MagicOffs, 0, fmtGunPaint_MagicLen, 0, NULL, fmtEncodeGunPaint }, { DO_LAST , 0 , 0 , 0, 0 , 0, NULL, NULL }, } },