Allow taking screenshots of formspecs and move message to chat
[oweals/minetest.git] / src / base64.cpp
index 2a863d161a00e5fcf6c56caf0c088ef6914f1a9e..728814b003dce0b7081168d2708f8b0b705d40de 100644 (file)
@@ -38,6 +38,13 @@ static inline bool is_base64(unsigned char c) {
   return (isalnum(c) || (c == '+') || (c == '/'));
 }
 
+bool base64_is_valid(std::string const& s)
+{
+       for(size_t i=0; i<s.size(); i++)
+               if(!is_base64(s[i])) return false;
+       return true;
+}
+
 std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_len) {
   std::string ret;
   int i = 0;
@@ -71,9 +78,10 @@ std::string base64_encode(unsigned char const* bytes_to_encode, unsigned int in_
 
     for (j = 0; (j < i + 1); j++)
       ret += base64_chars[char_array_4[j]];
-
-    while((i++ < 3))
-      ret += '=';
+       
+       // Don't pad it with =
+    /*while((i++ < 3))
+      ret += '=';*/
 
   }