updates
replaced MAXMSG with MAXID added a check if demandName is too long
This commit is contained in:
@@ -1234,7 +1234,7 @@ int DLLEXPORT EN_setoption(EN_Project p, int option, double value)
|
||||
if (demand->Pat == tmpPat)
|
||||
{
|
||||
demand->Pat = pat;
|
||||
demand->Name = xstrcpy(&demand->Name, "", MAXMSG);
|
||||
demand->Name = xstrcpy(&demand->Name, "", MAXID);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2776,11 +2776,14 @@ int DLLEXPORT EN_setdemandname(EN_Project p, int nodeIndex, int demandIndex,
|
||||
if (!p->Openflag) return 102;
|
||||
if (nodeIndex <= 0 || nodeIndex > p->network.Njuncs) return 203;
|
||||
|
||||
// Check that demandName is not too long
|
||||
if (strlen(demandName) > MAXID) return 250;
|
||||
|
||||
// Locate demand category record and assign demandName to it
|
||||
for (d = p->network.Node[nodeIndex].D;
|
||||
n < demandIndex && d->next != NULL; d = d->next) n++;
|
||||
if (n != demandIndex) return 253;
|
||||
d->Name = xstrcpy(&d->Name, demandName, MAXMSG);
|
||||
d->Name = xstrcpy(&d->Name, demandName, MAXID);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user