diff --git a/source/lib/res/graphics/tex.cpp b/source/lib/res/graphics/tex.cpp index f37a67a247..2f22947f76 100755 --- a/source/lib/res/graphics/tex.cpp +++ b/source/lib/res/graphics/tex.cpp @@ -544,14 +544,17 @@ int tex_write(const char* fn, uint w, uint h, uint bpp, uint flags, void* in_img CHECK_ERR(tex_codec_for_filename(fn, &c)); // encode - int err = c->encode(&t, &da); + int err; + size_t rounded_size; + + err = c->encode(&t, &da); if(err < 0) { debug_printf("tex_write (%s): %d", c->name, err); debug_warn("tex_writefailed"); goto fail; } - const size_t rounded_size = round_up(da.cur_size, FILE_BLOCK_SIZE); + rounded_size = round_up(da.cur_size, FILE_BLOCK_SIZE); CHECK_ERR(da_set_size(&da, rounded_size)); WARN_ERR(vfs_store(fn, da.base, da.pos)); err = 0;