diff options
author | Weng Xuetian <xweng@google.com> | 2020-08-17 00:41:33 -0700 |
---|---|---|
committer | Peng Wu <alexepico@gmail.com> | 2020-08-18 10:09:56 +0800 |
commit | 15adb1dbe553bc38c5a2a9032dbf6963cc859772 (patch) | |
tree | e7bb747c43d53bb70a1eafb485b4ede01331bfb9 | |
parent | 865dd14c83d9ad6fedb523181e2f066ed6b9dff3 (diff) | |
download | libpinyin-15adb1dbe553bc38c5a2a9032dbf6963cc859772.tar.gz libpinyin-15adb1dbe553bc38c5a2a9032dbf6963cc859772.tar.xz libpinyin-15adb1dbe553bc38c5a2a9032dbf6963cc859772.zip |
Copy the data when merge into single ngram.
system and user single ngram might be invalidated later.
-rw-r--r-- | src/storage/ngram.cpp | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/storage/ngram.cpp b/src/storage/ngram.cpp index b8347d9..15165fd 100644 --- a/src/storage/ngram.cpp +++ b/src/storage/ngram.cpp @@ -284,14 +284,14 @@ bool merge_single_gram(SingleGram * merged, const SingleGram * system, MemoryChunk & merged_chunk = merged->m_chunk; if (NULL == system) { - merged_chunk.set_chunk(user->m_chunk.begin(), - user->m_chunk.size(), NULL); + merged_chunk.set_content(0, user->m_chunk.begin(), + user->m_chunk.size()); return true; } if (NULL == user) { - merged_chunk.set_chunk(system->m_chunk.begin(), - system->m_chunk.size(), NULL); + merged_chunk.set_content(0, system->m_chunk.begin(), + system->m_chunk.size()); return true; } |