0001-Fix-literal-and-identifier-spacing-as-dictated-by-C-.patch 5.5 KB

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