Skip to content

uint64_t and size_t conflicts on 32 bit #209

@codecat

Description

@codecat

MSVC is reporting a bunch of warnings regarding the use of uint64_t throughout the library when building on 32 bit, which are due to the implicit casts to size_t (which is 32 bit rather than 64 bit.)

Perhaps size_t should be used for data lenghts and such rather than uint64_t?

httplib.h(1419): warning C4244: 'argument': conversion from 'uint64_t' to 'size_t', possible loss of data
httplib.h(1441): warning C4244: 'argument': conversion from 'uint64_t' to 'const unsigned int', possible loss of data
httplib.h(1751): warning C4244: 'argument': conversion from 'uint64_t' to 'const unsigned int', possible loss of data
httplib.h(2100): warning C4244: '=': conversion from 'uint64_t' to 'size_t', possible loss of data
httplib.h(2227): warning C4244: 'argument': conversion from '_Ty2' to 'const unsigned int', possible loss of data
httplib.h(2227): warning C4244: 'argument': conversion from '_Ty1' to 'const unsigned int', possible loss of data
httplib.h(1382): warning C4244: 'argument': conversion from 'uint64_t' to 'size_t', possible loss of data
httplib.h(1385): warning C4244: 'argument': conversion from 'uint64_t' to 'size_t', possible loss of data

There are also a number of cases where detail::ContentReceiverCore is set with the wrong callback parameters:

    if (!detail::read_content(strm, req, payload_max_length_, res.status,
                              Progress(), [&](const char *buf, size_t /* produces a warning because it's not uint64_t */ n) {
                                req.body.append(buf, n);
                                return true;
                              })) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions