susumu.yata
null+****@clear*****
Thu Sep 18 16:09:07 JST 2014
susumu.yata 2014-09-18 16:09:07 +0900 (Thu, 18 Sep 2014) New Revision: c693bc6c839681db5246cd25ab8eadca5940c3bc https://github.com/groonga/grnxx/commit/c693bc6c839681db5246cd25ab8eadca5940c3bc Message: Update IteratorCursor for the new Cursor. (#61) Modified files: lib/grnxx/index.cpp Modified: lib/grnxx/index.cpp (+4 -7) =================================================================== --- lib/grnxx/index.cpp 2014-09-18 16:07:19 +0900 (a7f684c) +++ lib/grnxx/index.cpp 2014-09-18 16:09:07 +0900 (039d1fa) @@ -154,7 +154,7 @@ class IteratorCursor : public Cursor { limit_left_(limit) {} ~IteratorCursor() {} - Int read(Error *error, Int max_count, Array<Record> *records); + Int read(Error *error, ArrayRef<Record> records); private: Iterator begin_; @@ -167,9 +167,8 @@ class IteratorCursor : public Cursor { }; template <typename T> -Int IteratorCursor<T>::read(Error *error, - Int max_count, - Array<Record> *records) { +Int IteratorCursor<T>::read(Error *, ArrayRef<Record> records) { + Int max_count = records.size(); if (max_count > limit_left_) { max_count = limit_left_; } @@ -182,9 +181,7 @@ Int IteratorCursor<T>::read(Error *error, --offset_left_; } while ((count < max_count) && (it_ != end_)) { - if (!records->push_back(error, Record(*it_, 0.0))) { - return -1; - } + records.set(count, Record(*it_, 0.0)); ++count; ++it_; } -------------- next part -------------- HTML����������������������������...Download