More Windows Updates

This commit is contained in:
Bob Perper 2018-03-30 14:05:18 -04:00
parent b93f59bea2
commit ab5c8df273
11 changed files with 24 additions and 39 deletions

View file

@ -121,7 +121,7 @@ add_executable(http_client
test/prog.c
test/test_common.c
)
target_link_libraries(http_client lsquic event pthread libssl.a libcrypto.a ${FIULIB} z m)
#target_link_libraries(http_client lsquic event pthread libssl.a libcrypto.a ${FIULIB} z m)
#MSVC
ELSE()

View file

@ -8,6 +8,9 @@
#include <stddef.h>
#include <stdint.h>
#ifdef WIN32
#include <vc_compat.h>
#endif
struct lsquic_hdec;
struct lsquic_mm;

View file

@ -65,10 +65,7 @@ lsquic_hdec_cleanup (struct lsquic_hdec *dec)
//https://tools.ietf.org/html/draft-ietf-httpbis-header-compression-12#section-5.1
#ifdef NDEBUG
static
#endif
int
int
lsquic_hdec_dec_int (const unsigned char **src, const unsigned char *src_end,
uint8_t prefix_bits, uint32_t *value)
{
@ -247,10 +244,7 @@ hdec_get_table_entry (struct lsquic_hdec *dec, uint32_t index)
}
#ifdef NDEBUG
static
#endif
int
int
lsquic_hdec_push_entry (struct lsquic_hdec *dec, const char *name,
uint16_t name_len, const char *val, uint16_t val_len)
{

View file

@ -45,7 +45,6 @@ lsquic_hdec_set_max_capacity (struct lsquic_hdec *, unsigned);
size_t
lsquic_hdec_mem_used (const struct lsquic_hdec *);
#ifndef NDEBUG
int
lsquic_hdec_dec_int (const unsigned char **src, const unsigned char *src_end,
uint8_t prefix_bits, uint32_t *value);
@ -54,6 +53,5 @@ int
lsquic_hdec_push_entry (struct lsquic_hdec *dec, const char *name,
hpack_strlen_t name_len, const char *val,
hpack_strlen_t val_len);
#endif
#endif

View file

@ -92,10 +92,7 @@ lsquic_henc_cleanup (struct lsquic_henc *enc)
//not find return 0, otherwise return the index
#ifdef NDEBUG
static
#endif
unsigned
unsigned
lsquic_henc_get_stx_tab_id (const char *name, hpack_strlen_t name_len,
const char *val, hpack_strlen_t val_len, int *val_matched)
{
@ -559,10 +556,7 @@ henc_huffman_enc (const unsigned char *src, const unsigned char *const src_end,
}
#ifdef NDEBUG
static
#endif
int
int
lsquic_henc_enc_str (unsigned char *const dst, size_t dst_len,
const unsigned char *str, hpack_strlen_t str_len)
{
@ -708,10 +702,7 @@ henc_grow_tables (struct lsquic_henc *enc)
return 0;
}
#ifdef NDEBUG
static
#endif
int
int
lsquic_henc_push_entry (struct lsquic_henc *enc, const char *name,
hpack_strlen_t name_len, const char *value,
hpack_strlen_t value_len)
@ -829,13 +820,13 @@ lsquic_henc_set_max_capacity (struct lsquic_henc *enc, unsigned max_capacity)
}
#ifndef NDEBUG
void
lsquic_henc_iter_reset (struct lsquic_henc *enc)
{
enc->hpe_iter = STAILQ_FIRST(&enc->hpe_all_entries);
}
/* Returns 0 if entry is found */
int
lsquic_henc_iter_next (struct lsquic_henc *enc,
@ -856,7 +847,6 @@ lsquic_henc_iter_next (struct lsquic_henc *enc,
retval->entry_id = henc_calc_table_id(enc, entry);
return 0;
}
#endif
size_t

View file

@ -10,7 +10,6 @@
struct enc_table_entry;
#ifndef NDEBUG
struct enc_dyn_table_entry
{
const char *name, /* Not NUL-terminated */
@ -19,7 +18,6 @@ struct enc_dyn_table_entry
value_len;
unsigned entry_id;
};
#endif
STAILQ_HEAD(enc_head, enc_table_entry);
struct double_enc_head;
@ -44,10 +42,8 @@ struct lsquic_henc
struct enc_head hpe_all_entries;
struct double_enc_head
*hpe_buckets;
#ifndef NDEBUG
const struct enc_table_entry
*hpe_iter;
#endif
};
@ -83,7 +79,6 @@ lsquic_henc_set_max_capacity (struct lsquic_henc *, unsigned);
size_t
lsquic_henc_mem_used (const struct lsquic_henc *);
#ifndef NDEBUG
unsigned
lsquic_henc_get_stx_tab_id (const char *name, hpack_strlen_t name_len,
const char *val, hpack_strlen_t val_len, int *val_matched);
@ -102,6 +97,5 @@ lsquic_henc_iter_reset (struct lsquic_henc *enc);
/* Returns 0 if entry is found */
int
lsquic_henc_iter_next (struct lsquic_henc *enc, struct enc_dyn_table_entry *);
#endif
#endif

View file

@ -122,10 +122,11 @@ lsquic_printf (const char *fmt, ...)
#ifdef WIN32
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
struct timezone
{
int tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */
time_t tz_minuteswest; /* minutes W of Greenwich */
time_t tz_dsttime; /* type of dst correction */
};
static int
@ -174,7 +175,14 @@ print_timestamp (void)
struct tm tm;
struct timeval tv;
gettimeofday(&tv, NULL);
#ifdef WIN32
{
time_t t = tv.tv_sec;
localtime_s(&tm, &t); // Could be a macro, but then a type mismatch.
}
#else
localtime_r(&tv.tv_sec, &tm);
#endif
if (g_llts == LLTS_YYYYMMDD_HHMMSSUS)
lsquic_printf("%04d-%02d-%02d %02d:%02d:%02d.%06d ",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday,

View file

@ -143,7 +143,6 @@ struct parse_funcs
uint16_t *reason_length, const char **reason);
int
(*pf_gen_ping_frame) (unsigned char *buf, int buf_len);
#ifndef NDEBUG
/* These float reading and writing functions assume `mem' has at least
* 2 bytes.
*/
@ -151,7 +150,6 @@ struct parse_funcs
(*pf_write_float_time16) (lsquic_time_t time_us, void *mem);
uint64_t
(*pf_read_float_time16) (const void *mem);
#endif
size_t
(*pf_calc_stream_frame_header_sz) (uint32_t stream_id, uint64_t offset);
void

View file

@ -96,7 +96,7 @@ lsquic_rechist_stop_wait (lsquic_rechist_t *rechist, lsquic_packno_t cutoff)
{
if (pi->range.high < cutoff)
{
rechist->rh_n_packets -= pi->range.high - pi->range.low + 1;
rechist->rh_n_packets -= (unsigned)(pi->range.high - pi->range.low + 1);
TAILQ_REMOVE(&rechist->rh_pints.pk_intervals, pi, next_pi);
free(pi);
}

View file

@ -3,11 +3,11 @@ include_directories( BEFORE ../../ssl/include )
include_directories( ../../include )
include_directories( ../../src/liblsquic )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-value")
enable_testing()
IF (NOT (CMAKE_C_COMPILER MATCHES "MSVC"))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-value")
add_executable(test_rechist test_rechist.c)
target_link_libraries(test_rechist lsquic pthread libssl.a libcrypto.a z m ${FIULIB})

View file

@ -83,7 +83,7 @@ lsquic_stream_acked (lsquic_stream_t *stream)
static void
elide_single_stream_frame (void)
{
struct packet_out_srec_iter posi;
struct packet_out_srec_iter posi = { 0 };
struct lsquic_engine_public enpub;
lsquic_stream_t streams[1];
lsquic_packet_out_t *packet_out;