Skip to content

Commit a261723

Browse files
committed
pocoproject#538 more dtor fixes and some style fixes along the way
1 parent 135c10c commit a261723

File tree

10 files changed

+68
-37
lines changed

10 files changed

+68
-37
lines changed

Data/ODBC/src/Binder.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,23 @@ void Binder::freeMemory()
5151
{
5252
LengthVec::iterator itLen = _lengthIndicator.begin();
5353
LengthVec::iterator itLenEnd = _lengthIndicator.end();
54-
for(; itLen != itLenEnd; ++itLen) delete *itLen;
54+
for (; itLen != itLenEnd; ++itLen) delete *itLen;
5555

5656
TimeMap::iterator itT = _times.begin();
5757
TimeMap::iterator itTEnd = _times.end();
58-
for(; itT != itTEnd; ++itT) delete itT->first;
58+
for (; itT != itTEnd; ++itT) delete itT->first;
5959

6060
DateMap::iterator itD = _dates.begin();
6161
DateMap::iterator itDEnd = _dates.end();
62-
for(; itD != itDEnd; ++itD) delete itD->first;
62+
for (; itD != itDEnd; ++itD) delete itD->first;
6363

6464
TimestampMap::iterator itTS = _timestamps.begin();
6565
TimestampMap::iterator itTSEnd = _timestamps.end();
66-
for(; itTS != itTSEnd; ++itTS) delete itTS->first;
66+
for (; itTS != itTSEnd; ++itTS) delete itTS->first;
6767

6868
StringMap::iterator itStr = _strings.begin();
6969
StringMap::iterator itStrEnd = _strings.end();
70-
for(; itStr != itStrEnd; ++itStr) std::free(itStr->first);
70+
for (; itStr != itStrEnd; ++itStr) std::free(itStr->first);
7171

7272
CharPtrVec::iterator itChr = _charPtrs.begin();
7373
CharPtrVec::iterator endChr = _charPtrs.end();

Data/ODBC/src/ODBCStatementImpl.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,11 @@ ODBCStatementImpl::~ODBCStatementImpl()
6464
{
6565
ColumnPtrVecVec::iterator it = _columnPtrs.begin();
6666
ColumnPtrVecVec::iterator end = _columnPtrs.end();
67-
for(; it != end; ++it)
67+
for (; it != end; ++it)
6868
{
6969
ColumnPtrVec::iterator itC = it->begin();
7070
ColumnPtrVec::iterator endC = it->end();
71-
for(; itC != endC; ++itC) delete *itC;
71+
for (; itC != endC; ++itC) delete *itC;
7272
}
7373
}
7474

Data/include/Poco/Data/Binding.h

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class CopyBinding: public AbstractBinding
140140
}
141141

142142
~CopyBinding()
143-
/// Destroys the Binding.
143+
/// Destroys the CopyBinding.
144144
{
145145
}
146146

@@ -264,7 +264,7 @@ class CopyBinding<const char*>: public AbstractBinding
264264
}
265265

266266
~CopyBinding()
267-
/// Destroys the Binding.
267+
/// Destroys the CopyBinding.
268268
{
269269
}
270270

@@ -396,7 +396,7 @@ class CopyBinding<std::vector<T> >: public AbstractBinding
396396
}
397397

398398
~CopyBinding()
399-
/// Destroys the Binding.
399+
/// Destroys the CopyBinding.
400400
{
401401
}
402402

@@ -559,7 +559,7 @@ class CopyBinding<std::vector<bool> >: public AbstractBinding
559559
}
560560

561561
~CopyBinding()
562-
/// Destroys the Binding.
562+
/// Destroys the CopyBinding.
563563
{
564564
}
565565

@@ -689,7 +689,7 @@ class CopyBinding<std::list<T> >: public AbstractBinding
689689
}
690690

691691
~CopyBinding()
692-
/// Destroys the Binding.
692+
/// Destroys the CopyBinding.
693693
{
694694
}
695695

@@ -819,7 +819,7 @@ class CopyBinding<std::deque<T> >: public AbstractBinding
819819
}
820820

821821
~CopyBinding()
822-
/// Destroys the Binding.
822+
/// Destroys the CopyBinding.
823823
{
824824
}
825825

@@ -949,7 +949,7 @@ class CopyBinding<std::set<T> >: public AbstractBinding
949949
}
950950

951951
~CopyBinding()
952-
/// Destroys the Binding.
952+
/// Destroys the CopyBinding.
953953
{
954954
}
955955

@@ -1079,7 +1079,7 @@ class CopyBinding<std::multiset<T> >: public AbstractBinding
10791079
}
10801080

10811081
~CopyBinding()
1082-
/// Destroys the Binding.
1082+
/// Destroys the CopyBinding.
10831083
{
10841084
}
10851085

@@ -1209,7 +1209,7 @@ class CopyBinding<std::map<K, V> >: public AbstractBinding
12091209
}
12101210

12111211
~CopyBinding()
1212-
/// Destroys the Binding.
1212+
/// Destroys the CopyBinding.
12131213
{
12141214
}
12151215

@@ -1339,7 +1339,7 @@ class CopyBinding<std::multimap<K, V> >: public AbstractBinding
13391339
}
13401340

13411341
~CopyBinding()
1342-
/// Destroys the Binding.
1342+
/// Destroys the CopyBinding.
13431343
{
13441344
}
13451345

Data/src/Row.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ Poco::Dynamic::Var& Row::get(std::size_t col)
8686
try
8787
{
8888
return _values.at(col);
89-
}catch (std::out_of_range& re)
89+
}
90+
catch (std::out_of_range& re)
9091
{
9192
throw RangeException(re.what());
9293
}

Foundation/include/Poco/ScopedUnlock.h

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,14 @@ class ScopedUnlock
4141
}
4242
inline ~ScopedUnlock()
4343
{
44-
_mutex.lock();
44+
try
45+
{
46+
_mutex.lock();
47+
}
48+
catch (...)
49+
{
50+
poco_unexpected();
51+
}
4552
}
4653

4754
private:

Foundation/src/SortedDirectoryIterator.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ SortedDirectoryIterator::~SortedDirectoryIterator()
6262
{
6363
}
6464

65+
6566
SortedDirectoryIterator& SortedDirectoryIterator::operator ++()
6667
{
6768
if (!_is_finished)

Foundation/src/SplitterChannel.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,14 @@ SplitterChannel::SplitterChannel()
2929

3030
SplitterChannel::~SplitterChannel()
3131
{
32-
close();
32+
try
33+
{
34+
close();
35+
}
36+
catch (...)
37+
{
38+
poco_unexpected();
39+
}
3340
}
3441

3542

MongoDB/src/Cursor.cpp

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,14 @@ Cursor::Cursor(const std::string& fullCollectionName, QueryRequest::Flags flags)
3939

4040
Cursor::~Cursor()
4141
{
42-
poco_assert_dbg(!_response.cursorID());
42+
try
43+
{
44+
poco_assert_dbg(!_response.cursorID());
45+
46+
}
47+
catch (...)
48+
{
49+
}
4350
}
4451

4552

Net/src/FTPClientSession.cpp

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -64,28 +64,33 @@ FTPClientSession::FTPClientSession(const std::string& host,
6464
Poco::UInt16 port,
6565
const std::string& username,
6666
const std::string& password):
67-
_host(host),
68-
_port(port),
69-
_pControlSocket(new DialogSocket(SocketAddress(host, port))),
70-
_pDataStream(0),
71-
_passiveMode(true),
72-
_fileType(TYPE_BINARY),
73-
_supports1738(true),
74-
_serverReady(false),
75-
_isLoggedIn(false),
76-
_timeout(DEFAULT_TIMEOUT)
77-
{
67+
_host(host),
68+
_port(port),
69+
_pControlSocket(new DialogSocket(SocketAddress(host, port))),
70+
_pDataStream(0),
71+
_passiveMode(true),
72+
_fileType(TYPE_BINARY),
73+
_supports1738(true),
74+
_serverReady(false),
75+
_isLoggedIn(false),
76+
_timeout(DEFAULT_TIMEOUT)
77+
{
7878
if (!username.empty())
7979
login(username, password);
8080
else
8181
_pControlSocket->setReceiveTimeout(_timeout);
82-
}
82+
}
8383

8484

8585
FTPClientSession::~FTPClientSession()
86+
{
87+
try
88+
{
89+
close();
90+
}
91+
catch (...)
8692
{
87-
try { close(); }
88-
catch (...) { }
93+
}
8994
}
9095

9196

@@ -126,7 +131,9 @@ void FTPClientSession::open(const std::string& host,
126131
_host = host;
127132
_port = port;
128133
if (!username.empty())
134+
{
129135
login(username, password);
136+
}
130137
else
131138
{
132139
_pControlSocket = new DialogSocket(SocketAddress(_host, _port));
@@ -168,12 +175,12 @@ void FTPClientSession::login(const std::string& username, const std::string& pas
168175

169176

170177
void FTPClientSession::logout()
171-
{
178+
{
172179
if (!isOpen())
173180
throw FTPException("Connection is closed.");
174181

175182
if (_isLoggedIn)
176-
{
183+
{
177184
try { endTransfer(); }
178185
catch (...) { }
179186
std::string response;

NetSSL_OpenSSL/src/SecureSocketImpl.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ SecureSocketImpl::~SecureSocketImpl()
6666
}
6767
catch (...)
6868
{
69+
poco_unexpected();
6970
}
7071
}
7172

0 commit comments

Comments
 (0)