Changeset 1585:5ffcd83c54fd
- Timestamp:
- 02/20/10 11:20:39 (5 months ago)
- Branch:
- default
- File:
-
- 1 edited
-
src/lasspatialreference.cpp (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/lasspatialreference.cpp
r1578 r1585 392 392 && strstr(pszWKT,"COMPD_CS") != NULL ) 393 393 { 394 OGRSpatialReference* poSRS = new OGRSpatialReference();394 OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL); 395 395 char *pszOrigWKT = pszWKT; 396 396 poSRS->importFromWkt( &pszOrigWKT ); … … 401 401 poSRS->StripVertical(); 402 402 poSRS->exportToWkt( &pszWKT ); 403 404 OGRSpatialReference::DestroySpatialReference(poSRS); 403 405 } 404 406 #endif … … 407 409 { 408 410 std::string tmp(pszWKT); 409 std::free(pszWKT);411 CPLFree(pszWKT); 410 412 return tmp; 411 413 } … … 421 423 char* poWKT = 0; 422 424 const char* input = v.c_str(); 423 OGRSpatialReference* poSRS = new OGRSpatialReference();425 OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL); 424 426 if (OGRERR_NONE != poSRS->SetFromUserInput((char *) input)) 425 427 { 426 delete poSRS;428 OGRSpatialReference::DestroySpatialReference(poSRS); 427 429 throw std::invalid_argument("could not import coordinate system into OSRSpatialReference SetFromUserInput"); 428 430 } 429 431 430 432 poSRS->exportToWkt(&poWKT); 431 delete poSRS;433 OGRSpatialReference::DestroySpatialReference(poSRS); 432 434 433 435 std::string tmp(poWKT); 434 std::free(poWKT);436 CPLFree(poWKT); 435 437 436 438 SetWKT(tmp); … … 516 518 const char* poWKT = wkt.c_str(); 517 519 518 OGRSpatialReference* poSRS = new OGRSpatialReference();520 OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL); 519 521 if (OGRERR_NONE != poSRS->importFromWkt((char **) &poWKT)) 520 522 { 521 delete poSRS;523 OGRSpatialReference::DestroySpatialReference(poSRS); 522 524 return std::string(); 523 525 } … … 526 528 poSRS->exportToProj4(&proj4); 527 529 std::string tmp(proj4); 528 std::free(proj4);529 530 delete poSRS;530 CPLFree(proj4); 531 532 OGRSpatialReference::DestroySpatialReference(poSRS); 531 533 532 534 return tmp; … … 543 545 char* proj4def = GTIFGetProj4Defn(&defn); 544 546 std::string tmp(proj4def); 545 std::free(proj4def); 547 std::free(proj4def); /* risk of cross-heap issue, but no free function in libgeotiff matching GTIFGetProj4Defn */ 546 548 547 549 return tmp; … … 565 567 char* poWKT = 0; 566 568 const char* poProj4 = v.c_str(); 567 OGRSpatialReference* poSRS = new OGRSpatialReference();569 OGRSpatialReference* poSRS = (OGRSpatialReference*) OSRNewSpatialReference(NULL); 568 570 if (OGRERR_NONE != poSRS->importFromProj4((char *) poProj4)) 569 571 { 570 delete poSRS;572 OGRSpatialReference::DestroySpatialReference(poSRS); 571 573 throw std::invalid_argument("could not import proj4 into OSRSpatialReference SetProj4"); 572 574 } 573 575 574 576 poSRS->exportToWkt(&poWKT); 575 delete poSRS;577 OGRSpatialReference::DestroySpatialReference(poSRS); 576 578 577 579 std::string tmp(poWKT); 578 std::free(poWKT);580 CPLFree(poWKT); 579 581 580 582 int ret = 0; … … 597 599 char* proj4def = GTIFGetProj4Defn(&defn); 598 600 std::string tmp(proj4def); 599 std::free(proj4def); 601 std::free(proj4def); /* risk of cross-heap issue, but no free function in libgeotiff matching GTIFGetProj4Defn */ 600 602 } 601 603 #else
Note: See TracChangeset
for help on using the changeset viewer.
