# HG changeset patch # User Matti Hamalainen # Date 1425589957 -7200 # Node ID 505317227ab48bb1931c2714b31e32d7524da39c # Parent 1483b6af60655247e189c00d87aaf44311a1ba9c Rename variable, improve two error messages. diff -r 1483b6af6065 -r 505317227ab4 minijss/jloadjss.c --- a/minijss/jloadjss.c Thu Mar 05 22:23:51 2015 +0200 +++ b/minijss/jloadjss.c Thu Mar 05 23:12:37 2015 +0200 @@ -494,26 +494,23 @@ if (inst && inst->hasData) { int ret; - size_t sz; - - // Calculate data size - if (inst->flags & jsf16bit) - sz = inst->size * sizeof(Uint16); - else - sz = inst->size * sizeof(Uint8); + size_t bsize = (inst->flags & jsf16bit) ? sizeof(Uint16) : sizeof(Uint8); + bsize *= inst->size; // Allocate - if ((inst->data = dmMalloc(sz)) == NULL) + if ((inst->data = dmMalloc(bsize)) == NULL) { JSSERROR(DMERR_MALLOC, DMERR_MALLOC, - "Could not allocate sample data #%d\n", index); + "Could not allocate %d bytes of sample data #%d\n", + bsize, index); } // Copy data - if (!dmf_read_str(inFile, inst->data, sz)) + if (!dmf_read_str(inFile, inst->data, bsize)) { JSSERROR(DMERR_FREAD, DMERR_FREAD, - "Could not read sample data for #%d\n", index); + "Could not read %d bytes of sample data for #%d\n", + bsize, index); } // Convert, if needed