1414// that cannot be deleted.
1515static const bool DONT_DELETE_MSG=false ;
1616
17+ // Error message used when throwing CppSQLite3Exception when allocations fail.
18+ static const char * const ALLOCATION_ERROR_MESSAGE = " Cannot allocate memory" ;
19+
1720// //////////////////////////////////////////////////////////////////////////////
1821// Prototypes for SQLite functions not included in SQLite DLL, but copied below
1922// from SQLite encode.c
@@ -39,7 +42,7 @@ SQLite3Memory::SQLite3Memory(int nBufferLen) :
3942 if (!mpBuf && mnBufferLen>0 )
4043 {
4144 throw CppSQLite3Exception (CPPSQLITE_ERROR,
42- " Cannot allocate memory " ,
45+ ALLOCATION_ERROR_MESSAGE ,
4346 DONT_DELETE_MSG);
4447 }
4548}
@@ -51,7 +54,7 @@ SQLite3Memory::SQLite3Memory(const char* szFormat, va_list list) :
5154 if (!mpBuf)
5255 {
5356 throw CppSQLite3Exception (CPPSQLITE_ERROR,
54- " Cannot allocate memory " ,
57+ ALLOCATION_ERROR_MESSAGE ,
5558 DONT_DELETE_MSG);
5659 }
5760 mnBufferLen = std::strlen (static_cast <char const *>(mpBuf))+1 ;
@@ -69,7 +72,7 @@ SQLite3Memory::SQLite3Memory(SQLite3Memory const& other) :
6972 if (!mpBuf && mnBufferLen>0 )
7073 {
7174 throw CppSQLite3Exception (CPPSQLITE_ERROR,
72- " Cannot allocate memory " ,
75+ ALLOCATION_ERROR_MESSAGE ,
7376 DONT_DELETE_MSG);
7477 }
7578 std::memcpy (mpBuf, other.mpBuf , mnBufferLen);
@@ -253,7 +256,7 @@ void CppSQLite3Binary::setEncoded(const unsigned char* pBuf)
253256 if (!mpBuf)
254257 {
255258 throw CppSQLite3Exception (CPPSQLITE_ERROR,
256- " Cannot allocate memory " ,
259+ ALLOCATION_ERROR_MESSAGE ,
257260 DONT_DELETE_MSG);
258261 }
259262
@@ -320,7 +323,7 @@ unsigned char* CppSQLite3Binary::allocBuffer(int nLen)
320323 if (!mpBuf)
321324 {
322325 throw CppSQLite3Exception (CPPSQLITE_ERROR,
323- " Cannot allocate memory " ,
326+ ALLOCATION_ERROR_MESSAGE ,
324327 DONT_DELETE_MSG);
325328 }
326329
0 commit comments