Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023-2024 HERE Europe B.V.
* Copyright (C) 2023-2025 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -79,11 +79,13 @@ bool PartitionsSaxHandler::String(const char* str, unsigned int length, bool) {
case State::kParsingIgnoreAttribute:
break;

case State::kWaitForRootObject: // Not expected
case State::kWaitForNextPartition: // Not expected
case State::kWaitForRootObjectEnd: // Not expected
case State::kParsingVersion: // Version is not a string
case State::kParsingDataSize: // DataSize is not a string
case State::kWaitForRootObject: // Not expected
case State::kWaitForNextPartition: // Not expected
case State::kWaitForRootObjectEnd: // Not expected
case State::kParsingVersion: // Version is not a string
case State::kParsingDataSize: // DataSize is not a string
case State::kParsingCompressedDataSize: // CompressedDataSize is not a
// string
default:
return false;
}
Expand All @@ -98,6 +100,8 @@ bool PartitionsSaxHandler::Uint(unsigned int value) {
partition_.SetVersion(value);
} else if (state_ == State::kParsingDataSize) {
partition_.SetDataSize(value);
} else if (state_ == State::kParsingCompressedDataSize) {
partition_.SetCompressedDataSize(value);
} else {
return false;
}
Expand Down Expand Up @@ -162,6 +166,8 @@ PartitionsSaxHandler::State PartitionsSaxHandler::ProcessNextAttribute(
return State::kParsingChecksum;
case HashStringToInt("dataSize"):
return State::kParsingDataSize;
case HashStringToInt("compressedDataSize"):
return State::kParsingCompressedDataSize;
case HashStringToInt("version"):
return State::kParsingVersion;
case HashStringToInt("crc"):
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 HERE Europe B.V.
* Copyright (C) 2023-2025 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -70,6 +70,7 @@ class PartitionsSaxHandler
kParsingDataHandle,
kParsingChecksum,
kParsingDataSize,
kParsingCompressedDataSize,
kParsingCrc,
kParsingIgnoreAttribute,

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (C) 2023 HERE Europe B.V.
* Copyright (C) 2023-2025 HERE Europe B.V.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -32,6 +32,7 @@ const char* kDataHandle = "dataHandle";
const char* kPartition = "partition";
const char* kChecksum = "checksum";
const char* kDataSize = "dataSize";
const char* kCompressedDataSize = "compressedDataSize";
const char* kVersion = "version";
const char* kCrc = "crc";

Expand Down Expand Up @@ -65,6 +66,8 @@ TEST(PartitionsSaxHandlerTest, NormalFlow) {
ASSERT_TRUE(handler.String(kChecksumValue, len(kChecksumValue), true));
ASSERT_TRUE(handler.String(kDataSize, len(kDataSize), true));
ASSERT_TRUE(handler.Uint(150));
ASSERT_TRUE(handler.String(kCompressedDataSize, len(kCompressedDataSize), true));
ASSERT_TRUE(handler.Uint(100));
ASSERT_TRUE(handler.String(kVersion, len(kVersion), true));
ASSERT_TRUE(handler.Uint(6));
ASSERT_TRUE(handler.String(kCrc, len(kCrc), true));
Expand All @@ -80,6 +83,7 @@ TEST(PartitionsSaxHandlerTest, NormalFlow) {
std::string(kChecksumValue));
EXPECT_EQ(parsed_partition.GetCrc().get_value_or(""), std::string(kCrcValue));
EXPECT_EQ(parsed_partition.GetDataSize().get_value_or(0), 150);
EXPECT_EQ(parsed_partition.GetCompressedDataSize().get_value_or(0), 100);
EXPECT_EQ(parsed_partition.GetVersion().get_value_or(0), 6);
}

Expand Down
Loading