From 3a0ab5a2d6ac2b7d94a2726862e4cd722c7c34a1 Mon Sep 17 00:00:00 2001 From: Henning Baldersheim Date: Wed, 26 Jan 2022 19:20:01 +0000 Subject: Add [[nodiscard]] to Read() too --- searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp | 3 ++- searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp | 5 +++-- 2 files changed, 5 insertions(+), 3 deletions(-) (limited to 'searchlib') diff --git a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp index 29c82936076..f6dd5a318ae 100644 --- a/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/bitvectordictionary.cpp @@ -53,7 +53,8 @@ BitVectorDictionary::open(const vespalib::string &pathPrefix, size_t bufSize = sizeof(WordSingleKey) * numEntries; assert(idxFile.GetSize() >= static_cast(idxHeaderLen + bufSize)); if (bufSize > 0) { - idxFile.Read(&_entries[0], bufSize); + ssize_t has_read = idxFile.Read(&_entries[0], bufSize); + assert(has_read == ssize_t(bufSize)); } } diff --git a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp index cd9cd6c34da..3c74ab5ff07 100644 --- a/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp +++ b/searchlib/src/vespa/searchlib/diskindex/wordnummapper.cpp @@ -2,6 +2,7 @@ #include "wordnummapper.h" #include +#include namespace search::diskindex { @@ -30,8 +31,8 @@ WordNumMapping::readMappingFile(const vespalib::string &name, map.resize(tempfileentries + 2); _oldDictSize = tempfileentries; - old2newwordfile.Read(&map[1], - static_cast(tempfilesize)); + ssize_t has_read = old2newwordfile.Read(&map[1], static_cast(tempfilesize)); + assert(has_read == tempfilesize); map[0] = noWordNum(); map[tempfileentries + 1] = noWordNumHigh(); } -- cgit v1.2.3