Skip to content

Commit 309bba5

Browse files
committed
Fix compilation warning seen with recent compilers
1 parent 29779de commit 309bba5

File tree

7 files changed

+59
-36
lines changed

7 files changed

+59
-36
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@
1111

1212
- Added a run-script 'testWindows' target for Windows testing. See [test/README.md](test/README.md)
1313

14+
- Fixed compilation warnings with recent compilers.
15+
1416
## node-oracledb v1.3.0 (15 Oct 2015)
1517

1618
- Added a `oracledb.oracleClientVersion` property giving the version of the Oracle

src/dpi/src/dpiConnImpl.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -580,19 +580,23 @@ void ConnImpl::initConnImpl ( bool pool, bool externalAuth,
580580
{
581581
ub4 mode = OCI_DEFAULT;
582582
ub2 csid = 0;
583+
void *errh = NULL;
584+
void *auth = NULL;
583585

584586
if ( pool )
585587
mode = externalAuth ? ( OCI_SESSGET_CREDEXT | OCI_SESSGET_SPOOL ) :
586588
OCI_SESSGET_SPOOL;
587589
else
588590
mode = externalAuth ? OCI_SESSGET_CREDEXT : OCI_DEFAULT;
589591

590-
ociCallEnv ( OCIHandleAlloc ( ( void * ) envh_, ( dvoid ** )&errh_,
592+
ociCallEnv ( OCIHandleAlloc ( ( void * ) envh_, &errh,
591593
OCI_HTYPE_ERROR, 0, ( dvoid ** ) 0 ), envh_ );
594+
errh_ = ( OCIError * ) errh;
592595

593-
ociCallEnv ( OCIHandleAlloc ( ( void * ) envh_, ( dvoid ** ) &auth_,
596+
ociCallEnv ( OCIHandleAlloc ( ( void * ) envh_, &auth,
594597
OCI_HTYPE_AUTHINFO, 0, ( dvoid ** ) 0 ),
595598
envh_ );
599+
auth_ = ( OCIAuthInfo * ) auth;
596600

597601
if ( externalAuth && ( !pool ) )
598602
{

src/dpi/src/dpiDateTimeArrayImpl.cpp

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -193,23 +193,25 @@ long double DateTimeArrayImpl::getDateTime ( const int idx )
193193

194194
if ( dbdatetime_ )
195195
{
196-
OCIInterval *interval = NULL ;
196+
void *interval = NULL ;
197197

198-
rc = OCIDescriptorAlloc ( (dvoid *) envh_, (dvoid **)&interval,
198+
rc = OCIDescriptorAlloc ( (dvoid *) envh_, &interval,
199199
OCI_DTYPE_INTERVAL_DS, 0, (dvoid **)0);
200+
200201
if (rc)
201202
{
202203
throw ExceptionImpl ( DpiErrInternal );
203204
}
204205

205206
/* Get diff of date/timestamp */
206207
rc = OCIDateTimeSubtract ( envh_, errh_, dbdatetime_[idx], baseDate_,
207-
interval);
208+
( OCIInterval * ) interval );
208209
ociCall ( rc, errh_ ) ;
209210

210211
// Get the Days, hours, minutes, seconds and fractional seconds
211212
ociCall ( OCIIntervalGetDaySecond ( envh_, errh_, &dy, &hr, &mm,
212-
&ss, &fsec, interval ), errh_ );
213+
&ss, &fsec,
214+
( OCIInterval * ) interval ), errh_ );
213215

214216
if ( interval )
215217
{
@@ -251,7 +253,7 @@ void DateTimeArrayImpl::setDateTime ( const int idx, long double ms)
251253
{
252254
if ( dbdatetime_ )
253255
{
254-
OCIInterval *interval = NULL;
256+
void *interval = NULL;
255257
sword rc = OCI_SUCCESS ;
256258
sb4 dy = 0;
257259
sb4 hr = 0;
@@ -270,19 +272,22 @@ void DateTimeArrayImpl::setDateTime ( const int idx, long double ms)
270272
ms = ms - (ss * DPI_MS_SECONDS );
271273
fs = ( sb4 )( ms * DPI_FRAC_SEC_MS ); // Convert the ms into frac sec
272274

273-
rc = OCIDescriptorAlloc ( (dvoid *) envh_, (dvoid **)&interval,
275+
rc = OCIDescriptorAlloc ( (dvoid *) envh_, &interval,
274276
OCI_DTYPE_INTERVAL_DS, 0, (dvoid **)0);
277+
275278
if (rc)
276279
{
277280
throw ExceptionImpl ( DpiErrInternal );
278281
}
279282

280283
// Convert the given timestamp in ms into interval
281284
ociCall ( OCIIntervalSetDaySecond ( envh_, errh_, dy, hr, mm,
282-
ss, fs, interval), errh_ );
285+
ss, fs, ( OCIInterval * ) interval),
286+
errh_ );
283287

284288
// Add the interval to the basedate.
285-
ociCall ( OCIDateTimeIntervalAdd ( envh_, errh_, baseDate_, interval,
289+
ociCall ( OCIDateTimeIntervalAdd ( envh_, errh_, baseDate_,
290+
( OCIInterval * ) interval,
286291
dbdatetime_[idx] ), errh_ ) ;
287292

288293
if ( interval )
@@ -314,14 +319,16 @@ void DateTimeArrayImpl::setDateTime ( const int idx, long double ms)
314319
void DateTimeArrayImpl::initBaseDate ( OCIEnv *envh )
315320
{
316321
sword rc = OCI_SUCCESS ;
317-
OCIError *errh = (OCIError *)0;
322+
void *errh = (OCIError *)0;
323+
void *baseDate = NULL;
318324

319325
// If baseDate is not allocated, allocate and init
320326
if ( !baseDate_ )
321327
{
322-
rc = OCIDescriptorAlloc ( (dvoid *)envh, (dvoid **)&baseDate_,
328+
rc = OCIDescriptorAlloc ( (dvoid *)envh, &baseDate,
323329
OCI_DTYPE_TIMESTAMP_LTZ, 0,
324330
(dvoid **)0);
331+
baseDate_ = (OCIDateTime *) baseDate;
325332

326333
if ( !rc ) // OCI_SUCCESS case
327334
{
@@ -331,16 +338,17 @@ void DateTimeArrayImpl::initBaseDate ( OCIEnv *envh )
331338
* OCI Env creation(one time). At this point of time, errh is not yet
332339
* created by OCI Env, create a local one, use and destroy
333340
*/
334-
ociCallEnv(OCIHandleAlloc((void *)envh, (dvoid **)&errh,
341+
ociCallEnv(OCIHandleAlloc((void *)envh, &errh,
335342
OCI_HTYPE_ERROR, 0, (dvoid **)0), envh);
343+
336344
// Base date is 1970-1-1 00:00:00
337-
ociCall ( OCIDateTimeConstruct (envh, errh, baseDate_,
345+
ociCall ( OCIDateTimeConstruct (envh, ( OCIError * ) errh, baseDate_,
338346
DPI_BASE_YEAR, DPI_BASE_MONTH,
339347
DPI_BASE_DATE, DPI_BASE_HOUR,
340348
DPI_BASE_MIN, DPI_BASE_SEC, DPI_BASE_FS,
341349
(OraText * )DPI_UTC_TZ,
342350
strlen ( DPI_UTC_TZ ) ),
343-
errh);
351+
( OCIError * ) errh);
344352

345353
// Free the allocated error handle
346354
if (errh)

src/dpi/src/dpiEnvImpl.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -680,12 +680,12 @@ void EnvImpl::releaseDateTimeArray ( DateTimeArray *arr ) const
680680

681681
DpiHandle * EnvImpl::allocHandle(HandleType handleType)
682682
{
683-
DpiHandle *handle = NULL;
683+
void *handle = NULL;
684684

685-
ociCallEnv(OCIHandleAlloc(envh_, (void **)&handle, handleType, 0, NULL),
685+
ociCallEnv(OCIHandleAlloc(envh_, &handle, handleType, 0, NULL),
686686
envh_);
687687

688-
return handle;
688+
return (DpiHandle *)handle;
689689
}
690690

691691

@@ -707,12 +707,12 @@ DpiHandle * EnvImpl::allocHandle(HandleType handleType)
707707

708708
Descriptor * EnvImpl::allocDescriptor(DescriptorType descriptorType)
709709
{
710-
Descriptor *descriptor = NULL;
710+
void *descriptor = NULL;
711711

712-
ociCallEnv(OCIDescriptorAlloc(envh_, (void **)&descriptor, descriptorType,
712+
ociCallEnv(OCIDescriptorAlloc(envh_, &descriptor, descriptorType,
713713
0, NULL), envh_);
714714

715-
return descriptor;
715+
return (Descriptor *)descriptor;
716716
}
717717

718718

src/dpi/src/dpiLob.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -200,13 +200,13 @@ unsigned int Lob::chunkSize(DpiHandle *svch, DpiHandle *errh,
200200
unsigned long long Lob::length(DpiHandle *svch, DpiHandle *errh,
201201
Descriptor *lobLocator)
202202
{
203-
unsigned long long length = 0;
203+
oraub8 length = 0;
204204

205205
ociCall(OCILobGetLength2((OCISvcCtx *)svch, (OCIError *)errh,
206206
(OCILobLocator *)lobLocator, (oraub8 *)&length),
207207
(OCIError *)errh);
208208

209-
return length;
209+
return (unsigned long long)length;
210210
}
211211

212212

src/dpi/src/dpiPoolImpl.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,21 @@ PoolImpl::PoolImpl(EnvImpl *env, OCIEnv *envh,
9292
spoolh_(NULL), poolName_(NULL)
9393
{
9494
ub4 mode = externalAuth ? OCI_DEFAULT : OCI_SPC_HOMOGENEOUS;
95+
void *errh = NULL;
96+
void *spoolh = NULL;
9597

9698
unsigned char spoolMode = OCI_SPOOL_ATTRVAL_NOWAIT; // spoolMode is a ub1
9799

98100
if (externalAuth && (password.length() || user.length()))
99101
throw ExceptionImpl(DpiErrExtAuth);
100102

101-
ociCallEnv(OCIHandleAlloc((void *)envh_, (dvoid **)&errh_,
103+
ociCallEnv(OCIHandleAlloc((void *)envh_, &errh,
102104
OCI_HTYPE_ERROR, 0, (dvoid **)0), envh_);
105+
errh_ = ( OCIError * ) errh;
103106

104-
ociCall(OCIHandleAlloc((void *)envh_, (dvoid **)&spoolh_,
107+
ociCall(OCIHandleAlloc((void *)envh_, (dvoid **)&spoolh,
105108
OCI_HTYPE_SPOOL, 0, (dvoid **)0), errh_);
109+
spoolh_ = ( OCISPool * ) spoolh;
106110

107111
ociCall(OCISessionPoolCreate(envh_, errh_, spoolh_,
108112
&poolName_, &poolNameLen_,

src/dpi/src/dpiStmtImpl.cpp

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,12 @@ StmtImpl::StmtImpl (EnvImpl *env, OCIEnv *envh, ConnImpl *conn,
9191
isReturning_(false), isReturningSet_(false), refCursor_(false),
9292
state_(DPI_STMT_STATE_UNDEFINED)
9393
{
94+
void *errh = NULL;
95+
void *stmth = NULL;
9496
// create an OCIError object for this execution
95-
ociCallEnv (OCIHandleAlloc ((void *)envh, (dvoid **)&errh_,
97+
ociCallEnv (OCIHandleAlloc ((void *)envh, &errh,
9698
OCI_HTYPE_ERROR, 0, (dvoid **)0), envh);
99+
errh_ = ( OCIError * ) errh;
97100

98101
if(!sql.empty())
99102
{
@@ -106,8 +109,9 @@ StmtImpl::StmtImpl (EnvImpl *env, OCIEnv *envh, ConnImpl *conn,
106109
else
107110
{
108111
// to build empty stmt object used for ref cursors.
109-
ociCall (OCIHandleAlloc ((void *)envh, (dvoid **)&stmth_,
112+
ociCall (OCIHandleAlloc ((void *)envh, (dvoid **)&stmth,
110113
OCI_HTYPE_STMT,0, (dvoid **)0), errh_);
114+
stmth_ = ( OCIStmt * ) stmth;
111115
refCursor_ = true;
112116
}
113117
}
@@ -473,38 +477,39 @@ const MetaData* StmtImpl::getMetaData ()
473477
return NULL;
474478

475479
ub4 col = 0;
476-
OCIParam *colDesc = (OCIParam *) 0;
480+
void *colDesc = (OCIParam *) 0;
477481

478482
meta_ = new MetaData[numCols_];
483+
void *colName = NULL;
479484

480485
while (col < numCols_)
481486
{
482487
ociCall(OCIParamGet((void *)stmth_, OCI_HTYPE_STMT, errh_,
483-
(void **)&colDesc, (ub4) (col+1)), errh_ );
484-
ociCall(OCIAttrGet((void*) colDesc, (ub4) OCI_DTYPE_PARAM,
485-
(void**) &(meta_[col].colName),
488+
&colDesc, (ub4) (col+1)), errh_ );
489+
ociCall(OCIAttrGet(colDesc, (ub4) OCI_DTYPE_PARAM, &colName,
486490
(ub4 *) &(meta_[col].colNameLen),
487491
(ub4) OCI_ATTR_NAME,errh_ ), errh_ );
488-
ociCall(OCIAttrGet((void*) colDesc, (ub4) OCI_DTYPE_PARAM,
492+
meta_[col].colName = (unsigned char *) colName;
493+
ociCall(OCIAttrGet(colDesc, (ub4) OCI_DTYPE_PARAM,
489494
(void*) &(meta_[col].dbType),(ub4 *) 0,
490495
(ub4) OCI_ATTR_DATA_TYPE,
491496
errh_ ), errh_ );
492-
ociCall(OCIAttrGet((void*) colDesc, (ub4) OCI_DTYPE_PARAM,
497+
ociCall(OCIAttrGet(colDesc, (ub4) OCI_DTYPE_PARAM,
493498
(void*) &(meta_[col].dbSize),(ub4 *) 0,
494499
(ub4) OCI_ATTR_DATA_SIZE,
495500
errh_ ), errh_ );
496-
ociCall(OCIAttrGet((void*) colDesc, (ub4) OCI_DTYPE_PARAM,
501+
ociCall(OCIAttrGet(colDesc, (ub4) OCI_DTYPE_PARAM,
497502
(void*) &(meta_[col].isNullable),(ub4*) 0,
498503
(ub4) OCI_ATTR_IS_NULL,
499504
errh_ ), errh_ );
500505
if (meta_[col].dbType == DpiNumber || meta_[col].dbType == DpiBinaryFloat
501506
||meta_[col].dbType == DpiBinaryDouble )
502507
{
503-
ociCall(OCIAttrGet((void*) colDesc, (ub4) OCI_DTYPE_PARAM,
508+
ociCall(OCIAttrGet(colDesc, (ub4) OCI_DTYPE_PARAM,
504509
(void*) &(meta_[col].precision),(ub4* ) 0,
505510
(ub4) OCI_ATTR_PRECISION,
506511
errh_ ), errh_ );
507-
ociCall(OCIAttrGet((void*) colDesc, (ub4) OCI_DTYPE_PARAM,
512+
ociCall(OCIAttrGet(colDesc, (ub4) OCI_DTYPE_PARAM,
508513
(void*) &(meta_[col].scale),(ub4*) 0,
509514
(ub4) OCI_ATTR_SCALE,
510515
errh_ ), errh_ );

0 commit comments

Comments
 (0)