diff --git a/build.sh b/build.sh index 885df51..44eb844 100644 --- a/build.sh +++ b/build.sh @@ -195,6 +195,7 @@ readonly TCP2_DIR="${BASE_DIR}/ngtcp2-${MY_CPU}" rm -rf "${TCP2_DIR}" && mkdir "${TCP2_DIR}" tar -xvf "${LIBS_DIR}/.pkg/ngtcp2.tar.gz" --strip-components=1 -C "${TCP2_DIR}" pushd "${TCP2_DIR}" +patch -p1 -b < "${BASE_DIR}/patch/ngtcp2_htons.diff" CFLAGS="-march=${MY_MARCH} -mtune=${MY_MTUNE} -DNDEBUG -D_WIN32_WINNT=0x0501 -I${LIBS_DIR}/include" LDFLAGS="-L${LIBS_DIR}/lib" OPENSSL_CFLAGS="-I${LIBS_DIR}/include" OPENSSL_LIBS="-L${LIBS_DIR}/lib -lssl -lcrypto -lws2_32 -lz" ZLIB_CFLAGS="-I${LIBS_DIR}/include" ZLIB_LIBS="-L${LIBS_DIR}/lib -lz" ./configure --prefix="${LIBS_DIR}" --enable-lib-only --with-openssl --disable-shared make && make install popd diff --git a/patch/ngtcp2_htons.diff b/patch/ngtcp2_htons.diff new file mode 100644 index 0000000..63e5c30 --- /dev/null +++ b/patch/ngtcp2_htons.diff @@ -0,0 +1,25 @@ +From 20995d0137b72fbbdb57f53bb8c272b2c5b61280 Mon Sep 17 00:00:00 2001 +From: Dmitry Karpov +Date: Tue, 28 Jun 2022 18:02:36 -0700 +Subject: [PATCH] Fixed error in ngtcp2_htons. + +--- + lib/ngtcp2_net.h | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/lib/ngtcp2_net.h b/lib/ngtcp2_net.h +index f8d8e518..b1f28096 100644 +--- a/lib/ngtcp2_net.h ++++ b/lib/ngtcp2_net.h +@@ -101,7 +101,7 @@ STIN uint32_t ngtcp2_htonl(uint32_t hostlong) { + STIN uint16_t ngtcp2_htons(uint16_t hostshort) { + uint16_t res; + unsigned char *p = (unsigned char *)&res; +- *p++ = (unsigned char)hostshort >> 8; ++ *p++ = (unsigned char)(hostshort >> 8); + *p = hostshort & 0xffu; + return res; + } +-- +2.35.1.windows.2 +