From 56c44c04f6f7619efafb207a795e3691fdad6fbc Mon Sep 17 00:00:00 2001 From: 0tkl Date: Wed, 14 May 2025 15:40:26 +0800 Subject: [PATCH] fix typos in code comments remove duplicate words from a comment --- src/epanet.c | 12 ++++++------ src/hydcoeffs.c | 2 +- src/hydsolver.c | 2 +- src/inpfile.c | 6 +++--- src/leakage.c | 2 +- src/outfile/src/epanet_output.c | 4 ++-- src/output.c | 4 ++-- src/qualreact.c | 4 ++-- src/qualroute.c | 2 +- src/smatrix.c | 4 ++-- src/validate.c | 2 +- 11 files changed, 22 insertions(+), 22 deletions(-) diff --git a/src/epanet.c b/src/epanet.c index 1e8cc8f..70c9a37 100644 --- a/src/epanet.c +++ b/src/epanet.c @@ -1019,7 +1019,7 @@ int DLLEXPORT EN_getversion(int *version) int DLLEXPORT EN_geterror(int errcode, char *errmsg, int maxLen) /*---------------------------------------------------------------- -** Input: errcode = an error or warnng code +** Input: errcode = an error or warning code ** maxLen = maximum characters that errmsg can hold ** Output: errmsg = text of error/warning message ** Returns: error code @@ -1283,7 +1283,7 @@ int DLLEXPORT EN_setoption(EN_Project p, int option, double value) // All other option values must be non-negative if (value < 0.0) return 213; - // Process the speficied option + // Process the specified option switch (option) { case EN_TRIALS: @@ -1920,7 +1920,7 @@ int DLLEXPORT EN_addnode(EN_Project p, const char *id, int nodeType, int *index) // Check for valid node type if (nodeType < EN_JUNCTION || nodeType > EN_TANK) return 251; - // Grow node-related arrays to accomodate the new node + // Grow node-related arrays to accommodate the new node size = (net->Nnodes + 2) * sizeof(Snode); net->Node = (Snode *)realloc(net->Node, size); size = (net->Nnodes + 2) * sizeof(double); @@ -3345,7 +3345,7 @@ int DLLEXPORT EN_addlink(EN_Project p, const char *id, int linkType, if (errcode) return errcode; } - // Grow link-related arrays to accomodate the new link + // Grow link-related arrays to accommodate the new link net->Nlinks++; p->parser.MaxLinks = net->Nlinks; n = net->Nlinks; @@ -3364,7 +3364,7 @@ int DLLEXPORT EN_addlink(EN_Project p, const char *id, int linkType, if (linkType <= PIPE) net->Npipes++; else if (linkType == PUMP) { - // Grow pump array to accomodate the new link + // Grow pump array to accommodate the new link net->Npumps++; size = (net->Npumps + 1) * sizeof(Spump); net->Pump = (Spump *)realloc(net->Pump, size); @@ -3386,7 +3386,7 @@ int DLLEXPORT EN_addlink(EN_Project p, const char *id, int linkType, } else { - // Grow valve array to accomodate the new link + // Grow valve array to accommodate the new link net->Nvalves++; size = (net->Nvalves + 1) * sizeof(Svalve); net->Valve = (Svalve *)realloc(net->Valve, size); diff --git a/src/hydcoeffs.c b/src/hydcoeffs.c index 9bf45dc..8cb034c 100644 --- a/src/hydcoeffs.c +++ b/src/hydcoeffs.c @@ -507,7 +507,7 @@ void emitterheadloss(Project *pr, int i, double *hloss, double *hgrad) ** Input: i = node index ** Output: hloss = head loss across node's emitter ** hgrad = head loss gradient -** Purpose: computes an emitters's head loss and gradient. +** Purpose: computes an emitter's head loss and gradient. **------------------------------------------------------------- */ { diff --git a/src/hydsolver.c b/src/hydsolver.c index 4337898..e5969bc 100644 --- a/src/hydsolver.c +++ b/src/hydsolver.c @@ -178,7 +178,7 @@ int hydsolve(Project *pr, int *iter, double *relerr) nextcheck = *iter + hyd->CheckFreq; } - // No convergence yet - see if its time for a periodic status + // No convergence yet - see if it's time for a periodic status // check on pumps, CV's, and pipes connected to tank else if (*iter <= hyd->MaxCheck && *iter == nextcheck) { diff --git a/src/inpfile.c b/src/inpfile.c index 2968353..e988875 100644 --- a/src/inpfile.c +++ b/src/inpfile.c @@ -39,7 +39,7 @@ extern char *CurveTypeTxt[]; void saveauxdata(Project *pr, FILE *f) /* ------------------------------------------------------------ - Writes auxilary data from original input file to new file. + Writes auxiliary data from original input file to new file. ------------------------------------------------------------ */ { @@ -84,7 +84,7 @@ void saveauxdata(Project *pr, FILE *f) } } - // Write line of auxilary data to file + // Write line of auxiliary data to file else { switch (sect) @@ -873,7 +873,7 @@ int saveinpfile(Project *pr, const char *fname) } } - // Save auxilary data to new input file + // Save auxiliary data to new input file fprintf(f, "\n"); saveauxdata(pr, f); diff --git a/src/leakage.c b/src/leakage.c index be1dbc5..e81b618 100644 --- a/src/leakage.c +++ b/src/leakage.c @@ -141,7 +141,7 @@ void convert_pipe_to_node_leakage(Project *pr) ** Input: none ** Output: none ** Purpose: converts pipe leakage parameters into node leakage -** coefficents. +** coefficients. **------------------------------------------------------------- */ { diff --git a/src/outfile/src/epanet_output.c b/src/outfile/src/epanet_output.c index 480f18f..d1be3b1 100644 --- a/src/outfile/src/epanet_output.c +++ b/src/outfile/src/epanet_output.c @@ -122,7 +122,7 @@ int EXPORT_OUT_API ENR_close(ENR_Handle *p_handle) ** ** Returns: Error code 0 on success, -1 on failure ** - ** Purpose: Close the output binary file, dellocate ENR_Handle struc + ** Purpose: Close the output binary file, deallocate ENR_Handle struct ** and nullify pointer to ENR_Handle struct ** ** NOTE: ENR_close must be called before program end @@ -161,7 +161,7 @@ int EXPORT_OUT_API ENR_open(ENR_Handle p_handle, const char* path) ** Returns: warning / error code ** Purpose: Opens the output binary file and reads prologue and epilogue ** - ** NOTE: ENR_init must be called before anyother ENR_* functions + ** NOTE: ENR_init must be called before any other ENR_* functions **------------------------------------------------------------------------- */ { diff --git a/src/output.c b/src/output.c index 33ead70..5ecd743 100644 --- a/src/output.c +++ b/src/output.c @@ -588,8 +588,8 @@ int linkoutput(Project *pr, int j, REAL4 *x, double ucf) case FRICTION: // Friction factor // f = 2ghd/(Lu^2) where f = friction factor - // u = velocity, g = grav. accel., h = head loss - //loss, d = diam., & L = pipe length + // u = velocity, g = grav. accel., h = head + // loss, d = diam., & L = pipe length for (i = 1; i <= net->Nlinks; i++) { if (net->Link[i].Type <= PIPE && ABS(hyd->LinkFlow[i]) > TINY) diff --git a/src/qualreact.c b/src/qualreact.c index cbc5d2a..7ce6234 100644 --- a/src/qualreact.c +++ b/src/qualreact.c @@ -232,7 +232,7 @@ double piperate(Project *pr, int k) } // Compute Reynolds No. - // Flow rate made consistent with how its saved to hydraulics file + // Flow rate made consistent with how it's saved to hydraulics file q = (hyd->LinkStatus[k] <= CLOSED) ? 0.0 : hyd->LinkFlow[k]; a = PI * d * d / 4.0; // pipe area u = fabs(q) / a; // flow velocity @@ -772,7 +772,7 @@ void tankmix4(Project *pr, int i, double vin, double win, double vnet) vsum += vseg; wsum += (seg->c) * vseg; - // ... update remiaing volume to remove + // ... update remaining volume to remove vnet -= vseg; // ... if no more volume left in current segment diff --git a/src/qualroute.c b/src/qualroute.c index 30294f5..2309ba8 100644 --- a/src/qualroute.c +++ b/src/qualroute.c @@ -247,7 +247,7 @@ double findnodequal(Project *pr, int n, double volin, return qual->NodeQual[n]; } - // Find quality contribued by any external chemical source + // Find quality contributed by any external chemical source else qual->SourceQual = findsourcequal(pr, n, volout, tstep); if (qual->SourceQual == 0.0) return qual->NodeQual[n]; diff --git a/src/smatrix.c b/src/smatrix.c index e4bb02b..1dde505 100755 --- a/src/smatrix.c +++ b/src/smatrix.c @@ -651,7 +651,7 @@ int sortsparse(Smatrix *sm, int n) /* **-------------------------------------------------------------- ** Input: n = number of rows in solution matrix -** Output: returns eror code +** Output: returns error code ** Purpose: puts row indexes in ascending order in NZSUB **-------------------------------------------------------------- */ @@ -834,7 +834,7 @@ int linsolve(Smatrix *sm, int n) } } // next j - // Foward substitution + // Forward substitution for (j = 1; j <= n; j++) { bj = B[j]/Aii[j]; diff --git a/src/validate.c b/src/validate.c index 241030d..5e120e7 100644 --- a/src/validate.c +++ b/src/validate.c @@ -162,7 +162,7 @@ int powerfuncpump(double h0, double h1, double h2, double q1, double q2, ** q1 = design flow ** q2 = max. flow ** Output: *a, *b, *c = pump curve coeffs. (H = a-bQ^c), -** Returns 1 if sucessful, 0 otherwise. +** Returns 1 if successful, 0 otherwise. ** Purpose: computes coeffs. for a power function pump curve **---------------------------------------------------------- */