From c9854dd02cf1531034840277a617daac1f5d57fa Mon Sep 17 00:00:00 2001 From: hyung-hwan Date: Thu, 9 Jan 2020 02:50:45 +0000 Subject: [PATCH] fixed wrong initialization in utl-skad.c --- hawk/configure | 42 ++++++++++++++++++++++++++++++++++++++++++ hawk/configure.ac | 14 +++++++++++++- hawk/lib/utl-skad.c | 2 +- 3 files changed, 56 insertions(+), 2 deletions(-) diff --git a/hawk/configure b/hawk/configure index edda955f..af6cd114 100755 --- a/hawk/configure +++ b/hawk/configure @@ -17323,6 +17323,36 @@ fi + + { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the compiler supports -fno-short-wchar" >&5 +$as_echo_n "checking whether the compiler supports -fno-short-wchar... " >&6; } +if ${ac_cv_cflags__fno_short_wchar+:} false; then : + $as_echo_n "(cached) " >&6 +else + + ac_hawk_try_cflags_saved=$CFLAGS + CFLAGS="$CFLAGS -fno-short-wchar" + cat confdefs.h - <<_ACEOF >conftest.$ac_ext +/* end confdefs.h. */ +int main(int argc, char **argv) { return 0; } +_ACEOF +if ac_fn_c_try_link "$LINENO"; then : + ac_cv_cflags__fno_short_wchar=yes +else + ac_cv_cflags__fno_short_wchar=no +fi +rm -f core conftest.err conftest.$ac_objext \ + conftest$ac_exeext conftest.$ac_ext + CFLAGS=$ac_hawk_try_cflags_saved +fi +{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cflags__fno_short_wchar" >&5 +$as_echo "$ac_cv_cflags__fno_short_wchar" >&6; } + if test $ac_cv_cflags__fno_short_wchar = yes; then : + EXTRACFLAGS="$EXTRACFLAGS -fno-short-wchar" +fi + + + # Check whether --enable-largefile was given. if test "${enable_largefile+set}" = set; then : enableval=$enable_largefile; @@ -18354,6 +18384,12 @@ $as_echo "#define HAWK_ENABLE_UNICODE 1" >>confdefs.h CFLAGS="$CFLAGS -DUNICODE -D_UNICODE" CXXFLAGS="$CXXFLAGS -DUNICODE -D_UNICODE" fi + + if test "${ac_cv_cflags__fno_short_wchar}" = "yes" + then + CFLAGS="$CFLAGS -fno-short-wchar" + CXXFLAGS="$CXXFLAGS -fno-short-wchar" + fi elif test "${enable_unicode}" = "yes:2" -o "${enable_unicode}" = "yes" then @@ -18377,6 +18413,12 @@ then $as_echo "#define HAWK_UNICODE_SIZE 4" >>confdefs.h + + if test "${ac_cv_cflags__fno_short_wchar}" = "yes" + then + CFLAGS="$CFLAGS -fno-short-wchar" + CXXFLAGS="$CXXFLAGS -fno-short-wchar" + fi else $as_echo "#define HAWK_UNICODE_SIZE 2" >>confdefs.h diff --git a/hawk/configure.ac b/hawk/configure.ac index 973ec287..79d78139 100644 --- a/hawk/configure.ac +++ b/hawk/configure.ac @@ -61,7 +61,7 @@ CFLAGS="$CFLAGS -DHAWK_HAVE_CFG_H" CXXFLAGS="$CXXFLAGS -DHAWK_HAVE_CFG_H" HAWK_TRY_CFLAGS([-fshort-wchar]) -dnl HAWK_TRY_CFLAGS([-fno-short-wchar]) +HAWK_TRY_CFLAGS([-fno-short-wchar]) dnl make visible the 64-bit interface to the file system AC_SYS_LARGEFILE() @@ -108,6 +108,12 @@ then [CFLAGS="$CFLAGS -DUNICODE -D_UNICODE"] [CXXFLAGS="$CXXFLAGS -DUNICODE -D_UNICODE"] fi + + if test "${ac_cv_cflags__fno_short_wchar}" = "yes" + then + [CFLAGS="$CFLAGS -fno-short-wchar"] + [CXXFLAGS="$CXXFLAGS -fno-short-wchar"] + fi elif test "${enable_unicode}" = "yes:2" -o "${enable_unicode}" = "yes" then AC_DEFINE([HAWK_UNICODE_SIZE],[2],[Unicode character type size]) @@ -125,6 +131,12 @@ then elif test "${enable_unicode}" = "no:4" then AC_DEFINE([HAWK_UNICODE_SIZE],[4],[Unicode character type size]) + + if test "${ac_cv_cflags__fno_short_wchar}" = "yes" + then + [CFLAGS="$CFLAGS -fno-short-wchar"] + [CXXFLAGS="$CXXFLAGS -fno-short-wchar"] + fi else dnl no:2, no, or anything else AC_DEFINE([HAWK_UNICODE_SIZE],[2],[Unicode character type size]) diff --git a/hawk/lib/utl-skad.c b/hawk/lib/utl-skad.c index a3b4b735..05bdef92 100644 --- a/hawk/lib/utl-skad.c +++ b/hawk/lib/utl-skad.c @@ -63,6 +63,6 @@ void hawk_clear_skad (hawk_skad_t* _skad) { hawk_skad_alt_t* skad = (hawk_skad_alt_t*)_skad; HAWK_ASSERT (HAWK_SIZEOF(*_skad) >= HAWK_SIZEOF(*skad)); - HAWK_MEMSET (skad, 0, HAWK_SIZEOF(skad)); + HAWK_MEMSET (skad, 0, HAWK_SIZEOF(*skad)); skad->sa.sa_family = HAWK_AF_UNSPEC; }