Repository navigation
copy the value store payload in binary mode in append merges - #499
Conversation
| namespace keyvi { | ||
| namespace dictionary { | ||
| namespace fsa { | ||
| namespace internal { |
There was a problem hiding this comment.
warning: nested namespaces can be concatenated [modernize-concat-nested-namespaces]
| namespace internal { | |
| namespace keyvi::dictionary::fsa::internal { |
keyvi/include/keyvi/dictionary/fsa/internal/value_store_append_merge.h:71:
- } /* namespace internal */
- } /* namespace fsa */
- } /* namespace dictionary */
- } /* namespace keyvi */
+ } // namespace keyvi::dictionary::fsa::internal
+
+ | */ | ||
| inline void CopyValueStorePayload(const std::string& filename, const ValueStoreProperties& properties, | ||
| std::ostream* stream) { | ||
| std::ifstream in_stream(filename, std::ios::binary); |
There was a problem hiding this comment.
warning: no header providing "std::ios" is directly included [misc-include-cleaner]
keyvi/include/keyvi/dictionary/fsa/internal/value_store_append_merge.h:29:
- #include <ostream>
+ #include <ios>
+ #include <ostream>| if (!in_stream.good()) { | ||
| throw std::invalid_argument("can not open dictionary file: " + filename); | ||
| } | ||
| in_stream.seekg(properties.GetOffset()); |
There was a problem hiding this comment.
warning: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'streamoff' (aka 'long') is implementation-defined [bugprone-narrowing-conversions]
in_stream.seekg(properties.GetOffset());
^| throw std::invalid_argument("file is corrupt(truncated): " + filename); | ||
| } | ||
|
|
||
| std::vector<char> buffer(64 * 1024); |
There was a problem hiding this comment.
warning: performing an implicit widening conversion to type 'size_type' (aka 'unsigned long') of a multiplication performed in type 'int' [bugprone-implicit-widening-of-multiplication-result]
std::vector<char> buffer(64 * 1024);
^Additional context
keyvi/include/keyvi/dictionary/fsa/internal/value_store_append_merge.h:58: make conversion explicit to silence this warning
std::vector<char> buffer(64 * 1024);
^keyvi/include/keyvi/dictionary/fsa/internal/value_store_append_merge.h:58: perform multiplication in a wider type
std::vector<char> buffer(64 * 1024);
^| size_t remaining = properties.GetSize(); | ||
| while (remaining > 0) { | ||
| const size_t chunk_size = std::min(remaining, buffer.size()); | ||
| in_stream.read(buffer.data(), chunk_size); |
There was a problem hiding this comment.
warning: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'streamsize' (aka 'long') is implementation-defined [bugprone-narrowing-conversions]
in_stream.read(buffer.data(), chunk_size);
^| if (static_cast<size_t>(in_stream.gcount()) != chunk_size) { | ||
| throw std::invalid_argument("file is corrupt(truncated): " + filename); | ||
| } | ||
| stream->write(buffer.data(), chunk_size); |
There was a problem hiding this comment.
warning: narrowing conversion from 'size_t' (aka 'unsigned long') to signed type 'streamsize' (aka 'long') is implementation-defined [bugprone-narrowing-conversions]
stream->write(buffer.data(), chunk_size);
^
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #499 +/- ##
==========================================
+ Coverage 87.55% 87.57% +0.01%
==========================================
Files 99 100 +1
Lines 5826 5834 +8
Branches 2518 2522 +4
==========================================
+ Hits 5101 5109 +8
Misses 391 391
Partials 334 334 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
No description provided.