[gnote] Iterate through utf-8 text more efficiently in TrieTree::find_matches() Fixes Bug 729832.



commit ae101ed0a111564f391264cd01f116260aaa8a99
Author: rincew314 <rincew314 gmail com>
Date:   Thu May 8 14:19:38 2014 -0500

    Iterate through utf-8 text more efficiently in TrieTree::find_matches()
    Fixes Bug 729832.

 src/trie.hpp |    7 ++++---
 1 files changed, 4 insertions(+), 3 deletions(-)
---
diff --git a/src/trie.hpp b/src/trie.hpp
index e394cf9..14c4477 100644
--- a/src/trie.hpp
+++ b/src/trie.hpp
@@ -1,7 +1,7 @@
 /*
  * gnote
  *
- * Copyright (C) 2013 Aurimas Cernius
+ * Copyright (C) 2013-2014 Aurimas Cernius
  * Copyright (C) 2011 Debarshi Ray
  * Copyright (C) 2009 Hubert Figuiere
  *
@@ -213,8 +213,9 @@ public:
       new typename TrieHit<value_t>::List());
     int start_index = 0;
 
-    for (Glib::ustring::size_type i = 0; i < haystack.size(); i++) {
-      gunichar c = haystack[i];
+    Glib::ustring::const_iterator haystack_iter = haystack.begin();
+    for (Glib::ustring::size_type i = 0; haystack_iter != haystack.end(); ++i, ++haystack_iter ) {
+      gunichar c = *haystack_iter;
       if (!m_case_sensitive)
         c = Glib::Unicode::tolower(c);
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]