# HG changeset patch # User Matti Hamalainen # Date 1425417756 -7200 # Node ID e06abfde6c3936dab5f58909a952c300ccc5c56c # Parent 0577f10dc3de9f91a48ee619ce0c8a95c60b2211 Cosmetics pass: Remove excess whitespace. diff -r 0577f10dc3de -r e06abfde6c39 src/dmargs_int.c --- a/src/dmargs_int.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmargs_int.c Tue Mar 03 23:22:36 2015 +0200 @@ -67,7 +67,7 @@ (*argIndex)++; optArg = argv[*argIndex]; } - + if (optArg == NULL) { THERR("Option '%s%s' requires an argument.\n", @@ -76,7 +76,7 @@ return FALSE; } } - + // Option was given succesfully, try to process it if (doProcess && !handleOptionCB(opt->id, optArg, currArg)) return FALSE; @@ -180,7 +180,7 @@ // Skip whitespace at line start while (isspace(str[pos]) || str[pos] == '\n') pos++; - + // Handle each word while (str[pos] && str[pos] != '\n') { diff -r 0577f10dc3de -r e06abfde6c39 src/dmblit.c --- a/src/dmblit.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmblit.c Tue Mar 03 23:22:36 2015 +0200 @@ -44,7 +44,7 @@ pv->vadd = clipMax - v2; pv->v1 = v0 + v2; } - + if (v0 < clipMin) { pv->voffs = clipMin - v0; @@ -56,7 +56,7 @@ pv->voffs = 0; pv->v0 = v0; } - + #ifdef DM_CLIP_DEBUG printf("dmClipCoord(%d, (%d, %d), [%d, %d]): vdelta=", v0, v1, v2, clipMin, clipMax); @@ -86,7 +86,7 @@ pv->vadd = clipMax - v1; pv->v1 = v0 + v1; } - + if (v0 < clipMin) { pv->voffs = clipMin - v0; @@ -98,7 +98,7 @@ pv->voffs = 0; pv->v0 = v0; } - + return 0; } @@ -155,7 +155,7 @@ idst = dmBitsPerPixel2Index(dst->BitsPerPixel); if (isrc < 0 || idst < 0) return NULL; - + return dmScaledBlitTable[mode][isrc][idst]; } @@ -163,7 +163,7 @@ int dmScaledBlitSurfaceAny(SDL_Surface *src, const int x0, const int y0, const int dwidth, const int dheight, SDL_Surface *dst, int mode) { DMScaledBlitFunc bfunc = dmGetScaledBlitFunc(src->format, dst->format, mode); - + if (bfunc == NULL) return -15; @@ -221,7 +221,7 @@ idst = dmBitsPerPixel2Index(dst->BitsPerPixel); if (isrc < 0 || idst < 0) return NULL; - + return dmUnscaledBlitTable[mode][isrc][idst]; } @@ -229,7 +229,7 @@ int dmUnscaledBlitSurfaceAny(SDL_Surface *src, const int x0, const int y0, SDL_Surface *dst, int mode) { DMUnscaledBlitFunc bfunc = dmGetUnscaledBlitFunc(src->format, dst->format, mode); - + if (bfunc == NULL) return -15; @@ -243,7 +243,7 @@ SDL_Surface *result = SDL_CreateRGBSurface(flags, dwidth, dheight, fmt->BitsPerPixel, fmt->Rmask, fmt->Gmask, fmt->Bmask, fmt->Amask); if (result == NULL) return NULL; - + // Use scaled blitting to convert the scaled image .. dmScaledBlitSurfaceAny(src, 0, 0, dwidth, dheight, result, DMD_NONE); diff -r 0577f10dc3de -r e06abfde6c39 src/dmblitfunc.h --- a/src/dmblitfunc.h Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmblitfunc.h Tue Mar 03 23:22:36 2015 +0200 @@ -97,7 +97,7 @@ #define DM_BLITFUNC_VARS \ const Uint32 qpdmask = 0xff000000; \ const Uint64 qpdrm = 0xff00ff00ff00ffULL; - + #define DM_BLITFUNC_SRC_TYPE Uint32 #define DM_BLITFUNC_DST_TYPE Uint32 #define DM_BLITFUNC_INNER \ @@ -420,7 +420,7 @@ #define DM_BLITFUNC_VARS \ const Uint32 qpdmask = 0xff000000; \ const Uint64 qpdrm = 0xff00ff00ff00ffULL; - + #define DM_BLITFUNC_SRC_TYPE Uint32 #define DM_BLITFUNC_DST_TYPE Uint32 #define DM_BLITFUNC_INNER \ diff -r 0577f10dc3de -r e06abfde6c39 src/dmbstr.c --- a/src/dmbstr.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmbstr.c Tue Mar 03 23:22:36 2015 +0200 @@ -51,7 +51,7 @@ if (ctx->outBitCount != 8) dmPutBits(ctx, 0, ctx->outBitCount); - + return 0; } diff -r 0577f10dc3de -r e06abfde6c39 src/dmdrawline.h --- a/src/dmdrawline.h Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmdrawline.h Tue Mar 03 23:22:36 2015 +0200 @@ -74,7 +74,7 @@ x0 += xstep; afrac += dy; - + DM_DRAWLINE_INNER } } diff -r 0577f10dc3de -r e06abfde6c39 src/dmengine.c --- a/src/dmengine.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmengine.c Tue Mar 03 23:22:36 2015 +0200 @@ -33,14 +33,14 @@ if (engineEffects == NULL) { return dmErrorDBG(DMERR_INIT_FAIL, - "Could not expand effects structure.\n"); + "Could not expand effects structure.\n"); } } // Copy effects structure memcpy(engineEffects + nengineEffects, ef, sizeof(DMEffect)); nengineEffects++; - + return DMERR_OK; } @@ -54,7 +54,7 @@ if (engine->effectData == NULL) { return dmErrorDBG(DMERR_INIT_FAIL, - "Could not expand effects data structure.\n"); + "Could not expand effects data structure.\n"); } for (i = 0; i < nengineEffects; i++) @@ -194,7 +194,7 @@ { return dmftell((DMResource *) datasource); } - + static ov_callbacks vorbisFileCBS = { @@ -306,7 +306,7 @@ if (res == NULL) return DMERR_NULLPTR; - + fext = strrchr(res->filename, '.'); for (i = 0; i < nengineResOps; i++) { @@ -317,7 +317,7 @@ return DMERR_OK; } } - + return DMERR_OK; } @@ -434,7 +434,7 @@ return; dmMutexLock(engine->audioStreamMutex); - + // Update variables for analysis buffer (FFT, etc.) engine->audioStreamBuf = stream; engine->audioStreamLen = len / engine->audioSampleSize; @@ -523,7 +523,7 @@ case AUDIO_S16SYS: case AUDIO_U16SYS: engine->audioSampleSize *= 2; break; } - + if (SDL_OpenAudio(&engine->optAfmt, NULL) < 0) { // We'll let this pass, as we want to support no-sound. diff -r 0577f10dc3de -r e06abfde6c39 src/dmeval.c --- a/src/dmeval.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmeval.c Tue Mar 03 23:22:36 2015 +0200 @@ -10,7 +10,7 @@ { { "-" , OT_UNARY , FALSE }, { "~" , OT_UNARY , TRUE }, - + { "+" , OT_LEFT , TRUE }, { "-" , OT_LEFT , TRUE }, { "*" , OT_LEFT , TRUE }, @@ -83,7 +83,7 @@ void dmEvalErrorV(DMEvalContext *ev, const char *fmt, va_list ap) { char *tmp = dm_strdup_vprintf(fmt, ap); - + ev->err = TRUE; if (ev->errStr != NULL) @@ -116,7 +116,7 @@ if (strcmp(ev->symbols[i].name, name) == 0) return &(ev->symbols[i]); } - + return NULL; } @@ -139,7 +139,7 @@ ev->nsymbols + 1); return NULL; } - + symbol = &(ev->symbols[ev->nsymbols]); ev->nsymbols++; @@ -156,7 +156,7 @@ DMEvalSymbol *symbol = dmEvalContextAddSymbol(ev, name, SYM_VAR); if (symbol == NULL) return NULL; - + symbol->var = var; return symbol; } @@ -167,7 +167,7 @@ DMEvalSymbol *symbol = dmEvalContextAddSymbol(ev, name, SYM_CONST); if (symbol == NULL) return NULL; - + symbol->cvalue = value; return symbol; } @@ -178,7 +178,7 @@ DMEvalSymbol *symbol = dmEvalContextAddSymbol(ev, name, SYM_VAR); if (symbol == NULL) return NULL; - + symbol->func = func; symbol->nargs = nargs; @@ -236,7 +236,7 @@ { if (ev == NULL) return; - + dmFree(ev->errStr); ev->err = FALSE; ev->errStr = NULL; @@ -323,7 +323,7 @@ DM_CHECK(SUBEXPR_START); DM_CHECK(SUBEXPR_END); DM_CHECK(ARGS); - + return dm_strdup(str); } @@ -358,7 +358,7 @@ ev->expect = PARSE_NORMAL; ev->mode = PARSE_START; - + while (ev->mode != PARSE_ERROR && ev->mode != PARSE_END) switch (ev->mode) { @@ -382,16 +382,16 @@ } c++; } - + else if (*c == '(') dmEvalSetMode(ev, func != NULL ? PARSE_ARGS : PARSE_SUBEXPR_START); - + else if (*c == '-') dmEvalSetMode(ev, (ev->prev == PARSE_START || ev->prev == PARSE_OPER || ev->prev == PARSE_OPER_UNARY) ? PARSE_OPER_UNARY : PARSE_OPER); - + else if (*c == '~') dmEvalSetMode(ev, PARSE_OPER_UNARY); - + else if (strchr("+*/<>%&|!^", *c)) dmEvalSetMode(ev, PARSE_OPER); @@ -400,7 +400,7 @@ else if (isalpha(*c) || *c == '_') dmEvalSetMode(ev, PARSE_IDENT); - + else { dmEvalError(ev, "Syntax error near '%s' (depth %d).\n", c, depth); @@ -409,7 +409,7 @@ first = TRUE; break; - + case PARSE_SUBEXPR_START: tmp = c + 1; @@ -434,7 +434,7 @@ case PARSE_ARGS: tmp = c + 1; - + for (argIndex = 0; argIndex < func->symbol->nargs; argIndex++) { if (dmEvalTokenizeExpr(ev, &(func->args[argIndex]), &tmp, depth + 1) != 0) @@ -460,7 +460,7 @@ first = FALSE; decimal = FALSE; tmpStrLen = 0; - + if (isdigit(*c) || *c == '-' || *c == '+' || *c == '.') { if (*c == '.') @@ -560,7 +560,7 @@ c++; } break; - + case '<': if (c[1] == '<') { @@ -654,7 +654,7 @@ ev->prev = PARSE_START; ret = dmEvalTokenizeExpr(ev, result, &expr, 0); - + return ret; } @@ -681,18 +681,18 @@ case OP_VALUE: *presult = node->val; return TRUE; - + case OP_FUNC: - + return TRUE; - + case OP_SUBEXPR: return dmEvalTreeExecute(ev, node->subexpr, presult); - + // Binary operators case OP_BIT_LSHIFT: case OP_BIT_RSHIFT: - + case OP_BIT_AND: case OP_BIT_XOR: case OP_BIT_OR: diff -r 0577f10dc3de -r e06abfde6c39 src/dmeval.h --- a/src/dmeval.h Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmeval.h Tue Mar 03 23:22:36 2015 +0200 @@ -88,7 +88,7 @@ typedef struct DMEvalNode { int op; // Operator/token type - DMValue val; // Value, if immediate constant + DMValue val; // Value, if immediate constant DMEvalSymbol *symbol; // Symbol pointer, if function/variable/constvar struct DMEvalNode *args[DM_EVAL_MAX_ARGS]; // Arguments, if function @@ -101,7 +101,7 @@ { BOOL err; char *errStr; - + int nsymbols; DMEvalSymbol *symbols; diff -r 0577f10dc3de -r e06abfde6c39 src/dmfft.c --- a/src/dmfft.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmfft.c Tue Mar 03 23:22:36 2015 +0200 @@ -202,7 +202,7 @@ real[0] = buffer[0]; imag[0] = 0; power[0] = DM_PW(buffer[0], 0, scale); - + real[ctx->npoints] = buffer[1]; imag[ctx->npoints] = 0; power[ctx->npoints] = DM_PW(buffer[1], 0, scale); diff -r 0577f10dc3de -r e06abfde6c39 src/dmfile.c --- a/src/dmfile.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmfile.c Tue Mar 03 23:22:36 2015 +0200 @@ -67,7 +67,7 @@ int res = DMERR_OK; Uint8 *dataBuf = NULL; size_t readSize, dataSize, dataRead, dataPos; - + if (inFile != NULL) f = inFile; else @@ -125,6 +125,6 @@ error: if (f != inFile) fclose(f); - + return res; } diff -r 0577f10dc3de -r e06abfde6c39 src/dmgfx.c --- a/src/dmgfx.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmgfx.c Tue Mar 03 23:22:36 2015 +0200 @@ -18,12 +18,12 @@ cx0 = screen->clip_rect.x, cy0 = screen->clip_rect.y, cx1 = screen->clip_rect.x + screen->clip_rect.w - 1, cy1 = screen->clip_rect.y + screen->clip_rect.h - 1; - + DM_SWAP(int, x0, x1); if (yc < cy0|| yc > cy1 || x1 < cx0 || x0 > cx1) return; if (x0 < cx0) x0 = cx0; if (x1 > cx1) x1 = cx1; - + int x = x1 - x0 + 1; Uint8 *pix = ((Uint8 *) screen->pixels) + yc * screen->pitch + (x0 * bpp); switch (screen->format->BitsPerPixel) @@ -32,7 +32,7 @@ while (x--) *pix++ = col; break; - + case 32: { Uint32 *p = (Uint32 *) pix; @@ -68,7 +68,7 @@ pix += pitch; } break; - + case 32: { Uint32 *p = (Uint32 *) pix; diff -r 0577f10dc3de -r e06abfde6c39 src/dmimage.c --- a/src/dmimage.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmimage.c Tue Mar 03 23:22:36 2015 +0200 @@ -57,7 +57,7 @@ } if (pixtmp != NULL) SDL_FreeSurface(pixtmp); - + return result; } @@ -70,7 +70,7 @@ result = SDL_CreateRGBSurface(SDL_SWSURFACE, width, height, 8, 0,0,0,0); if (result == NULL) return NULL; - + dst = result->pixels; src = data; for (yc = 0; yc < height; yc++) @@ -168,7 +168,7 @@ result = dmCreatePaletteSurfaceFrom(data, width, height, width * comp); break; } - + stbi_image_free(data); if (result == NULL) diff -r 0577f10dc3de -r e06abfde6c39 src/dmlib.c --- a/src/dmlib.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmlib.c Tue Mar 03 23:22:36 2015 +0200 @@ -150,7 +150,7 @@ { if (error >= DM_SYSTEM_ERRORS) return strerror(error - DM_SYSTEM_ERRORS); - + switch (error) { case DMERR_OK: return "No error"; @@ -255,7 +255,7 @@ "Lock #%d: thread=%d, state=%d\n", i, lock->id, lock->state); } - } + } } int dmDOMutexLock(DMMutex *mutex, const char *file, const int line) @@ -263,7 +263,7 @@ if (mutex != NULL) { dmPrintMutexLocks(mutex, "LOCKING", file, line); - + DMMutexLock *lock = dmGetMutexThreadIDLock(mutex); if (lock != NULL) { diff -r 0577f10dc3de -r e06abfde6c39 src/dmlib.h --- a/src/dmlib.h Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmlib.h Tue Mar 03 23:22:36 2015 +0200 @@ -56,7 +56,7 @@ DMERR_OUT_OF_DATA, DMERR_EXTRA_DATA, DMERR_BOUNDS, - + DMERR_DATA_ERROR, // Data decoding/encoding/parsing error // PACK-file subsystem @@ -195,9 +195,9 @@ DMD_NONE = 0x0000, DMD_TRANSPARENT = 0x0001, DMD_SATURATE = 0x0002, - + DMD_ANTIALIAS = 0x0004, - + DMD_NMODES = 6 }; @@ -207,7 +207,7 @@ { DMD_8BIT = 0, DMD_32BIT, - + DMD_NBITDEPTHS }; diff -r 0577f10dc3de -r e06abfde6c39 src/dmlineclip.h --- a/src/dmlineclip.h Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmlineclip.h Tue Mar 03 23:22:36 2015 +0200 @@ -53,7 +53,7 @@ { const int c = clipA ? clipA : clipB; DM_COORD_TYPE x, y; - + // The segment is inside? if ((clipA | clipB) == 0) { @@ -126,7 +126,7 @@ yB = y; DM_CLIP_BITS(clipB, xB, yB); } - + } while (1); #else // Buyu-Skala clipping method diff -r 0577f10dc3de -r e06abfde6c39 src/dmpack.c --- a/src/dmpack.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmpack.c Tue Mar 03 23:22:36 2015 +0200 @@ -32,7 +32,7 @@ { *packDir = node->prev = node; } - + node->next = NULL; } @@ -126,7 +126,7 @@ { ret = dmErrorDBG(DMERR_INVALID, "Error seeking to PACK file '%s' directory offset.\n", - filename); + filename); goto out; } diff -r 0577f10dc3de -r e06abfde6c39 src/dmres.c --- a/src/dmres.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmres.c Tue Mar 03 23:22:36 2015 +0200 @@ -28,7 +28,7 @@ DMResource *node = dmMalloc0(sizeof(DMResource)); if (node == NULL) return NULL; - + node->lib = lib; node->filename = dm_strdup(filename); node->rawSize = size; @@ -80,7 +80,7 @@ { if (lib == NULL || node == NULL) return; - + node->lib = lib; if (lib->resources != NULL) @@ -93,7 +93,7 @@ { lib->resources = node->prev = node; } - + node->next = NULL; } @@ -260,16 +260,16 @@ int ret = dm_stdio_fopen(handle); if (ret != DMERR_OK) return ret; - + dm_stdio_fsize(handle); - + handle->rawData = dmMalloc(handle->rawSize); if (handle->rawData == NULL) return DMERR_MALLOC; - + if (dm_stdio_fread(handle->rawData, sizeof(Uint8), handle->rawSize, handle) != handle->rawSize) return DMERR_FREAD; - + return DMERR_OK; } @@ -668,7 +668,7 @@ NULL, dm_mem_fread, NULL, - + dm_pack_fopen, dm_pack_fclose, dm_pack_preload, @@ -690,7 +690,7 @@ dm_mem_fputc, dm_mem_fread, dm_mem_fwrite, - + NULL, dmResourceFree, NULL @@ -737,7 +737,7 @@ ret = handle->rops->load(handle); handle->fops->fclose(handle); } - + if (ret == DMERR_OK) handle->flags |= DMF_LOADED_RES; } @@ -831,7 +831,7 @@ handle->fops = &dfStdioFileOps; handle->fh = fopen(filename, mode); handle->error = dmGetErrno(); - + if (handle->fh == NULL) { dmResourceFree(handle); @@ -873,10 +873,10 @@ { if (f == NULL) return DMERR_NULLPTR; - + if (f->fops == NULL || f->fops->freset == NULL) return DMERR_OK; - + return f->fops->freset(f); } @@ -949,7 +949,7 @@ *p++ = c; } *p = 0; - + return (n > 0) ? s : NULL; } @@ -1040,7 +1040,7 @@ // Basic data lib->mutex = dmCreateMutex(); - lib->flags = flags; + lib->flags = flags; lib->resPath = dm_strdup((path != NULL) ? path : DMRES_DATA_PATH); @@ -1086,7 +1086,7 @@ res->fops = &dfPackFileOps; dmResourceInsert(lib, res); } - + initialized = TRUE; } } @@ -1126,10 +1126,10 @@ int dmResourcesClose(DMResourceLib *lib) { DMResource *node; - + if (lib == NULL) return DMERR_NULLPTR; - + dmMutexLock(lib->mutex); // Shutdown possible subsystems @@ -1170,12 +1170,12 @@ int ret = DMERR_OK; dmMutexLock(lib->mutex); - - // Initialize preloading + + // Initialize preloading if (lib->preload == NULL || start) { DMResource *node; - + lib->preload = lib->resources; *loaded = 0; *total = 0; diff -r 0577f10dc3de -r e06abfde6c39 src/dmscaledblit.h --- a/src/dmscaledblit.h Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmscaledblit.h Tue Mar 03 23:22:36 2015 +0200 @@ -25,9 +25,9 @@ #ifdef DM_BLITFUNC_VARS DM_BLITFUNC_VARS #endif - + // Clip coordinates - if (dmScaledClipCoord(&xr, x0, src->w, dwidth, + if (dmScaledClipCoord(&xr, x0, src->w, dwidth, dst->clip_rect.x, dst->clip_rect.x + dst->clip_rect.w) || dmScaledClipCoord(&yr, y0, src->h, dheight, diff -r 0577f10dc3de -r e06abfde6c39 src/dmsimple.c --- a/src/dmsimple.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmsimple.c Tue Mar 03 23:22:36 2015 +0200 @@ -56,12 +56,12 @@ case 1: dmVerbosity++; break; - + default: dmErrorDBGMsg("Unknown option '%s'.\n", currArg); return FALSE; } - + return TRUE; } @@ -72,10 +72,10 @@ dh = 20, dw = engine.screen->w - (2 * dx), dy = (engine.screen->h - dh) / 2; - + if (SDL_MUSTLOCK(engine.screen) != 0 && SDL_LockSurface(engine.screen) != 0) return DMERR_INIT_FAIL; - + // Draw the progress bar dmClearSurface(engine.screen, dmMapRGBA(engine.screen, 0,0,0,0)); dmFillRect(engine.screen, dx, dy, dx+dw, dy+dh, dmMapRGB(engine.screen, 255,255,255)); @@ -114,7 +114,7 @@ first = FALSE; } while (err == DMERR_PROGRESS); - + return err; } @@ -171,11 +171,11 @@ { DMModeEntry *mode; int i, aspect = engineGetVideoAspect(w, h); - + dmPrint(2, " - Proposed %d x %d\n", w, h); if (aspect <= 0) return DMERR_INVALID_ARGS; - + // Check if the mode is already in our list for (i = 0; i < nengineModeList; i++) { @@ -191,7 +191,7 @@ if (aspect != engine.optVidAspect) return DMERR_OK; break; - + case DM_VSETUP_ANY: break; } @@ -204,16 +204,16 @@ if (engineModeList == NULL) return DMERR_MALLOC; } - + // Store mode = &engineModeList[nengineModeList]; mode->w = w; mode->h = h; mode->aspect = engineGetVideoAspect(w, h); dmPrint(2, " - %d x %d, %d\n", w, h, mode->aspect); - + nengineModeList++; - + return DMERR_OK; } @@ -240,7 +240,7 @@ // Find start of the line for (pos = 0; isspace(buf[pos]); pos++); - + // Skip empty lines and comments if (buf[pos] == 0 || buf[pos] == '#') continue; @@ -310,7 +310,7 @@ "No compatible video resolutions/depths available at all. Bailing out.\n"); goto out; } - + if (modes != (SDL_Rect**) -1) { int i; @@ -386,7 +386,7 @@ result, dmErrorStr(result)); goto out; } - + if (menuBgImage->w != DM_VSETUP_WIDTH || menuBgImage->h != DM_VSETUP_HEIGHT) { @@ -509,7 +509,7 @@ // Render the menu dmDirectBlitSurface(menuBgImage, engine.screen); - + // XXX/TODO: Some hardcoded bits here ... float t = engineGetTimeDT(&engine); int index, entry; @@ -538,7 +538,7 @@ DMFloat posX = engine.setupMenuCenter ? 2.0f + (vsX(engine.setupMenuDim) - menuFont->width * strlen(menuStr)) / 2.0f : 2.0f; - + dmDrawBMTextConst( engine.screen, menuFont, engine.setupTextCondensed, DMD_TRANSPARENT, @@ -546,7 +546,7 @@ vsY(engine.setupMenuPos) + (index * menuEntryHeight), menuStr); } - + dmDrawBMTextConst( engine.screen, menuFont, engine.setupTextCondensed, DMD_TRANSPARENT, @@ -594,7 +594,7 @@ SDL_FreeSurface(menuBgImage); SDL_FreeSurface(menuBarImage); dmFreeBitmapFont(menuFont); - + return menuState; } @@ -682,7 +682,7 @@ engine.optAfmt.format = AUDIO_S16SYS; engine.optAfmt.channels = 2; } - + if (engine.optAfmt.samples == 0) engine.optAfmt.samples = engine.optAfmt.freq / 50; @@ -835,7 +835,7 @@ case SDLK_ESCAPE: engine.exitFlag = TRUE; break; - + case SDLK_SPACE: engine.pauseFlag = !engine.pauseFlag; break; @@ -876,7 +876,7 @@ engine.paused = engine.pauseFlag; engine.pauseTime = engineGetTick(&engine); } - + if (engine.paused) { engine.startTime = engine.frameTime - engine.pauseTime; @@ -946,7 +946,7 @@ } SDL_UnlockAudio(); - + if (engine.audioStreamMutex != NULL) dmDestroyMutex(engine.audioStreamMutex); diff -r 0577f10dc3de -r e06abfde6c39 src/dmstring.c --- a/src/dmstring.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmstring.c Tue Mar 03 23:22:36 2015 +0200 @@ -54,7 +54,7 @@ const size_t slen = strlen(str), nlen = strlen(needle); - + if (slen < nlen) return NULL; diff -r 0577f10dc3de -r e06abfde6c39 src/dmtext_bm.c --- a/src/dmtext_bm.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmtext_bm.c Tue Mar 03 23:22:36 2015 +0200 @@ -46,7 +46,7 @@ void dmDrawBMText(SDL_Surface *screen, DMBitmapFont *font, BOOL condensed, int mode, int xc, int yc, const char *fmt, ...) { va_list ap; - + va_start(ap, fmt); dmDrawBMTextVA(screen, font, condensed, mode, xc, yc, fmt, ap); va_end(ap); @@ -58,7 +58,7 @@ DMBitmapFont *font = dmMalloc0(sizeof(DMBitmapFont)); if (font == NULL) return NULL; - + font->width = width; font->height = height; font->nglyphs = nglyphs; @@ -79,7 +79,7 @@ if (font == NULL) return DMERR_NULLPTR; - + for (i = 0; i < font->nglyphs; i++) { if (font->glyphs[i] != NULL) @@ -104,10 +104,10 @@ if (font == NULL) return DMERR_NULLPTR; - + if (start < 0 || size < 1) return DMERR_INVALID_ARGS; - + for (i = 0; i < font->nglyphs; i++) { SDL_Surface *glyph = font->glyphs[i]; @@ -129,11 +129,11 @@ Uint16 version, nglyphs, maxglyph; int width, height; BOOL tsfont = FALSE; - + // Check magic and version dmf_read_str(res, (Uint8 *) &magic, 6); dmf_read_le16(res, &version); - + // Check if it is a legacy TSFONT file if (memcmp(magic, TSFONT_MAGIC, 6) == 0) { @@ -147,7 +147,7 @@ #ifdef FN_DEBUG fprintf(stderr, "TSFONT v%d.%d (0x%04x), encoding=%d\n", version >> 8, version & 0xff, version, encoding); #endif - + // There were only two encodings, 0 = none and 1 = RLE // of which RLE was never actually used ... derp. if (encoding != 0) @@ -161,13 +161,13 @@ if (version > DMFONT_VERSION) return DMERR_VERSION; } - + // Read other header data if (tsfont) { // TSFONT only has number of glyphs stored in the file nglyphs = dmfgetc(res); - + // Maximum glyph number maxglyph = 256; } @@ -176,7 +176,7 @@ dmf_read_le16(res, &nglyphs); dmf_read_le16(res, &maxglyph); } - + width = dmfgetc(res); height = dmfgetc(res); @@ -189,7 +189,7 @@ { // TSFONT color assignments (boolean) .. we discard this. dmfgetc(res); - + // Very old TSFONTs have some extra data that is not used // .. can't actually even remember what it was for. if (version == 0x0200) diff -r 0577f10dc3de -r e06abfde6c39 src/dmtext_ttf.c --- a/src/dmtext_ttf.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmtext_ttf.c Tue Mar 03 23:22:36 2015 +0200 @@ -35,7 +35,7 @@ void dmDrawTTFText(SDL_Surface *screen, TTF_Font *font, SDL_Color col, int xc, int yc, const char *fmt, ...) { va_list ap; - + va_start(ap, fmt); dmDrawTTFTextVA(screen, font, col, xc, yc, fmt, ap); va_end(ap); diff -r 0577f10dc3de -r e06abfde6c39 src/dmtimeline.c --- a/src/dmtimeline.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmtimeline.c Tue Mar 03 23:22:36 2015 +0200 @@ -31,11 +31,11 @@ // Calculate and allocate space points->npoints = npoints; points->nallocated = ((npoints / 16) + 1) * 16; - + points->points = dmCalloc(points->nallocated, sizeof(DMTimelinePoint)); if (points->points == NULL) return DMERR_MALLOC; - + // Read points for (point = 0; point < points->npoints; point++) { @@ -44,7 +44,7 @@ if (!dmf_read_le32(res, &ptype) || !dmf_read_le32(res, &ptime)) return DMERR_FREAD; - + switch (type) { case EFPT_INT: @@ -60,7 +60,7 @@ if (!dmLoadFloatValue(res, &pt->vfloat)) return DMERR_FREAD; break; - + case EFPT_VECTOR: if (!dmLoadFloatValue(res, &pt->vector.x) || !dmLoadFloatValue(res, &pt->vector.y) || @@ -81,7 +81,7 @@ } break; } - + pt->type = ptype; pt->time = ptime; } @@ -146,7 +146,7 @@ return DMERR_FREAD; hdr.effectName[sizeof(hdr.effectName) - 1] = 0; - + if (hdr.nparams > DT_MAX_EFFECT_PARAMS) { return dmError(DMERR_INVALID_DATA, @@ -190,7 +190,7 @@ curve->enabled = dmfgetc(res); if ((err = dmLoadTimelinePoints(res, &(curve->points), EFPT_FLOAT)) != DMERR_OK) return err; - + return DMERR_OK; } @@ -274,7 +274,7 @@ if ((err = dmLoadTimelineTrack(res, &(tl->tracks[track]))) != DMERR_OK) return err; } - + return DMERR_OK; } @@ -371,11 +371,11 @@ int dmAddSplitPreparedEventGroup(DMPreparedEventGroup **groups, DMTimelineTrack *track, DMTimelineEvent *event) { DMPreparedEventGroup *node; - + for (node = *groups; node != NULL; node = node->next) { } - + return DMERR_OK; } @@ -398,7 +398,7 @@ return err; } } - + // Compute number of groups ptl->ngroups = 0; for (node = groups; node != NULL; node = node->next) @@ -412,7 +412,7 @@ // Store pointers in the array for (group = 0, node = groups; node != NULL; node = node->next) ptl->groups[group++] = node; - + return DMERR_OK; } diff -r 0577f10dc3de -r e06abfde6c39 src/dmtimelinew.c --- a/src/dmtimelinew.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmtimelinew.c Tue Mar 03 23:22:36 2015 +0200 @@ -25,7 +25,7 @@ npoints = points->npoints; if (!dmf_write_le32(res, npoints)) return DMERR_FWRITE; - + // Save points for (point = 0; point < points->npoints; point++) { @@ -48,7 +48,7 @@ if (!dmSaveFloatValue(res, pt->vfloat)) return DMERR_FWRITE; break; - + case EFPT_VECTOR: if (!dmSaveFloatValue(res, pt->vector.x) || !dmSaveFloatValue(res, pt->vector.y) || @@ -83,7 +83,7 @@ if ((err = dmSaveTimelinePoints(res, &(curve->points), EFPT_FLOAT)) != DMERR_OK) return err; - + return DMERR_OK; } @@ -155,7 +155,7 @@ { int event, err; DMFTimelineTrack hdr; - + strncpy(hdr.name, track->name, sizeof(hdr.name)); if (!dmf_write_le32(res, track->index) || @@ -187,7 +187,7 @@ strncpy(hdr.name, tl->name, sizeof(hdr.name)); hdr.ntracks = tl->ntracks; hdr.duration = tl->duration; - + if (!dmf_write_str(res, hdr.magic, sizeof(hdr.magic)) || !dmf_write_str(res, hdr.name, sizeof(hdr.name)) || !dmf_write_le32(res, hdr.ntracks) || @@ -211,7 +211,7 @@ return DMERR_MALLOC; tl->name = dm_strdup(name); - + return DMERR_OK; } @@ -219,10 +219,10 @@ int dmTimelineAddTrack(DMTimeline *tl, DMTimelineTrack **ptrack, const char *name) { DMTimelineTrack *track; - + if ((*ptrack = track = dmMalloc0(sizeof(DMTimelineTrack))) == NULL) return DMERR_MALLOC; - + track->name = dm_strdup(name); track->enabled = TRUE; @@ -234,10 +234,10 @@ tl->nallocated += 16; tl->tracks = ptmp; } - + tl->tracks[tl->ntracks] = track; tl->ntracks++; - + return DMERR_OK; } @@ -245,13 +245,13 @@ int dmTimelineTrackAddEvent(DMTimelineTrack *track, int start, int duration, DMTimelineEvent **pev) { DMTimelineEvent *ev; - + if ((*pev = ev = dmMalloc0(sizeof(DMTimelineEvent))) == NULL) return DMERR_MALLOC; - + ev->start = start; ev->duration = duration; - + if (track->nevents + 1 >= track->nallocated) { void *ptmp = dmRealloc(track->events, sizeof(DMTimelineEvent *) * (track->nallocated + 16)); @@ -260,10 +260,10 @@ track->nallocated += 16; track->events = ptmp; } - + track->events[track->nevents] = ev; track->nevents++; - + return DMERR_OK; } @@ -279,7 +279,7 @@ event->params = dmCalloc(ef->nparams, sizeof(DMTimelineEventParam)); if (event->params == NULL) return DMERR_MALLOC; - + for (param = 0; param < ef->nparams; param++) { DMTimelineEventParam *psrc = &ef->params[param], @@ -300,7 +300,7 @@ memcpy(pdst->pts.points, psrc->pts.points, pdst->pts.npoints * sizeof(DMTimelinePoint)); } } - + return DMERR_OK; } @@ -332,7 +332,7 @@ return DMERR_MALLOC; memcpy(dst->points, src->points, sizeof(DMTimelinePoint) * src->npoints); - + return DMERR_OK; } @@ -353,7 +353,7 @@ DMTimelineEvent *dst; if ((*pdst = dst = dmMalloc0(sizeof(DMTimelineEvent))) == NULL) return DMERR_MALLOC; - + dst->start = src->start; dst->duration = src->duration; dst->nparams = src->nparams; @@ -389,7 +389,7 @@ if ((dst->events = dmCalloc(src->nevents, sizeof(DMTimelineEvent *))) == NULL) return DMERR_MALLOC; - + dst->name = dm_strdup(src->name); dst->enabled = src->enabled; dst->nevents = src->nevents; @@ -413,7 +413,7 @@ DMTimeline *dst; if ((*pdst = dst = dmMalloc0(sizeof(DMTimeline))) == NULL) return DMERR_MALLOC; - + dst->tracks = (DMTimelineTrack **) dmCalloc(src->ntracks, sizeof(DMTimelineTrack *)); if (dst->tracks == NULL) return DMERR_MALLOC; @@ -427,6 +427,6 @@ if ((err = dmCopyTimelineTrack(src->tracks[track], &(dst->tracks[track]))) != DMERR_OK) return err; } - + return DMERR_OK; } diff -r 0577f10dc3de -r e06abfde6c39 src/dmunscaledblit.h --- a/src/dmunscaledblit.h Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmunscaledblit.h Tue Mar 03 23:22:36 2015 +0200 @@ -21,7 +21,7 @@ #ifdef DM_BLITFUNC_VARS DM_BLITFUNC_VARS #endif - + // Clip coordinates if (dmUnscaledClipCoord(&xr, x0, src->w, dst->clip_rect.x, dst->clip_rect.x + dst->clip_rect.w) diff -r 0577f10dc3de -r e06abfde6c39 src/dmvecmat.c --- a/src/dmvecmat.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmvecmat.c Tue Mar 03 23:22:36 2015 +0200 @@ -101,7 +101,7 @@ // vector -> xmm0 "movups %2, %%xmm0\n" - + // zero final result in xmm2 "xorps %%xmm2, %%xmm2\n" @@ -169,7 +169,7 @@ ( // list[i] -> xmm0 "movups %1, %%xmm0\n" - + // zero final result in xmm2 "xorps %%xmm2, %%xmm2\n" @@ -255,7 +255,7 @@ "shufps $0x00, %%xmm1, %%xmm1\n" // mat2[0][0] "mulps %%xmm0, %%xmm1\n" "movups %%xmm1, %%xmm3\n" - + // 1 "movups 16(%%ebx), %%xmm0\n" // mat1[0] "movups (%%edx), %%xmm1\n" // mat2[0] @@ -290,7 +290,7 @@ "shufps $0x00, %%xmm1, %%xmm1\n" // mat2[0][0] "mulps %%xmm0, %%xmm1\n" "movups %%xmm1, %%xmm3\n" - + // 1 "movups 16(%%ebx), %%xmm0\n" // mat1[0] "movups 16(%%edx), %%xmm1\n" // mat2[1] @@ -325,7 +325,7 @@ "shufps $0x00, %%xmm1, %%xmm1\n" // mat2[0][0] "mulps %%xmm0, %%xmm1\n" "movups %%xmm1, %%xmm3\n" - + // 1 "movups 16(%%ebx), %%xmm0\n" // mat1[0] "movups 32(%%edx), %%xmm1\n" // mat2[1] @@ -360,7 +360,7 @@ "shufps $0x00, %%xmm1, %%xmm1\n" // mat2[0][0] "mulps %%xmm0, %%xmm1\n" "movups %%xmm1, %%xmm3\n" - + // 1 "movups 16(%%ebx), %%xmm0\n" // mat1[0] "movups 48(%%edx), %%xmm1\n" // mat2[1] @@ -431,11 +431,11 @@ i = sx * sz, j = sx * cz; - mat->m[0][3] = - mat->m[1][3] = - mat->m[2][3] = - mat->m[3][0] = - mat->m[3][1] = + mat->m[0][3] = + mat->m[1][3] = + mat->m[2][3] = + mat->m[3][0] = + mat->m[3][1] = mat->m[3][2] = 0; mat->m[3][3] = 1.0f; diff -r 0577f10dc3de -r e06abfde6c39 src/dmwav.c --- a/src/dmwav.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmwav.c Tue Mar 03 23:22:36 2015 +0200 @@ -24,7 +24,7 @@ void dmWriteWAVHeader(FILE *outFile, int sampBits, int sampFreq, int sampChn, size_t sampLen) { DMWaveFile wav; - + // PCM WAVE chunk dmMakeWAVChunk(&wav.chFormat, DM_WAVE_FMT_ID, (2 + 2 + 4 + 4 + 2 + 2)); @@ -46,16 +46,16 @@ // Write header dm_fwrite_str(outFile, wav.riffID, sizeof(wav.riffID)); dm_fwrite_le32(outFile, wav.fileSize); - + dm_fwrite_str(outFile, wav.riffType, sizeof(wav.riffType)); dmWriteWAVChunk(outFile, &wav.chFormat); - + dm_fwrite_le16(outFile, wav.wFormatTag); dm_fwrite_le16(outFile, wav.nChannels); dm_fwrite_le32(outFile, wav.nSamplesPerSec); dm_fwrite_le32(outFile, wav.nAvgBytesPerSec); dm_fwrite_le16(outFile, wav.nBlockAlign); dm_fwrite_le16(outFile, wav.wBitsPerSample); - + dmWriteWAVChunk(outFile, &wav.chData); } diff -r 0577f10dc3de -r e06abfde6c39 src/dmwav.h --- a/src/dmwav.h Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmwav.h Tue Mar 03 23:22:36 2015 +0200 @@ -25,7 +25,7 @@ { Uint8 chunkID[4]; Uint32 chunkSize; -} DMWaveChunk; +} DMWaveChunk; typedef struct diff -r 0577f10dc3de -r e06abfde6c39 src/dmzlib.c --- a/src/dmzlib.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/dmzlib.c Tue Mar 03 23:22:36 2015 +0200 @@ -218,7 +218,7 @@ ctx->codeBuffer >>= s; ctx->numBits -= s; *val = huff->value[b]; - + return DMERR_OK; } diff -r 0577f10dc3de -r e06abfde6c39 src/libgfx.c --- a/src/libgfx.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/libgfx.c Tue Mar 03 23:22:36 2015 +0200 @@ -31,7 +31,7 @@ DMImage *img = dmMalloc0(sizeof(DMImage)); if (img == NULL) return NULL; - + img->width = width; img->height = height; img->pitch = width * sizeof(Uint8); @@ -42,7 +42,7 @@ dmFree(img); return NULL; } - + return img; } @@ -86,7 +86,7 @@ { if (img == NULL) return FALSE; - + img->ncolors = ncolors; img->ctransp = ctransp; return dmPaletteAlloc(&(img->pal), ncolors, ctransp); @@ -112,7 +112,7 @@ static BOOL dmReadPaletteData(FILE *fp, DMColor *pal, int ncolors) { int i; - + for (i = 0; i < ncolors; i++) { Uint8 colR, colG, colB; @@ -167,7 +167,7 @@ qg = img->pal[c].g; qb = img->pal[c].b; qa = img->pal[c].a; - + for (xscale = 0; xscale < spec->scaleX; xscale++) { *ptr1++ = qr; @@ -181,7 +181,7 @@ qr = img->pal[c].r; qg = img->pal[c].g; qb = img->pal[c].b; - + for (xscale = 0; xscale < spec->scaleX; xscale++) { *ptr1++ = qr; @@ -194,7 +194,7 @@ qr = img->pal[c].r; qg = img->pal[c].g; qb = img->pal[c].b; - + for (xscale = 0; xscale < spec->scaleX; xscale++) { *ptr1++ = qr; @@ -213,7 +213,7 @@ } done: - dmFree(row); + dmFree(row); return res; } @@ -251,7 +251,7 @@ { int xc, yc, plane, res; DMBitStreamContext bs; - + if ((res = dmInitBitStreamFILE(&bs, fp)) != DMERR_OK) return res; @@ -287,7 +287,7 @@ } } } - + return dmFlushBitStream(&bs); } @@ -386,7 +386,7 @@ "PNG: png_create_write_struct() failed.\n"); goto error; } - + info_ptr = png_create_info_struct(png_ptr); if (info_ptr == NULL) { @@ -395,7 +395,7 @@ png_ptr); goto error; } - + if (setjmp(png_jmpbuf(png_ptr))) { res = dmError(DMERR_INIT_FAIL, @@ -417,7 +417,7 @@ spec->format); goto error; } - + png_set_IHDR(png_ptr, info_ptr, img->width * spec->scaleX, img->height * spec->scaleY, @@ -444,7 +444,7 @@ "PNG: Could not allocate palette structure."); goto error; } - + memset(palette, 0, PNG_MAX_PALETTE_LENGTH * sizeof(png_color)); for (i = 0; i < img->ncolors; i++) @@ -530,7 +530,7 @@ png_ptr); goto error; } - + if (setjmp(png_jmpbuf(png_ptr))) { res = dmError(DMERR_INIT_FAIL, @@ -568,7 +568,7 @@ goto error; } break; - + case PNG_COLOR_TYPE_PALETTE: png_set_packing(png_ptr); break; @@ -617,10 +617,10 @@ img->pal[i].r = img->pal[i].g = img->pal[i].b = i; } break; - + case PNG_COLOR_TYPE_PALETTE: png_get_PLTE(png_ptr, info_ptr, &palette, &ncolors); - dmMsg(3, "PNG: Palette of %d colors found.\n", ncolors); + dmMsg(3, "PNG: Palette of %d colors found.\n", ncolors); if (ncolors > 0 && palette != NULL) { if (!dmImageAllocPalette(img, ncolors, -1)) @@ -652,7 +652,7 @@ img->ctransp = i; } } - } + } error: // png_free(png_ptr, palette); @@ -747,7 +747,7 @@ DMPCXData *pcx = (DMPCXData *) cbdata; int plane; size_t soffs = 0; - + // fprintf(stderr, "%d, %d * %d = %d\n", len, pcx->header->bpl, pcx->header->nplanes, pcx->header->nplanes * pcx->header->bpl); pcx->bufOffs = 0; @@ -864,7 +864,7 @@ "PCX: Could not write basic header data.\n"); goto error; } - + if (!dm_fwrite_le16(pcx.fp, hdr.xmin) || !dm_fwrite_le16(pcx.fp, hdr.ymin) || !dm_fwrite_le16(pcx.fp, hdr.xmax) || @@ -883,7 +883,7 @@ "PCX: Could not write colormap.\n"); goto error; } - + if (!dm_fwrite_byte(pcx.fp, hdr.reserved) || !dm_fwrite_byte(pcx.fp, hdr.nplanes) || !dm_fwrite_le16(pcx.fp, hdr.bpl) || @@ -912,7 +912,7 @@ dm_fwrite_byte(pcx.fp, img->pal[i].b); } - // Pad the palette, if necessary + // Pad the palette, if necessary for (; i < 256; i++) { dm_fwrite_byte(pcx.fp, 0); @@ -920,7 +920,7 @@ dm_fwrite_byte(pcx.fp, 0); } } - + error: dmFree(pcx.buf); return res; @@ -938,9 +938,9 @@ "PCX: Could not open file '%s' for writing.\n", filename); } - + res = dmWritePCXImageFILE(fp, img, spec); - + fclose(fp); return res; } @@ -956,7 +956,7 @@ if (!dm_fread_byte(fp, &data)) return FALSE; - + if ((data & 0xC0) == 0xC0) { count = data & 0x3F; @@ -996,7 +996,7 @@ "PCX: Could not read basic header data.\n"); goto error; } - + if (hdr.manufacturer != 10 || hdr.version != 5 || hdr.encoding != 1 || @@ -1006,7 +1006,7 @@ "PCX: Not a PCX file, or unsupported variant.\n"); goto error; } - + if (!dm_fread_le16(fp, &hdr.xmin) || !dm_fread_le16(fp, &hdr.ymin) || !dm_fread_le16(fp, &hdr.xmax) || @@ -1025,7 +1025,7 @@ "PCX: Could not read colormap.\n"); goto error; } - + if (!dm_fread_byte(fp, &hdr.reserved) || !dm_fread_byte(fp, &hdr.nplanes) || !dm_fread_le16(fp, &hdr.bpl) || @@ -1036,7 +1036,7 @@ "PCX: Could not read header remainder.\n"); goto error; } - + if (hdr.nplanes != 3 && hdr.nplanes != 1) { res = dmError(DMERR_FREAD, @@ -1073,14 +1073,14 @@ "PCX: Error decoding RLE data.\n"); goto error; } - + // Decode bitplanes switch (hdr.nplanes) { case 1: memcpy(dp, pcx.buf, img->width); break; - + case 3: { Uint8 *dptr = dp, @@ -1097,7 +1097,7 @@ } break; } - + dp += img->pitch; } @@ -1125,7 +1125,7 @@ "PCX: Could not allocate palette data!\n"); goto error; } - + if (read) { if (!dmReadPaletteData(fp, img->pal, ncolors)) @@ -1166,7 +1166,7 @@ "PCX: Could not open file '%s' for reading.\n", filename); } - + res = dmReadPCXImageFILE(fp, pimg); fclose(fp); @@ -1302,7 +1302,7 @@ if (!dm_fread_byte(fp, (Uint8 *) &dcount)) return FALSE; - + if (dcount == -128) { if (!dm_fread_byte(fp, &data)) @@ -1361,7 +1361,7 @@ Uint8 *buf; size_t bufLen; int yc, res = DMERR_OK; - + *read = 0; // Allocate image @@ -1374,7 +1374,7 @@ return DMERR_MALLOC; dmMsg(3, "ILBM: plane row size %d bytes.\n", bufLen); - + // Decode the chunk for (yc = 0; yc < img->height; yc++) { @@ -1418,7 +1418,7 @@ for (xc = 0; xc < img->width; xc++) { const Uint8 data = (buf[xc / 8] >> (7 - (xc & 7))) & 1; - + // Black out any pixels with mask bit 0 if (!data) dp[xc] = 0; @@ -1484,7 +1484,7 @@ return dmError(DMERR_NOT_SUPPORTED, "ILBM: Not a IFF file.\n"); } - + // Check IFF ILBM signature if (!dm_fread_be32(fp, &idILBM) || (idILBM != IFF_ID_ILBM && idILBM != IFF_ID_PBM)) @@ -1502,7 +1502,7 @@ return dmError(DMERR_FREAD, "ILBM: Error reading IFF ILBM data.\n"); } - + switch (chunk.id) { case IFF_ID_BMHD: @@ -1532,7 +1532,7 @@ dmMsg(3, "ILBM: BMHD %d x %d @ %d, %d : nplanes=%d, comp=%d, mask=%d\n", iff.bmhd.w, iff.bmhd.h, iff.bmhd.x, iff.bmhd.y, iff.bmhd.nplanes, iff.bmhd.compression, iff.bmhd.masking); - + // Sanity check if (iff.bmhd.nplanes < 1 || iff.bmhd.nplanes > 8 || (iff.bmhd.compression != IFF_COMP_NONE && @@ -1569,7 +1569,7 @@ if (iff.bmhd.nplanes > 0 && iff.ncolors != 1 << iff.bmhd.nplanes) dmMsg(3, "ILBM: Expected %d entries in CMAP.\n", 1 << iff.bmhd.nplanes); - + // Read palette if (iff.ncolors > 0) { @@ -1589,7 +1589,7 @@ if (iff.chBMHD.count && iff.chBODY.count) parsed = TRUE; break; - + case IFF_ID_BODY: // Check for multiple occurences of CMAP if ((res = dmCheckIFFChunk(&iff.chBODY, &chunk, FALSE, 1)) != DMERR_OK) @@ -1603,7 +1603,7 @@ } dmMsg(3, "ILBM: BODY chunk size %d bytes\n", chunk.size); - + // Decode the body if (iff.planar) { @@ -1630,7 +1630,7 @@ return dmError(DMERR_FREAD, "ILBM: Error reading CAMG chunk.\n"); } - + dmMsg(3, "ILBM: CAMG value 0x%08x\n", iff.camg); if ((iff.camg & IFF_CAMG_HAM)) @@ -1648,7 +1648,7 @@ { dmMsg(4, "Unknown chunk ID '%s', size %d\n", dmGetIFFChunkID(&chunk), chunk.size); - + if (fseeko(fp, chunk.size, SEEK_CUR) != 0) { return dmError(DMERR_FSEEK, @@ -1657,7 +1657,7 @@ } break; } - + if (chunk.size & 1) fgetc(fp); } @@ -1684,7 +1684,7 @@ } else iff.pal = ptmp; - + for (i = 0; i < iff.ncolors; i++) { int i2 = iff.ncolors + i; @@ -1693,7 +1693,7 @@ iff.pal[i2].b = iff.pal[i].b / 2; } } - + (*pimg)->ncolors = iff.ncolors; (*pimg)->pal = iff.pal; } @@ -1713,7 +1713,7 @@ "ILBM: Could not open file '%s' for reading.\n", filename); } - + res = dmReadILBMImageFILE(fp, pimg); fclose(fp); diff -r 0577f10dc3de -r e06abfde6c39 src/stb_image.c --- a/src/stb_image.c Tue Mar 03 22:32:34 2015 +0200 +++ b/src/stb_image.c Tue Mar 03 23:22:36 2015 +0200 @@ -3723,7 +3723,7 @@ if ((ret = dmZLibDecode(&ctx)) != DMERR_OK) goto err; - + *outBuf = ctx.outBufferStart; *outLen = ctx.outBuffer - ctx.outBufferStart; return DMERR_OK;