Add a third default.
[oweals/gnunet.git] / src / util / strings.c
index 00c0cf0e19c9e6ab249ff34eeefa73540b34f5f0..b25b39bcd1dc4b4acfc11d91c3aeb38288962021 100644 (file)
@@ -492,44 +492,46 @@ GNUNET_STRINGS_from_utf8 (const char *input,
 
 
 /**
- * Convert the utf-8 input string to lowercase
- * Output needs to be allocated appropriately
+ * Convert the utf-8 input string to lowercase.
+ * Output needs to be allocated appropriately.
  *
  * @param input input string
  * @param output output buffer
  */
 void
-GNUNET_STRINGS_utf8_tolower(const char* input, char** output)
+GNUNET_STRINGS_utf8_tolower (const char *input,
+                             char *output)
 {
   uint8_t *tmp_in;
   size_t len;
 
   tmp_in = u8_tolower ((uint8_t*)input, strlen ((char *) input),
                        NULL, UNINORM_NFD, NULL, &len);
-  memcpy(*output, tmp_in, len);
-  (*output)[len] = '\0';
+  memcpy(output, tmp_in, len);
+  output[len] = '\0';
   free(tmp_in);
 }
 
 
 /**
- * Convert the utf-8 input string to uppercase
- * Output needs to be allocated appropriately
+ * Convert the utf-8 input string to uppercase.
+ * Output needs to be allocated appropriately.
  *
  * @param input input string
  * @param output output buffer
  */
 void
-GNUNET_STRINGS_utf8_toupper(const char* input, char** output)
+GNUNET_STRINGS_utf8_toupper(const char *input,
+                            char *output)
 {
   uint8_t *tmp_in;
   size_t len;
 
   tmp_in = u8_toupper ((uint8_t*)input, strlen ((char *) input),
                        NULL, UNINORM_NFD, NULL, &len);
-  memcpy(*output, tmp_in, len);
-  (*output)[len] = '\0';
-  free(tmp_in);
+  memcpy (output, tmp_in, len);
+  output[len] = '\0';
+  free (tmp_in);
 }
 
 
@@ -776,6 +778,8 @@ getValue__ (unsigned char a)
     return a - '0';
   if ((a >= 'A') && (a <= 'V'))
     return (a - 'A' + 10);
+  if ((a >= 'a') && (a <= 'v'))
+    return (a - 'a' + 10);
   return -1;
 }
 
@@ -853,10 +857,10 @@ GNUNET_STRINGS_data_to_string (const void *data, size_t size, char *out, size_t
  * out_size must match exactly the size of the data before it was encoded.
  *
  * @param enc the encoding
- * @param enclen number of characters in 'enc' (without 0-terminator, which can be missing)
+ * @param enclen number of characters in @a enc (without 0-terminator, which can be missing)
  * @param out location where to store the decoded data
- * @param out_size size of the output buffer
- * @return GNUNET_OK on success, GNUNET_SYSERR if result has the wrong encoding
+ * @param out_size size of the output buffer @a out
+ * @return #GNUNET_OK on success, #GNUNET_SYSERR if result has the wrong encoding
  */
 int
 GNUNET_STRINGS_string_to_data (const char *enc, size_t enclen,