Commit Graph

25 Commits

Author SHA1 Message Date
6246345ef7 Remove nonnull attribute from some functions
* include/wget/wget.h: Remove nonnull attribute from some functions
* libwget/encoding.c: Add explicit checks for NULL
* libwget/io.c: Likewise
* libwget/pipe.c: Likewise
* libwget/strlcpy.c: Likewise
* libwget/utils.c: Likewise
2017-05-15 10:28:03 +02:00
c6ee3d79ad Fix syntax-check 'sc_prohibit_have_config_h'
* cfg.mk: Remove sc_prohibit_have_config_h from local-checks-to-skip
* libwget/*.c: Include <config.h> unconditionally
* src/*.c: Likewise
* tests/*.c: Likewise
2017-04-30 22:01:34 +02:00
59f163cd7b Remove useless cpp parens (syntax-check) 2017-04-29 20:56:57 +02:00
58f1274808 Do not include unused strings.h
* examples/getstream.c: Remove #include <strings.h>
* libwget/css.c: Likewise
* libwget/encoding.c: Likewise
* libwget/hashfile.c: Likewise
* libwget/metalink.c: Likewise
* libwget/net.c: Likewise
* libwget/robots.c: Likewise
* src/wget.c: Likewise
2017-04-29 20:24:19 +02:00
bf432c29ee * libwget/encoding.c (wget_str_to_ascii): Fall back to TR46 transitional on error 2017-04-25 12:36:17 +02:00
6bb3ff5ee1 * libwget/encoding.c (wget_memiconv): Treat non-reversible conversion as error 2017-04-16 19:44:03 +02:00
7d2eb91b1c Skip IDNA tests when IDNA not available
* libwget/encoding.c: Fix #ifdef
* tests/test-idn-cmd.c: Skip if IDNA not available
* tests/test-idn-meta.c: Likewise
* tests/test-idn-robots.c: Likewise
* tests/test.c (test_iri_parse): Skip IDN test
2017-03-27 21:51:42 +02:00
1d52ade444 * libwget/encoding.c: Include idn-free.h on _WIN32 2017-03-23 16:44:47 +01:00
3005824e71 Fix misuse of libidn & libidn2 memory
* libwget/encoding.c (wget_str_to_ascii):
  Free libidn memory with idn_free(),
  Free libidn2 memory with idn2_free()
2017-03-23 14:33:11 +01:00
8610300d78 Use IDNA2008 + TR46 non-transitional for IRIs
* libwget/encoding.c: Fix unistring includes,
  (wget_str_to_ascii): Check for libidn2 version
* src/options.c (init): Remove "unistring" output for --version
2017-03-20 09:59:37 +01:00
ec396c577f Fix URLs to HTTPS where possible 2017-02-28 15:31:30 +01:00
8b1a701c21 Use wget_strdup() instead of strdup()
* examples/getstream.c: Use wget_strdup().
* libwget/cookie.c: Likewise.
* libwget/encoding.c: Likewise.
* libwget/http.c: Likewise.
* libwget/iri.c: Likewise.
* libwget/netrc.c: Likewise.
* src/options.c: Likewise.
* src/wget.c: Likewise.
* tests/test.c: Likewise.
2016-11-03 09:58:09 +01:00
165cfa20fb Mark some functions as pure
* libwget/cookie.c (_compare_cookie{,2}): Mark as pure
* libwget/encoding.c (_utf8_is_valid): Same
* libwget/hsts.c (_compare_hsts): Same
* libwget/ocsp.c (_compare_ocsp): Same
* libwget/netrc.c (_compare_netrc): Same
* libwget/tls_session.c (_compare_tls_session): Same
2016-09-30 14:48:08 +02:00
9568b0c87e Rename include/libwget.h to include/wget/wget.h+wgetver.h 2016-09-30 09:47:32 +02:00
4597de60d2 * libwget/encoding.c (wget_memiconv): Fix memleak
Reported-by: Coverity
2016-09-14 12:54:38 +02:00
7d63e876ed * libwget/encoding.c: Use ICONV_CONST to avoid cc warning 2016-09-09 17:10:54 +02:00
483c304aef Support parsing of UTF-16 HTML documents
* examples/print_html_urls.c (html_parse_localfile):
  Detect BOM (Byte Order Mark), convert UTF-16 to UTF-8 before parsing.
* include/libwget.h.in: Remove wget_charset_transcode(),
  add wget_memiconv() and wget_striconv().
* libwget/encoding.c: Implement wget_memiconv() and wget_striconv()
* src/wget.c (html_parse): Add 'html_len' param,
  convert UTF-16 to UTF-8 before parsing.
* tests/test.c: New test for wget_memiconv().
2016-04-24 15:08:20 +02:00
857ea9de85 * libwget/encoding.c: Use '#ifdef WITH_LIBIDN' instead of '#if' 2016-02-06 21:40:09 +01:00
dd3c2f63b2 Updated copyright year for all relevant files 2016-01-25 13:06:21 +01:00
33697e17df Add gnulib module langinfo
* autogen.sh: Add gnulib module langinfo
* configure.ac: Remove searching for stringprep.h and langinfo.h
* libwget/encoding.c: Remove conditional code
2016-01-12 16:31:29 +01:00
14a3c0f806 Fix OpenSolaris libidn include directory
* configure.ac: Search for idn/idna.h
* libwget/encoding.c: Include idn/idna.h if found
2016-01-09 19:32:27 +01:00
e168584d02 Fix iconv conversion
* libwget/encoding.c: Kick out the last character from iconv().

Thanks to Eli Zaretskii <eliz@gnu.org> for suggesting the fix.
Reported-by: "Andries E. Brouwer" <Andries.Brouwer@cwi.nl>
2015-12-15 10:47:16 +01:00
18bdc20576 Replaced strndup() by wget_strmemdup()
* examples/getstream.c, examples/print_css_urls2.c, libwget/cookie.c,
  libwget/css_url.c, libwget/encoding.c, libwget/hsts.c,
  libwget/html_url.c, libwget/http.c, libwget/metalink.c,
  libwget/ocsp.c, libwget/robots.c, libwget/ssl_gnutls.c,
  src/options.c, src/wget.c, tests/stringmap_perf.c,
  tests/test-wget-1.c

Strndup() calls an additional strlen() on the input string.
This is normally not needed, and thus just consumes CPU cycles.
All calls to strndup() could be replaced by wget_strmemdup, which
basically allocates len+1 memory, calls memcpy and terminates with
a 0 byte.
2015-11-10 10:55:30 +01:00
0f8e49128a Transfer copyright to Free Software Foundation, Inc. 2015-09-22 11:50:06 +02:00
c6b0e461a1 Transform Mget into Wget 2015-09-19 22:54:38 +02:00