Skip to content

Commit aa6ecb8

Browse files
committed
use std::unique_ptr instead of auto_ptr
as proposed in #4
1 parent 6b46b67 commit aa6ecb8

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

src/refimpl/E57FoundationImpl.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ using std::ios_base;
9898
using std::scientific;
9999
using std::setprecision;
100100
using std::string;
101-
using std::auto_ptr;
101+
using std::unique_ptr;
102102
using std::min;
103103
using std::max;
104104

@@ -3815,7 +3815,7 @@ void ImageFileImpl::construct2(const ustring& fileName, const ustring& mode, con
38153815
throw E57_EXCEPTION2(E57_ERROR_XML_PARSER_INIT, "parserMessage=" + ustring(XMLString::transcode(ex.getMessage())));
38163816
}
38173817

3818-
xmlReader = XMLReaderFactory::createXMLReader(); //??? auto_ptr?
3818+
xmlReader = XMLReaderFactory::createXMLReader(); //??? unique_ptr?
38193819

38203820
//??? check these are right
38213821
xmlReader->setFeature(XMLUni::fgSAX2CoreValidation, true);
@@ -6290,7 +6290,7 @@ CompressedVectorReaderImpl::CompressedVectorReaderImpl(shared_ptr<CompressedVect
62906290
/// Verify that packet given by dataPhysicalOffset is actually a data packet, init channels
62916291
{
62926292
char* anyPacket = NULL;
6293-
auto_ptr<PacketLock> packetLock = cache_->lock(dataLogicalOffset, anyPacket);
6293+
unique_ptr<PacketLock> packetLock = cache_->lock(dataLogicalOffset, anyPacket);
62946294

62956295
DataPacket* dpkt = reinterpret_cast<DataPacket*>(anyPacket);
62966296

@@ -6453,7 +6453,7 @@ void CompressedVectorReaderImpl::feedPacketToDecoders(uint64_t currentPacketLogi
64536453
{
64546454
/// Get packet at currentPacketLogicalOffset into memory.
64556455
char* anyPacket = NULL;
6456-
auto_ptr<PacketLock> packetLock = cache_->lock(currentPacketLogicalOffset, anyPacket);
6456+
unique_ptr<PacketLock> packetLock = cache_->lock(currentPacketLogicalOffset, anyPacket);
64576457
DataPacket* dpkt = reinterpret_cast<DataPacket*>(anyPacket);
64586458

64596459
/// Double check that have a data packet. Should have already determined this.
@@ -6520,7 +6520,7 @@ void CompressedVectorReaderImpl::feedPacketToDecoders(uint64_t currentPacketLogi
65206520
if (nextPacketLogicalOffset < E57_UINT64_MAX) { //??? huh?
65216521
/// Get packet at nextPacketLogicalOffset into memory.
65226522
char* anyPacket = NULL;
6523-
auto_ptr<PacketLock> packetLock = cache_->lock(nextPacketLogicalOffset, anyPacket);
6523+
unique_ptr<PacketLock> packetLock = cache_->lock(nextPacketLogicalOffset, anyPacket);
65246524
DataPacket* dpkt = reinterpret_cast<DataPacket*>(anyPacket);
65256525

65266526
/// Got a data packet, update the channels with exhausted input
@@ -6569,7 +6569,7 @@ uint64_t CompressedVectorReaderImpl::findNextDataPacket(uint64_t nextPacketLogic
65696569
/// Starting at nextPacketLogicalOffset, search for next data packet until hit end of binary section.
65706570
while (nextPacketLogicalOffset < sectionEndLogicalOffset_) {
65716571
char* anyPacket = NULL;
6572-
auto_ptr<PacketLock> packetLock = cache_->lock(nextPacketLogicalOffset, anyPacket);
6572+
unique_ptr<PacketLock> packetLock = cache_->lock(nextPacketLogicalOffset, anyPacket);
65736573

65746574
/// Guess it's a data packet, if not continue to next packet
65756575
DataPacket* dpkt = reinterpret_cast<DataPacket*>(anyPacket);
@@ -7819,7 +7819,7 @@ PacketReadCache::~PacketReadCache()
78197819
}
78207820
}
78217821

7822-
auto_ptr<PacketLock> PacketReadCache::lock(uint64_t packetLogicalOffset, char* &pkt)
7822+
unique_ptr<PacketLock> PacketReadCache::lock(uint64_t packetLogicalOffset, char* &pkt)
78237823
{
78247824
#ifdef E57_MAX_VERBOSE
78257825
cout << "PacketReadCache::lock() called, packetLogicalOffset=" << packetLogicalOffset << endl;
@@ -7847,7 +7847,7 @@ auto_ptr<PacketLock> PacketReadCache::lock(uint64_t packetLogicalOffset, char* &
78477847
pkt = entries_[i].buffer_;
78487848

78497849
/// Create lock so we are sure that we will be unlocked when use is finished.
7850-
auto_ptr<PacketLock> plock(new PacketLock(this, i));
7850+
unique_ptr<PacketLock> plock(new PacketLock(this, i));
78517851

78527852
/// Increment cache lock just before return
78537853
lockCount_++;
@@ -7875,7 +7875,7 @@ auto_ptr<PacketLock> PacketReadCache::lock(uint64_t packetLogicalOffset, char* &
78757875
pkt = entries_[oldestEntry].buffer_;
78767876

78777877
/// Create lock so we are sure we will be unlocked when use is finished.
7878-
auto_ptr<PacketLock> plock(new PacketLock(this, oldestEntry));
7878+
unique_ptr<PacketLock> plock(new PacketLock(this, oldestEntry));
78797879

78807880
/// Increment cache lock just before return
78817881
lockCount_++;

src/refimpl/E57FoundationImpl.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1368,7 +1368,7 @@ class PacketReadCache {
13681368
PacketReadCache(CheckedFile* cFile, unsigned packetCount);
13691369
~PacketReadCache();
13701370

1371-
std::auto_ptr<PacketLock> lock(uint64_t packetLogicalOffset, char* &pkt); //??? pkt could be const
1371+
std::unique_ptr<PacketLock> lock(uint64_t packetLogicalOffset, char* &pkt); //??? pkt could be const
13721372
void markDiscarable(uint64_t packetLogicalOffset);
13731373

13741374
#ifdef E57_DEBUG
@@ -1773,7 +1773,7 @@ void SeekIndexReader::lookup(uint64_t recordNumber, uint64_t& foundRecordNumber,
17731773
for (unsigned level = indexDepth_-1; level >= 0; level--) {
17741774
/// Get index packet at packetOffset into cache and get pointer
17751775
char* pkt;
1776-
auto_ptr<PacketLock> plock = imf_->cache()->lock(nextPacketOffset, pkt);
1776+
unique_ptr<PacketLock> plock = imf_->cache()->lock(nextPacketOffset, pkt);
17771777
IndexPacket* ipkt = reinterpret_cast<IndexPacket*>(pkt);
17781778

17791779
/// Quick check that packet looks ok
@@ -1848,7 +1848,7 @@ void SeekIndexReader::lookup(uint64_t recordNumber, uint64_t& foundRecordNumber,
18481848
for (unsigned level = indexDepth_-1; level >= 0; level--) {
18491849
/// Get index packet at packetOffset into cache and get pointer
18501850
char* pkt;
1851-
auto_ptr<PacketLock> plock = imf_->cache()->lock(nextPacketOffset, pkt);
1851+
unique_ptr<PacketLock> plock = imf_->cache()->lock(nextPacketOffset, pkt);
18521852
IndexPacket* ipkt = reinterpret_cast<IndexPacket*>(pkt);
18531853

18541854
/// Quick check that packet looks ok

0 commit comments

Comments
 (0)