Skip to content

Commit

Permalink
bytes_to_str(): fix MSVC '>': signed/unsigned mismatch warning
Browse files Browse the repository at this point in the history
MSVC doesn't display this warning even with `/W4`, one has to provide
`/Wall`. But I guess some people are seeing this, see
roelschroeven@1793188

For the record, here's what the entire warning looked like:

```
C:\temp\kaitai_struct\runtime\cpp_stl\kaitai\kaitaistream.cpp(893,22): warning C4388: '>': signed/unsigned mismatch [C:\temp\kaitai_struct\runtime\cpp_stl\build\kaitai_struct_cpp_stl_runtime.vcxproj]
```
  • Loading branch information
generalmimon committed Jul 26, 2024
1 parent 58a23be commit 6fd70af
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion kaitai/kaitaistream.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,7 @@ std::string kaitai::kstream::bytes_to_str(const std::string src, int codepage) {
std::wstring utf16;
int32_t utf16_len;
int32_t src_len;
if (src.length() > std::numeric_limits<int32_t>::max()) {
if (src.length() > static_cast<uint32_t>(std::numeric_limits<int32_t>::max())) {
throw bytes_to_str_error("buffers longer than int32_t are unsupported");
} else {
src_len = static_cast<int32_t>(src.length());
Expand Down

0 comments on commit 6fd70af

Please sign in to comment.