#endif
#include "gnunet_common.h"
#include "gnunet_strings_lib.h"
+#include <unicase.h>
#define LOG(kind,...) GNUNET_log_from (kind, "util", __VA_ARGS__)
return GNUNET_STRINGS_conv (input, len, "UTF-8", charset);
}
+/**
+ * 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)
+{
+ 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';
+ free(tmp_in);
+}
+
+/**
+ * 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)
+{
+ 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);
+}
/**
ret = inet_pton (AF_INET6, zt_addr, &r_buf->sin6_addr);
if (ret <= 0)
return GNUNET_SYSERR;
- r_buf->sin6_port = htonl (port);
+ r_buf->sin6_port = htons (port);
r_buf->sin6_family = AF_INET6;
return GNUNET_OK;
}
if (port > 65535)
return GNUNET_SYSERR;
+
+
r_buf->sin_family = AF_INET;
- r_buf->sin_port = htonl (port);
+ r_buf->sin_port = htons (port);
r_buf->sin_addr.s_addr = htonl ((temps[0] << 24) + (temps[1] << 16) +
(temps[2] << 8) + temps[3]);
return GNUNET_OK;