Resuscitate Windows build (#61)

This commit is contained in:
Dmitri Tikhonov 2019-01-30 15:28:35 -05:00 committed by LiteSpeed Tech
parent 12693a011b
commit 2d296031db
16 changed files with 148 additions and 478 deletions

View file

@ -13,6 +13,7 @@
#define bswap_32 OSSwapInt32
#define bswap_64 OSSwapInt64
#elif defined(WIN32)
#include <stdlib.h>
#define bswap_16 _byteswap_ushort
#define bswap_32 _byteswap_ulong
#define bswap_64 _byteswap_uint64

View file

@ -286,7 +286,7 @@ block_write (struct data_block *block, unsigned block_off,
set = block_off >> 6;
bit = block_off & 0x3F;
assert(set <= N_DB_SETS);
assert(set < N_DB_SETS);
if (bit)
{

View file

@ -2486,6 +2486,7 @@ static void
create_delayed_streams (struct full_conn *conn)
{
unsigned stream_count, avail, i;
struct lsquic_stream **new_streams;
stream_count = count_streams(conn, 0);
@ -2496,7 +2497,7 @@ create_delayed_streams (struct full_conn *conn)
if (conn->fc_n_delayed_streams < avail)
avail = conn->fc_n_delayed_streams;
struct lsquic_stream *new_streams[ avail ];
new_streams = malloc(sizeof(new_streams[0]) * avail);
LSQ_DEBUG("creating delayed streams");
for (i = 0; i < avail; ++i)
@ -2509,7 +2510,7 @@ create_delayed_streams (struct full_conn *conn)
{
ABORT_ERROR("%s: cannot create new stream: %s", __func__,
strerror(errno));
return;
goto cleanup;
}
}
LSQ_DEBUG("created %u delayed stream%.*s", avail, avail != 1, "s");
@ -2519,6 +2520,8 @@ create_delayed_streams (struct full_conn *conn)
for (i = 0; i < avail; ++i)
lsquic_stream_call_on_new(new_streams[i]);
cleanup:
free(new_streams);
}

View file

@ -92,7 +92,7 @@ hwc_uh_write (struct header_writer_ctx *hwc, const void *buf, size_t sz)
else
hwc->headers_sz = hwc->w_off + sz;
h1h_buf = realloc(hwc->hwc_h1h.h1h_buf, hwc->headers_sz);
if (!buf)
if (!h1h_buf)
return -1;
hwc->hwc_h1h.h1h_buf = h1h_buf;
}

View file

@ -50,6 +50,7 @@
#include <sys/queue.h>
#ifdef WIN32
#include <vc_compat.h>
#include <intrin.h>
#endif
#include "fiu-local.h"
@ -262,7 +263,14 @@ size_in_bits (size_t sz)
#if __GNUC__
unsigned clz = __builtin_clz(sz - 1);
return 32 - clz;
#elif defined(WIN32)
unsigned char s;
unsigned long idx;
s = _BitScanReverse(&idx, sz);
assert(s);
return (unsigned) idx + 1;
#else
#error This function contains a bug!
unsigned clz;
size_t y;

View file

@ -131,7 +131,7 @@ find_and_set_lowest_priority (struct stream_prio_iter *iter)
#endif
SPI_DEBUG("%s: prio %u -> %u", __func__, iter->spi_cur_prio, prio);
iter->spi_cur_prio = prio;
iter->spi_cur_prio = (unsigned char) prio;
return 0;
}
@ -184,7 +184,7 @@ find_and_set_next_priority (struct stream_prio_iter *iter)
#endif
SPI_DEBUG("%s: prio %u -> %u", __func__, iter->spi_cur_prio, prio);
iter->spi_cur_prio = prio;
iter->spi_cur_prio = (unsigned char) prio;
return 0;
}

View file

@ -31,7 +31,11 @@ extern "C" {
#endif
#include <stdint.h>
#ifndef WIN32
#include <sys/uio.h>
#else
#include "vc_compat.h"
#endif
/**
* Strings up to 65535 characters in length are supported.