aboutsummaryrefslogtreecommitdiff
path: root/src/apps/cct.cpp
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:47:49 +0100
commite100c8334b6257fb8a02e0d9161ef710f29334e9 (patch)
tree9f57c9213bd95906ded8c6e3211dc87378db143e /src/apps/cct.cpp
parent014156cf865ba30777da9850b238f969c9706f68 (diff)
downloadPROJ-e100c8334b6257fb8a02e0d9161ef710f29334e9.tar.gz
PROJ-e100c8334b6257fb8a02e0d9161ef710f29334e9.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 )
Diffstat (limited to 'src/apps/cct.cpp')
-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 fe566920..acd89404 100644
--- a/src/apps/cct.cpp
+++ b/src/apps/cct.cpp
@@ -385,6 +385,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 */