Skip to content

Commit 58ee8f5

Browse files
committed
changes the return value of IsValidNormalizerData
1 parent 1baeb2c commit 58ee8f5

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

src/builder.cc

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -153,11 +153,11 @@ Builder::Chars Normalize(const Builder::CharsMap &chars_map,
153153
return normalized;
154154
}
155155

156-
bool IsValidNormalizerData(absl::string_view blob_data) {
156+
util::Status IsValidNormalizerData(absl::string_view blob_data) {
157157
NormalizerSpec spec;
158158
spec.set_precompiled_charsmap(blob_data.data(), blob_data.size());
159159
const Normalizer normalizer(spec);
160-
return normalizer.status().ok();
160+
return normalizer.status();
161161
}
162162

163163
} // namespace
@@ -223,7 +223,7 @@ util::Status Builder::CompileCharsMap(const CharsMap &chars_map,
223223
absl::string_view trie_blob(static_cast<const char *>(trie.array()),
224224
trie.size() * trie.unit_size());
225225
*output = Normalizer::EncodePrecompiledCharsMap(trie_blob, normalized);
226-
CHECK_OR_RETURN(IsValidNormalizerData(*output));
226+
RETURN_IF_ERROR(IsValidNormalizerData(*output));
227227

228228
LOG(INFO) << "Generated normalizer blob. size=" << output->size();
229229

@@ -300,8 +300,7 @@ util::Status Builder::GetPrecompiledCharsMap(absl::string_view name,
300300
const auto *blob = &kNormalizationRules_blob[i];
301301
if (blob->name == name) {
302302
output->assign(blob->data, blob->size);
303-
CHECK_OR_RETURN(IsValidNormalizerData(*output));
304-
return util::OkStatus();
303+
return IsValidNormalizerData(*output);
305304
}
306305
}
307306
#else // DISABLE_EMBEDDED_DATA
@@ -311,8 +310,7 @@ util::Status Builder::GetPrecompiledCharsMap(absl::string_view name,
311310
auto input = filesystem::NewReadableFile(filename, true /* is binary */);
312311
if (input->status().ok()) {
313312
input->ReadAll(output);
314-
CHECK_OR_RETURN(IsValidNormalizerData(*output));
315-
return util::OkStatus();
313+
return IsValidNormalizerData(*output);
316314
}
317315
}
318316
#endif // DISABLE_EMBEDDED_DATA

wheel.yml

Whitespace-only changes.

0 commit comments

Comments
 (0)