]> git.lizzy.rs Git - dragonfireclient.git/blobdiff - src/hex.h
make formspec textarea wordwrap
[dragonfireclient.git] / src / hex.h
index 84b2656286745679a2bddda8de6b94c787c6ce44..6f00a79bff0a451115f4e1230fc1aa430d71203c 100644 (file)
--- a/src/hex.h
+++ b/src/hex.h
@@ -1,18 +1,18 @@
 /*
-Minetest-c55
-Copyright (C) 2012 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
+Minetest
+Copyright (C) 2013 Jonathan Neuschäfer <j.neuschaefer@gmx.net>
 
 This program is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2 of the License, or
+it under the terms of the GNU Lesser General Public License as published by
+the Free Software Foundation; either version 2.1 of the License, or
 (at your option) any later version.
 
 This program is distributed in the hope that it will be useful,
 but WITHOUT ANY WARRANTY; without even the implied warranty of
 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
+GNU Lesser General Public License for more details.
 
-You should have received a copy of the GNU General Public License along
+You should have received a copy of the GNU Lesser General Public License along
 with this program; if not, write to the Free Software Foundation, Inc.,
 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */
@@ -46,4 +46,17 @@ static inline std::string hex_encode(const std::string &data)
     return hex_encode(data.c_str(), data.size());
 }
 
+static inline bool hex_digit_decode(char hexdigit, unsigned char &value)
+{
+       if(hexdigit >= '0' && hexdigit <= '9')
+               value = hexdigit - '0';
+       else if(hexdigit >= 'A' && hexdigit <= 'F')
+               value = hexdigit - 'A' + 10;
+       else if(hexdigit >= 'a' && hexdigit <= 'f')
+               value = hexdigit - 'a' + 10;
+       else
+               return false;
+       return true;
+}
+
 #endif