comparison plugins/spellchk.c @ 6250:1c8caacac1de

[gaim-migrate @ 6746] Fixes bug #725868 - caused Win (ME, 98) Gaim to crash oncalls to isspace and ispunct committer: Tailor Script <tailor@pidgin.im>
author Herman Bloggs <hermanator12002@yahoo.com>
date Sun, 20 Jul 2003 23:47:00 +0000
parents de49cfd8fd59
children 8f94cce8faa5
comparison
equal deleted inserted replaced
6249:2c567a03a34a 6250:1c8caacac1de
130 int state = 0; 130 int state = 0;
131 131
132 for (pos = 0; pos < strlen(m); pos++) { 132 for (pos = 0; pos < strlen(m); pos++) {
133 switch (state) { 133 switch (state) {
134 case 0: /* expecting word */ 134 case 0: /* expecting word */
135 if (!isspace(m[pos]) && !ispunct(m[pos])) { 135 if (!g_ascii_isspace(m[pos]) && !g_ascii_ispunct(m[pos])) {
136 count++; 136 count++;
137 state = 1; 137 state = 1;
138 } else if (m[pos] == '<') 138 } else if (m[pos] == '<')
139 state = 2; 139 state = 2;
140 break; 140 break;
141 case 1: /* inside word */ 141 case 1: /* inside word */
142 if (m[pos] == '<') 142 if (m[pos] == '<')
143 state = 2; 143 state = 2;
144 else if (isspace(m[pos]) || ispunct(m[pos])) 144 else if (g_ascii_isspace(m[pos]) || g_ascii_ispunct(m[pos]))
145 state = 0; 145 state = 0;
146 break; 146 break;
147 case 2: /* inside HTML tag */ 147 case 2: /* inside HTML tag */
148 if (m[pos] == '>') 148 if (m[pos] == '>')
149 state = 0; 149 state = 0;
159 int state = 0; 159 int state = 0;
160 160
161 for (pos = 0; pos < strlen(m) && count <= word; pos++) { 161 for (pos = 0; pos < strlen(m) && count <= word; pos++) {
162 switch (state) { 162 switch (state) {
163 case 0: 163 case 0:
164 if (!isspace(m[pos]) && !ispunct(m[pos])) { 164 if (!g_ascii_isspace(m[pos]) && !g_ascii_ispunct(m[pos])) {
165 count++; 165 count++;
166 state = 1; 166 state = 1;
167 } else if (m[pos] == '<') 167 } else if (m[pos] == '<')
168 state = 2; 168 state = 2;
169 break; 169 break;
170 case 1: 170 case 1:
171 if (m[pos] == '<') 171 if (m[pos] == '<')
172 state = 2; 172 state = 2;
173 else if (isspace(m[pos]) || ispunct(m[pos])) 173 else if (g_ascii_isspace(m[pos]) || g_ascii_ispunct(m[pos]))
174 state = 0; 174 state = 0;
175 break; 175 break;
176 case 2: 176 case 2:
177 if (m[pos] == '>') 177 if (m[pos] == '>')
178 state = 0; 178 state = 0;
347 gtk_widget_set_sensitive((GtkWidget*)data, is); 347 gtk_widget_set_sensitive((GtkWidget*)data, is);
348 } 348 }
349 349
350 static gboolean non_empty(const char *s) 350 static gboolean non_empty(const char *s)
351 { 351 {
352 while(*s && isspace(*s)) 352 while(*s && g_ascii_isspace(*s))
353 s++; 353 s++;
354 return *s; 354 return *s;
355 } 355 }
356 356
357 static void on_entry_changed(GtkEditable *editable, gpointer data) 357 static void on_entry_changed(GtkEditable *editable, gpointer data)