diff options
author | Linus Nielsen Feltzing <linus@haxx.se> | 2006-03-01 13:31:36 +0000 |
---|---|---|
committer | Linus Nielsen Feltzing <linus@haxx.se> | 2006-03-01 13:31:36 +0000 |
commit | f954a53da5edc1fc0a46c9a9cedb9ddaf5b0bf1f (patch) | |
tree | 0a34258c6975c4eb311be40e079e4aa7ea1c41ff /apps/plugins/viewer.c | |
parent | 342a7aacda674ffcdd26980014b1a628b3407e43 (diff) | |
download | rockbox-f954a53da5edc1fc0a46c9a9cedb9ddaf5b0bf1f.tar.gz rockbox-f954a53da5edc1fc0a46c9a9cedb9ddaf5b0bf1f.zip |
Quick hack to restore the reading of ISO encoded text files with the viewer plugin
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@8875 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'apps/plugins/viewer.c')
-rw-r--r-- | apps/plugins/viewer.c | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/apps/plugins/viewer.c b/apps/plugins/viewer.c index f0f900cf4f..f8e72be445 100644 --- a/apps/plugins/viewer.c +++ b/apps/plugins/viewer.c | |||
@@ -598,6 +598,9 @@ static void viewer_draw(int col) | |||
598 | unsigned char *line_end; | 598 | unsigned char *line_end; |
599 | unsigned char c; | 599 | unsigned char c; |
600 | unsigned char scratch_buffer[MAX_COLUMNS + 1]; | 600 | unsigned char scratch_buffer[MAX_COLUMNS + 1]; |
601 | unsigned char utf8_buffer[MAX_COLUMNS*4 + 1]; | ||
602 | int len; | ||
603 | unsigned char *endptr; | ||
601 | 604 | ||
602 | 605 | ||
603 | /* If col==-1 do all calculations but don't display */ | 606 | /* If col==-1 do all calculations but don't display */ |
@@ -685,7 +688,11 @@ static void viewer_draw(int col) | |||
685 | if (col != -1) | 688 | if (col != -1) |
686 | if (k > col) { | 689 | if (k > col) { |
687 | scratch_buffer[k] = 0; | 690 | scratch_buffer[k] = 0; |
688 | rb->lcd_puts(left_col, i, scratch_buffer + col); | 691 | endptr = rb->iso_decode(scratch_buffer + col, utf8_buffer, |
692 | -1, k-col); | ||
693 | *endptr = 0; | ||
694 | len = rb->utf8length(utf8_buffer); | ||
695 | rb->lcd_puts(left_col, i, utf8_buffer); | ||
689 | } | 696 | } |
690 | } | 697 | } |
691 | else if (line_mode == REFLOW) { | 698 | else if (line_mode == REFLOW) { |
@@ -773,7 +780,11 @@ static void viewer_draw(int col) | |||
773 | if (col != -1) | 780 | if (col != -1) |
774 | if (k > col) { | 781 | if (k > col) { |
775 | scratch_buffer[k] = 0; | 782 | scratch_buffer[k] = 0; |
776 | rb->lcd_puts(left_col, i, scratch_buffer + col); | 783 | endptr = rb->iso_decode(scratch_buffer + col, utf8_buffer, |
784 | -1, k-col); | ||
785 | *endptr = 0; | ||
786 | len = rb->utf8length(utf8_buffer); | ||
787 | rb->lcd_puts(left_col, i, utf8_buffer); | ||
777 | } | 788 | } |
778 | } | 789 | } |
779 | else { /* line_mode != JOIN && line_mode != REFLOW */ | 790 | else { /* line_mode != JOIN && line_mode != REFLOW */ |
@@ -781,7 +792,11 @@ static void viewer_draw(int col) | |||
781 | if (line_len > col) { | 792 | if (line_len > col) { |
782 | c = line_end[0]; | 793 | c = line_end[0]; |
783 | line_end[0] = 0; | 794 | line_end[0] = 0; |
784 | rb->lcd_puts(left_col, i, line_begin + col); | 795 | endptr = rb->iso_decode(line_begin + col, utf8_buffer, |
796 | -1, line_end-line_begin); | ||
797 | *endptr = 0; | ||
798 | len = rb->utf8length(utf8_buffer); | ||
799 | rb->lcd_puts(left_col, i, utf8_buffer); | ||
785 | line_end[0] = c; | 800 | line_end[0] = c; |
786 | } | 801 | } |
787 | } | 802 | } |