Skip to content

Commit 2e6e325

Browse files
authored
Use const pointers args in functions, no names for unused function args (#138)
1 parent dab2ca6 commit 2e6e325

File tree

16 files changed

+77
-71
lines changed

16 files changed

+77
-71
lines changed

.gitignore

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
*.bin
2-
*.c~
2+
*~
33
*.cas
44
*.d88
5-
*.h~
65
*.swp
6+
*.err
77
.vscode/
88
.vscode/c_cpp_properties.json
99
.vscode/settings.json
@@ -13,6 +13,8 @@ autorun
1313
autorun.atr
1414
autorun.rmm
1515
build
16+
_cache
17+
r2r
1618
config
1719
config.com
1820
config.com.lbl

src/adam/screen.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,18 +38,18 @@ void screen_hosts_and_devices_edit_host_slot(unsigned char i);
3838
void screen_hosts_and_devices_eject(unsigned char ds);
3939
void screen_hosts_and_devices_host_slot_empty(unsigned char hs);
4040

41-
void screen_hosts_and_devices_long_filename(char *f);
41+
void screen_hosts_and_devices_long_filename(const char *f);
4242

4343
void screen_show_info(bool printerEnabled,AdapterConfig* ac);
4444

4545
void screen_select_file(void);
4646
void screen_select_file_display(char *p, char *f);
47-
void screen_select_file_display_long_filename(char *e);
47+
void screen_select_file_display_long_filename(const char *e);
4848
void screen_select_file_clear_long_filename(void);
4949
void screen_select_file_filter(void);
5050
void screen_select_file_next(void);
5151
void screen_select_file_prev(void);
52-
void screen_select_file_display_entry(unsigned char y, char* e, unsigned entryType);
52+
void screen_select_file_display_entry(unsigned char y, const char* e, unsigned entryType);
5353
void screen_select_file_choose(char visibleEntries);
5454
void screen_select_file_new_type(void);
5555
void screen_select_file_new_size(unsigned char k);

src/apple2/screen.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -344,7 +344,7 @@ const char* screen_hosts_and_devices_device_slot(unsigned char hs, bool e, char
344344
return &empty[0];
345345
}
346346

347-
char* screen_hosts_and_devices_slot(char *c)
347+
const char* screen_hosts_and_devices_slot(const char *c)
348348
{
349349
return c[0]==0x00 ? empty : c;
350350
}
@@ -561,7 +561,7 @@ void screen_select_file_prev(void)
561561
}
562562

563563
#pragma warn (unused-param, push, off)
564-
void screen_select_file_display_long_filename(char *e)
564+
void screen_select_file_display_long_filename(const char *e)
565565
{
566566
// it wasn't this.
567567
/* gotoxy(0,19); */
@@ -575,7 +575,7 @@ void screen_select_file_next(void)
575575
}
576576

577577
#pragma warn (unused-param, push, off)
578-
void screen_select_file_display_entry(unsigned char y, char* e, unsigned entryType)
578+
void screen_select_file_display_entry(unsigned char y, const char* e, unsigned entryType)
579579
{
580580
gotoxy(0,y+3);
581581
cprintf("%-40s",&e[2]); // skip the first two chars from FN (hold over from Adam)
@@ -693,7 +693,7 @@ void screen_select_file_new_name(void)
693693
screen_print_menu(" New media: Enter filename \r\n","");
694694
}
695695

696-
void screen_hosts_and_devices_long_filename(char *f)
696+
void screen_hosts_and_devices_long_filename(const char *f)
697697
{
698698
// TODO: implement
699699
if (strlen(f)>31)

src/apple2/screen.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,14 +54,14 @@ void screen_select_file_filter(void);
5454
void screen_select_file_next(void);
5555
void screen_select_file_new_type(void);
5656
void screen_select_file_prev(void);
57-
void screen_select_file_display_long_filename(char *e);
58-
void screen_select_file_display_entry(unsigned char y, char* e, unsigned entryType);
57+
void screen_select_file_display_long_filename(const char *e);
58+
void screen_select_file_display_entry(unsigned char y, const char* e, unsigned entryType);
5959
void screen_select_file_clear_long_filename(void);
6060
void screen_select_file_choose(char visibleEntries);
6161
void screen_select_file_new_size(unsigned char k);
6262
void screen_select_file_new_custom(void);
6363
void screen_select_file_new_name(void);
64-
void screen_hosts_and_devices_long_filename(char *f);
64+
void screen_hosts_and_devices_long_filename(const char *f);
6565
void screen_hosts_and_devices_devices_clear_all(void);
6666
void screen_select_file_new_creating(void);
6767

src/atari/bar.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ static unsigned char bar_y=1;
1515
/**
1616
* Clear bar from screen
1717
*/
18-
void bar_clear(bool old)
18+
void bar_clear(bool)
1919
{
2020
memset(bar_pmbase,0,1024);
2121
}
@@ -100,4 +100,4 @@ void fastcall bar_show(unsigned char y)
100100
}
101101

102102

103-
#endif
103+
#endif

src/atari/input.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ unsigned char input_handle_joystick(void)
8484
return 0;
8585
}
8686

87-
void input_line(unsigned char x, unsigned char y, unsigned char o, char *c, unsigned char l, bool password)
87+
void input_line(unsigned char, unsigned char, unsigned char, char *, unsigned char, bool)
8888
{
8989
}
9090

@@ -107,7 +107,7 @@ void input_line_set_wifi_password(char *c)
107107
edit_line(0, 21, c, 64, true);
108108
}
109109

110-
void input_line_hosts_and_devices_host_slot(unsigned char i, unsigned char o, char *c)
110+
void input_line_hosts_and_devices_host_slot(unsigned char i, unsigned char, char *c)
111111
{
112112
edit_line(5, i + HOSTS_START_Y, c, 32, false);
113113
}
@@ -123,7 +123,7 @@ unsigned char input_select_file_new_type(void)
123123
return 1;
124124
}
125125

126-
unsigned long input_select_file_new_size(unsigned char t)
126+
unsigned long input_select_file_new_size(unsigned char)
127127
{
128128
char temp[8];
129129
memset(temp, 0, sizeof(temp));
@@ -198,9 +198,10 @@ void input_select_file_new_name(char *c)
198198

199199
bool input_select_slot_build_eos_directory(void)
200200
{
201+
return false;
201202
}
202203

203-
void input_select_slot_build_eos_directory_label(char *c)
204+
void input_select_slot_build_eos_directory_label(char *)
204205
{
205206
}
206207

@@ -345,13 +346,13 @@ HDSubState input_hosts_and_devices_hosts(void)
345346
return HD_HOSTS;
346347
case KCODE_RETURN:
347348
selected_host_slot = bar_get() - HOSTS_START_Y;
348-
if ( !wifiEnabled && strcmp(hostSlots[selected_host_slot],"SD") != 0) // Don't go in a TNFS host if wifi is disabled.
349+
if ( !wifiEnabled && strcmp((char *) hostSlots[selected_host_slot],"SD") != 0) // Don't go in a TNFS host if wifi is disabled.
349350
{
350351
return HD_HOSTS;
351352
}
352353
if (hostSlots[selected_host_slot][0] != 0)
353354
{
354-
strcpy(selected_host_name, hostSlots[selected_host_slot]);
355+
strcpy(selected_host_name, (char *) hostSlots[selected_host_slot]);
355356
state = SELECT_FILE;
356357
return HD_DONE;
357358
}
@@ -433,13 +434,13 @@ HDSubState input_hosts_and_devices_devices(void)
433434
// set device mode to read
434435
selected_device_slot = bar_get() - DEVICES_START_Y;
435436
hosts_and_devices_devices_set_mode(MODE_READ);
436-
screen_hosts_and_devices_device_slots(DEVICES_START_Y, &deviceSlots[0], "");
437+
screen_hosts_and_devices_device_slots(DEVICES_START_Y, &deviceSlots[0], (bool *) "");
437438
return HD_DEVICES;
438439
case 'W':
439440
// set device mode to write
440441
selected_device_slot = bar_get() - DEVICES_START_Y;
441442
hosts_and_devices_devices_set_mode(MODE_WRITE);
442-
screen_hosts_and_devices_device_slots(DEVICES_START_Y, &deviceSlots[0], "");
443+
screen_hosts_and_devices_device_slots(DEVICES_START_Y, &deviceSlots[0], (bool *) "");
443444
return HD_DEVICES;
444445
case 'C':
445446
state = SHOW_INFO;

src/atari/io.c

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ bool io_error(void)
3737

3838
unsigned char io_status(void)
3939
{
40+
return 0;
4041
}
4142

4243
void io_init(void)
@@ -156,16 +157,16 @@ void io_open_directory(unsigned char hs, char *p, char *f)
156157
memset(response, 0, 256);
157158
strcpy(response, p);
158159
strcpy(&response[strlen(response) + 1], f);
159-
_p = &response;
160+
_p = response;
160161
}
161162
fuji_open_directory(hs, _p);
162163
}
163164

164165
char *io_read_directory(unsigned char maxlen, unsigned char a)
165166
{
166167
memset(response, 0, maxlen);
167-
fuji_read_directory(maxlen, a, &response);
168-
return &response;
168+
fuji_read_directory(maxlen, a, response);
169+
return response;
169170
}
170171

171172
void io_close_directory(void)
@@ -185,8 +186,8 @@ void io_set_device_filename(unsigned char ds, unsigned char hs, unsigned char mo
185186

186187
char *io_get_device_filename(unsigned char slot)
187188
{
188-
fuji_get_device_filename(slot, &response);
189-
return &response;
189+
fuji_get_device_filename(slot, response);
190+
return response;
190191
}
191192

192193
void io_set_boot_config(unsigned char toggle)
@@ -260,11 +261,11 @@ void io_create_new(unsigned char selected_host_slot, unsigned char selected_devi
260261

261262
}
262263

263-
void io_build_directory(unsigned char ds, unsigned long numBlocks, char *v)
264+
void io_build_directory(unsigned char, unsigned long, char *)
264265
{
265266
}
266267

267-
bool io_get_device_enabled_status(unsigned char d)
268+
bool io_get_device_enabled_status(unsigned char)
268269
{
269270
// adam calls $D1, which doesn't exist in atari.
270271
return false;
@@ -281,11 +282,11 @@ void io_update_devices_enabled(bool *e)
281282
}
282283
}
283284

284-
void io_enable_device(unsigned char d)
285+
void io_enable_device(unsigned char)
285286
{
286287
}
287288

288-
void io_disable_device(unsigned char d)
289+
void io_disable_device(unsigned char)
289290
{
290291
}
291292

@@ -296,11 +297,12 @@ void io_disable_device(unsigned char d)
296297
void io_copy_file(unsigned char source_slot, unsigned char destination_slot)
297298
{
298299
// incrementing is handled in function, we keep everything 0 based
299-
fuji_copy_file(source_slot, destination_slot, &copySpec);
300+
fuji_copy_file(source_slot, destination_slot, copySpec);
300301
}
301302

302-
unsigned char io_device_slot_to_device(unsigned char ds)
303+
unsigned char io_device_slot_to_device(unsigned char)
303304
{
305+
return 0;
304306
}
305307

306308
/**

0 commit comments

Comments
 (0)