diff options
Diffstat (limited to 'apps/plugins/imageviewer/ppm/ppm.c')
-rw-r--r-- | apps/plugins/imageviewer/ppm/ppm.c | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/apps/plugins/imageviewer/ppm/ppm.c b/apps/plugins/imageviewer/ppm/ppm.c index 5e03f8c335..6f59b1f6b0 100644 --- a/apps/plugins/imageviewer/ppm/ppm.c +++ b/apps/plugins/imageviewer/ppm/ppm.c | |||
@@ -75,7 +75,8 @@ static int img_mem(int ds) | |||
75 | } | 75 | } |
76 | 76 | ||
77 | static int load_image(char *filename, struct image_info *info, | 77 | static int load_image(char *filename, struct image_info *info, |
78 | unsigned char *buf, ssize_t *buf_size) | 78 | unsigned char *buf, ssize_t *buf_size, |
79 | int offset, int filesize) | ||
79 | { | 80 | { |
80 | int fd; | 81 | int fd; |
81 | int rc = PLUGIN_OK; | 82 | int rc = PLUGIN_OK; |
@@ -83,7 +84,7 @@ static int load_image(char *filename, struct image_info *info, | |||
83 | int w, h; /* used to center output */ | 84 | int w, h; /* used to center output */ |
84 | 85 | ||
85 | unsigned char *memory, *memory_max; | 86 | unsigned char *memory, *memory_max; |
86 | size_t memory_size, file_size; | 87 | size_t memory_size; |
87 | 88 | ||
88 | /* cleanup */ | 89 | /* cleanup */ |
89 | memset(&disp, 0, sizeof(disp)); | 90 | memset(&disp, 0, sizeof(disp)); |
@@ -100,13 +101,20 @@ static int load_image(char *filename, struct image_info *info, | |||
100 | return PLUGIN_ERROR; | 101 | return PLUGIN_ERROR; |
101 | } | 102 | } |
102 | 103 | ||
103 | file_size = rb->filesize(fd); | 104 | if (offset) |
105 | { | ||
106 | rb->lseek(fd, offset, SEEK_SET); | ||
107 | } | ||
108 | else | ||
109 | { | ||
110 | filesize = rb->filesize(fd); | ||
111 | } | ||
104 | DEBUGF("reading file '%s'\n", filename); | 112 | DEBUGF("reading file '%s'\n", filename); |
105 | 113 | ||
106 | if (!iv->running_slideshow) | 114 | if (!iv->running_slideshow) |
107 | { | 115 | { |
108 | rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1); | 116 | rb->lcd_puts(0, 0, rb->strrchr(filename,'/')+1); |
109 | rb->lcd_putsf(0, 1, "loading %zu bytes", file_size); | 117 | rb->lcd_putsf(0, 1, "loading %zu bytes", filesize); |
110 | rb->lcd_update(); | 118 | rb->lcd_update(); |
111 | } | 119 | } |
112 | 120 | ||