aboutsummaryrefslogtreecommitdiff
path: root/icing/index/main/posting-list-hit-serializer.h
diff options
context:
space:
mode:
Diffstat (limited to 'icing/index/main/posting-list-hit-serializer.h')
-rw-r--r--icing/index/main/posting-list-hit-serializer.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/icing/index/main/posting-list-hit-serializer.h b/icing/index/main/posting-list-hit-serializer.h
index 975b05a..2986d9c 100644
--- a/icing/index/main/posting-list-hit-serializer.h
+++ b/icing/index/main/posting-list-hit-serializer.h
@@ -23,6 +23,7 @@
#include "icing/file/posting_list/posting-list-common.h"
#include "icing/file/posting_list/posting-list-used.h"
#include "icing/index/hit/hit.h"
+#include "icing/util/status-macros.h"
namespace icing {
namespace lib {
@@ -72,8 +73,9 @@ class PostingListHitSerializer : public PostingListSerializer {
// keep_prepended is true, whatever could be prepended is kept, otherwise the
// posting list is left in its original state.
template <class T, Hit (*GetHit)(const T&)>
- uint32_t PrependHitArray(PostingListUsed* posting_list_used, const T* array,
- uint32_t num_hits, bool keep_prepended) const;
+ libtextclassifier3::StatusOr<uint32_t> PrependHitArray(
+ PostingListUsed* posting_list_used, const T* array, uint32_t num_hits,
+ bool keep_prepended) const;
// Retrieves the hits stored in the posting list.
//
@@ -312,9 +314,10 @@ class PostingListHitSerializer : public PostingListSerializer {
// Inlined functions. Implementation details below. Avert eyes!
template <class T, Hit (*GetHit)(const T&)>
-uint32_t PostingListHitSerializer::PrependHitArray(
- PostingListUsed* posting_list_used, const T* array, uint32_t num_hits,
- bool keep_prepended) const {
+libtextclassifier3::StatusOr<uint32_t>
+PostingListHitSerializer::PrependHitArray(PostingListUsed* posting_list_used,
+ const T* array, uint32_t num_hits,
+ bool keep_prepended) const {
if (!IsPostingListValid(posting_list_used)) {
return 0;
}
@@ -331,7 +334,7 @@ uint32_t PostingListHitSerializer::PrependHitArray(
// before. PopFrontHits guarantees that it will remove all 'i' hits so long
// as there are at least 'i' hits in the posting list, which we know there
// are.
- PopFrontHits(posting_list_used, /*num_hits=*/i);
+ ICING_RETURN_IF_ERROR(PopFrontHits(posting_list_used, /*num_hits=*/i));
}
return i;
}