| ... | ... |
@@ -103,6 +103,6 @@ const size_t bonus_index[256] = {
|
| 103 | 103 |
ASSIGN_DIGIT(1) |
| 104 | 104 |
}; |
| 105 | 105 |
|
| 106 |
-#define COMPUTE_BONUS(last_ch, ch) (bonus_states[bonus_index[(size_t)(ch)]][(size_t)(last_ch)]) |
|
| 106 |
+#define COMPUTE_BONUS(last_ch, ch) (bonus_states[bonus_index[(unsigned char)(ch)]][(unsigned char)(last_ch)]) |
|
| 107 | 107 |
|
| 108 | 108 |
#endif |
| ... | ... |
@@ -268,6 +268,17 @@ void test_choices_without_search() {
|
| 268 | 268 |
choices_destroy(&choices); |
| 269 | 269 |
} |
| 270 | 270 |
|
| 271 |
+/* Regression test for segfault */ |
|
| 272 |
+void test_choices_unicode() {
|
|
| 273 |
+ choices_t choices; |
|
| 274 |
+ choices_init(&choices); |
|
| 275 |
+ |
|
| 276 |
+ choices_add(&choices, "Edmund Husserl - Méditations cartésiennes - Introduction a la phénoménologie.pdf"); |
|
| 277 |
+ choices_search(&choices, "e"); |
|
| 278 |
+ |
|
| 279 |
+ choices_destroy(&choices); |
|
| 280 |
+} |
|
| 281 |
+ |
|
| 271 | 282 |
void summary() {
|
| 272 | 283 |
printf("%i tests, %i assertions, %i failures\n", testsrun, assertionsrun, testsfailed);
|
| 273 | 284 |
} |
| ... | ... |
@@ -298,6 +309,7 @@ int main(int argc, char *argv[]) {
|
| 298 | 309 |
runtest(test_choices_1); |
| 299 | 310 |
runtest(test_choices_2); |
| 300 | 311 |
runtest(test_choices_without_search); |
| 312 |
+ runtest(test_choices_unicode); |
|
| 301 | 313 |
|
| 302 | 314 |
summary(); |
| 303 | 315 |
|