From c6fdff2b223d8527600a7df13638cd0258db4de7 Mon Sep 17 00:00:00 2001 From: Brad King Date: Tue, 6 Oct 2009 16:33:15 -0400 Subject: Support more special characters in file(STRINGS) The commits "Teach Fortran compiler identification about the Portland Group compiler" and "Fix previous change to file(STRINGS) command" taught file(STRINGS) to recognize the form-feed '\f' character as part of string literals. The Portland Group Fortran compiler also puts 0x14 bytes at the end of string literals in some cases. We generalize the previous solution and add the new character in this commit. --- Source/cmFileCommand.cxx | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Source/cmFileCommand.cxx b/Source/cmFileCommand.cxx index a70ca75..609e95b 100644 --- a/Source/cmFileCommand.cxx +++ b/Source/cmFileCommand.cxx @@ -531,6 +531,13 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) return false; } + // At least one compiler (Portland Group Fortran) produces binaries + // with some extra characters in strings. + char extra[256]; // = {}; // some compilers do not like this + memset(extra, 0, sizeof(extra)); + extra['\f'] = 1; // FF (form feed) + extra[0x14] = 1; // DC4 (device control 4) + // Parse strings out of the file. int output_size = 0; std::vector strings; @@ -585,7 +592,7 @@ bool cmFileCommand::HandleStringsCommand(std::vector const& args) { // Ignore CR character to make output always have UNIX newlines. } - else if((c >= 0x20 && c < 0x7F) || c == '\t' || c == '\f' || + else if((c >= 0x20 && c < 0x7F) || c == '\t' || extra[c] || (c == '\n' && newline_consume)) { // This is an ASCII character that may be part of a string. -- cgit v0.12