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/prog.c
test/test_common.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 #MSVC
ELSE() ELSE()

View file

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

View file

@ -65,9 +65,6 @@ lsquic_hdec_cleanup (struct lsquic_hdec *dec)
//https://tools.ietf.org/html/draft-ietf-httpbis-header-compression-12#section-5.1 //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, lsquic_hdec_dec_int (const unsigned char **src, const unsigned char *src_end,
uint8_t prefix_bits, uint32_t *value) uint8_t prefix_bits, uint32_t *value)
@ -247,9 +244,6 @@ 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, lsquic_hdec_push_entry (struct lsquic_hdec *dec, const char *name,
uint16_t name_len, const char *val, uint16_t val_len) 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 size_t
lsquic_hdec_mem_used (const struct lsquic_hdec *); lsquic_hdec_mem_used (const struct lsquic_hdec *);
#ifndef NDEBUG
int int
lsquic_hdec_dec_int (const unsigned char **src, const unsigned char *src_end, lsquic_hdec_dec_int (const unsigned char **src, const unsigned char *src_end,
uint8_t prefix_bits, uint32_t *value); uint8_t prefix_bits, uint32_t *value);
@ -54,6 +53,5 @@ int
lsquic_hdec_push_entry (struct lsquic_hdec *dec, const char *name, lsquic_hdec_push_entry (struct lsquic_hdec *dec, const char *name,
hpack_strlen_t name_len, const char *val, hpack_strlen_t name_len, const char *val,
hpack_strlen_t val_len); hpack_strlen_t val_len);
#endif
#endif #endif

View file

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

View file

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

View file

@ -122,10 +122,11 @@ lsquic_printf (const char *fmt, ...)
#ifdef WIN32 #ifdef WIN32
#define DELTA_EPOCH_IN_MICROSECS 11644473600000000Ui64
struct timezone struct timezone
{ {
int tz_minuteswest; /* minutes W of Greenwich */ time_t tz_minuteswest; /* minutes W of Greenwich */
int tz_dsttime; /* type of dst correction */ time_t tz_dsttime; /* type of dst correction */
}; };
static int static int
@ -174,7 +175,14 @@ print_timestamp (void)
struct tm tm; struct tm tm;
struct timeval tv; struct timeval tv;
gettimeofday(&tv, NULL); 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); localtime_r(&tv.tv_sec, &tm);
#endif
if (g_llts == LLTS_YYYYMMDD_HHMMSSUS) if (g_llts == LLTS_YYYYMMDD_HHMMSSUS)
lsquic_printf("%04d-%02d-%02d %02d:%02d:%02d.%06d ", lsquic_printf("%04d-%02d-%02d %02d:%02d:%02d.%06d ",
tm.tm_year + 1900, tm.tm_mon + 1, tm.tm_mday, 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); uint16_t *reason_length, const char **reason);
int int
(*pf_gen_ping_frame) (unsigned char *buf, int buf_len); (*pf_gen_ping_frame) (unsigned char *buf, int buf_len);
#ifndef NDEBUG
/* These float reading and writing functions assume `mem' has at least /* These float reading and writing functions assume `mem' has at least
* 2 bytes. * 2 bytes.
*/ */
@ -151,7 +150,6 @@ struct parse_funcs
(*pf_write_float_time16) (lsquic_time_t time_us, void *mem); (*pf_write_float_time16) (lsquic_time_t time_us, void *mem);
uint64_t uint64_t
(*pf_read_float_time16) (const void *mem); (*pf_read_float_time16) (const void *mem);
#endif
size_t size_t
(*pf_calc_stream_frame_header_sz) (uint32_t stream_id, uint64_t offset); (*pf_calc_stream_frame_header_sz) (uint32_t stream_id, uint64_t offset);
void void

View file

@ -96,7 +96,7 @@ lsquic_rechist_stop_wait (lsquic_rechist_t *rechist, lsquic_packno_t cutoff)
{ {
if (pi->range.high < 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); TAILQ_REMOVE(&rechist->rh_pints.pk_intervals, pi, next_pi);
free(pi); free(pi);
} }

View file

@ -3,11 +3,11 @@ include_directories( BEFORE ../../ssl/include )
include_directories( ../../include ) include_directories( ../../include )
include_directories( ../../src/liblsquic ) include_directories( ../../src/liblsquic )
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-value")
enable_testing() enable_testing()
IF (NOT (CMAKE_C_COMPILER MATCHES "MSVC")) IF (NOT (CMAKE_C_COMPILER MATCHES "MSVC"))
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unused-value")
add_executable(test_rechist test_rechist.c) add_executable(test_rechist test_rechist.c)
target_link_libraries(test_rechist lsquic pthread libssl.a libcrypto.a z m ${FIULIB}) 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 static void
elide_single_stream_frame (void) elide_single_stream_frame (void)
{ {
struct packet_out_srec_iter posi; struct packet_out_srec_iter posi = { 0 };
struct lsquic_engine_public enpub; struct lsquic_engine_public enpub;
lsquic_stream_t streams[1]; lsquic_stream_t streams[1];
lsquic_packet_out_t *packet_out; lsquic_packet_out_t *packet_out;