Changeset 11183

Show
Ignore:
Timestamp:
04/02/07 20:27:23 (2 years ago)
Author:
mloskot
Message:

Backported fix of ticket #1523 to the stable branch 1.4.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • branches/1.4/gdal/gcore/gdal_misc.cpp

    r11096 r11183  
    13271327    const char  *pszTFW; 
    13281328    char        szExtUpper[32], szExtLower[32]; 
    1329     int         i; 
    1330     char        **papszLines; 
     1329    int         i = 0; 
     1330    int         nLinesCount = 0; 
     1331    char        **papszLines = NULL; 
     1332    bool        bValid = false; 
    13311333 
    13321334/* -------------------------------------------------------------------- */ 
     
    14061408    papszLines = CSLLoad( pszTFW ); 
    14071409 
    1408     if( CSLCount(papszLines) >= 6  
    1409         && (CPLAtofM(papszLines[0]) != 0.0 || CPLAtofM(papszLines[2]) != 0.0) 
    1410         && (CPLAtofM(papszLines[3]) != 0.0 || CPLAtofM(papszLines[1]) != 0.0) ) 
     1410    nLinesCount = CSLCount(papszLines); 
     1411    if( nLinesCount >= 6 ) 
     1412    { 
     1413        bValid = true; 
     1414 
     1415        /* First six lines of a world file can not be empty. */ 
     1416        for( i = 0; i < 6; i++) 
     1417        { 
     1418           CPLString line(papszLines[i]); 
     1419           if( line.Trim().empty() ) 
     1420           { 
     1421               bValid = false; 
     1422               break; 
     1423           } 
     1424        } 
     1425    } 
     1426    else 
     1427        bValid = false; 
     1428 
     1429 
     1430    if( bValid ) 
    14111431    { 
    14121432        padfGeoTransform[0] = CPLAtofM(papszLines[4]);