Commit c6cfd6450334cc09d3a984d710e3fcc26b809f0f

Authored by Jay Berkenbilt
1 parent bd8918ff

Rename QUtil::strcasecmp to QUtil::str_compare_nocase (fixes #242)

ChangeLog
  1 +2019-06-21 Jay Berkenbilt <ejb@ql.org>
  2 +
  3 + * Source-level incompatibility: rename QUtil::strcasecmp to
  4 + QUtil::str_compare_nocase. This is a non-compatible change, but
  5 + QUtil::strcasecmp is hardly the most important part of qpdf's API.
  6 + The reason for this change is that strcasecmp is a macro on some
  7 + systems, and that was causing problems when QUtil.hh was included
  8 + in certain circumstances. Fixes #242.
  9 +
1 10 2019-06-20 Jay Berkenbilt <ejb@ql.org>
2 11  
3 12 * Enable compilation with additional warnings for integer
... ...
1 1 Next ABI
2 2 ========
3 3  
4   - * Rename QUtil::strcasecmp since strcasecmp is a macro on some
5   - platforms. See #242.
6   -
7 4 * Get rid of the version of QPDF::copyForeignObject with the bool
8 5 unused parameter.
9 6  
... ...
include/qpdf/QUtil.hh
... ... @@ -305,8 +305,11 @@ namespace QUtil
305 305 QPDF_DLL
306 306 std::list<std::string> read_lines_from_file(std::istream&);
307 307  
  308 + // This used to be called strcasecmp, but that is a macro on some
  309 + // platforms, so we have to give it a name that is not likely to
  310 + // be a macro anywhere.
308 311 QPDF_DLL
309   - int strcasecmp(char const *, char const *);
  312 + int str_compare_nocase(char const *, char const *);
310 313  
311 314 // These routines help the tokenizer recognize certain character
312 315 // classes without using ctype, which we avoid because of locale
... ...
libqpdf/QUtil.cc
... ... @@ -997,14 +997,14 @@ QUtil::read_lines_from_file(std::istream&amp; in)
997 997 }
998 998  
999 999 int
1000   -QUtil::strcasecmp(char const *s1, char const *s2)
  1000 +QUtil::str_compare_nocase(char const *s1, char const *s2)
1001 1001 {
1002 1002 #if defined(_WIN32) && defined(__BORLANDC__)
1003 1003 return stricmp(s1, s2);
1004 1004 #elif defined(_WIN32)
1005 1005 return _stricmp(s1, s2);
1006 1006 #else
1007   - return ::strcasecmp(s1, s2);
  1007 + return strcasecmp(s1, s2);
1008 1008 #endif
1009 1009 }
1010 1010  
... ...
qpdf/qpdf.cc
... ... @@ -4981,7 +4981,8 @@ static void write_outfile(QPDF&amp; pdf, Options&amp; o)
4981 4981 after = num_spot + 2;
4982 4982 }
4983 4983 else if ((len >= 4) &&
4984   - (QUtil::strcasecmp(o.outfilename + len - 4, ".pdf") == 0))
  4984 + (QUtil::str_compare_nocase(
  4985 + o.outfilename + len - 4, ".pdf") == 0))
4985 4986 {
4986 4987 QTC::TC("qpdf", "qpdf split-pages .pdf");
4987 4988 before = std::string(o.outfilename, len - 4) + "-";
... ...