Fix C++20 build
Bug: 311052584
Test: build Trusty
Change-Id: Ie52a4e2d4a5ad5d53acf72b8925c2341a13a3cd6
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 @@
*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 @@
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: