Index: generic/nsf.c =================================================================== diff -u -r24571ae44c492c681d3efd2f2d2f5169ad7d6d57 -r919f731adf8e0104d8addfec4540159fba75ed81 --- generic/nsf.c (.../nsf.c) (revision 24571ae44c492c681d3efd2f2d2f5169ad7d6d57) +++ generic/nsf.c (.../nsf.c) (revision 919f731adf8e0104d8addfec4540159fba75ed81) @@ -370,7 +370,7 @@ static Tcl_Obj *NsfParamDefsVirtualFormat(Tcl_Interp *interp, Nsf_Param CONST *pPtr, NsfObject *contextObject, CONST char *pattern, NsfFormatFunction formatFunction) - nonnull(1) nonnull(2) nonnull(3) nonnull(4); + nonnull(1) nonnull(2) nonnull(3) nonnull(5); static int NsfParamDefsAppendVirtual(Tcl_Interp *interp, Tcl_Obj *listObj, Nsf_Param CONST *paramsPtr, NsfObject *contextObject, @@ -6272,9 +6272,8 @@ assert(class != NULL); assert(methodName != NULL); assert(proc != NULL); + assert(cl->nsPtr != NULL); - - /* Check, if we are allowed to redefine the method */ result = CanRedefineCmd(interp, cl->nsPtr, &cl->object, (char *)methodName, flags); if (unlikely(result != TCL_OK)) { @@ -11783,9 +11782,9 @@ assert(interp != NULL); assert(pPtr != NULL); - assert(pPtr->type); - assert(formatFunction != NULL); + assert(pPtr->type != NULL); assert(contextObject != NULL); + assert(formatFunction != NULL); if (strcmp(pPtr->type, "virtualobjectargs") == 0) { result = GetObjectParameterDefinition(interp, NsfGlobalObjs[NSF_EMPTY], contextObject, NULL, &parsedParam); @@ -17648,7 +17647,7 @@ #endif } else if (likely(result == TCL_OK)) { NsfCallStackContent *topCscPtr; - Tcl_CallFrame *varFramePtr; + Tcl_CallFrame *varFramePtr = NULL; int isLeafNext; /* @@ -17676,6 +17675,7 @@ topCscPtr = CallStackGetTopFrame(interp, &varFramePtr); assert(topCscPtr != NULL); + assert(varFramePtr != NULL); /* * Find the appropriate frame pointing to the start of the ensemble, in @@ -17694,10 +17694,12 @@ if ((topCscPtr->flags & NSF_CM_ENSEMBLE_UNKNOWN)) break; } - varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr); - if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { - topCscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); - assert(topCscPtr != NULL); + if (varFramePtr != NULL) { + varFramePtr = Tcl_CallFrame_callerPtr(varFramePtr); + if (Tcl_CallFrame_isProcCallFrame(varFramePtr) & (FRAME_IS_NSF_METHOD|FRAME_IS_NSF_CMETHOD)) { + topCscPtr = (NsfCallStackContent *)Tcl_CallFrame_clientData(varFramePtr); + assert(topCscPtr != NULL); + } } } @@ -22229,7 +22231,7 @@ Tcl_ResetResult(interp); - if (regObject && !NsfObjectIsClass(regObject)) { + if (regObject != NULL && !NsfObjectIsClass(regObject)) { withPer_object = 1; /* don't output "object" modifier, if regObject is not a class */ outputPerObject = 0; @@ -22422,7 +22424,7 @@ Tcl_SetObjResult(interp, NsfGlobalObjs[NSF_FORWARD]); break; case InfomethodsubcmdDefinitionIdx: - { + if (regObject != NULL) { ClientData clientData; assert(cmd != NULL); @@ -22437,9 +22439,9 @@ AppendForwardDefinition(interp, resultObj, clientData); Tcl_SetObjResult(interp, resultObj); - break; } } + break; } } else if (procPtr == NsfSetterMethod) { @@ -22448,19 +22450,19 @@ case InfomethodsubcmdTypeIdx: Tcl_SetObjResult(interp, NsfGlobalObjs[NSF_SETTER]); break; - case InfomethodsubcmdDefinitionIdx: { - SetterCmdClientData *cd = (SetterCmdClientData *)Tcl_Command_objClientData(cmd); + case InfomethodsubcmdDefinitionIdx: + if (regObject != NULL) { + SetterCmdClientData *cd = (SetterCmdClientData *)Tcl_Command_objClientData(cmd); - resultObj = Tcl_NewListObj(0, NULL); - /* todo: don't hard-code registering command name "setter" / NSF_SETTER */ - - AppendMethodRegistration(interp, resultObj, NsfGlobalStrings[NSF_SETTER], regObject, - (cd && cd->paramsPtr) ? ObjStr(cd->paramsPtr->paramObj) : methodName, - cmd, 0, outputPerObject, 1); - Tcl_SetObjResult(interp, resultObj); + resultObj = Tcl_NewListObj(0, NULL); + /* todo: don't hard-code registering command name "setter" / NSF_SETTER */ + AppendMethodRegistration(interp, resultObj, NsfGlobalStrings[NSF_SETTER], regObject, + (cd && cd->paramsPtr) ? ObjStr(cd->paramsPtr->paramObj) : methodName, + cmd, 0, outputPerObject, 1); + Tcl_SetObjResult(interp, resultObj); + } break; } - } } else if (procPtr == NsfProcStub) { /* * Special nsfproc handling: @@ -22532,7 +22534,7 @@ Tcl_SetObjResult(interp, NsfGlobalObjs[NSF_ALIAS]); break; case InfomethodsubcmdDefinitionIdx: - { + if (regObject != NULL) { int nrElements; Tcl_Obj **listElements; @@ -22546,8 +22548,9 @@ AppendReturnsClause(interp, resultObj, cmd); Tcl_ListObjAppendElement(interp, resultObj, listElements[nrElements-1]); Tcl_SetObjResult(interp, resultObj); - break; } + break; + case InfomethodsubcmdOriginIdx: { int nrElements; @@ -28014,7 +28017,10 @@ } for( ; i < objc; argc = nextArgc, argv = nextArgv, methodName = nextMethodName) { + + assert(initString != NULL); Tcl_ResetResult(interp); + switch (isdasharg) { case SKALAR_DASH: /* Argument is a skalar with a leading dash */ { int j; Index: library/mongodb/nsfmongo.c =================================================================== diff -u -r24571ae44c492c681d3efd2f2d2f5169ad7d6d57 -r919f731adf8e0104d8addfec4540159fba75ed81 --- library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision 24571ae44c492c681d3efd2f2d2f5169ad7d6d57) +++ library/mongodb/nsfmongo.c (.../nsfmongo.c) (revision 919f731adf8e0104d8addfec4540159fba75ed81) @@ -1364,6 +1364,9 @@ if (n > 0) { iov.iov_len = n; n = mongoc_gridfs_file_writev(gridFile, &iov, 1, 0); + if (n != iov.iov_len) { + NsfLog(interp, NSF_LOG_WARN, "mongodb: write of %d bytes returned %d", iov.iov_len, n); + } } else if (n == 0) { break; } else {