Changeset 1586:e26071072b5e


Ignore:
Timestamp:
02/20/10 12:58:21 (5 months ago)
Author:
Howard Butler <hobu.inc@…>
Branch:
default
Message:

use stack-based OGRSpatialReference instead of heap-based

Files:
2 edited

Legend:

Unmodified
Added
Removed
  • apps/oci_wrapper.cpp

    r1583 r1586  
    466466    if( nStmtType != OCI_STMT_SELECT ) 
    467467    { 
    468         // nStmtMode = OCI_COMMIT_ON_SUCCESS; 
    469         nStmtMode = OCI_DEFAULT; 
     468        nStmtMode = OCI_COMMIT_ON_SUCCESS; 
     469        // nStmtMode = OCI_DEFAULT; 
    470470 
    471471    } 
  • src/lasspatialreference.cpp

    r1585 r1586  
    402402            poSRS->exportToWkt( &pszWKT ); 
    403403             
    404             OGRSpatialReference::DestroySpatialReference(poSRS); 
     404            delete poSRS; 
    405405        } 
    406406#endif 
     
    423423    char* poWKT = 0; 
    424424    const char* input = v.c_str(); 
    425     OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL); 
    426     if (OGRERR_NONE != poSRS->SetFromUserInput((char *) input)) 
    427     { 
    428         OGRSpatialReference::DestroySpatialReference(poSRS); 
     425     
     426    // OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL); 
     427    OGRSpatialReference srs(NULL); 
     428    if (OGRERR_NONE != srs.SetFromUserInput((char *) input)) 
     429    { 
    429430        throw std::invalid_argument("could not import coordinate system into OSRSpatialReference SetFromUserInput"); 
    430431    } 
    431432     
    432     poSRS->exportToWkt(&poWKT); 
    433     OGRSpatialReference::DestroySpatialReference(poSRS); 
     433    srs.exportToWkt(&poWKT); 
    434434     
    435435    std::string tmp(poWKT); 
     
    518518    const char* poWKT = wkt.c_str(); 
    519519     
    520     OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL); 
    521     if (OGRERR_NONE != poSRS->importFromWkt((char **) &poWKT)) 
    522     { 
    523         OGRSpatialReference::DestroySpatialReference(poSRS); 
     520    OGRSpatialReference srs(NULL); 
     521    if (OGRERR_NONE != srs.importFromWkt((char **) &poWKT)) 
     522    { 
    524523        return std::string(); 
    525524    } 
    526525     
    527526    char* proj4 = 0; 
    528     poSRS->exportToProj4(&proj4); 
     527    srs.exportToProj4(&proj4); 
    529528    std::string tmp(proj4); 
    530529    CPLFree(proj4); 
    531530     
    532     OGRSpatialReference::DestroySpatialReference(poSRS); 
    533  
    534531    return tmp; 
    535532#endif 
     
    567564    char* poWKT = 0; 
    568565    const char* poProj4 = v.c_str(); 
    569     OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL); 
    570     if (OGRERR_NONE != poSRS->importFromProj4((char *) poProj4)) 
    571     { 
    572         OGRSpatialReference::DestroySpatialReference(poSRS); 
     566 
     567    OGRSpatialReference srs(NULL); 
     568    if (OGRERR_NONE != srs.importFromProj4((char *) poProj4)) 
     569    { 
    573570        throw std::invalid_argument("could not import proj4 into OSRSpatialReference SetProj4"); 
    574571    } 
    575572     
    576     poSRS->exportToWkt(&poWKT); 
    577     OGRSpatialReference::DestroySpatialReference(poSRS); 
     573    srs.exportToWkt(&poWKT); 
    578574     
    579575    std::string tmp(poWKT); 
Note: See TracChangeset for help on using the changeset viewer.