]> git.ipfire.org Git - thirdparty/pdns.git/commitdiff
add dns_toupper() helper function 3465/head
authorThiago Farina <tfarina@chromium.org>
Fri, 26 Feb 2016 22:47:21 +0000 (19:47 -0300)
committerThiago Farina <tfarina@chromium.org>
Fri, 26 Feb 2016 22:47:21 +0000 (19:47 -0300)
This patch adds a ASCII version of toupper() function, called
dns_toupper(), and use it in place of toupper().

This fixes issue #3425

pdns/misc.hh

index 8d788dcdf4b428348e74c94ddf0b29eb637c688e..d9e6f9f8c487ac13cde1577ada03c7ac487d80a2 100644 (file)
@@ -244,6 +244,13 @@ inline char dns_tolower(char c)
   return c;
 }
 
+inline char dns_toupper(char c)
+{
+  if(c>='a' && c<='z')
+    c+='A'-'a';
+  return c;
+}
+
 inline const string toLower(const string &upper)
 {
   string reply(upper);
@@ -281,7 +288,7 @@ inline string toUpper( const string& s )
 {
         string r(s);
         for( unsigned int i = 0; i < s.length(); i++ ) {
-               r[i] = toupper( r[i] );
+          r[i] = dns_toupper(r[i]);
         }
         return r;
 }