Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 222921 Details for
Bug 308753
games-emulation/mupen64plus fails to build with libpng14
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Update fix_readpng.patch, Fix FTBFS with libpng14
fix_readpng.patch (text/plain), 6.68 KB, created by
Robert Wohlrab
on 2010-03-10 00:01:15 UTC
(
hide
)
Description:
Update fix_readpng.patch, Fix FTBFS with libpng14
Filename:
MIME Type:
Creator:
Robert Wohlrab
Created:
2010-03-10 00:01:15 UTC
Size:
6.68 KB
patch
obsolete
>Description: Fix crash when loading png due to reordering optimizer > The optimizer can reorder instructions like the initialisation of variables if > it looks safe to him. It isn't said that all variables are initialised right > before the call of the first setjmp and thus we cannot rely on there value to > determine if they are point to actual data. >Origin: backport, commit:1411 >Bug: http://code.google.com/p/mupen64plus/issues/detail?id=209 >Author: Sven Eckelmann <sven.eckelmann@gmx.de> >Author: Richard Goedeken <Richard@fascinationsoftware.com> > >--- >diff --git a/rice_video/liblinux/bmp.c b/rice_video/liblinux/bmp.c >index 13c66fdc427c6fc94bff5e3434a1067199d7353f..e1e821db0ec45854faff4c0710195b759b423741 100644 >--- a/rice_video/liblinux/bmp.c >+++ b/rice_video/liblinux/bmp.c >@@ -205,18 +205,18 @@ err_jmp: > BMGError WriteBMP( const char *filename, > struct BMGImageStruct img ) > { >- FILE *file = NULL; >+ FILE * volatile file = NULL; > jmp_buf err_jmp; > int error; > >- unsigned char *bits = NULL; >+ unsigned char * volatile bits = NULL; > unsigned int DIBScanWidth; > unsigned int BitsPerPixel; > unsigned int bit_size; /*, new_bit_size; */ > /* unsigned int rawbit_size; */ > unsigned char *p, *q, *r, *t; > /* unsigned int cnt; */ >- unsigned char *pColor = NULL; >+ unsigned char * volatile pColor = NULL; > > BITMAPFILEHEADER bmfh; > BITMAPINFOHEADER bmih; >@@ -224,17 +224,17 @@ BMGError WriteBMP( const char *filename, > SetLastBMGError( BMG_OK ); > > /* error handler */ >- error = setjmp( err_jmp ); >- if ( error != 0 ) >+ error = setjmp(err_jmp); >+ if (error != 0) > { >- if ( file != NULL ) >- fclose( file ); >- if ( bits != NULL ) >- free( bits ); >- if ( pColor != NULL ) >- free( pColor ); >- SetLastBMGError( (BMGError)error ); >- return (BMGError)error; >+ if (file != NULL) >+ fclose(file); >+ if (bits != NULL) >+ free(bits); >+ if (pColor != NULL) >+ free(pColor); >+ SetLastBMGError((BMGError)error); >+ return (BMGError) error; > } > > if ( img.bits == NULL ) >diff --git a/rice_video/liblinux/pngrw.c b/rice_video/liblinux/pngrw.c >index 673741adbc1d75499100624572a6512fdefd39dc..c13e5d4f410163635d307503acbc13ff6899c2a0 100644 >--- a/rice_video/liblinux/pngrw.c >+++ b/rice_video/liblinux/pngrw.c >@@ -94,12 +94,12 @@ Comments: > gray scale images with alpha components are converted to 32-bit images > */ > BMGError ReadPNG( const char *filename, >- struct BMGImageStruct *img ) >+ struct BMGImageStruct * volatile img ) > { > jmp_buf err_jmp; > int error; > >- FILE *file = NULL; >+ FILE * volatile file = NULL; > int BitDepth; > int BitsPerPixel; > int FixedBitDepth; >@@ -107,18 +107,19 @@ BMGError ReadPNG( const char *filename, > int ImageChannels; > int InterlaceType; > unsigned char signature[8]; >- png_structp png_ptr = NULL; >- png_infop info_ptr = NULL; >+ png_structp volatile png_ptr = NULL; >+ png_infop volatile info_ptr = NULL; >+ png_infop volatile end_info = NULL; > png_colorp PNGPalette = NULL; > png_color_16 *ImageBackground = NULL; > png_bytep trns = NULL; > int NumTrans = 0; > int i, j, k; > png_color_16p TransColors = NULL; >- unsigned int Width, Height; >+ png_uint_32 Width, Height; > > unsigned char *bits, *p, *q; >- unsigned char** rows = NULL; >+ unsigned char** volatile rows = NULL; > int NumColors = 0; > unsigned char BgdRed = 0; > unsigned char BgdGreen = 0; >@@ -130,20 +131,26 @@ BMGError ReadPNG( const char *filename, > > /* error handler */ > error = setjmp( err_jmp ); >- if ( error != 0 ) >+ if (error != 0) > { >- if ( png_ptr != NULL ) >- png_destroy_read_struct( &png_ptr, NULL, NULL ); >- if ( rows ) >+ if (end_info != NULL) >+ png_destroy_read_struct((png_structp *) &png_ptr, (png_infop *) &info_ptr, (png_infop *) &end_info); >+ else if (info_ptr != NULL) >+ png_destroy_read_struct((png_structp *) &png_ptr, (png_infop *) &info_ptr, NULL); >+ else if (png_ptr != NULL) >+ png_destroy_read_struct((png_structp *) &png_ptr, NULL, NULL); >+ if (rows) > { >- if ( rows[0] ) >- free( rows[0] ); >- free( rows ); >+ if (rows[0]) >+ free(rows[0]); >+ free(rows); > } >- FreeBMGImage( img ); >- fclose( file ); >- SetLastBMGError( (BMGError)error ); >- return (BMGError)error; >+ if (img) >+ FreeBMGImage(img); >+ if (file) >+ fclose(file); >+ SetLastBMGError((BMGError) error); >+ return (BMGError) error; > } > > if ( img == NULL ) >@@ -163,6 +170,16 @@ BMGError ReadPNG( const char *filename, > if ( !png_ptr ) > longjmp( err_jmp, (int)errMemoryAllocation ); > >+ /* create a pointer to the png info structure */ >+ info_ptr = png_create_info_struct( png_ptr ); >+ if ( !info_ptr ) >+ longjmp( err_jmp, (int)errMemoryAllocation ); >+ >+ /* create a pointer to the png end-info structure */ >+ end_info = png_create_info_struct(png_ptr); >+ if (!end_info) >+ longjmp( err_jmp, (int)errMemoryAllocation ); >+ > /* bamboozle the PNG longjmp buffer */ > /*generic PNG error handler*/ > /* error will always == 1 which == errLib */ >@@ -171,11 +188,6 @@ BMGError ReadPNG( const char *filename, > if ( error > 0 ) > longjmp( err_jmp, error ); > >- /* create a pointer to the png info structure */ >- info_ptr = png_create_info_struct( png_ptr ); >- if ( !info_ptr ) >- longjmp( err_jmp, (int)errMemoryAllocation ); >- > /* attach file buffer to the png read pointer */ > png_init_io( png_ptr, file ); > >@@ -187,7 +199,7 @@ BMGError ReadPNG( const char *filename, > > /* extract the data we need to form the HBITMAP from the PNG header */ > png_get_IHDR( png_ptr, info_ptr, &Width, &Height, &BitDepth, &ColorType, >- &InterlaceType, NULL, NULL ); >+ &InterlaceType, NULL, NULL); > > img->width = Width; > img->height = Height; >@@ -475,7 +487,7 @@ BMGError ReadPNG( const char *filename, > free( rows[0] ); > free( rows ); > png_read_end( png_ptr, info_ptr ); >- png_destroy_read_struct( &png_ptr, &info_ptr, NULL ); >+ png_destroy_read_struct((png_structp *) &png_ptr, (png_infop *) &info_ptr, (png_infop *) &end_info); > fclose( file ); > > return BMG_OK;
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 308753
:
222921
|
223757