Skip to content

Commit

Permalink
Merge pull request #389 from zowe/bugfix/dynalloc64_0c4
Browse files Browse the repository at this point in the history
Fixed an inconsistent use of pointers in 64 bit case in dataset creation
  • Loading branch information
1000TurquoisePogs authored Jul 28, 2023
2 parents 44bc925 + 6734a60 commit b186413
Show file tree
Hide file tree
Showing 3 changed files with 516 additions and 4 deletions.
10 changes: 6 additions & 4 deletions c/dynalloc.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,30 +874,32 @@ int setTextUnit(int type, int size, char* stringValue, int numValue, int key,
}
}

typedef TextUnit *__ptr32 *__ptr32 TextUnitPtrArray;

int dynallocNewDataset(TextUnit **inputTextUnit, int inputTextUnitCount, int *reasonCode) {
ALLOC_STRUCT31(
STRUCT31_NAME(below2G),
STRUCT31_FIELDS(
DynallocParms parms;
TextUnit ** __ptr32 textUnits;
TextUnitPtrArray textUnits;
)
);

below2G->textUnits = (TextUnit **)safeMalloc31(sizeof(TextUnit*) * inputTextUnitCount, "Text units array");
below2G->textUnits = (TextUnitPtrArray)safeMalloc31(sizeof(TextUnit*__ptr32) * inputTextUnitCount, "Text units array");
if(below2G->textUnits == NULL) {
return -1;
}
DynallocParms *parms = &below2G->parms;
dynallocParmsInit(parms);

dynallocParmsSetTextUnits(parms, (TextUnit * __ptr32 *)below2G->textUnits, inputTextUnitCount);
dynallocParmsSetTextUnits(parms, (TextUnitPtrArray)below2G->textUnits, inputTextUnitCount);

int rc;

do {
rc = 0;
for (int i = 0; i < inputTextUnitCount; i++) {
below2G->textUnits[i] = inputTextUnit[i];
below2G->textUnits[i] = (TextUnit *__ptr32)inputTextUnit[i];
if (below2G->textUnits[i] == NULL) {
rc = -1;
break;
Expand Down
11 changes: 11 additions & 0 deletions tests/create1.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{"ndisp":"CATALOG",
"status":"NEW",
"space":"TRK",
"dsorg":"PO",
"lrecl":80,
"recfm":"FB",
"dir":20,
"prime":3,
"secnd":3,
"dsnt":"PDS",
"close":"true"}
Loading

0 comments on commit b186413

Please sign in to comment.