diff -Nru xbubble-0.5.11.2/debian/changelog xbubble-0.5.11.2/debian/changelog --- xbubble-0.5.11.2/debian/changelog 2010-11-11 23:00:35.000000000 +0000 +++ xbubble-0.5.11.2/debian/changelog 2010-11-11 22:43:32.000000000 +0000 @@ -1,3 +1,27 @@ +xbubble (0.5.11.2-3.1ubuntu1) natty; urgency=low + + * Merge from debian unstable. Remaining changes: + - debian/patches/11-loadpng.patch: Fix FTBFS caused by ignoring + the return value of some functions: + + src/init.c: check the return code of realpath. + + src/loadpng.c: handle short reads. + + -- Artur Rona Thu, 11 Nov 2010 22:54:35 +0100 + +xbubble (0.5.11.2-3.1) unstable; urgency=low + + [Jari Aalto] + * Non-maintainer upload. + - Move to packaging format "3.0 (quilt)" due to patch. + * debian/patches + - (Number 10): Add patch to fix Gcc 4.4 error: declaration of 'round' + shadows a global declaration. Patch thanks to Ilya Barygin + . (RC bug FTBFS serious; Closes: #552885). + * debian/source/format + - New file. + + -- Jari Aalto Tue, 30 Mar 2010 16:41:03 +0300 + xbubble (0.5.11.2-3ubuntu2) lucid; urgency=low * src/{game.*,xbubble.h}: rename "round" variable to resolve name diff -Nru xbubble-0.5.11.2/debian/patches/10-game.c.patch xbubble-0.5.11.2/debian/patches/10-game.c.patch --- xbubble-0.5.11.2/debian/patches/10-game.c.patch 1970-01-01 00:00:00.000000000 +0000 +++ xbubble-0.5.11.2/debian/patches/10-game.c.patch 2010-03-30 13:34:11.000000000 +0000 @@ -0,0 +1,65 @@ +From 33e5508f710b2d78674461fed16befde0f6f6c8f Mon Sep 17 00:00:00 2001 +From: Jari Aalto +Date: Tue, 30 Mar 2010 16:33:44 +0300 +Subject: [PATCH] Fix error: declaration of 'round' shadows a global declaration +Organization: Private +Content-Type: text/plain; charset="utf-8" +Content-Transfer-Encoding: 8bit + +Signed-off-by: Jari Aalto +--- + src/game.c | 4 ++-- + src/xbubble.c | 6 +++--- + 2 files changed, 5 insertions(+), 5 deletions(-) + +diff --git a/src/game.c b/src/game.c +index cabd993..31e1342 100644 +--- a/src/game.c ++++ b/src/game.c +@@ -187,7 +187,7 @@ static void display_cups( Game game, int n, int on ) { + Game new_game( enum GameMode mode, + RuleSet_t *ruleset, + int *colors, +- int round, ++ int round_now, + int *score, + enum Level level ) { + +@@ -200,7 +200,7 @@ Game new_game( enum GameMode mode, + game->state = PLAYING; + game->mode = mode; + game->score = score; +- game->round = round; ++ game->round = round_now; + for ( i = 0; i < 2; i++ ) { + game->player_left[i] = 0; + game->player_right[i] = 0; +diff --git a/src/xbubble.c b/src/xbubble.c +index 8763c05..0f84d25 100644 +--- a/src/xbubble.c ++++ b/src/xbubble.c +@@ -116,7 +116,7 @@ static void play_challenge_game( int *handicap ) { + } + + static void play_match( enum GameMode mode, int *handicap, enum Level level ) { +- int round; ++ int game_round; + int done; + int score[2]; + int games[2] = { 0, 0 }; +@@ -132,10 +132,10 @@ static void play_match( enum GameMode mode, int *handicap, enum Level level ) { + score[0] = 0; + score[1] = 0; + done = 0; +- for ( round = 1; !done; round++ ) { ++ for ( game_round = 1; !done; game_round++ ) { + /* preload bubbles */ + create_randome_level(5); +- game = new_game( mode, ruleset, colors, round, score, level); ++ game = new_game( mode, ruleset, colors, game_round, score, level); + result = play_game(game); + done = score[1]==2 || score[0]==2 || result == ABORTED; + //not_done= (!(((score[1]>=5)&&(score[1]-score[0]>1)) || +-- +1.7.0 + diff -Nru xbubble-0.5.11.2/debian/patches/11-loadpng.patch xbubble-0.5.11.2/debian/patches/11-loadpng.patch --- xbubble-0.5.11.2/debian/patches/11-loadpng.patch 1970-01-01 00:00:00.000000000 +0000 +++ xbubble-0.5.11.2/debian/patches/11-loadpng.patch 2010-11-11 22:22:59.000000000 +0000 @@ -0,0 +1,204 @@ +From: Artur Rona +Description: Fix build errors caused by ignoring the return value of some functions. + - src/init.c: check the return code of realpath. + - src/loadpng.c: handle short reads. +Bug-Debian: http://bugs.debian.org/511922 +Origin: http://launchpadlibrarian.net/21243066/xbubble_0.5.11.2-2_0.5.11.2-2ubuntu1.diff.gz +Author: James Westby +diff -pruN 0.5.11.2-3/src/init.c 0.5.11.2-3ubuntu2/src/init.c +--- 0.5.11.2-3/src/init.c 2005-04-27 16:42:19.000000000 +0100 ++++ 0.5.11.2-3ubuntu2/src/init.c 2010-03-08 22:38:42.000000000 +0000 +@@ -97,7 +97,8 @@ static char * data_file( const char * fi + path_max = 4096; + #endif + abs_data_dir = (char *) xmalloc( path_max * sizeof(char)); +- realpath( data_dir, abs_data_dir ); ++ if (!realpath( data_dir, abs_data_dir )) ++ return NULL; + offset = strlen(abs_data_dir); + if ( offset > 1024-128 ) + offset = 1024-128; +@@ -119,8 +120,9 @@ static char * data_file( const char * fi + } + + +-static void load_levels( const char * file ) { ++static void load_levels( const char * file_path ) { + FILE *fd; ++ char * file; + char line[128]; + unsigned char r[8]; + int i, cell = 0; +@@ -129,7 +131,11 @@ static void load_levels( const char * fi + int color, parse_error = 0; + + nb_levels = 0; +- file = data_file(file, 0); ++ file = data_file(file_path, 0); ++ if ( file == NULL ) { ++ warn( _("cannot open levels file %s."), file_path); ++ return; ++ } + + fd = fopen( file, "r" ); + if ( fd == NULL ) { +@@ -232,6 +238,7 @@ static void add_font_path( char * path ) + + static XFontStruct * load_font( int pixel_size ) { + XFontStruct * xfont; ++ char * font_path; + char name[128]; + int i; + static int added_font_path = 0; +@@ -245,7 +252,10 @@ static XFontStruct * load_font( int pixe + } + /* let's see if we can supply a font */ + if ( ! added_font_path ) { +- add_font_path(data_file("",0)); ++ font_path = data_file("", 0); ++ if ( font_path == NULL ) ++ fail( _("couldn't determine path to load font !") ); ++ add_font_path(font_path); + added_font_path = 1; + } + sprintf( name, SUPPLIED_FONT, pixel_size ); +@@ -276,8 +286,13 @@ static Frame load_frame( char *file, dou + RgbaImage ri1; + RgbaImage ri2; + Frame frame = (Frame) xmalloc( sizeof( struct _Frame )); ++ char * png_file; + +- ri1 = create_rgba_image_from_png_file(data_file(file,1)); ++ png_file = data_file(file, 1); ++ if ( png_file == NULL ) { ++ fail(_("Couldn't get file to load frame from")); ++ } ++ ri1 = create_rgba_image_from_png_file(png_file); + /* ri2 = ( zoom < 1.0 )? scale_rgba_image( ri1, zoom, zoom ) : ri1; */ + ri2 = scale_rgba_image( ri1, zoom, zoom ) ; + pmask = ( ri2->has_alpha )? &mask : NULL; +@@ -322,11 +337,16 @@ static Set load_animation( const char *f + char line[128]; + char framename[128]; + FILE *fd; ++ char * animation_file; + + /* open animation description file */ +- fd = fopen( data_file(filename,1), "r" ); ++ animation_file = data_file(filename,1); ++ if ( animation_file == NULL ) { ++ fail(_("couldn't get file to load animation from")); ++ } ++ fd = fopen( animation_file, "r" ); + if ( fd == NULL ) +- fail( _("cannot open animation file %s."), data_file(filename,1) ); ++ fail( _("cannot open animation file %s."), animation_file ); + + /* count frames */ + while ( fgets( line, 128, fd ) != NULL ) { +@@ -362,7 +382,13 @@ static Set load_animation( const char *f + static void load_scaled_image( const char *file, Pixmap *pix, Pixmap *mask, double zoom ) { + RgbaImage ri1; + RgbaImage ri2; +- ri1 = create_rgba_image_from_png_file(data_file(file,1)); ++ char * png_file; ++ ++ png_file = data_file(file, 1); ++ if ( png_file == NULL ) { ++ fail(_("Couldn't load file to scale image")); ++ } ++ ri1 = create_rgba_image_from_png_file(png_file); + ri2 = ( zoom < 1.0 )? scale_rgba_image( ri1, zoom, zoom ) : ri1; + create_pixmaps_from_rgba_image( ri2, pix, mask ); + delete_rgba_image(ri1); +@@ -390,8 +416,13 @@ static void make_canon_animation( double + Pixmap mask; + Frame frame; + int i; ++ char * canon_data_file; + +- ri2 = create_rgba_image_from_png_file(data_file("canon.png",1)); ++ canon_data_file = data_file("canon.png",1); ++ if ( canon_data_file == NULL ) { ++ fail(_("Couldn't load file for canon information")); ++ } ++ ri2 = create_rgba_image_from_png_file(canon_data_file); + ri2->hotx = CANON_CX; + ri2->hoty = CANON_CY; + ri = scale_rgba_image( ri2, zoom, zoom ); +@@ -503,6 +534,9 @@ static void load_animations( double zoom + + /* bubble animation */ + dir = data_file("./",1); ++ if ( dir == NULL ) { ++ fail(_("couldn't get dir for loading bubble")); ++ } + + n = scandir(dir, &namelist, diren_select_bubbles , alphasort); + if (n < 0) fail(_("Error while scanning %s"),dir); +@@ -747,6 +781,7 @@ void splash_screen( double zoom ) { + char * subtitle = _("Loading graphics ..."); + + const char *config_file = "config.txt"; ++ char * config_data_file; + FILE *fd = NULL ; + char line[128]; + char *copy = NULL; +@@ -759,7 +794,11 @@ void splash_screen( double zoom ) { + double newzoom = zoom; + int i; + +- fd = fopen( data_file(config_file,1), "r" ); ++ config_data_file = data_file(config_file,1); ++ if ( config_data_file == NULL ) { ++ fail(_("Couldn't find data file for splash screen")); ++ } ++ fd = fopen( config_data_file, "r" ); + if(fd) { /* time to change default values... */ + while ( fgets( line, 128, fd ) != NULL ) { + lc++; +diff -pruN 0.5.11.2-3/src/loadpng.c 0.5.11.2-3ubuntu2/src/loadpng.c +--- 0.5.11.2-3/src/loadpng.c 2005-04-22 17:13:04.000000000 +0100 ++++ 0.5.11.2-3ubuntu2/src/loadpng.c 2010-03-08 22:38:42.000000000 +0000 +@@ -18,6 +18,7 @@ + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + ++#include + #include + #include + #include +@@ -43,7 +44,8 @@ unsigned char * load_png_file( const cha + FILE *fd; + unsigned char *data; + unsigned char header[8]; +- int bit_depth, color_type, i; ++ unsigned char *header_ptr; ++ int bit_depth, color_type, i, bytes_to_read, bytes_read; + png_uint_32 png_width, png_height, rowbytes; + png_structp png_ptr; + png_infop info_ptr; +@@ -55,7 +57,22 @@ unsigned char * load_png_file( const cha + return NULL; + } + /* ensure that we opened a PNG file */ +- fread( header, 1, 8, fd ); ++ bytes_to_read = 8; ++ header_ptr = header; ++ do { ++ bytes_read = fread( header_ptr, 1, bytes_to_read, fd ); ++ if (bytes_read == bytes_to_read) ++ break; ++ if (bytes_read >= 0) { ++ bytes_to_read -= bytes_read; ++ header_ptr += bytes_read; ++ } ++ } while (bytes_read >= 0 || errno == EINTR); ++ if (bytes_read == 0) { ++ fclose(fd); ++ fprintf(stderr,_("Error reading from %s.\n"), file); ++ return NULL; ++ } + if ( ! png_check_sig( header, 8 ) ) { + fclose(fd); + fprintf(stderr,_("File %s does not have a valid PNG signature.\n"), file); diff -Nru xbubble-0.5.11.2/debian/patches/series xbubble-0.5.11.2/debian/patches/series --- xbubble-0.5.11.2/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ xbubble-0.5.11.2/debian/patches/series 2010-11-11 22:03:57.000000000 +0000 @@ -0,0 +1,2 @@ +10-game.c.patch +11-loadpng.patch diff -Nru xbubble-0.5.11.2/debian/source/format xbubble-0.5.11.2/debian/source/format --- xbubble-0.5.11.2/debian/source/format 1970-01-01 00:00:00.000000000 +0000 +++ xbubble-0.5.11.2/debian/source/format 2010-11-11 23:00:36.000000000 +0000 @@ -0,0 +1 @@ +3.0 (quilt) diff -Nru xbubble-0.5.11.2/src/game.c xbubble-0.5.11.2/src/game.c --- xbubble-0.5.11.2/src/game.c 2010-11-11 23:00:35.000000000 +0000 +++ xbubble-0.5.11.2/src/game.c 2005-04-27 14:29:41.000000000 +0000 @@ -187,7 +187,7 @@ Game new_game( enum GameMode mode, RuleSet_t *ruleset, int *colors, - int round_xb, + int round, int *score, enum Level level ) { @@ -200,7 +200,7 @@ game->state = PLAYING; game->mode = mode; game->score = score; - game->round = round_xb; + game->round = round; for ( i = 0; i < 2; i++ ) { game->player_left[i] = 0; game->player_right[i] = 0; diff -Nru xbubble-0.5.11.2/src/game.h xbubble-0.5.11.2/src/game.h --- xbubble-0.5.11.2/src/game.h 2010-11-11 23:00:35.000000000 +0000 +++ xbubble-0.5.11.2/src/game.h 2004-12-05 20:21:37.000000000 +0000 @@ -23,7 +23,7 @@ Game new_game( enum GameMode mode, RuleSet_t *ruleset, int *colors, - int round_xb, + int round, int *score, enum Level level ); diff -Nru xbubble-0.5.11.2/src/init.c xbubble-0.5.11.2/src/init.c --- xbubble-0.5.11.2/src/init.c 2010-11-11 23:00:35.000000000 +0000 +++ xbubble-0.5.11.2/src/init.c 2005-04-27 15:42:19.000000000 +0000 @@ -97,8 +97,7 @@ path_max = 4096; #endif abs_data_dir = (char *) xmalloc( path_max * sizeof(char)); - if (!realpath( data_dir, abs_data_dir )) - return NULL; + realpath( data_dir, abs_data_dir ); offset = strlen(abs_data_dir); if ( offset > 1024-128 ) offset = 1024-128; @@ -120,9 +119,8 @@ } -static void load_levels( const char * file_path ) { +static void load_levels( const char * file ) { FILE *fd; - char * file; char line[128]; unsigned char r[8]; int i, cell = 0; @@ -131,11 +129,7 @@ int color, parse_error = 0; nb_levels = 0; - file = data_file(file_path, 0); - if ( file == NULL ) { - warn( _("cannot open levels file %s."), file_path); - return; - } + file = data_file(file, 0); fd = fopen( file, "r" ); if ( fd == NULL ) { @@ -238,7 +232,6 @@ static XFontStruct * load_font( int pixel_size ) { XFontStruct * xfont; - char * font_path; char name[128]; int i; static int added_font_path = 0; @@ -252,10 +245,7 @@ } /* let's see if we can supply a font */ if ( ! added_font_path ) { - font_path = data_file("", 0); - if ( font_path == NULL ) - fail( _("couldn't determine path to load font !") ); - add_font_path(font_path); + add_font_path(data_file("",0)); added_font_path = 1; } sprintf( name, SUPPLIED_FONT, pixel_size ); @@ -286,13 +276,8 @@ RgbaImage ri1; RgbaImage ri2; Frame frame = (Frame) xmalloc( sizeof( struct _Frame )); - char * png_file; - png_file = data_file(file, 1); - if ( png_file == NULL ) { - fail(_("Couldn't get file to load frame from")); - } - ri1 = create_rgba_image_from_png_file(png_file); + ri1 = create_rgba_image_from_png_file(data_file(file,1)); /* ri2 = ( zoom < 1.0 )? scale_rgba_image( ri1, zoom, zoom ) : ri1; */ ri2 = scale_rgba_image( ri1, zoom, zoom ) ; pmask = ( ri2->has_alpha )? &mask : NULL; @@ -337,16 +322,11 @@ char line[128]; char framename[128]; FILE *fd; - char * animation_file; /* open animation description file */ - animation_file = data_file(filename,1); - if ( animation_file == NULL ) { - fail(_("couldn't get file to load animation from")); - } - fd = fopen( animation_file, "r" ); + fd = fopen( data_file(filename,1), "r" ); if ( fd == NULL ) - fail( _("cannot open animation file %s."), animation_file ); + fail( _("cannot open animation file %s."), data_file(filename,1) ); /* count frames */ while ( fgets( line, 128, fd ) != NULL ) { @@ -382,13 +362,7 @@ static void load_scaled_image( const char *file, Pixmap *pix, Pixmap *mask, double zoom ) { RgbaImage ri1; RgbaImage ri2; - char * png_file; - - png_file = data_file(file, 1); - if ( png_file == NULL ) { - fail(_("Couldn't load file to scale image")); - } - ri1 = create_rgba_image_from_png_file(png_file); + ri1 = create_rgba_image_from_png_file(data_file(file,1)); ri2 = ( zoom < 1.0 )? scale_rgba_image( ri1, zoom, zoom ) : ri1; create_pixmaps_from_rgba_image( ri2, pix, mask ); delete_rgba_image(ri1); @@ -416,13 +390,8 @@ Pixmap mask; Frame frame; int i; - char * canon_data_file; - canon_data_file = data_file("canon.png",1); - if ( canon_data_file == NULL ) { - fail(_("Couldn't load file for canon information")); - } - ri2 = create_rgba_image_from_png_file(canon_data_file); + ri2 = create_rgba_image_from_png_file(data_file("canon.png",1)); ri2->hotx = CANON_CX; ri2->hoty = CANON_CY; ri = scale_rgba_image( ri2, zoom, zoom ); @@ -534,9 +503,6 @@ /* bubble animation */ dir = data_file("./",1); - if ( dir == NULL ) { - fail(_("couldn't get dir for loading bubble")); - } n = scandir(dir, &namelist, diren_select_bubbles , alphasort); if (n < 0) fail(_("Error while scanning %s"),dir); @@ -781,7 +747,6 @@ char * subtitle = _("Loading graphics ..."); const char *config_file = "config.txt"; - char * config_data_file; FILE *fd = NULL ; char line[128]; char *copy = NULL; @@ -794,11 +759,7 @@ double newzoom = zoom; int i; - config_data_file = data_file(config_file,1); - if ( config_data_file == NULL ) { - fail(_("Couldn't find data file for splash screen")); - } - fd = fopen( config_data_file, "r" ); + fd = fopen( data_file(config_file,1), "r" ); if(fd) { /* time to change default values... */ while ( fgets( line, 128, fd ) != NULL ) { lc++; diff -Nru xbubble-0.5.11.2/src/loadpng.c xbubble-0.5.11.2/src/loadpng.c --- xbubble-0.5.11.2/src/loadpng.c 2010-11-11 23:00:35.000000000 +0000 +++ xbubble-0.5.11.2/src/loadpng.c 2005-04-22 16:13:04.000000000 +0000 @@ -18,7 +18,6 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA */ -#include #include #include #include @@ -44,8 +43,7 @@ FILE *fd; unsigned char *data; unsigned char header[8]; - unsigned char *header_ptr; - int bit_depth, color_type, i, bytes_to_read, bytes_read; + int bit_depth, color_type, i; png_uint_32 png_width, png_height, rowbytes; png_structp png_ptr; png_infop info_ptr; @@ -57,22 +55,7 @@ return NULL; } /* ensure that we opened a PNG file */ - bytes_to_read = 8; - header_ptr = header; - do { - bytes_read = fread( header_ptr, 1, bytes_to_read, fd ); - if (bytes_read == bytes_to_read) - break; - if (bytes_read >= 0) { - bytes_to_read -= bytes_read; - header_ptr += bytes_read; - } - } while (bytes_read >= 0 || errno == EINTR); - if (bytes_read == 0) { - fclose(fd); - fprintf(stderr,_("Error reading from %s.\n"), file); - return NULL; - } + fread( header, 1, 8, fd ); if ( ! png_check_sig( header, 8 ) ) { fclose(fd); fprintf(stderr,_("File %s does not have a valid PNG signature.\n"), file); diff -Nru xbubble-0.5.11.2/src/xbubble.c xbubble-0.5.11.2/src/xbubble.c --- xbubble-0.5.11.2/src/xbubble.c 2010-11-11 23:00:35.000000000 +0000 +++ xbubble-0.5.11.2/src/xbubble.c 2006-03-21 23:22:35.000000000 +0000 @@ -116,7 +116,7 @@ } static void play_match( enum GameMode mode, int *handicap, enum Level level ) { - int round_xb; + int round; int done; int score[2]; int games[2] = { 0, 0 }; @@ -132,10 +132,10 @@ score[0] = 0; score[1] = 0; done = 0; - for ( round_xb = 1; !done; round_xb++ ) { + for ( round = 1; !done; round++ ) { /* preload bubbles */ create_randome_level(5); - game = new_game( mode, ruleset, colors, round_xb, score, level); + game = new_game( mode, ruleset, colors, round, score, level); result = play_game(game); done = score[1]==2 || score[0]==2 || result == ABORTED; //not_done= (!(((score[1]>=5)&&(score[1]-score[0]>1)) ||