aboutsummaryrefslogtreecommitdiff
path: root/src/util/strings.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/util/strings.c')
-rw-r--r--src/util/strings.c46
1 files changed, 23 insertions, 23 deletions
diff --git a/src/util/strings.c b/src/util/strings.c
index 3d061fb57..d0e8fddc7 100644
--- a/src/util/strings.c
+++ b/src/util/strings.c
@@ -381,8 +381,8 @@ GNUNET_STRINGS_fancy_time_to_absolute (const char *fancy_time,
381 */ 381 */
382char * 382char *
383GNUNET_STRINGS_conv (const char *input, 383GNUNET_STRINGS_conv (const char *input,
384 size_t len, 384 size_t len,
385 const char *input_charset, 385 const char *input_charset,
386 const char *output_charset) 386 const char *output_charset)
387{ 387{
388 char *ret; 388 char *ret;
@@ -391,10 +391,10 @@ GNUNET_STRINGS_conv (const char *input,
391 size_t u8_string_length; 391 size_t u8_string_length;
392 size_t encoded_string_length; 392 size_t encoded_string_length;
393 393
394 u8_string = u8_conv_from_encoding (input_charset, 394 u8_string = u8_conv_from_encoding (input_charset,
395 iconveh_error, 395 iconveh_error,
396 input, len, 396 input, len,
397 NULL, NULL, 397 NULL, NULL,
398 &u8_string_length); 398 &u8_string_length);
399 if (NULL == u8_string) 399 if (NULL == u8_string)
400 { 400 {
@@ -409,9 +409,9 @@ GNUNET_STRINGS_conv (const char *input,
409 free (u8_string); 409 free (u8_string);
410 return ret; 410 return ret;
411 } 411 }
412 encoded_string = u8_conv_to_encoding (output_charset, iconveh_error, 412 encoded_string = u8_conv_to_encoding (output_charset, iconveh_error,
413 u8_string, u8_string_length, 413 u8_string, u8_string_length,
414 NULL, NULL, 414 NULL, NULL,
415 &encoded_string_length); 415 &encoded_string_length);
416 free (u8_string); 416 free (u8_string);
417 if (NULL == encoded_string) 417 if (NULL == encoded_string)
@@ -644,14 +644,14 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta,
644 return _("forever"); 644 return _("forever");
645 if (0 == delta.rel_value_us) 645 if (0 == delta.rel_value_us)
646 return _("0 ms"); 646 return _("0 ms");
647 if ( ( (GNUNET_YES == do_round) && 647 if ( ( (GNUNET_YES == do_round) &&
648 (dval > 5 * 1000) ) || 648 (dval > 5 * 1000) ) ||
649 (0 == (dval % 1000) )) 649 (0 == (dval % 1000) ))
650 { 650 {
651 dval = dval / 1000; 651 dval = dval / 1000;
652 unit = _( /* time unit */ "ms"); 652 unit = _( /* time unit */ "ms");
653 if ( ( (GNUNET_YES == do_round) && 653 if ( ( (GNUNET_YES == do_round) &&
654 (dval > 5 * 1000) ) || 654 (dval > 5 * 1000) ) ||
655 (0 == (dval % 1000) )) 655 (0 == (dval % 1000) ))
656 { 656 {
657 dval = dval / 1000; 657 dval = dval / 1000;
@@ -663,7 +663,7 @@ GNUNET_STRINGS_relative_time_to_string (struct GNUNET_TIME_Relative delta,
663 dval = dval / 60; 663 dval = dval / 60;
664 unit = _( /* time unit */ "m"); 664 unit = _( /* time unit */ "m");
665 if ( ( (GNUNET_YES == do_round) && 665 if ( ( (GNUNET_YES == do_round) &&
666 (dval > 5 * 60) ) || 666 (dval > 5 * 60) ) ||
667 (0 == (dval % 60) )) 667 (0 == (dval % 60) ))
668 { 668 {
669 dval = dval / 60; 669 dval = dval / 60;
@@ -756,7 +756,7 @@ getValue__ (unsigned char a)
756 * Convert binary data to ASCII encoding. The ASCII encoding is rather 756 * Convert binary data to ASCII encoding. The ASCII encoding is rather
757 * GNUnet specific. It was chosen such that it only uses characters 757 * GNUnet specific. It was chosen such that it only uses characters
758 * in [0-9A-V], can be produced without complex arithmetics and uses a 758 * in [0-9A-V], can be produced without complex arithmetics and uses a
759 * small number of characters. 759 * small number of characters.
760 * Does not append 0-terminator, but returns a pointer to the place where 760 * Does not append 0-terminator, but returns a pointer to the place where
761 * it should be placed, if needed. 761 * it should be placed, if needed.
762 * 762 *
@@ -771,7 +771,7 @@ char *
771GNUNET_STRINGS_data_to_string (const void *data, size_t size, char *out, size_t out_size) 771GNUNET_STRINGS_data_to_string (const void *data, size_t size, char *out, size_t out_size)
772{ 772{
773 /** 773 /**
774 * 32 characters for encoding 774 * 32 characters for encoding
775 */ 775 */
776 static char *encTable__ = "0123456789ABCDEFGHIJKLMNOPQRSTUV"; 776 static char *encTable__ = "0123456789ABCDEFGHIJKLMNOPQRSTUV";
777 unsigned int wpos; 777 unsigned int wpos;
@@ -1040,7 +1040,7 @@ GNUNET_STRINGS_path_is_absolute (const char *filename, int can_be_uri,
1040 1040
1041/** 1041/**
1042 * Perform 'checks' on 'filename' 1042 * Perform 'checks' on 'filename'
1043 * 1043 *
1044 * @param filename file to check 1044 * @param filename file to check
1045 * @param checks checks to perform 1045 * @param checks checks to perform
1046 * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them 1046 * @return GNUNET_YES if all checks pass, GNUNET_NO if at least one of them
@@ -1081,7 +1081,7 @@ GNUNET_STRINGS_check_filename (const char *filename,
1081/** 1081/**
1082 * Tries to convert 'zt_addr' string to an IPv6 address. 1082 * Tries to convert 'zt_addr' string to an IPv6 address.
1083 * The string is expected to have the format "[ABCD::01]:80". 1083 * The string is expected to have the format "[ABCD::01]:80".
1084 * 1084 *
1085 * @param zt_addr 0-terminated string. May be mangled by the function. 1085 * @param zt_addr 0-terminated string. May be mangled by the function.
1086 * @param addrlen length of zt_addr (not counting 0-terminator). 1086 * @param addrlen length of zt_addr (not counting 0-terminator).
1087 * @param r_buf a buffer to fill. Initially gets filled with zeroes, 1087 * @param r_buf a buffer to fill. Initially gets filled with zeroes,
@@ -1090,7 +1090,7 @@ GNUNET_STRINGS_check_filename (const char *filename,
1090 * case the contents of r_buf are undefined. 1090 * case the contents of r_buf are undefined.
1091 */ 1091 */
1092int 1092int
1093GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr, 1093GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
1094 uint16_t addrlen, 1094 uint16_t addrlen,
1095 struct sockaddr_in6 *r_buf) 1095 struct sockaddr_in6 *r_buf)
1096{ 1096{
@@ -1100,7 +1100,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
1100 unsigned int port; 1100 unsigned int port;
1101 1101
1102 if (addrlen < 6) 1102 if (addrlen < 6)
1103 return GNUNET_SYSERR; 1103 return GNUNET_SYSERR;
1104 memcpy (zbuf, zt_addr, addrlen); 1104 memcpy (zbuf, zt_addr, addrlen);
1105 if ('[' != zbuf[0]) 1105 if ('[' != zbuf[0])
1106 { 1106 {
@@ -1152,7 +1152,7 @@ GNUNET_STRINGS_to_address_ipv6 (const char *zt_addr,
1152/** 1152/**
1153 * Tries to convert 'zt_addr' string to an IPv4 address. 1153 * Tries to convert 'zt_addr' string to an IPv4 address.
1154 * The string is expected to have the format "1.2.3.4:80". 1154 * The string is expected to have the format "1.2.3.4:80".
1155 * 1155 *
1156 * @param zt_addr 0-terminated string. May be mangled by the function. 1156 * @param zt_addr 0-terminated string. May be mangled by the function.
1157 * @param addrlen length of zt_addr (not counting 0-terminator). 1157 * @param addrlen length of zt_addr (not counting 0-terminator).
1158 * @param r_buf a buffer to fill. 1158 * @param r_buf a buffer to fill.
@@ -1191,7 +1191,7 @@ GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, uint16_t addrlen,
1191/** 1191/**
1192 * Tries to convert 'addr' string to an IP (v4 or v6) address. 1192 * Tries to convert 'addr' string to an IP (v4 or v6) address.
1193 * Will automatically decide whether to treat 'addr' as v4 or v6 address. 1193 * Will automatically decide whether to treat 'addr' as v4 or v6 address.
1194 * 1194 *
1195 * @param addr a string, may not be 0-terminated. 1195 * @param addr a string, may not be 0-terminated.
1196 * @param addrlen number of bytes in addr (if addr is 0-terminated, 1196 * @param addrlen number of bytes in addr (if addr is 0-terminated,
1197 * 0-terminator should not be counted towards addrlen). 1197 * 0-terminator should not be counted towards addrlen).
@@ -1200,7 +1200,7 @@ GNUNET_STRINGS_to_address_ipv4 (const char *zt_addr, uint16_t addrlen,
1200 * case the contents of r_buf are undefined. 1200 * case the contents of r_buf are undefined.
1201 */ 1201 */
1202int 1202int
1203GNUNET_STRINGS_to_address_ip (const char *addr, 1203GNUNET_STRINGS_to_address_ip (const char *addr,
1204 uint16_t addrlen, 1204 uint16_t addrlen,
1205 struct sockaddr_storage *r_buf) 1205 struct sockaddr_storage *r_buf)
1206{ 1206{