Skip to content

Commit

Permalink
ofpbuf: Fix parameter for const initializer.
Browse files Browse the repository at this point in the history
Clang 4.0 complains:

In file included from include/openvswitch/cxxtest.cc:11:0:
../include/openvswitch/ofpbuf.h: In function ‘ofpbuf ofpbuf_const_initializer(const void*, size_t)’:
../include/openvswitch/ofpbuf.h:107:5: warning: narrowing conversion of ‘size’ from ‘size_t {aka long unsigned int}’ to ‘uint32_t {aka unsigned int}’ inside { } [-Wnarrowing]
     };
     ^
../include/openvswitch/ofpbuf.h:107:5: warning: narrowing conversion of ‘size’ from ‘size_t {aka long unsigned int}’ to ‘uint32_t {aka unsigned int}’ inside { } [-Wnarrowing]

This is because the ofpbuf struct's "size" parameter is a uint32_t,
while ofpbuf_const_initializer() takes a size_t for the size. Fix this
function to take a uint32_t instead.

Signed-off-by: Joe Stringer <[email protected]>
Acked-by: Ben Pfaff <[email protected]>
  • Loading branch information
joestringer committed Aug 1, 2017
1 parent c94d815 commit 952646c
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion include/openvswitch/ofpbuf.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ struct ofpbuf {
* ofpbuf_use_const().
*/
static inline struct ofpbuf
ofpbuf_const_initializer(const void *data, size_t size)
ofpbuf_const_initializer(const void *data, uint32_t size)
{
return (struct ofpbuf) {
.base = CONST_CAST(void *, data),
Expand Down

0 comments on commit 952646c

Please sign in to comment.