Changeset 12098

Show
Ignore:
Timestamp:
09/07/07 16:22:16 (1 year ago)
Author:
warmerdam
Message:

Various fixes to support large (>2GB) JPEG2000 file (for which poOpenInfo->fp
is NULL) and to support reading jpc files.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • trunk/gdal/frmts/jp2kak/jp2kakdataset.cpp

    r11730 r12098  
    10941094/*      Check header                                                    */ 
    10951095/* -------------------------------------------------------------------- */ 
    1096     if( poOpenInfo->fp == NULL
     1096    if( poOpenInfo->nHeaderBytes < (int) sizeof(jp2_header)
    10971097    { 
    10981098        const char  *pszExtension = NULL; 
     
    11231123 
    11241124        pszExtension = CPLGetExtension( poOpenInfo->pszFilename ); 
    1125         if( !EQUAL(pszExtension,"jpc") && !EQUAL(pszExtension,"j2k")  
    1126             && !EQUAL(pszExtension,"jp2") && !EQUAL(pszExtension,"jpx")  
    1127             && !EQUAL(pszExtension,"j2c") ) 
     1125        if( EQUAL(pszExtension,"jpc")  
     1126            || EQUAL(pszExtension,"j2k")  
     1127            || EQUAL(pszExtension,"jp2")  
     1128            || EQUAL(pszExtension,"jpx")  
     1129            || EQUAL(pszExtension,"j2c") ) 
    11281130            return TRUE; 
    11291131    } 
     
    11521154/* -------------------------------------------------------------------- */ 
    11531155    pszExtension = CPLGetExtension( poOpenInfo->pszFilename ); 
    1154     if( poOpenInfo->fp == NULL
     1156    if( poOpenInfo->nHeaderBytes < 16
    11551157    { 
    11561158        if( (EQUALN(poOpenInfo->pszFilename,"http://",7) 
     
    11881190    else 
    11891191    { 
    1190         if( poOpenInfo->nHeaderBytes < 16 ) 
    1191             return NULL; 
    1192  
    11931192        pabyHeader = poOpenInfo->pabyHeader; 
    11941193    } 
     
    11991198/*      If the header is a JP2 header, mark this as a JP2 dataset.      */ 
    12001199/* -------------------------------------------------------------------- */ 
    1201     if( memcmp(pabyHeader,jp2_header,sizeof(jp2_header)) == 0 ) 
     1200    if( pabyHeader && memcmp(pabyHeader,jp2_header,sizeof(jp2_header)) == 0 ) 
    12021201        pszExtension = "jp2"; 
    12031202 
     
    14071406/*      Look for supporting coordinate system information.              */ 
    14081407/* -------------------------------------------------------------------- */ 
    1409         if( poOpenInfo->fp != NULL
     1408        if( poOpenInfo->nHeaderBytes > 0
    14101409        { 
    14111410            GDALJP2Metadata oJP2Geo;