diff options
author | Teruaki Kawashima <teru@rockbox.org> | 2010-10-01 14:40:28 +0000 |
---|---|---|
committer | Teruaki Kawashima <teru@rockbox.org> | 2010-10-01 14:40:28 +0000 |
commit | 15e846005388a393cca38d667250cb4f2ddf38b3 (patch) | |
tree | f6cccbbe068d095527bd0e91d0ca1be52dc7a28d /apps/plugins/text_editor.c | |
parent | 55a63609ef1bf24c3594eeb2f6eca92cba81bae5 (diff) | |
download | rockbox-15e846005388a393cca38d667250cb4f2ddf38b3.tar.gz rockbox-15e846005388a393cca38d667250cb4f2ddf38b3.zip |
text editor: decrease size of extension to reduce stack usage.
this could solve crash in text editor (FS#10078).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@28189 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/text_editor.c')
-rw-r--r-- | apps/plugins/text_editor.c | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/apps/plugins/text_editor.c b/apps/plugins/text_editor.c index ceb71e4495..32013b6f28 100644 --- a/apps/plugins/text_editor.c +++ b/apps/plugins/text_editor.c | |||
@@ -410,41 +410,40 @@ enum plugin_status plugin_start(const void* parameter) | |||
410 | if (edit_colors_file && line_count) | 410 | if (edit_colors_file && line_count) |
411 | { | 411 | { |
412 | char *name = temp_line, *value = NULL; | 412 | char *name = temp_line, *value = NULL; |
413 | char extension[MAX_LINE_LEN]; | 413 | char extension[16]; |
414 | int color, old_color; | 414 | int color, old_color; |
415 | bool temp_changed = false; | 415 | bool temp_changed = false; |
416 | |||
417 | MENUITEM_STRINGLIST(menu, "Edit What?", NULL, | ||
418 | "Extension", "Colour"); | ||
419 | |||
416 | rb->settings_parseline(temp_line, &name, &value); | 420 | rb->settings_parseline(temp_line, &name, &value); |
417 | if (line_count) | 421 | rb->strlcpy(extension, name, sizeof(extension)); |
422 | if (value) | ||
423 | my_hex_to_rgb(value, &color); | ||
424 | else | ||
425 | color = 0; | ||
426 | |||
427 | switch (rb->do_menu(&menu, NULL, NULL, false)) | ||
418 | { | 428 | { |
419 | MENUITEM_STRINGLIST(menu, "Edit What?", NULL, | 429 | case 0: |
420 | "Extension", "Colour"); | 430 | temp_changed = !rb->kbd_input(extension, sizeof(extension)); |
421 | rb->strcpy(extension, name); | 431 | break; |
422 | if (value) | 432 | case 1: |
423 | my_hex_to_rgb(value, &color); | 433 | old_color = color; |
424 | else | 434 | rb->set_color(rb->screens[SCREEN_MAIN], name, &color, -1); |
425 | color = 0; | 435 | temp_changed = (value == NULL) || (color != old_color); |
426 | 436 | break; | |
427 | switch (rb->do_menu(&menu, NULL, NULL, false)) | 437 | } |
428 | { | 438 | |
429 | case 0: | 439 | if (temp_changed) |
430 | temp_changed = !rb->kbd_input(extension,MAX_LINE_LEN); | 440 | { |
431 | break; | 441 | rb->snprintf(temp_line, MAX_LINE_LEN, "%s: %02X%02X%02X", |
432 | case 1: | 442 | extension, RGB_UNPACK_RED(color), |
433 | old_color = color; | 443 | RGB_UNPACK_GREEN(color), |
434 | rb->set_color(rb->screens[SCREEN_MAIN], name, &color, -1); | 444 | RGB_UNPACK_BLUE(color)); |
435 | temp_changed = (value == NULL) || (color != old_color); | 445 | do_action(ACTION_UPDATE, temp_line, cur_sel); |
436 | break; | 446 | changed = true; |
437 | } | ||
438 | |||
439 | if (temp_changed) | ||
440 | { | ||
441 | rb->snprintf(temp_line, MAX_LINE_LEN, "%s: %02X%02X%02X", | ||
442 | extension, RGB_UNPACK_RED(color), | ||
443 | RGB_UNPACK_GREEN(color), | ||
444 | RGB_UNPACK_BLUE(color)); | ||
445 | do_action(ACTION_UPDATE, temp_line, cur_sel); | ||
446 | changed = true; | ||
447 | } | ||
448 | } | 447 | } |
449 | } | 448 | } |
450 | else | 449 | else |