From e0e339699addbdc837b79c110a8432f0641d16ee Mon Sep 17 00:00:00 2001
From: Jean Chalard <jchalard@google.com>
Date: Mon, 26 Dec 2011 20:23:32 +0900
Subject: [PATCH] Skip shortcut targets if any. (A1)

Change-Id: I1e83bba2b36bdc0429debb22425ce75001e61c81
---
 native/src/binary_format.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/native/src/binary_format.h b/native/src/binary_format.h
index 6f65088dba..cbaccb2957 100644
--- a/native/src/binary_format.h
+++ b/native/src/binary_format.h
@@ -145,15 +145,15 @@ inline int BinaryFormat::skipFrequency(const uint8_t flags, const int pos) {
 
 inline int BinaryFormat::skipAllAttributes(const uint8_t* const dict, const uint8_t flags,
         const int pos) {
-    // This function skips all attributes. The format makes provision for future extension
-    // with other attributes (notably shortcuts) but for the time being, bigrams are the
-    // only attributes that may be found in a character group, so we only look at bigrams
-    // in this version.
+    // This function skips all attributes: shortcuts and bigrams.
+    int newPos = pos;
+    if (UnigramDictionary::FLAG_HAS_SHORTCUT_TARGETS & flags) {
+        newPos = skipAttributes(dict, newPos);
+    }
     if (UnigramDictionary::FLAG_HAS_BIGRAMS & flags) {
-        return skipAttributes(dict, pos);
-    } else {
-        return pos;
+        newPos = skipAttributes(dict, newPos);
     }
+    return newPos;
 }
 
 inline int BinaryFormat::skipChildrenPosAndAttributes(const uint8_t* const dict,
-- 
GitLab