diff options
author | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-05 10:08:15 +0900 |
---|---|---|
committer | DongHun Kwak <dh0128.kwak@samsung.com> | 2021-03-05 10:08:15 +0900 |
commit | 24d4e855d95e02a5324c2f3d88cfd5cd19830c2c (patch) | |
tree | 371d954e80394a8e72ef95d6ee7d45312c3f87a9 /src/utils.c | |
parent | 0b86d50828d05a27de3ff840d6a06407310393c2 (diff) | |
download | wget-24d4e855d95e02a5324c2f3d88cfd5cd19830c2c.tar.gz wget-24d4e855d95e02a5324c2f3d88cfd5cd19830c2c.tar.bz2 wget-24d4e855d95e02a5324c2f3d88cfd5cd19830c2c.zip |
Imported Upstream version 1.17upstream/1.17
Diffstat (limited to 'src/utils.c')
-rw-r--r-- | src/utils.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/src/utils.c b/src/utils.c index 3cc7d97..5222851 100644 --- a/src/utils.c +++ b/src/utils.c @@ -1,7 +1,7 @@ /* Various utility functions. Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, - 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation, - Inc. + 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2015 Free Software + Foundation, Inc. This file is part of GNU Wget. @@ -336,7 +336,7 @@ aprintf (const char *fmt, ...) { /* maybe we have some wrong format string? */ logprintf (LOG_ALWAYS, - _("%s: aprintf: text buffer is too big (%ld bytes), " + _("%s: aprintf: text buffer is too big (%d bytes), " "aborting.\n"), exec_name, size); /* printout a log message */ abort (); /* and abort... */ @@ -1284,7 +1284,10 @@ free_vec (char **vec) { char **p = vec; while (*p) - xfree (*p++); + { + xfree (*p); + p++; + } xfree (vec); } } @@ -2503,6 +2506,21 @@ get_max_length (const char *path, int length, int name) return ret; } +void +wg_hex_to_string (char *str_buffer, const char *hex_buffer, size_t hex_len) +{ + size_t i; + + for (i = 0; i < hex_len; i++) + { + /* Each byte takes 2 characters. */ + sprintf (str_buffer + 2 * i, "%02x", hex_buffer[i] & 0xFF); + } + + /* Null-terminate result. */ + str_buffer[2 * i] = '\0'; +} + #ifdef TESTING const char * |