aws/aws-sdk-cpp

Build fails due to warnings C4267: '=': conversion from 'size_t' to 'uInt', possible loss of data

ajishna opened this issue · 4 comments

Describe the bug

strm.avail_in aws-sdk-cpp/src/aws-cpp-sdk-core/source/client/RequestCompression.cpp
has improper conversions at 2 locations:
Line 159:
strm.avail_in = (flush == Z_FINISH)?toRead-1:toRead; //skip EOF if included
and Line 280:
strm.avail_in = toRead;

Found when building custom client.
Worked around with adding #pragma warning(suppress: 4267) on the source.

Expected Behavior

Build should not fail

Current Behavior

Build fails when building custom clients with warning treated as error:
C4267: '=': conversion from 'size_t' to 'uInt', possible loss of data

Reproduction Steps

Build custom client with cmake ( flag -DLEGACY_BUILD=ON and -DADD_CUSTOM_CLIENTS=<your_service_name>)

Possible Solution

Fix the conversion issue

Additional Information/Context

No response

AWS CPP SDK version used

1.11.169

Compiler and Version used

Visual Studio 2022

Operating System and version

Windows 10

jmklix commented

Can you try turning off warning as errors? You can do this with this cmake flag:

-DAWS_SDK_WARNINGS_ARE_ERRORS=OFF

Yes, turning off warning as errors works, but ideally one shouldn't.

jmklix commented

Should be fixed with the above PR. Closing this issue. Please let me know if you are still seeing the above warning when building this sdk

⚠️COMMENT VISIBILITY WARNING⚠️

Comments on closed issues are hard for our team to see.
If you need more assistance, please either tag a team member or open a new issue that references this one.
If you wish to keep having a conversation with other community members under this issue feel free to do so.