@@ -35,8 +35,8 @@ SQLite3Memory::SQLite3Memory() :
3535{
3636}
3737
38- SQLite3Memory::SQLite3Memory (int nBufferLen) :
39- mpBuf (sqlite3_malloc(nBufferLen)),
38+ SQLite3Memory::SQLite3Memory (size_t nBufferLen) :
39+ mpBuf (sqlite3_malloc(static_cast < int >( nBufferLen) )),
4040 mnBufferLen (nBufferLen)
4141{
4242 if (!mpBuf && mnBufferLen>0 )
@@ -66,7 +66,7 @@ SQLite3Memory::~SQLite3Memory()
6666}
6767
6868SQLite3Memory::SQLite3Memory (SQLite3Memory const & other) :
69- mpBuf (sqlite3_malloc(other.mnBufferLen)),
69+ mpBuf (sqlite3_malloc(static_cast < int >( other.mnBufferLen) )),
7070 mnBufferLen (other.mnBufferLen)
7171{
7272 if (!mpBuf && mnBufferLen>0 )
@@ -128,7 +128,7 @@ CppSQLite3Exception::CppSQLite3Exception(const int nErrCode,
128128
129129 if (bDeleteMsg && szErrMess)
130130 {
131- sqlite3_free (( void *) szErrMess);
131+ sqlite3_free (static_cast < void *>( const_cast < char *>( szErrMess)) );
132132 }
133133}
134134
@@ -238,7 +238,7 @@ CppSQLite3Binary::~CppSQLite3Binary()
238238}
239239
240240
241- void CppSQLite3Binary::setBinary (const unsigned char * pBuf, int nLen)
241+ void CppSQLite3Binary::setBinary (const unsigned char * pBuf, size_t nLen)
242242{
243243 mpBuf = allocBuffer (nLen);
244244 memcpy (mpBuf, pBuf, nLen);
@@ -249,10 +249,10 @@ void CppSQLite3Binary::setEncoded(const unsigned char* pBuf)
249249{
250250 clear ();
251251
252- mnEncodedLen = strlen (( const char *) pBuf);
252+ mnEncodedLen = strlen (reinterpret_cast < const char *>( pBuf) );
253253 mnBufferLen = mnEncodedLen + 1 ; // Allow for NULL terminator
254254
255- mpBuf = ( unsigned char *) malloc (mnBufferLen);
255+ mpBuf = reinterpret_cast < unsigned char *>( malloc (mnBufferLen) );
256256
257257 if (!mpBuf)
258258 {
@@ -270,9 +270,9 @@ const unsigned char* CppSQLite3Binary::getEncoded()
270270{
271271 if (!mbEncoded)
272272 {
273- unsigned char * ptmp = ( unsigned char *) malloc (mnBinaryLen);
273+ unsigned char * ptmp = reinterpret_cast < unsigned char *>( malloc (mnBinaryLen) );
274274 memcpy (ptmp, mpBuf, mnBinaryLen);
275- mnEncodedLen = sqlite3_encode_binary (ptmp, mnBinaryLen, mpBuf);
275+ mnEncodedLen = static_cast < size_t >( sqlite3_encode_binary (ptmp, static_cast < int >( mnBinaryLen) , mpBuf) );
276276 free (ptmp);
277277 mbEncoded = true ;
278278 }
@@ -286,30 +286,30 @@ const unsigned char* CppSQLite3Binary::getBinary()
286286 if (mbEncoded)
287287 {
288288 // in/out buffers can be the same
289- mnBinaryLen = sqlite3_decode_binary (mpBuf, mpBuf);
289+ int result = sqlite3_decode_binary (mpBuf, mpBuf);
290290
291- if (mnBinaryLen == -1 )
291+ if (result == -1 )
292292 {
293293 throw CppSQLite3Exception (CPPSQLITE_ERROR,
294294 " Cannot decode binary" ,
295295 DONT_DELETE_MSG);
296296 }
297-
297+ mnBinaryLen = static_cast < size_t >(result);
298298 mbEncoded = false ;
299299 }
300300
301301 return mpBuf;
302302}
303303
304304
305- int CppSQLite3Binary::getBinaryLength ()
305+ size_t CppSQLite3Binary::getBinaryLength ()
306306{
307307 getBinary ();
308308 return mnBinaryLen;
309309}
310310
311311
312- unsigned char * CppSQLite3Binary::allocBuffer (int nLen)
312+ unsigned char * CppSQLite3Binary::allocBuffer (size_t nLen)
313313{
314314 clear ();
315315
@@ -319,7 +319,7 @@ unsigned char* CppSQLite3Binary::allocBuffer(int nLen)
319319 mnBinaryLen = nLen;
320320 mnBufferLen = 3 + (257 *nLen)/254 ;
321321
322- mpBuf = ( unsigned char *) malloc (mnBufferLen);
322+ mpBuf = static_cast < unsigned char *>( malloc (mnBufferLen) );
323323
324324 if (!mpBuf)
325325 {
@@ -430,14 +430,14 @@ const char* CppSQLite3Query::fieldValue(int nField) const
430430 DONT_DELETE_MSG);
431431 }
432432
433- return ( const char *) sqlite3_column_text (mpVM, nField);
433+ return reinterpret_cast < const char *>( sqlite3_column_text (mpVM, nField) );
434434}
435435
436436
437437const char * CppSQLite3Query::fieldValue (const char * szField) const
438438{
439439 int nField = fieldIndex (szField);
440- return ( const char *) sqlite3_column_text (mpVM, nField);
440+ return reinterpret_cast < const char *>( sqlite3_column_text (mpVM, nField) );
441441}
442442
443443
@@ -529,7 +529,7 @@ const char* CppSQLite3Query::getStringField(int nField, const char* szNullValue/
529529 }
530530 else
531531 {
532- return ( const char *) sqlite3_column_text (mpVM, nField);
532+ return reinterpret_cast < const char *>( sqlite3_column_text (mpVM, nField) );
533533 }
534534}
535535
@@ -541,7 +541,7 @@ const char* CppSQLite3Query::getStringField(const char* szField, const char* szN
541541}
542542
543543
544- const unsigned char * CppSQLite3Query::getBlobField (int nField, int & nLen) const
544+ const unsigned char * CppSQLite3Query::getBlobField (int nField, size_t & nLen) const
545545{
546546 checkVM ();
547547
@@ -552,12 +552,12 @@ const unsigned char* CppSQLite3Query::getBlobField(int nField, int& nLen) const
552552 DONT_DELETE_MSG);
553553 }
554554
555- nLen = sqlite3_column_bytes (mpVM, nField);
556- return ( const unsigned char *) sqlite3_column_blob (mpVM, nField);
555+ nLen = static_cast < size_t >( sqlite3_column_bytes (mpVM, nField) );
556+ return reinterpret_cast < const unsigned char *>( sqlite3_column_blob (mpVM, nField) );
557557}
558558
559559
560- const unsigned char * CppSQLite3Query::getBlobField (const char * szField, int & nLen) const
560+ const unsigned char * CppSQLite3Query::getBlobField (const char * szField, size_t & nLen) const
561561{
562562 int nField = fieldIndex (szField);
563563 return getBlobField (nField, nLen);
@@ -1147,11 +1147,11 @@ void CppSQLite3Statement::bind(int nParam, const double dValue)
11471147}
11481148
11491149
1150- void CppSQLite3Statement::bind (int nParam, const unsigned char * blobValue, int nLen)
1150+ void CppSQLite3Statement::bind (int nParam, const unsigned char * blobValue, size_t nLen)
11511151{
11521152 checkVM ();
1153- int nRes = sqlite3_bind_blob (mpVM, nParam,
1154- ( const void *)blobValue, nLen, SQLITE_TRANSIENT);
1153+ int nRes = sqlite3_bind_blob (mpVM, nParam, static_cast < const void *>(blobValue),
1154+ static_cast < int >( nLen) , SQLITE_TRANSIENT);
11551155
11561156 if (nRes != SQLITE_OK)
11571157 {
0 commit comments