aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJ.H. van de Water <houder@xs4all.nl>2020-11-19 10:52:29 +0100
committerKristian Evers <kristianevers@gmail.com>2020-11-19 11:45:47 +0100
commit2cbf659bfcdffe12a4e7e397553c886566b2e949 (patch)
treecb1a001e6e0b21713da6dfd5948a4221490e31e1
parent4478eed4f5fe9d33fe7ef34126f98d3f7aa2daa5 (diff)
downloadPROJ-2cbf659bfcdffe12a4e7e397553c886566b2e949.tar.gz
PROJ-2cbf659bfcdffe12a4e7e397553c886566b2e949.zip
Replace line feed in input line by null character
As result of a modification in logging (adding a line feed), many changes had to be made in different places of cct.cpp. However, one missed the line feed in input to cct. As result of missing this, the output from cct showed a superfluous empty line after each output line, but only if the corresponding input line ended with comment. Replacing the LF in the "comment" string (present if the input line ended with comment) by a null character ('\0') solves this issue. Modification in logging? https://github.com/OSGeo/PROJ/commit/37da5e243191c04607597f6b8a77acfa017a5c99 ( cct: revise end-of-line handling in logging, and always output debug ) See also: https://github.com/OSGeo/PROJ/issues/1677 ( cct outputs excessive whitespace comments are included in input data )
-rw-r--r--src/apps/cct.cpp5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/apps/cct.cpp b/src/apps/cct.cpp
index fa75267a..b0e15e62 100644
--- a/src/apps/cct.cpp
+++ b/src/apps/cct.cpp
@@ -450,6 +450,11 @@ int main(int argc, char **argv) {
colmax = MAX(colmax, columns_xyzt[i]);
comment = column(buf, colmax+1);
}
+ /* remove the line feed from comment, as logger() above, invoked
+ by print() below (output), will add one */
+ size_t len = strlen(comment);
+ if (len >= 1)
+ comment[len - 1] = '\0';
comment_delimiter = (comment && *comment) ? whitespace : blank_comment;
/* Time to print the result */