Skip to content

Commit 9745dd9

Browse files
committed
Fix a number of bugs/warnings unearthed by clang. Move to Tcl 8.6.
BUGZID:
1 parent 996e7dd commit 9745dd9

File tree

4 files changed

+11
-12
lines changed

4 files changed

+11
-12
lines changed

README.FreeBSD

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
#
44

55
autoconf
6-
./configure --with-tcl=/usr/local/lib/tcl8.5 --mandir=/usr/local/man --enable-symbols
6+
./configure --with-tcl=/usr/local/lib/tcl8.6 --mandir=/usr/local/man --enable-symbols
77

generic/bson.c

+1-2
Original file line numberDiff line numberDiff line change
@@ -565,11 +565,10 @@ mongotcl_appendBsonFromObject(Tcl_Interp *interp, bson *bs, bson_type bsonType,
565565
case BSON_BINDATA: {
566566
unsigned char *binary;
567567
int binaryLength;
568-
int binaryType;
569568

570569
binary = Tcl_GetByteArrayFromObj (valueObj, &binaryLength);
571570

572-
if (bson_append_binary (bs, key, binaryType, (char *)binary, binaryLength) != BSON_OK) {
571+
if (bson_append_binary (bs, key, bsonBinarySubtype, (char *)binary, binaryLength) != BSON_OK) {
573572
return mongotcl_setBsonError (interp, bs);
574573
}
575574
break;

generic/cursor.c

+2-2
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ mongotcl_tcllist_to_cursor_fields (Tcl_Interp *interp, Tcl_Obj *fieldList, mongo
155155
return TCL_ERROR;
156156
}
157157

158-
if (i & 1) {
158+
if (listObjc & 1) {
159159
Tcl_SetObjResult (interp, Tcl_NewStringObj ("field list must have even number of elements", -1));
160160
return TCL_ERROR;
161161
}
@@ -318,7 +318,7 @@ mongotcl_cursorObjectObjCmd(ClientData cData, Tcl_Interp *interp, int objc, Tcl_
318318

319319
case OPT_CURSOR_SET_OPTIONS: {
320320
int listObjc;
321-
int cursorFlags;
321+
int cursorFlags = 0;
322322
int i;
323323
Tcl_Obj **listObjv;
324324

generic/mongotcl.c

+7-7
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ mongotcl_mongoObjectObjCmd(ClientData cData, Tcl_Interp *interp, int objc, Tcl_O
476476
}
477477
}
478478

479-
if (mongo_insert_batch (md->conn, Tcl_GetString(objv[2]), bsonList, listObjc, md->write_concern, flags) != MONGO_OK) {
479+
if (mongo_insert_batch (md->conn, Tcl_GetString(objv[2]), (const bson **)bsonList, listObjc, md->write_concern, flags) != MONGO_OK) {
480480
return mongotcl_setMongoError (interp, md->conn);
481481
}
482482

@@ -653,29 +653,29 @@ mongotcl_mongoObjectObjCmd(ClientData cData, Tcl_Interp *interp, int objc, Tcl_O
653653
}
654654

655655
case OPT_GET_LAST_ERROR: {
656-
bson *out;
656+
bson out;
657657

658658
if (objc != 3) {
659659
Tcl_WrongNumArgs (interp, 2, objv, "db");
660660
return TCL_ERROR;
661661
}
662662

663-
if (mongo_cmd_get_last_error (md->conn, Tcl_GetString(objv[2]), out) != MONGO_OK) {
663+
if (mongo_cmd_get_last_error (md->conn, Tcl_GetString(objv[2]), &out) != MONGO_OK) {
664664
return mongotcl_setMongoError (interp, md->conn);
665665
}
666666

667667
break;
668668
}
669669

670670
case OPT_GET_PREV_ERROR: {
671-
bson *out;
671+
bson out;
672672

673673
if (objc != 3) {
674674
Tcl_WrongNumArgs (interp, 2, objv, "db");
675675
return TCL_ERROR;
676676
}
677677

678-
if (mongo_cmd_get_prev_error (md->conn, Tcl_GetString(objv[2]), out) != MONGO_OK) {
678+
if (mongo_cmd_get_prev_error (md->conn, Tcl_GetString(objv[2]), &out) != MONGO_OK) {
679679
return mongotcl_setMongoError (interp, md->conn);
680680
}
681681

@@ -941,14 +941,14 @@ mongotcl_mongoObjectObjCmd(ClientData cData, Tcl_Interp *interp, int objc, Tcl_O
941941
}
942942

943943
case OPT_CMD_DROP_COLLECTION: {
944-
bson *out;
944+
bson out;
945945

946946
if (objc != 4) {
947947
Tcl_WrongNumArgs (interp, 2, objv, "db collect");
948948
return TCL_ERROR;
949949
}
950950

951-
if (mongo_cmd_drop_collection (md->conn, Tcl_GetString(objv[2]), Tcl_GetString(objv[3]), out) != MONGO_OK) {
951+
if (mongo_cmd_drop_collection (md->conn, Tcl_GetString(objv[2]), Tcl_GetString(objv[3]), &out) != MONGO_OK) {
952952
return mongotcl_setMongoError (interp, md->conn);
953953
}
954954
break;

0 commit comments

Comments
 (0)