1
0
mirror of https://github.com/moparisthebest/spdylay synced 2024-12-21 23:28:52 -05:00

Fix error with w64-mingw32 cross compiler. Add --enable-example option.

This commit is contained in:
Tatsuhiro Tsujikawa 2012-08-24 02:15:57 +09:00
parent a6817ff5e2
commit d8c4b19351
4 changed files with 31 additions and 5 deletions

View File

@ -45,6 +45,11 @@ AC_ARG_ENABLE([maintainer-mode],
[Turn on compile time warnings])],
[maintainer_mode=$withval], [maintainer_mode=no])
AC_ARG_ENABLE([examples],
[AS_HELP_STRING([--enable-examples],
[Build example programs])],
[request_examples=$withval], [request_examples=yes])
dnl Checks for programs
AC_PROG_CC
AC_PROG_CXX
@ -124,7 +129,12 @@ fi
AM_CONDITIONAL([HAVE_LIBXML2], [ test "x${have_libxml2}" = "xyes" ])
# The example programs depend on OpenSSL
enable_examples=$have_openssl
enable_examples=no
if test "x${request_examples}" = "xyes" &&
test "x${have_openssl}" = "xyes"; then
enable_examples=yes
fi
AM_CONDITIONAL([ENABLE_EXAMPLES], [ test "x${enable_examples}" = "xyes" ])
# Checks for header files.
@ -140,6 +150,9 @@ AC_CHECK_HEADERS([ \
unistd.h \
])
# For ntohl, ntohs in Windows
AC_CHECK_HEADERS([winsock2.h])
# Checks for typedefs, structures, and compiler characteristics.
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
@ -188,6 +201,13 @@ if test "x$kevent_udata_intptr_t" = "xyes"; then
fi
AC_LANG_POP()
dnl Windows library for winsock2
case "${host}" in
*mingw*)
LIBS="$LIBS -lws2_32"
;;
esac
if test "x$maintainer_mode" != "xno"; then
CFLAGS="$CFLAGS -Wall -Wextra -Werror"
CFLAGS="$CFLAGS -Wmissing-prototypes -Wstrict-prototypes"

View File

@ -80,5 +80,7 @@ int spdylay_gzip_inflate(spdylay_gzip *inflater,
return SPDYLAY_ERR_GZIP;
default:
assert(0);
/* We need this for some compilers */
return 0;
}
}

View File

@ -37,4 +37,8 @@
# include <netinet/in.h>
#endif /* HAVE_NETINET_IN_H */
#ifdef HAVE_WINSOCK2_H
# include <winsock2.h>
#endif /* HAVE_WINSOCK2_H */
#endif /* SPDYLAY_NET_H */

View File

@ -2784,16 +2784,16 @@ ssize_t spdylay_session_pack_data(spdylay_session *session,
spdylay_data *frame)
{
ssize_t framelen = datamax+8, r;
int eof;
int eof_flags;
uint8_t flags;
r = spdylay_reserve_buffer(buf_ptr, buflen_ptr, framelen);
if(r != 0) {
return r;
}
eof = 0;
eof_flags = 0;
r = frame->data_prd.read_callback
(session, frame->stream_id, (*buf_ptr)+8, datamax,
&eof, &frame->data_prd.source, session->user_data);
&eof_flags, &frame->data_prd.source, session->user_data);
if(r == SPDYLAY_ERR_DEFERRED || r == SPDYLAY_ERR_TEMPORAL_CALLBACK_FAILURE) {
return r;
} else if(r < 0 || datamax < (size_t)r) {
@ -2804,7 +2804,7 @@ ssize_t spdylay_session_pack_data(spdylay_session *session,
spdylay_put_uint32be(&(*buf_ptr)[0], frame->stream_id);
spdylay_put_uint32be(&(*buf_ptr)[4], r);
flags = 0;
if(eof) {
if(eof_flags) {
frame->eof = 1;
if(frame->flags & SPDYLAY_DATA_FLAG_FIN) {
flags |= SPDYLAY_DATA_FLAG_FIN;