update libpinyin-0.3.x-head.patch

This commit is contained in:
Peng Wu 2011-10-27 14:49:04 +08:00
parent c5a3b8596b
commit 42d213c0be
2 changed files with 53 additions and 3 deletions

View File

@ -1,7 +1,7 @@
From 127a5ce640ec5282bbb4b473c01c5366e3c5e2f2 Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Tue, 11 Oct 2011 14:56:23 +0800
Subject: [PATCH 1/2] fixes fsf address
Subject: [PATCH 1/3] fixes fsf address
---
src/include/memory_chunk.h | 2 +-
@ -769,7 +769,7 @@ index 5fc7031..b9b864c 100644
From 6df832baaa4c06bcffed93620edf5431ee9249fc Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Wed, 26 Oct 2011 10:22:44 +0800
Subject: [PATCH 2/2] add m_modified
Subject: [PATCH 2/3] add m_modified
---
src/pinyin.cpp | 14 ++++++++++----
@ -847,3 +847,50 @@ index c8eff79..46269e1 100644
--
1.7.6.4
From cdd9f5355a24f59f3aa587842d5b0a7e9fce4394 Mon Sep 17 00:00:00 2001
From: Peng Wu <alexepico@gmail.com>
Date: Thu, 27 Oct 2011 14:37:43 +0800
Subject: [PATCH 3/3] fixes load_db
---
src/storage/ngram.cpp | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diff --git a/src/storage/ngram.cpp b/src/storage/ngram.cpp
index 17c7e9b..fedd744 100644
--- a/src/storage/ngram.cpp
+++ b/src/storage/ngram.cpp
@@ -224,20 +224,22 @@ bool SingleGram::set_freq( /* in */ phrase_token_t token,
bool Bigram::load_db(const char * dbfile){
reset();
- DB * tmp_db = NULL;
- int ret = db_create(&tmp_db, NULL, 0);
+ /* create in memory db. */
+ int ret = db_create(&m_db, NULL, 0);
assert(ret == 0);
- ret = tmp_db->open(tmp_db, NULL, dbfile, NULL,
- DB_HASH, DB_RDONLY, 0600);
+ ret = m_db->open(m_db, NULL, NULL, NULL,
+ DB_HASH, DB_CREATE, 0600);
if ( ret != 0 )
return false;
- ret = db_create(&m_db, NULL, 0);
+ /* load db into memory. */
+ DB * tmp_db = NULL;
+ ret = db_create(&tmp_db, NULL, 0);
assert(ret == 0);
- ret = m_db->open(m_db, NULL, NULL, NULL,
- DB_HASH, DB_CREATE, 0600);
+ ret = tmp_db->open(tmp_db, NULL, dbfile, NULL,
+ DB_HASH, DB_RDONLY, 0600);
if ( ret != 0 )
return false;
--
1.7.6.4

View File

@ -1,6 +1,6 @@
Name: libpinyin
Version: 0.2.99.2
Release: 3%{?dist}
Release: 4%{?dist}
Summary: Library to deal with pinyin
License: GPLv2+
@ -70,6 +70,9 @@ find $RPM_BUILD_ROOT -name '*.la' -exec rm -f {} ';'
%{_datadir}/libpinyin/data
%changelog
* Thu Oct 27 2011 Peng Wu <pwu@redhat.com> - 0.2.99.2-4
- Update libpinyin-0.3.x-head.patch
* Thu Oct 27 2011 Peng Wu <pwu@redhat.com> - 0.2.99.2-3
- Add requires