From 2cbf659bfcdffe12a4e7e397553c886566b2e949 Mon Sep 17 00:00:00 2001 From: "J.H. van de Water" Date: Thu, 19 Nov 2020 10:52:29 +0100 Subject: 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 ) --- src/apps/cct.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src') 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 */ -- cgit v1.2.3