aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTomasz Wasilczyk <twasilczyk@google.com>2023-12-04 21:56:35 -0800
committerTomasz Wasilczyk <twasilczyk@google.com>2023-12-04 21:56:35 -0800
commit20d2be8672d24bfb441d075f82cc317d17d601f8 (patch)
treec36d22235981ced49a043031c14fda09b1a97600
parent61d9bff9605ad2ffd877bd99a3bde414e21f01a2 (diff)
downloadlibcppbor-20d2be8672d24bfb441d075f82cc317d17d601f8.tar.gz
Fix C++20 build
Bug: 311052584 Test: build Trusty Change-Id: Ie52a4e2d4a5ad5d53acf72b8925c2341a13a3cd6
-rw-r--r--src/cppbor.cpp16
1 files changed, 8 insertions, 8 deletions
diff --git a/src/cppbor.cpp b/src/cppbor.cpp
index 9236d15..d916ce4 100644
--- a/src/cppbor.cpp
+++ b/src/cppbor.cpp
@@ -273,17 +273,17 @@ uint8_t* encodeHeader(MajorType type, uint64_t addlInfo, uint8_t* pos, const uin
*pos++ = type | static_cast<uint8_t>(addlInfo);
return pos;
case 2:
- *pos++ = type | ONE_BYTE_LENGTH;
+ *pos++ = type | static_cast<MajorType>(ONE_BYTE_LENGTH);
*pos++ = static_cast<uint8_t>(addlInfo);
return pos;
case 3:
- *pos++ = type | TWO_BYTE_LENGTH;
+ *pos++ = type | static_cast<MajorType>(TWO_BYTE_LENGTH);
return writeBigEndian(static_cast<uint16_t>(addlInfo), pos);
case 5:
- *pos++ = type | FOUR_BYTE_LENGTH;
+ *pos++ = type | static_cast<MajorType>(FOUR_BYTE_LENGTH);
return writeBigEndian(static_cast<uint32_t>(addlInfo), pos);
case 9:
- *pos++ = type | EIGHT_BYTE_LENGTH;
+ *pos++ = type | static_cast<MajorType>(EIGHT_BYTE_LENGTH);
return writeBigEndian(addlInfo, pos);
default:
CHECK(false); // Impossible to get here.
@@ -298,19 +298,19 @@ void encodeHeader(MajorType type, uint64_t addlInfo, EncodeCallback encodeCallba
encodeCallback(type | static_cast<uint8_t>(addlInfo));
break;
case 2:
- encodeCallback(type | ONE_BYTE_LENGTH);
+ encodeCallback(type | static_cast<MajorType>(ONE_BYTE_LENGTH));
encodeCallback(static_cast<uint8_t>(addlInfo));
break;
case 3:
- encodeCallback(type | TWO_BYTE_LENGTH);
+ encodeCallback(type | static_cast<MajorType>(TWO_BYTE_LENGTH));
writeBigEndian(static_cast<uint16_t>(addlInfo), encodeCallback);
break;
case 5:
- encodeCallback(type | FOUR_BYTE_LENGTH);
+ encodeCallback(type | static_cast<MajorType>(FOUR_BYTE_LENGTH));
writeBigEndian(static_cast<uint32_t>(addlInfo), encodeCallback);
break;
case 9:
- encodeCallback(type | EIGHT_BYTE_LENGTH);
+ encodeCallback(type | static_cast<MajorType>(EIGHT_BYTE_LENGTH));
writeBigEndian(addlInfo, encodeCallback);
break;
default: