Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame] | 1 | From 7d7b60e38ca701819d4d00b38161faddce01e2ae Mon Sep 17 00:00:00 2001 |
| 2 | From: Khem Raj <raj.khem@gmail.com> |
| 3 | Date: Thu, 6 Sep 2018 23:21:22 -0700 |
| 4 | Subject: [PATCH] Fix literal and identifier spacing as dictated by C++11 |
| 5 | |
| 6 | Fixes clang error like below |
| 7 | |
| 8 | error: invalid suffix on literal; C++11 requires a space between literal and identifier [-Wreserved-user-defined-literal] |
| 9 | | status(" Known files not found: %"PRIu64, this->match.unused); |
| 10 | |
| 11 | Upstream-Status: Submitted [https://github.com/jessek/hashdeep/pull/385/commits/18a6b5d57f7a648d2b7dcc6e50ff00a1e4b05fcc] |
| 12 | Signed-off-by: Khem Raj <raj.khem@gmail.com> |
| 13 | --- |
| 14 | src/display.cpp | 16 ++++++++-------- |
| 15 | src/files.cpp | 4 ++-- |
| 16 | src/hash.cpp | 2 +- |
| 17 | src/hashlist.cpp | 4 ++-- |
| 18 | src/xml.h | 2 +- |
| 19 | 5 files changed, 14 insertions(+), 14 deletions(-) |
| 20 | |
| 21 | diff --git a/src/display.cpp b/src/display.cpp |
| 22 | index b23335d..2eddc23 100644 |
| 23 | --- a/src/display.cpp |
| 24 | +++ b/src/display.cpp |
| 25 | @@ -311,7 +311,7 @@ void display::display_realtime_stats(const file_data_hasher_t *fdht, const hash_ |
| 26 | |
| 27 | ss << mb_read << "MB of " << fdht->stat_megs() << "MB done, "; |
| 28 | char msg[64]; |
| 29 | - snprintf(msg,sizeof(msg),"%02"PRIu64":%02"PRIu64":%02"PRIu64" left", hour, min, seconds); |
| 30 | + snprintf(msg,sizeof(msg),"%02" PRIu64 ":%02" PRIu64 ":%02" PRIu64 " left", hour, min, seconds); |
| 31 | ss << msg; |
| 32 | } |
| 33 | ss << "\r"; |
| 34 | @@ -424,14 +424,14 @@ void display::display_audit_results() |
| 35 | |
| 36 | if (opt_verbose) { |
| 37 | if(opt_verbose >= MORE_VERBOSE){ |
| 38 | - status(" Input files examined: %"PRIu64, this->match.total); |
| 39 | - status(" Known files expecting: %"PRIu64, this->match.expect); |
| 40 | + status(" Input files examined: %" PRIu64, this->match.total); |
| 41 | + status(" Known files expecting: %" PRIu64, this->match.expect); |
| 42 | } |
| 43 | - status(" Files matched: %"PRIu64, this->match.exact); |
| 44 | - status("Files partially matched: %"PRIu64, this->match.partial); |
| 45 | - status(" Files moved: %"PRIu64, this->match.moved); |
| 46 | - status(" New files found: %"PRIu64, this->match.unknown); |
| 47 | - status(" Known files not found: %"PRIu64, this->match.unused); |
| 48 | + status(" Files matched: %" PRIu64, this->match.exact); |
| 49 | + status("Files partially matched: %" PRIu64, this->match.partial); |
| 50 | + status(" Files moved: %" PRIu64, this->match.moved); |
| 51 | + status(" New files found: %" PRIu64, this->match.unknown); |
| 52 | + status(" Known files not found: %" PRIu64, this->match.unused); |
| 53 | } |
| 54 | } |
| 55 | |
| 56 | diff --git a/src/files.cpp b/src/files.cpp |
| 57 | index 89c6984..3dfd363 100644 |
| 58 | --- a/src/files.cpp |
| 59 | +++ b/src/files.cpp |
| 60 | @@ -509,7 +509,7 @@ int state::parse_encase_file(const char *fn, FILE *handle,uint32_t expected_hash |
| 61 | |
| 62 | // Users expect the line numbers to start at one, not zero. |
| 63 | if ((!ocb.opt_silent) || (mode_warn_only)) { |
| 64 | - ocb.error("%s: No hash found in line %"PRIu32, fn, count + 1); |
| 65 | + ocb.error("%s: No hash found in line %" PRIu32, fn, count + 1); |
| 66 | ocb.error("%s: %s", fn, strerror(errno)); |
| 67 | return status_t::STATUS_USER_ERROR; |
| 68 | } |
| 69 | @@ -542,7 +542,7 @@ int state::parse_encase_file(const char *fn, FILE *handle,uint32_t expected_hash |
| 70 | } |
| 71 | |
| 72 | if (expected_hashes != count){ |
| 73 | - ocb.error("%s: Expecting %"PRIu32" hashes, found %"PRIu32"\n", |
| 74 | + ocb.error("%s: Expecting %" PRIu32 " hashes, found %" PRIu32 "\n", |
| 75 | fn, expected_hashes, count); |
| 76 | } |
| 77 | return status_t::status_ok; |
| 78 | diff --git a/src/hash.cpp b/src/hash.cpp |
| 79 | index 52f419b..a4b3128 100644 |
| 80 | --- a/src/hash.cpp |
| 81 | +++ b/src/hash.cpp |
| 82 | @@ -124,7 +124,7 @@ bool file_data_hasher_t::compute_hash(uint64_t request_start,uint64_t request_le |
| 83 | |
| 84 | // If an error occured, display a message and see if we need to quit. |
| 85 | if ((current_read_bytes<0) || (this->handle && ferror(this->handle))){ |
| 86 | - ocb->error_filename(this->file_name,"error at offset %"PRIu64": %s", |
| 87 | + ocb->error_filename(this->file_name,"error at offset %" PRIu64 ": %s", |
| 88 | request_start, strerror(errno)); |
| 89 | |
| 90 | if (file_fatal_error()){ |
| 91 | diff --git a/src/hashlist.cpp b/src/hashlist.cpp |
| 92 | index b5b275f..eb0d45a 100644 |
| 93 | --- a/src/hashlist.cpp |
| 94 | +++ b/src/hashlist.cpp |
| 95 | @@ -342,7 +342,7 @@ hashlist::load_hash_file(display *ocb,const std::string &fn) |
| 96 | file_data_t *t = new (std::nothrow) file_data_t(); |
| 97 | if (NULL == t) |
| 98 | { |
| 99 | - ocb->fatal_error("%s: Out of memory in line %"PRIu64, |
| 100 | + ocb->fatal_error("%s: Out of memory in line %" PRIu64, |
| 101 | fn.c_str(), line_number); |
| 102 | } |
| 103 | |
| 104 | @@ -390,7 +390,7 @@ hashlist::load_hash_file(display *ocb,const std::string &fn) |
| 105 | if ( !algorithm_t::valid_hash(hash_column[column_number],word)) |
| 106 | { |
| 107 | if (ocb) |
| 108 | - ocb->error("%s: Invalid %s hash in line %"PRIu64, |
| 109 | + ocb->error("%s: Invalid %s hash in line %" PRIu64, |
| 110 | fn.c_str(), |
| 111 | hashes[hash_column[column_number]].name.c_str(), |
| 112 | line_number); |
| 113 | diff --git a/src/xml.h b/src/xml.h |
| 114 | index bfe0c94..017dba7 100644 |
| 115 | --- a/src/xml.h |
| 116 | +++ b/src/xml.h |
| 117 | @@ -100,7 +100,7 @@ public: |
| 118 | void xmlout(const std::string &tag,const std::string &value){ xmlout(tag,value,"",true); } |
| 119 | void xmlout(const std::string &tag,const int value){ xmlprintf(tag,"","%d",value); } |
| 120 | void xmloutl(const std::string &tag,const long value){ xmlprintf(tag,"","%ld",value); } |
| 121 | - void xmlout(const std::string &tag,const int64_t value){ xmlprintf(tag,"","%"PRId64,value); } |
| 122 | + void xmlout(const std::string &tag,const int64_t value){ xmlprintf(tag,"","%" PRId64,value); } |
| 123 | void xmlout(const std::string &tag,const double value){ xmlprintf(tag,"","%f",value); } |
| 124 | void xmlout(const std::string &tag,const struct timeval &ts){ |
| 125 | xmlprintf(tag,"","%d.%06d",(int)ts.tv_sec, (int)ts.tv_usec); |
| 126 | -- |
| 127 | 2.18.0 |
| 128 | |