Merge lp:~lool/usplash/misc-fixes into lp:usplash

Proposed by Loïc Minier
Status: Merged
Merged at revision: not available
Proposed branch: lp:~lool/usplash/misc-fixes
Merge into: lp:usplash
Diff against target: None lines
To merge this branch: bzr merge lp:~lool/usplash/misc-fixes
To post a comment you must log in.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2009-06-22 10:49:51 +0000
3+++ debian/changelog 2009-08-05 10:27:48 +0000
4@@ -1,3 +1,17 @@
5+usplash (0.5.33) UNRELEASED; urgency=low
6+
7+ * Fix return type of strncspn in libusplash.h
8+ * Include usplash-theme.h from libusplash.h as it uses struct usplash_theme
9+ in declarations.
10+ * Include libusplash.h in libusplash.c to ensure sanity of prototypes.
11+ * Remove duplicate testcard_theme definition from libusplash.c.
12+ * libusplash.c: drop most prototypes for non-static functions which are
13+ already declared in libusplash.h.
14+ * Add usplash_sanity_check_theme() and use it to reject themes which have a
15+ textbox which overflows the theme dimensions; LP: #401432.
16+
17+ -- Loïc Minier <lool@dooz.org> Wed, 05 Aug 2009 11:00:08 +0100
18+
19 usplash (0.5.32) karmic; urgency=low
20
21 * Update Launchpad bug-filing URLs.
22
23=== modified file 'libusplash.c'
24--- libusplash.c 2009-03-09 22:06:48 +0000
25+++ libusplash.c 2009-08-05 10:27:48 +0000
26@@ -57,6 +57,8 @@
27 #include "usplash.h"
28 #include "usplash-theme.h"
29
30+#include "libusplash.h"
31+
32 /*
33 * This shouldn't be needed any more now that animation takes place
34 * outside the alarm handler. However, removing it seems to introduce
35@@ -67,24 +69,6 @@
36 #define unblocksig() do{ sigprocmask(SIG_UNBLOCK, &sigs, NULL); } while(0)
37
38 /* Prototypes of non-static functions */
39-void switch_console(int vt, int vt_fd);
40-void flush_stdin();
41-
42-void clear_screen(void);
43-
44-void clear_progressbar(void);
45-void draw_progressbar(int percentage);
46-
47-void clear_text(void);
48-void draw_text(const char *string, size_t len);
49-void draw_status(const char *string, size_t len, int mode);
50-
51-int handle_input(const char *string, size_t len, int quiet);
52-int handle_timeout_input(const char *string, size_t len, int quiet,int timeout);
53-
54-int handle_input_char();
55-int handle_verbose(int mode);
56-
57 /* Helpers for video implementations */
58 void usplash_restore_console(void);
59 void usplash_save_font(void);
60@@ -97,9 +81,6 @@
61 static void draw_newline(void);
62 static void draw_chars(const char *string, size_t len);
63
64-/* Default theme, used when no suitable alternative can be found */
65-extern struct usplash_theme testcard_theme;
66-
67 /* Theme being used */
68 struct usplash_theme *theme;
69
70@@ -460,6 +441,13 @@
71 return theme->theme_height ? theme->theme_height : theme->pixmap->height;
72 }
73
74+int usplash_sanity_check_theme(struct usplash_theme* theme)
75+{
76+ USPLASH_THEME_ASSERT(theme->theme_width && theme->text_x + theme->text_width > theme->theme_width)
77+ USPLASH_THEME_ASSERT(theme->theme_width && theme->text_x + theme->text_width > theme->theme_width)
78+ return 0;
79+}
80+
81 int usplash_setup(int xres, int yres, int v)
82 {
83 int ret;
84@@ -526,7 +514,8 @@
85 if (usplash_theme_height(theme) <= yres
86 && usplash_theme_width(theme) <= xres
87 && usplash_theme_height(theme) * usplash_theme_width(theme) > maxarea
88- && theme->ratio == ratio) {
89+ && theme->ratio == ratio
90+ && usplash_sanity_check_theme(theme) == 0) {
91 maxarea = usplash_theme_height(theme) * usplash_theme_width(theme);
92 htheme = theme;
93 }
94
95=== modified file 'libusplash.h'
96--- libusplash.h 2009-02-07 14:41:49 +0000
97+++ libusplash.h 2009-08-05 10:27:48 +0000
98@@ -17,6 +17,8 @@
99 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
100 */
101
102+#include "usplash-theme.h"
103+
104 void switch_console(int vt, int vt_fd);
105 void flush_stdin();
106
107@@ -34,8 +36,20 @@
108 void request_animate_step();
109 void process_pending_animation_steps();
110 void animate_step(int pulsating);
111+
112+#define USPLASH_THEME_ASSERT(expr) \
113+ if (expr) { \
114+ fprintf(stderr, \
115+ "usplash: rejecting theme %s %dx%d (assertion %s failed); please file a bug\n", \
116+ USPLASH_THEME, \
117+ theme->theme_width, theme->theme_height, \
118+ #expr); \
119+ return -1; \
120+ }
121+
122+int usplash_sanity_check_theme(struct usplash_theme* theme);
123 int usplash_setup(int xres, int yres, int verbose);
124-int strncspn(const char *s, size_t n, const char *reject);
125+size_t strncspn(const char *s, size_t n, const char *reject);
126 int handle_input(const char *string, size_t len, int quiet);
127 int handle_timeout_input(const char *string, size_t len, int quiet,int timeout);
128 int handle_input_char();
129@@ -43,6 +57,7 @@
130 int usplash_timeout_get_string(char *inputbuf, int length, int quiet, int inputtimeout);
131 #define usplash_get_string(buf,length,quiet) usplash_timeout_get_string(buf,length,quiet,-1)
132
133+/* Default theme, used when no suitable alternative can be found */
134 extern struct usplash_theme testcard_theme;
135 extern struct usplash_theme *theme;
136 extern int usplash_xres, usplash_yres;

Subscribers

People subscribed via source and target branches

to all changes:
to status/vote changes: