forked from osmocom/wireshark
Try to fix a narrowing warning
"C:\Development\wsbuild64\Wireshark.sln" (default target) (1) -> "C:\Development\wsbuild64\epan\dfilter\dfilter.vcxproj.metaproj" (default target) (18) -> "C:\Development\wsbuild64\epan\dfilter\dfilter.vcxproj" (default target) (108) -> (ClCompile target) -> C:/Development/wireshark/epan/dfilter/scanner.l(463,54): warning C4267: '+=': conversion from 'size_t' to 'int ', possible loss of data [C:\Development\wsbuild64\epan\dfilter\dfilter.vcxproj] C:/Development/wireshark/epan/dfilter/scanner.l(463,54): warning C4267: state->location.col_start += sta te->location.col_len; [C:\Development\wsbuild64\epan\dfilter\dfilter.vcxproj] C:/Development/wireshark/epan/dfilter/scanner.l(463,54): warning C4267: ^ (compiling source file C:\Development\wsbuild64\epan\dfilter\scanner.c) [C:\Development\ws build64\epan\dfilter\dfilter.vcxproj]
This commit is contained in:
parent
2f02cd6e19
commit
09696f1762
11
dftest.c
11
dftest.c
|
@ -41,17 +41,14 @@ static void dftest_cmdarg_err(const char *fmt, va_list ap);
|
|||
static void dftest_cmdarg_err_cont(const char *fmt, va_list ap);
|
||||
|
||||
static void
|
||||
putloc(FILE *fp, int start, size_t len)
|
||||
putloc(FILE *fp, dfilter_loc_t loc)
|
||||
{
|
||||
if (start < 0)
|
||||
return;
|
||||
|
||||
for (int i = 0; i < start; i++) {
|
||||
for (long i = 0; i < loc.col_start; i++) {
|
||||
fputc(' ', fp);
|
||||
}
|
||||
fputc('^', fp);
|
||||
|
||||
for (size_t l = len; l > 1; l--) {
|
||||
for (size_t l = loc.col_len; l > 1; l--) {
|
||||
fputc('~', fp);
|
||||
}
|
||||
fputc('\n', fp);
|
||||
|
@ -170,7 +167,7 @@ main(int argc, char **argv)
|
|||
if (err_loc.col_start >= 0) {
|
||||
fprintf(stderr, "\t%s\n", expanded_text);
|
||||
fputc('\t', stderr);
|
||||
putloc(stderr, err_loc.col_start, err_loc.col_len);
|
||||
putloc(stderr, err_loc);
|
||||
}
|
||||
g_free(err_msg);
|
||||
g_free(expanded_text);
|
||||
|
|
|
@ -53,7 +53,7 @@ dfilter_expand(const char *expr, char **err_ret);
|
|||
*/
|
||||
|
||||
typedef struct _dfilter_loc {
|
||||
int col_start;
|
||||
long col_start;
|
||||
size_t col_len;
|
||||
} dfilter_loc_t;
|
||||
|
||||
|
|
|
@ -460,7 +460,7 @@ DIAG_ON_FLEX
|
|||
static void
|
||||
_update_location(df_scanner_state_t *state, size_t len)
|
||||
{
|
||||
state->location.col_start += state->location.col_len;
|
||||
state->location.col_start += (long)state->location.col_len;
|
||||
state->location.col_len = len;
|
||||
}
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ sprint_node(stnode_t *node)
|
|||
wmem_strbuf_append_printf(buf, "magic=0x%"PRIx32", ", node->magic);
|
||||
wmem_strbuf_append_printf(buf, "type=%s, ", stnode_type_name(node));
|
||||
wmem_strbuf_append_printf(buf, "data=<%s>, ", stnode_todebug(node));
|
||||
wmem_strbuf_append_printf(buf, "location=%d:%zu",
|
||||
wmem_strbuf_append_printf(buf, "location=%ld:%zu",
|
||||
node->location.col_start, node->location.col_len);
|
||||
return wmem_strbuf_finalize(buf);
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ typedef struct {
|
|||
} sttype_t;
|
||||
|
||||
typedef struct {
|
||||
int col_start;
|
||||
long col_start;
|
||||
size_t col_len;
|
||||
} stloc_t;
|
||||
|
||||
|
|
|
@ -433,6 +433,7 @@ libwsutil.so.0 libwsutil0 #MINVER#
|
|||
ws_regex_pattern@Base 3.7.0
|
||||
ws_socket_ptoa@Base 3.1.1
|
||||
ws_strcasestr@Base 3.7.0
|
||||
ws_strdup_underline@Base 3.7.0
|
||||
ws_strerrorname_r@Base 3.7.0
|
||||
ws_strptime@Base 3.7.0
|
||||
ws_strtoi16@Base 2.3.0
|
||||
|
|
2
tshark.c
2
tshark.c
|
@ -627,7 +627,7 @@ _compile_dfilter(const char *text, dfilter_t **dfp, const char *caller)
|
|||
cmdarg_err("%s", err_msg);
|
||||
g_free(err_msg);
|
||||
if (err_loc.col_start >= 0) {
|
||||
err_off = ws_strdup_error_offset(NULL, err_loc.col_start, err_loc.col_len);
|
||||
err_off = ws_strdup_underline(NULL, err_loc.col_start, err_loc.col_len);
|
||||
cmdarg_err_cont(" %s", expanded);
|
||||
cmdarg_err_cont(" %s", err_off);
|
||||
g_free(err_off);
|
||||
|
|
|
@ -549,7 +549,7 @@ ws_strerrorname_r(int errnum, char *buf, size_t buf_size)
|
|||
}
|
||||
|
||||
char *
|
||||
ws_strdup_error_offset(wmem_allocator_t *allocator, int offset, size_t len)
|
||||
ws_strdup_underline(wmem_allocator_t *allocator, long offset, size_t len)
|
||||
{
|
||||
if (offset < 0)
|
||||
return NULL;
|
||||
|
|
|
@ -219,7 +219,7 @@ WS_DLL_PUBLIC WS_RETNONNULL
|
|||
const char *ws_strerrorname_r(int errnum, char *buf, size_t buf_size);
|
||||
|
||||
WS_DLL_PUBLIC
|
||||
char *ws_strdup_error_offset(wmem_allocator_t *allocator, int offset, size_t len);
|
||||
char *ws_strdup_underline(wmem_allocator_t *allocator, long offset, size_t len);
|
||||
|
||||
/* To pass one of two strings, singular or plural */
|
||||
#define plurality(d,s,p) ((d) == 1 ? (s) : (p))
|
||||
|
|
Loading…
Reference in New Issue