more c89 conformance
variables should be declared at the beginning of functions
This commit is contained in:
@@ -3329,11 +3329,12 @@ int DLLEXPORT ENgetaveragepatternvalue(int index, EN_API_FLOAT_TYPE *value)
|
|||||||
** and pattern
|
** and pattern
|
||||||
**----------------------------------------------------------------
|
**----------------------------------------------------------------
|
||||||
*/
|
*/
|
||||||
{ *value = 0.0;
|
{
|
||||||
|
int i;
|
||||||
|
*value = 0.0;
|
||||||
if (!Openflag) return(102);
|
if (!Openflag) return(102);
|
||||||
if (index < 1 || index > Npats) return(205);
|
if (index < 1 || index > Npats) return(205);
|
||||||
//if (period < 1 || period > Pattern[index].Length) return(251);
|
//if (period < 1 || period > Pattern[index].Length) return(251);
|
||||||
int i;
|
|
||||||
for (i=0; i<Pattern[index].Length; i++) {
|
for (i=0; i<Pattern[index].Length; i++) {
|
||||||
*value+=Pattern[index].F[i];
|
*value+=Pattern[index].F[i];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -30,11 +30,12 @@ unsigned int _enHash(char *str);
|
|||||||
unsigned int _enHash(char *str)
|
unsigned int _enHash(char *str)
|
||||||
{
|
{
|
||||||
unsigned int hash = 5381;
|
unsigned int hash = 5381;
|
||||||
|
unsigned int retHash;
|
||||||
int c;
|
int c;
|
||||||
while ((c = *str++)) {
|
while ((c = *str++)) {
|
||||||
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
|
hash = ((hash << 5) + hash) + c; /* hash * 33 + c */
|
||||||
}
|
}
|
||||||
unsigned int retHash = hash % ENHASHTABLEMAXSIZE;
|
retHash = hash % ENHASHTABLEMAXSIZE;
|
||||||
return retHash;
|
return retHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -237,7 +237,7 @@ int runqual(long *t)
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// stepwise calculation - hydraulic results are already in memory
|
// stepwise calculation - hydraulic results are already in memory
|
||||||
for (int i=1; i<= Ntanks; ++i) {
|
for (i=1; i<= Ntanks; ++i) {
|
||||||
QTankVolumes[i-1] = Tank[i].V;
|
QTankVolumes[i-1] = Tank[i].V;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,7 +282,9 @@ int nextqual(long *tstep)
|
|||||||
{
|
{
|
||||||
long hydstep; /* Hydraulic solution time step */
|
long hydstep; /* Hydraulic solution time step */
|
||||||
int errcode = 0;
|
int errcode = 0;
|
||||||
|
double *tankVolumes;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
/* Determine time step */
|
/* Determine time step */
|
||||||
*tstep = 0;
|
*tstep = 0;
|
||||||
|
|
||||||
@@ -291,12 +293,10 @@ int nextqual(long *tstep)
|
|||||||
if (Htime <= Dur) hydstep = Htime - Qtime;
|
if (Htime <= Dur) hydstep = Htime - Qtime;
|
||||||
else hydstep = 0;
|
else hydstep = 0;
|
||||||
|
|
||||||
double *tankVolumes;
|
|
||||||
|
|
||||||
// if we're operating in stepwise mode, capture the tank levels so we can restore them later.
|
// if we're operating in stepwise mode, capture the tank levels so we can restore them later.
|
||||||
if (OpenHflag) {
|
if (OpenHflag) {
|
||||||
tankVolumes = calloc(Ntanks, sizeof(double));
|
tankVolumes = calloc(Ntanks, sizeof(double));
|
||||||
for (int i=1; i<=Ntanks; ++i) {
|
for (i=1; i<=Ntanks; ++i) {
|
||||||
if (Tank[i].A != 0) { // skip reservoirs
|
if (Tank[i].A != 0) { // skip reservoirs
|
||||||
tankVolumes[i-1] = Tank[i].V;
|
tankVolumes[i-1] = Tank[i].V;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user