Changeset 13366

Show
Ignore:
Timestamp:
12/18/07 16:30:32 (5 months ago)
Author:
mloskot
Message:

Patch disabling internal bort() call by libpng (Ticket #1769).

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/frmts/png/pngdataset.cpp

    r13302 r13366  
    466466    hPNG = png_create_read_struct( PNG_LIBPNG_VER_STRING, this, NULL, NULL ); 
    467467 
    468     png_set_error_fn( hPNG, this, png_gdal_error, png_gdal_warning ); 
     468    png_set_error_fn( hPNG, &sSetJmpContext, png_gdal_error, png_gdal_warning ); 
    469469    if( setjmp( sSetJmpContext ) != 0 ) 
    470470        return; 
     
    778778/*      Setup error handling.                                           */ 
    779779/* -------------------------------------------------------------------- */ 
    780     png_set_error_fn( poDS->hPNG, poDS, png_gdal_error, png_gdal_warning ); 
     780    png_set_error_fn( poDS->hPNG, &poDS->sSetJmpContext, png_gdal_error, png_gdal_warning ); 
    781781 
    782782    if( setjmp( poDS->sSetJmpContext ) != 0 ) 
     
    10551055    png_infop   psPNGInfo; 
    10561056     
     1057    jmp_buf     sSetJmpContext; 
    10571058    hPNG = png_create_write_struct( PNG_LIBPNG_VER_STRING,  
    1058                                     NULL, NULL, NULL ); 
     1059                                    &sSetJmpContext, png_gdal_error, png_gdal_warning ); 
    10591060    psPNGInfo = png_create_info_struct( hPNG ); 
    1060      
     1061 
     1062    if( setjmp( sSetJmpContext ) != 0 ) 
     1063    { 
     1064        VSIFCloseL( fpImage ); 
     1065        png_destroy_write_struct( &hPNG, &psPNGInfo ); 
     1066        return NULL; 
     1067    } 
     1068 
    10611069    png_set_write_fn( hPNG, fpImage, png_vsi_write_data, png_vsi_flush ); 
    10621070 
     
    13231331    // semantics.  Ugg.  
    13241332 
    1325     PNGDataset *poDS = (PNGDataset *) png_ptr->error_ptr; 
    1326  
    1327     longjmp( poDS->sSetJmpContext, 1 ); 
     1333    jmp_buf* psSetJmpContext = (jmp_buf*) png_ptr->error_ptr; 
     1334    if (psSetJmpContext) 
     1335    { 
     1336        longjmp( *psSetJmpContext, 1 ); 
     1337    } 
    13281338} 
    13291339