Skip to content

Commit

Permalink
Release 4.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
gwanglst committed May 31, 2023
1 parent 1b113d1 commit 8fb7e2c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} /wd4245") # conversion from 'int' to 'unsi
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} /wd4267") # integer conversion
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} /wd4214") # nonstandard extension used: bit field types other than int
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} /wd4295") # array is too small to include a terminating null character
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} /wd4324") # structure was padded due to alignment specifier
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} /wd4334") # result of 32-bit shift implicitly converted to 64 bits (was 64-bit shift intended?)
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} /wd4456") # hide previous local declaration
SET(MY_CMAKE_FLAGS "${MY_CMAKE_FLAGS} /wd4459") # hide global declaration
Expand Down
21 changes: 11 additions & 10 deletions include/lsxpack_header.h
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/* Copyright (c) 2017 - 2022 LiteSpeed Technologies Inc. See LICENSE. */
#ifndef LSXPACK_HEADER_H_v207
#define LSXPACK_HEADER_H_v207
#ifndef LSXPACK_HEADER_H_v208
#define LSXPACK_HEADER_H_v208

#ifdef __cplusplus
extern "C" {
Expand All @@ -14,6 +14,7 @@ extern "C" {
#define LSXPACK_MAX_STRLEN UINT16_MAX
#endif

typedef int32_t lsxpack_offset_t;
#if LSXPACK_MAX_STRLEN == UINT16_MAX
typedef uint16_t lsxpack_strlen_t;
#elif LSXPACK_MAX_STRLEN == UINT32_MAX
Expand Down Expand Up @@ -49,9 +50,9 @@ struct lsxpack_header
char *buf; /* the buffer for headers */
uint32_t name_hash; /* hash value for name */
uint32_t nameval_hash; /* hash value for name + value */
lsxpack_strlen_t name_offset; /* the offset for name in the buffer */
lsxpack_offset_t name_offset; /* the offset for name in the buffer */
lsxpack_offset_t val_offset; /* the offset for value in the buffer */
lsxpack_strlen_t name_len; /* the length of name */
lsxpack_strlen_t val_offset; /* the offset for value in the buffer */
lsxpack_strlen_t val_len; /* the length of value */
uint16_t chain_next_idx; /* mainly for cookie value chain */
uint8_t hpack_index; /* HPACK static table index */
Expand Down Expand Up @@ -99,11 +100,11 @@ lsxpack_header_set_offset(lsxpack_header_t *hdr, const char *buf,
{
memset(hdr, 0, sizeof(*hdr));
hdr->buf = (char *)buf;
hdr->name_offset = (lsxpack_strlen_t)name_offset;
hdr->name_offset = (lsxpack_offset_t)name_offset;
assert(name_len <= LSXPACK_MAX_STRLEN);
hdr->name_len = (lsxpack_strlen_t)name_len;
assert(name_offset + name_len + 2 <= LSXPACK_MAX_STRLEN);
hdr->val_offset = (lsxpack_strlen_t)(name_offset + name_len + 2);
hdr->val_offset = (lsxpack_offset_t)(name_offset + name_len + 2);
assert(val_len <= LSXPACK_MAX_STRLEN);
hdr->val_len = (lsxpack_strlen_t)val_len;
}
Expand All @@ -116,11 +117,11 @@ lsxpack_header_set_offset2(lsxpack_header_t *hdr, const char *buf,
{
memset(hdr, 0, sizeof(*hdr));
hdr->buf = (char *)buf;
hdr->name_offset = (lsxpack_strlen_t)name_offset;
hdr->name_offset = (lsxpack_offset_t)name_offset;
assert(name_len <= LSXPACK_MAX_STRLEN);
hdr->name_len = (lsxpack_strlen_t)name_len;
assert(val_offset <= LSXPACK_MAX_STRLEN);
hdr->val_offset = (lsxpack_strlen_t)val_offset;
hdr->val_offset = (lsxpack_offset_t)val_offset;
assert(val_len <= LSXPACK_MAX_STRLEN);
hdr->val_len = (lsxpack_strlen_t)val_len;
}
Expand All @@ -133,7 +134,7 @@ lsxpack_header_prepare_decode(lsxpack_header_t *hdr,
memset(hdr, 0, sizeof(*hdr));
hdr->buf = out;
assert(offset <= LSXPACK_MAX_STRLEN);
hdr->name_offset = (lsxpack_strlen_t)offset;
hdr->name_offset = (lsxpack_offset_t)offset;
if (len > LSXPACK_MAX_STRLEN)
hdr->val_len = LSXPACK_MAX_STRLEN;
else
Expand Down Expand Up @@ -166,4 +167,4 @@ lsxpack_header_mark_val_changed(lsxpack_header_t *hdr)
}
#endif

#endif //LSXPACK_HEADER_H_v207
#endif //LSXPACK_HEADER_H_v208

0 comments on commit 8fb7e2c

Please sign in to comment.