aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJay Berkenbilt <ejb@ql.org>2019-06-22 00:38:03 +0200
committerJay Berkenbilt <ejb@ql.org>2019-06-22 04:29:31 +0200
commitc6cfd6450334cc09d3a984d710e3fcc26b809f0f (patch)
tree8a2226e216577b87aebd03f8901e911a558ec49a
parentbd8918fffc73803698f02021543a14445ba17e0b (diff)
downloadqpdf-c6cfd6450334cc09d3a984d710e3fcc26b809f0f.tar.zst
Rename QUtil::strcasecmp to QUtil::str_compare_nocase (fixes #242)
-rw-r--r--ChangeLog9
-rw-r--r--TODO3
-rw-r--r--include/qpdf/QUtil.hh5
-rw-r--r--libqpdf/QUtil.cc4
-rw-r--r--qpdf/qpdf.cc3
5 files changed, 17 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 6b94b5c5..49a3c614 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+2019-06-21 Jay Berkenbilt <ejb@ql.org>
+
+ * Source-level incompatibility: rename QUtil::strcasecmp to
+ QUtil::str_compare_nocase. This is a non-compatible change, but
+ QUtil::strcasecmp is hardly the most important part of qpdf's API.
+ The reason for this change is that strcasecmp is a macro on some
+ systems, and that was causing problems when QUtil.hh was included
+ in certain circumstances. Fixes #242.
+
2019-06-20 Jay Berkenbilt <ejb@ql.org>
* Enable compilation with additional warnings for integer
diff --git a/TODO b/TODO
index a04be5c9..bf400c33 100644
--- a/TODO
+++ b/TODO
@@ -1,9 +1,6 @@
Next ABI
========
- * Rename QUtil::strcasecmp since strcasecmp is a macro on some
- platforms. See #242.
-
* Get rid of the version of QPDF::copyForeignObject with the bool
unused parameter.
diff --git a/include/qpdf/QUtil.hh b/include/qpdf/QUtil.hh
index afdd2033..9f76f738 100644
--- a/include/qpdf/QUtil.hh
+++ b/include/qpdf/QUtil.hh
@@ -305,8 +305,11 @@ namespace QUtil
QPDF_DLL
std::list<std::string> read_lines_from_file(std::istream&);
+ // This used to be called strcasecmp, but that is a macro on some
+ // platforms, so we have to give it a name that is not likely to
+ // be a macro anywhere.
QPDF_DLL
- int strcasecmp(char const *, char const *);
+ int str_compare_nocase(char const *, char const *);
// These routines help the tokenizer recognize certain character
// classes without using ctype, which we avoid because of locale
diff --git a/libqpdf/QUtil.cc b/libqpdf/QUtil.cc
index 607c28f7..ddfc0cdb 100644
--- a/libqpdf/QUtil.cc
+++ b/libqpdf/QUtil.cc
@@ -997,14 +997,14 @@ QUtil::read_lines_from_file(std::istream& in)
}
int
-QUtil::strcasecmp(char const *s1, char const *s2)
+QUtil::str_compare_nocase(char const *s1, char const *s2)
{
#if defined(_WIN32) && defined(__BORLANDC__)
return stricmp(s1, s2);
#elif defined(_WIN32)
return _stricmp(s1, s2);
#else
- return ::strcasecmp(s1, s2);
+ return strcasecmp(s1, s2);
#endif
}
diff --git a/qpdf/qpdf.cc b/qpdf/qpdf.cc
index 4200903b..cbda36a1 100644
--- a/qpdf/qpdf.cc
+++ b/qpdf/qpdf.cc
@@ -4981,7 +4981,8 @@ static void write_outfile(QPDF& pdf, Options& o)
after = num_spot + 2;
}
else if ((len >= 4) &&
- (QUtil::strcasecmp(o.outfilename + len - 4, ".pdf") == 0))
+ (QUtil::str_compare_nocase(
+ o.outfilename + len - 4, ".pdf") == 0))
{
QTC::TC("qpdf", "qpdf split-pages .pdf");
before = std::string(o.outfilename, len - 4) + "-";