1
0
mirror of git://projects.qi-hardware.com/gmenu2x.git synced 2024-07-01 04:06:42 +03:00

Fixed compilation with GCC 4.9

This commit is contained in:
Maarten ter Huurne 2014-05-18 21:19:03 +02:00
parent fe1a586fb3
commit 9e113d88c7

View File

@ -144,15 +144,19 @@ SDL_Surface *loadPNG(const std::string &path) {
goto cleanup;
}
// Compute row pointers.
png_bytep rowPointers[height];
for (png_uint_32 y = 0; y < height; y++) {
rowPointers[y] =
static_cast<png_bytep>(surface->pixels) + y * surface->pitch;
}
// Note: GCC 4.9 doesn't want to jump over 'rowPointers' with goto
// if it is in the outer scope.
{
// Compute row pointers.
png_bytep rowPointers[height];
for (png_uint_32 y = 0; y < height; y++) {
rowPointers[y] =
static_cast<png_bytep>(surface->pixels) + y * surface->pitch;
}
// Read the entire image in one go.
png_read_image(png, rowPointers);
// Read the entire image in one go.
png_read_image(png, rowPointers);
}
// Read rest of file, and get additional chunks in the info struct.
// Note: We got all we need, so skip this step.