vsam.js 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/WrappedVsam.cpp +20 -2
- package/package.json +1 -1
package/WrappedVsam.cpp
CHANGED
|
@@ -669,6 +669,7 @@ int WrappedVsam::Write_(const Napi::CallbackInfo &info, const char *pApiName,
|
|
|
669
669
|
Napi::String(info.Env(), field.ToString()));
|
|
670
670
|
if (i->type == LayoutItem::STRING) {
|
|
671
671
|
if (!VsamFile::isStrValid(*i, str, pApiName, errmsg)) {
|
|
672
|
+
free(recbuf);
|
|
672
673
|
throwError(info, 0, firstArgType, true, errmsg.c_str());
|
|
673
674
|
return -1;
|
|
674
675
|
}
|
|
@@ -678,6 +679,7 @@ int WrappedVsam::Write_(const Napi::CallbackInfo &info, const char *pApiName,
|
|
|
678
679
|
memcpy(fldbuf, str.c_str(), str.length());
|
|
679
680
|
} else {
|
|
680
681
|
if (!VsamFile::isHexStrValid(*i, str, pApiName, errmsg)) {
|
|
682
|
+
free(recbuf);
|
|
681
683
|
throwError(info, 0, firstArgType, true, errmsg.c_str());
|
|
682
684
|
return -1;
|
|
683
685
|
}
|
|
@@ -685,6 +687,7 @@ int WrappedVsam::Write_(const Napi::CallbackInfo &info, const char *pApiName,
|
|
|
685
687
|
VsamFile::hexstrToBuffer(fldbuf, i->maxLength, str.c_str());
|
|
686
688
|
}
|
|
687
689
|
} else {
|
|
690
|
+
free(recbuf);
|
|
688
691
|
throwError(info, 0, firstArgType, true,
|
|
689
692
|
"%s error: unexpected JSON data type %d for %s.", pApiName,
|
|
690
693
|
i->type, i->name.c_str());
|
|
@@ -778,6 +781,7 @@ int WrappedVsam::Update_(const Napi::CallbackInfo &info, const char *pApiName,
|
|
|
778
781
|
for (auto i = layout.begin(); i != layout.end(); ++i) {
|
|
779
782
|
const Napi::Value &field = record.Get(i->name);
|
|
780
783
|
if (field.IsUndefined()) {
|
|
784
|
+
free(recbuf);
|
|
781
785
|
throwError(info, 0, firstArgType, true,
|
|
782
786
|
"%s error: update value for %s has not been set.", pApiName,
|
|
783
787
|
i->name.c_str());
|
|
@@ -788,6 +792,7 @@ int WrappedVsam::Update_(const Napi::CallbackInfo &info, const char *pApiName,
|
|
|
788
792
|
static_cast<std::string>(Napi::String(info.Env(), field.ToString()));
|
|
789
793
|
if (i->type == LayoutItem::STRING) {
|
|
790
794
|
if (!VsamFile::isStrValid(*i, str, pApiName, errmsg)) {
|
|
795
|
+
free(recbuf);
|
|
791
796
|
throwError(info, 0, firstArgType, true, errmsg.c_str());
|
|
792
797
|
return -1;
|
|
793
798
|
}
|
|
@@ -796,6 +801,7 @@ int WrappedVsam::Update_(const Napi::CallbackInfo &info, const char *pApiName,
|
|
|
796
801
|
memcpy(fldbuf, str.c_str(), str.length());
|
|
797
802
|
} else {
|
|
798
803
|
if (!VsamFile::isHexStrValid(*i, str, pApiName, errmsg)) {
|
|
804
|
+
free(recbuf);
|
|
799
805
|
throwError(info, 0, firstArgType, true, errmsg.c_str());
|
|
800
806
|
return -1;
|
|
801
807
|
}
|
|
@@ -803,6 +809,7 @@ int WrappedVsam::Update_(const Napi::CallbackInfo &info, const char *pApiName,
|
|
|
803
809
|
}
|
|
804
810
|
fldbuf += i->maxLength;
|
|
805
811
|
} else {
|
|
812
|
+
free(recbuf);
|
|
806
813
|
throwError(info, 0, firstArgType, true,
|
|
807
814
|
"%s error: unexpected data type %d for %s.", pApiName, i->type,
|
|
808
815
|
i->name.c_str());
|
|
@@ -1186,6 +1193,8 @@ int WrappedVsam::FindUpdate_(const Napi::CallbackInfo &info,
|
|
|
1186
1193
|
static_cast<std::string>(Napi::String(info.Env(), field.ToString()));
|
|
1187
1194
|
if (i->type == LayoutItem::STRING) {
|
|
1188
1195
|
if (!VsamFile::isStrValid(*i, str, pApiName, errmsg)) {
|
|
1196
|
+
free(recbuf);
|
|
1197
|
+
delete pupd;
|
|
1189
1198
|
throwError(info, errArg, firstArgType, true, errmsg.c_str());
|
|
1190
1199
|
return -1;
|
|
1191
1200
|
}
|
|
@@ -1194,6 +1203,8 @@ int WrappedVsam::FindUpdate_(const Napi::CallbackInfo &info,
|
|
|
1194
1203
|
memcpy(fldbuf, str.c_str(), str.length());
|
|
1195
1204
|
} else {
|
|
1196
1205
|
if (!VsamFile::isHexStrValid(*i, str, pApiName, errmsg)) {
|
|
1206
|
+
free(recbuf);
|
|
1207
|
+
delete pupd;
|
|
1197
1208
|
throwError(info, errArg, firstArgType, true, errmsg.c_str());
|
|
1198
1209
|
return -1;
|
|
1199
1210
|
}
|
|
@@ -1207,13 +1218,20 @@ int WrappedVsam::FindUpdate_(const Napi::CallbackInfo &info,
|
|
|
1207
1218
|
#endif
|
|
1208
1219
|
fldbuf += i->maxLength;
|
|
1209
1220
|
} else {
|
|
1221
|
+
free(recbuf);
|
|
1222
|
+
delete pupd;
|
|
1210
1223
|
throwError(info, errArg, firstArgType, true,
|
|
1211
1224
|
"Error: unexpected data type %d.", i->type);
|
|
1212
1225
|
return -1;
|
|
1213
1226
|
}
|
|
1214
1227
|
}
|
|
1215
|
-
|
|
1216
|
-
|
|
1228
|
+
int rc = Find(info, __KEY_EQ, pApiName, cbArg, ppdata, firstArgType,
|
|
1229
|
+
FindUpdateExecute, FindUpdateComplete, recbuf, pupd);
|
|
1230
|
+
if (rc != 0) {
|
|
1231
|
+
free(recbuf);
|
|
1232
|
+
delete pupd;
|
|
1233
|
+
}
|
|
1234
|
+
return rc;
|
|
1217
1235
|
}
|
|
1218
1236
|
|
|
1219
1237
|
int WrappedVsam::FindDelete_(const Napi::CallbackInfo &info,
|