1 |
eva 07/11/04 22:57:48 |
2 |
|
3 |
Added: link-grammar-4.2.4-tokenize.patch |
4 |
digest-link-grammar-4.2.4-r1 |
5 |
Log: |
6 |
fix repoman warnings and fix bug #196803 |
7 |
(Portage version: 2.1.3.16) |
8 |
|
9 |
Revision Changes Path |
10 |
1.1 dev-libs/link-grammar/files/link-grammar-4.2.4-tokenize.patch |
11 |
|
12 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-libs/link-grammar/files/link-grammar-4.2.4-tokenize.patch?rev=1.1&view=markup |
13 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-libs/link-grammar/files/link-grammar-4.2.4-tokenize.patch?rev=1.1&content-type=text/plain |
14 |
|
15 |
Index: link-grammar-4.2.4-tokenize.patch |
16 |
=================================================================== |
17 |
Index: tokenize.c |
18 |
=================================================================== |
19 |
RCS file: /cvsroot/link-grammar/link-grammar/tokenize.c,v |
20 |
retrieving revision 1.3 |
21 |
retrieving revision 1.4 |
22 |
diff -u -b -B -r1.3 -r1.4 |
23 |
--- link-grammar/link-grammar/tokenize.c 16 Aug 2006 17:07:02 -0000 1.3 |
24 |
+++ link-grammar/link-grammar/tokenize.c 27 Oct 2007 19:03:40 -0000 1.4 |
25 |
@@ -172,7 +172,8 @@ |
26 |
used in a sentence. |
27 |
*/ |
28 |
|
29 |
- |
30 |
+#undef MIN |
31 |
+#define MIN(a, b) (((a) < (b)) ? (a) : (b)) |
32 |
|
33 |
static int separate_word(Sentence sent, char *w, char *wend, int is_first_word, int quote_found) { |
34 |
/* w points to a string, wend points to the char one after the end. The |
35 |
@@ -256,8 +257,8 @@ |
36 |
|
37 |
for (n_r_stripped = 0; n_r_stripped < MAX_STRIP; n_r_stripped++) { |
38 |
|
39 |
- strncpy(word, w, wend-w); |
40 |
- word[wend-w] = '\0'; |
41 |
+ strncpy(word, w, MIN(wend-w, MAX_WORD)); |
42 |
+ word[MIN(wend-w, MAX_WORD)] = '\0'; |
43 |
if (wend == w) break; /* it will work without this */ |
44 |
|
45 |
if (boolean_dictionary_lookup(sent->dict, word) || is_initials_word(word)) break; |
46 |
@@ -285,8 +286,8 @@ |
47 |
/* Now we strip off suffixes...w points to the remaining word, "wend" to the end of the word. */ |
48 |
|
49 |
s_stripped = -1; |
50 |
- strncpy(word, w, wend-w); |
51 |
- word[wend-w] = '\0'; |
52 |
+ strncpy(word, w, MIN(wend-w, MAX_WORD)); |
53 |
+ word[MIN(wend-w, MAX_WORD)] = '\0'; |
54 |
word_is_in_dict=0; |
55 |
|
56 |
if (boolean_dictionary_lookup(sent->dict, word) || is_initials_word(word)) word_is_in_dict=1; |
57 |
@@ -309,16 +310,16 @@ |
58 |
|
59 |
if(s_ok==1 || i==s_strippable) { |
60 |
|
61 |
- strncpy(newword, w, (wend-len)-w); |
62 |
- newword[(wend-len)-w] = '\0'; |
63 |
+ strncpy(newword, w, MIN((wend-len)-w, MAX_WORD)); |
64 |
+ newword[MIN((wend-len)-w, MAX_WORD)] = '\0'; |
65 |
|
66 |
/* Check if the remainder is in the dictionary; for the no-suffix case, it won't be */ |
67 |
if (boolean_dictionary_lookup(sent->dict, newword)) { |
68 |
if(verbosity>1) if(i< s_strippable) printf("Splitting word into two: %s-%s\n", newword, suffix[i]); |
69 |
s_stripped = i; |
70 |
wend -= len; |
71 |
- strncpy(word, w, wend-w); |
72 |
- word[wend-w] = '\0'; |
73 |
+ strncpy(word, w, MIN(wend-w, MAX_WORD)); |
74 |
+ word[MIN(wend-w, MAX_WORD)] = '\0'; |
75 |
break; |
76 |
} |
77 |
|
78 |
@@ -326,16 +327,16 @@ |
79 |
else { |
80 |
for (j=0; j<p_strippable; j++) { |
81 |
if (strncmp(w, prefix[j], strlen(prefix[j])) == 0) { |
82 |
- strncpy(newword, w+strlen(prefix[j]), (wend-len)-(w+strlen(prefix[j]))); |
83 |
- newword[(wend-len)-(w+strlen(prefix[j]))]='\0'; |
84 |
+ strncpy(newword, w+strlen(prefix[j]), MIN((wend-len)-(w+strlen(prefix[j])), MAX_WORD)); |
85 |
+ newword[MIN((wend-len)-(w+strlen(prefix[j])), MAX_WORD)]='\0'; |
86 |
if(boolean_dictionary_lookup(sent->dict, newword)) { |
87 |
if(verbosity>1) if(i < s_strippable) printf("Splitting word into three: %s-%s-%s\n", prefix[j], newword, suffix[i]); |
88 |
if (!issue_sentence_word(sent, prefix[j])) return FALSE; |
89 |
if(i < s_strippable) s_stripped = i; |
90 |
wend -= len; |
91 |
w += strlen(prefix[j]); |
92 |
- strncpy(word, w, wend-w); |
93 |
- word[wend-w] = '\0'; |
94 |
+ strncpy(word, w, MIN(wend-w, MAX_WORD)); |
95 |
+ word[MIN(wend-w, MAX_WORD)] = '\0'; |
96 |
break; |
97 |
} |
98 |
} |
99 |
|
100 |
|
101 |
|
102 |
|
103 |
1.1 dev-libs/link-grammar/files/digest-link-grammar-4.2.4-r1 |
104 |
|
105 |
file : http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-libs/link-grammar/files/digest-link-grammar-4.2.4-r1?rev=1.1&view=markup |
106 |
plain: http://sources.gentoo.org/viewcvs.py/gentoo-x86/dev-libs/link-grammar/files/digest-link-grammar-4.2.4-r1?rev=1.1&content-type=text/plain |
107 |
|
108 |
Index: digest-link-grammar-4.2.4-r1 |
109 |
=================================================================== |
110 |
MD5 56ed2a55cc6d2c8ec013b75bd0bcc01b link-grammar-4.2.4.tar.gz 741007 |
111 |
RMD160 40cdb470201a3c935c53670534613e1fdddf7c3c link-grammar-4.2.4.tar.gz 741007 |
112 |
SHA256 e28cf49636d83c8faf487718c913d8fc9d01a54c1c63dc9cd995f4e669a4a740 link-grammar-4.2.4.tar.gz 741007 |
113 |
|
114 |
|
115 |
|
116 |
-- |
117 |
gentoo-commits@g.o mailing list |