Skip to content

Commit 090a854

Browse files
committed
gfxlib2: internal: const GFXDRIVER
- normalize const qualifier on GFXDRIVER variables (previously a mix of const and non-const usages) - fix comments for GFXDRIVER procedure descriptions
1 parent 4220fc3 commit 090a854

19 files changed

+148
-132
lines changed

src/gfxlib2/dos/gfx_dos.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99
#define TIMER_HZ 1000
1010

1111
/* driver list */
12-
extern GFXDRIVER fb_gfxDriverVESAlinear;
13-
extern GFXDRIVER fb_gfxDriverVESA;
14-
extern GFXDRIVER fb_gfxDriverBIOS;
15-
extern GFXDRIVER fb_gfxDriverVGA;
16-
extern GFXDRIVER fb_gfxDriverModeX;
12+
extern const GFXDRIVER fb_gfxDriverVESAlinear;
13+
extern const GFXDRIVER fb_gfxDriverVESA;
14+
extern const GFXDRIVER fb_gfxDriverBIOS;
15+
extern const GFXDRIVER fb_gfxDriverVGA;
16+
extern const GFXDRIVER fb_gfxDriverModeX;
1717

1818
const GFXDRIVER *__fb_gfx_drivers_list[] = {
1919
&fb_gfxDriverVESAlinear,

src/gfxlib2/dos/gfx_driver_bios.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ static void driver_update_bpp4(void);
1414
static void end_of_driver_update(void);
1515
static int *driver_fetch_modes(int depth, int *size);
1616

17-
GFXDRIVER fb_gfxDriverBIOS =
17+
/* GFXDRIVER */
18+
const GFXDRIVER fb_gfxDriverBIOS =
1819
{
1920
"BIOS", /* char *name; */
2021
driver_init, /* int (*init)(char *title, int w, int h, int depth, int refresh_rate, int flags); */

src/gfxlib2/dos/gfx_driver_modex.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ static void driver_update(void);
1515
static void end_of_driver_update(void);
1616
static int *driver_fetch_modes(int depth, int *size);
1717

18-
GFXDRIVER fb_gfxDriverModeX =
18+
/* GFXDRIVER */
19+
const GFXDRIVER fb_gfxDriverModeX =
1920
{
2021
"ModeX", /* char *name; */
2122
driver_init, /* int (*init)(char *title, int w, int h, int depth, int refresh_rate, int flags); */

src/gfxlib2/dos/gfx_driver_vesa_bnk.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ static void fb_dos_vesa_set_bank_int_end(void);
1212
extern void fb_dos_vesa_set_bank_pm(void);
1313
extern void fb_dos_vesa_set_bank_pm_end(void);
1414

15-
GFXDRIVER fb_gfxDriverVESA =
15+
/* GFXDRIVER */
16+
const GFXDRIVER fb_gfxDriverVESA =
1617
{
1718
"VESA banked", /* char *name; */
1819
driver_init, /* int (*init)(char *title, int w, int h, int depth, int refresh_rate, int flags); */

src/gfxlib2/dos/gfx_driver_vesa_lin.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ static void driver_exit(void);
1111
static void driver_update(void);
1212
static void end_of_driver_update(void);
1313

14-
GFXDRIVER fb_gfxDriverVESAlinear =
14+
/* GFXDRIVER */
15+
const GFXDRIVER fb_gfxDriverVESAlinear =
1516
{
1617
"VESA linear", /* char *name; */
1718
driver_init, /* int (*init)(char *title, int w, int h, int depth, int refresh_rate, int flags); */

src/gfxlib2/dos/gfx_driver_vga.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ static void driver_update(void);
1010
static void end_of_driver_update(void);
1111
static int *driver_fetch_modes(int depth, int *size);
1212

13-
GFXDRIVER fb_gfxDriverVGA =
13+
/* GFXDRIVER */
14+
const GFXDRIVER fb_gfxDriverVGA =
1415
{
1516
"VGA", /* char *name; */
1617
driver_init, /* int (*init)(char *title, int w, int h, int depth, int refresh_rate, int flags); */
@@ -29,17 +30,17 @@ GFXDRIVER fb_gfxDriverVGA =
2930
};
3031

3132
static int modes[] = {
32-
SCREENLIST(320, 200),
33-
SCREENLIST(320, 100),
34-
SCREENLIST(256, 256),
35-
SCREENLIST(160, 120),
36-
SCREENLIST(80, 80)
33+
SCREENLIST(320, 200),
34+
SCREENLIST(320, 100),
35+
SCREENLIST(256, 256),
36+
SCREENLIST(160, 120),
37+
SCREENLIST(80, 80)
3738
};
3839

3940
static int driver_init(char *title, int w, int h, int depth_arg, int refresh_rate, int flags)
4041
{
41-
int depth = depth_arg;
42-
int c;
42+
int depth = depth_arg;
43+
int c;
4344

4445
fb_dos_detect();
4546

src/gfxlib2/gfx_driver_null.c

Lines changed: 15 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,23 @@
44

55
static void driver_dummy(void);
66

7+
/* GFXDRIVER */
78
const GFXDRIVER __fb_gfxDriverNull =
89
{
9-
"Null", /* char *name; */
10-
NULL, /* int (*init)(int w, int h, char *title, int fullscreen); */
11-
NULL, /* void (*exit)(void); */
12-
driver_dummy, /* void (*lock)(void); */
13-
driver_dummy, /* void (*unlock)(void); */
14-
NULL, /* void (*set_palette)(int index, int r, int g, int b); */
15-
NULL, /* void (*wait_vsync)(void); */
16-
NULL, /* int (*get_mouse)(int *x, int *y, int *z, int *buttons); */
17-
NULL, /* void (*set_mouse)(int x, int y, int cursor); */
18-
NULL, /* void (*set_window_title)(char *title); */
19-
NULL, /* int (*set_window_pos)(int x, int y); */
20-
NULL, /* int *(*fetch_modes)(int depth, int *size); */
21-
NULL, /* void (*flip)(void); */
22-
NULL /* void (*poll_events)(void); */
10+
"Null", /* char *name; */
11+
NULL, /* int (*init)(char *title, int w, int h, int depth, int refresh_rate, int flags); */
12+
NULL, /* void (*exit)(void); */
13+
driver_dummy, /* void (*lock)(void); */
14+
driver_dummy, /* void (*unlock)(void); */
15+
NULL, /* void (*set_palette)(int index, int r, int g, int b); */
16+
NULL, /* void (*wait_vsync)(void); */
17+
NULL, /* int (*get_mouse)(int *x, int *y, int *z, int *buttons); */
18+
NULL, /* void (*set_mouse)(int x, int y, int cursor); */
19+
NULL, /* void (*set_window_title)(char *title); */
20+
NULL, /* int (*set_window_pos)(int x, int y); */
21+
NULL, /* int *(*fetch_modes)(int depth, int *size); */
22+
NULL, /* void (*flip)(void); */
23+
NULL /* void (*poll_events)(void); */
2324
};
2425

2526
static void driver_dummy(void)

src/gfxlib2/js/gfx_driver.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,7 @@ static void driver_set_window_title(char *title)
259259
SDL_WM_SetCaption(title, NULL);
260260
}
261261

262+
/* GFXDRIVER */
262263
static const GFXDRIVER fb_gfxDriverJS =
263264
{
264265
"asmjs", /* char *name; */
@@ -277,11 +278,12 @@ static const GFXDRIVER fb_gfxDriverJS =
277278
driver_poll_events /* void (*poll_events)(void); */
278279
};
279280

281+
/* GFXDRIVER */
280282
static const GFXDRIVER fb_gfxWebGL =
281283
{
282284
"WebGL", /* char *name; */
283-
WGL_init, /* int (*init)(char *title, int w, int h, int depth, int refresh_rate, int flags); */
284-
WGL_exit, /* void (*exit)(void); */
285+
WGL_init, /* int (*init)(char *title, int w, int h, int depth, int refresh_rate, int flags); */
286+
WGL_exit, /* void (*exit)(void); */
285287
driver_lock, /* void (*lock)(void); */
286288
driver_unlock, /* void (*unlock)(void); */
287289
NULL, /* void (*set_palette)(int index, int r, int g, int b); */
@@ -291,7 +293,7 @@ static const GFXDRIVER fb_gfxWebGL =
291293
driver_set_window_title, /* void (*set_window_title)(char *title); */
292294
NULL, /* int (*set_window_pos)(int x, int y); */
293295
driver_fetch_modes, /* int *(*fetch_modes)(int depth, int *size); */
294-
WGL_Flip, /* void (*flip)(void); */
296+
WGL_Flip, /* void (*flip)(void); */
295297
driver_poll_events /* void (*poll_events)(void); */
296298
};
297299

src/gfxlib2/linux/fb_gfx_linux.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77

88
#define DOUBLE_CLICK_TIME 250
99

10-
extern GFXDRIVER fb_gfxDriverFBDev;
10+
extern const GFXDRIVER fb_gfxDriverFBDev;
1111

1212
extern int fb_hFBDevInfo(ssize_t *width, ssize_t *height, ssize_t *depth, ssize_t *refresh);
1313

src/gfxlib2/linux/gfx_driver_fbdev.c

Lines changed: 16 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -42,22 +42,23 @@ static int driver_get_mouse(int *x, int *y, int *z, int *buttons, int *clip);
4242
static void driver_set_mouse(int x, int y, int cursor, int clip);
4343
static int *driver_fetch_modes(int depth, int *size);
4444

45-
GFXDRIVER fb_gfxDriverFBDev =
45+
/* GFXDRIVER */
46+
const GFXDRIVER fb_gfxDriverFBDev =
4647
{
47-
"FBDev", /* char *name; */
48-
driver_init, /* int (*init)(int w, int h, char *title, int fullscreen); */
49-
driver_exit, /* void (*exit)(void); */
50-
driver_lock, /* void (*lock)(void); */
51-
driver_unlock, /* void (*unlock)(void); */
52-
driver_set_palette, /* void (*set_palette)(int index, int r, int g, int b); */
53-
driver_wait_vsync, /* void (*wait_vsync)(void); */
54-
driver_get_mouse, /* int (*get_mouse)(int *x, int *y, int *z, int *buttons, int *clip); */
55-
driver_set_mouse, /* void (*set_mouse)(int x, int y, int cursor, int clip); */
56-
NULL, /* void (*set_window_title)(char *title); */
57-
NULL, /* int (*set_window_pos)(int x, int y); */
58-
driver_fetch_modes, /* int *(*fetch_modes)(void); */
59-
NULL, /* void (*flip)(void); */
60-
NULL /* void (*poll_events)(void); */
48+
"FBDev", /* char *name; */
49+
driver_init, /* int (*init)(char *title, int w, int h, int depth, int refresh_rate, int flags); */
50+
driver_exit, /* void (*exit)(void); */
51+
driver_lock, /* void (*lock)(void); */
52+
driver_unlock, /* void (*unlock)(void); */
53+
driver_set_palette, /* void (*set_palette)(int index, int r, int g, int b); */
54+
driver_wait_vsync, /* void (*wait_vsync)(void); */
55+
driver_get_mouse, /* int (*get_mouse)(int *x, int *y, int *z, int *buttons, int *clip); */
56+
driver_set_mouse, /* void (*set_mouse)(int x, int y, int cursor, int clip); */
57+
NULL, /* void (*set_window_title)(char *title); */
58+
NULL, /* int (*set_window_pos)(int x, int y); */
59+
driver_fetch_modes, /* int *(*fetch_modes)(void); */
60+
NULL, /* void (*flip)(void); */
61+
NULL /* void (*poll_events)(void); */
6162
};
6263

6364

0 commit comments

Comments
 (0)