diff options
| author | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-11 18:45:14 +0200 |
|---|---|---|
| committer | Albrecht Schlosser <albrechts.fltk@online.de> | 2020-07-11 18:48:42 +0200 |
| commit | 8a3d3684acd4f13da57e39060ed2a88e625a1d2d (patch) | |
| tree | efe816b88b3767f7d3aa07f72b99bf33db88dde9 /fluid/Fl_Function_Type.cxx | |
| parent | e5fbfcbec1fb06dc29393a70594317904610a426 (diff) | |
Fluid: fix "trailing whitespace" errors (#100)
Fluid would write trailing whitespace at some points when generating
.cxx and .h files from .fl files.
This was an old issue but became obvious since we removed trailing
whitespace from source and header files recently.
This commit fixes all whitespace errors in files generated from .fl
files in the FLTK repository, i.e. in fluid/, src/, and test/ folders.
I can't guarantee that I found all possible whitespace errors, but
this commit:
Fixes #100
Diffstat (limited to 'fluid/Fl_Function_Type.cxx')
| -rw-r--r-- | fluid/Fl_Function_Type.cxx | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/fluid/Fl_Function_Type.cxx b/fluid/Fl_Function_Type.cxx index d39e2164d..f6e8f5b29 100644 --- a/fluid/Fl_Function_Type.cxx +++ b/fluid/Fl_Function_Type.cxx @@ -500,10 +500,16 @@ void Fl_Code_Type::write_code1() { while( (pch=strchr(c,'\n')) ) { int line_len = pch - c; - write_c("%s%.*s\n", ind, line_len, c); + if (line_len < 1) + write_c("\n"); + else + write_c("%s%.*s\n", ind, line_len, c); c = pch+1; } - write_c("%s%s\n", ind, c); + if (*c) + write_c("%s%s\n", ind, c); + else + write_c("\n"); } void Fl_Code_Type::write_code2() {} @@ -738,23 +744,24 @@ void Fl_Decl_Type::write_code1() { if (class_name(1)) { write_public(public_); write_comment_h(" "); - write_h(" %.*s; %s\n", (int)(e-c), c, csc); + write_hc(" ", int(e-c), c, csc); } else { if (public_) { if (static_) write_h("extern "); else write_comment_h(); - write_h("%.*s; %s\n", (int)(e-c), c, csc); + write_hc("", int(e-c), c, csc); + if (static_) { write_comment_c(); - write_c("%.*s; %s\n", (int)(e-c), c, csc); + write_cc("", int(e-c), c, csc); } } else { write_comment_c(); if (static_) write_c("static "); - write_c("%.*s; %s\n", (int)(e-c), c, csc); + write_cc("", int(e-c), c, csc); } } } |
