Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(212)

Side by Side Diff: third_party/hunspell/google/bdict_reader.cc

Issue 2081893002: [Hunspell] Better handling of invalid dictionary (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "third_party/hunspell/google/bdict_reader.h" 5 #include "third_party/hunspell/google/bdict_reader.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 10
(...skipping 764 matching lines...) Expand 10 before | Expand all | Expand 10 after
775 LineIterator BDictReader::GetOtherLineIterator() const { 775 LineIterator BDictReader::GetOtherLineIterator() const {
776 if (!bdict_data_ || 776 if (!bdict_data_ ||
777 aff_header_->other_offset == 0 || 777 aff_header_->other_offset == 0 ||
778 aff_header_->other_offset >= bdict_length_) 778 aff_header_->other_offset >= bdict_length_)
779 return LineIterator(bdict_data_, 0, 0); // Item is empty or invalid. 779 return LineIterator(bdict_data_, 0, 0); // Item is empty or invalid.
780 return LineIterator(bdict_data_, bdict_length_, 780 return LineIterator(bdict_data_, bdict_length_,
781 aff_header_->other_offset); 781 aff_header_->other_offset);
782 } 782 }
783 783
784 ReplacementIterator BDictReader::GetReplacementIterator() const { 784 ReplacementIterator BDictReader::GetReplacementIterator() const {
785 if (!bdict_data_ ||
786 aff_header_->rep_offset == 0 ||
787 aff_header_->rep_offset >= bdict_length_)
788 return ReplacementIterator(bdict_data_, 0, 0); // Item is empty or invalid.
please use gerrit instead 2016/06/21 16:35:44 nit: {}
groby-ooo-7-16 2016/06/21 18:22:40 Keeping it consistent with the rest of the file.
785 return ReplacementIterator(bdict_data_, bdict_length_, 789 return ReplacementIterator(bdict_data_, bdict_length_,
786 aff_header_->rep_offset); 790 aff_header_->rep_offset);
787 } 791 }
788 792
789 793
790 WordIterator BDictReader::GetAllWordIterator() const { 794 WordIterator BDictReader::GetAllWordIterator() const {
791 NodeReader reader(bdict_data_, bdict_length_, header_->dic_offset, 0); 795 NodeReader reader(bdict_data_, bdict_length_, header_->dic_offset, 0);
792 return WordIterator(reader); 796 return WordIterator(reader);
793 } 797 }
794 798
795 } // namespace hunspell 799 } // namespace hunspell
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698