Skip to content

Commit ad9124f

Browse files
committed
Resync
1 parent c4dbae0 commit ad9124f

File tree

8 files changed

+101
-112
lines changed

8 files changed

+101
-112
lines changed

cdrom/cdrom.c

+20-18
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ void increment_msf(unsigned char *min, unsigned char *sec, unsigned char *frame)
9999
}
100100

101101
#ifdef CDROM_DEBUG
102-
static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
102+
static void cdrom_print_sense_data(const unsigned char *s, size_t len)
103103
{
104104
unsigned i;
105105
const char *sense_key_text = NULL;
@@ -114,20 +114,20 @@ static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
114114
return;
115115
}
116116

117-
key = sense[2] & 0xF;
118-
asc = sense[12];
119-
ascq = sense[13];
117+
key = s[2] & 0xF;
118+
asc = s[12];
119+
ascq = s[13];
120120

121121
printf("[CDROM] Sense Data: ");
122122

123123
for (i = 0; i < MIN(len, 16); i++)
124-
printf("%02X ", sense[i]);
124+
printf("%02X ", s[i]);
125125

126126
printf("\n");
127127

128-
if (sense[0] == 0x70)
128+
if (s[0] == 0x70)
129129
printf("[CDROM] CURRENT ERROR:\n");
130-
if (sense[0] == 0x71)
130+
if (s[0] == 0x71)
131131
printf("[CDROM] DEFERRED ERROR:\n");
132132

133133
switch (key)
@@ -371,17 +371,17 @@ static int cdrom_send_command_linux(const libretro_vfs_implementation_file *stre
371371
#endif
372372

373373
static int cdrom_send_command(libretro_vfs_implementation_file *stream, CDROM_CMD_Direction dir,
374-
void *buf, size_t len, unsigned char *cmd, size_t cmd_len, size_t skip)
374+
void *s, size_t len, unsigned char *cmd, size_t cmd_len, size_t skip)
375375
{
376-
unsigned char *xfer_buf = NULL;
377-
unsigned char *xfer_buf_pos = xfer_buf;
378-
unsigned char sense[CDROM_MAX_SENSE_BYTES] = {0};
379-
unsigned char retries_left = CDROM_MAX_RETRIES;
380376
int i, rv = 0;
381377
int frames = 1;
378+
unsigned char *xfer_buf = NULL;
379+
unsigned char *xfer_buf_pos = xfer_buf;
380+
unsigned char sense[CDROM_MAX_SENSE_BYTES] = {0};
381+
unsigned char retries_left = CDROM_MAX_RETRIES;
382382
size_t padded_req_bytes;
383-
size_t copied_bytes = 0;
384-
bool read_cd = false;
383+
size_t copied_bytes = 0;
384+
bool read_cd = false;
385385

386386
if (!cmd || cmd_len == 0 || cmd_len < CDROM_MIN_BUFSIZE)
387387
return 1;
@@ -491,13 +491,13 @@ static int cdrom_send_command(libretro_vfs_implementation_file *stream, CDROM_CM
491491
{
492492
rv = 0;
493493

494-
if (buf)
494+
if (s)
495495
{
496496
#if 0
497497
printf("offsetting %" PRId64 " from buf, copying at xfer_buf offset %" PRId64 ", copying %" PRId64 " bytes\n", copied_bytes, (xfer_buf_pos + skip) - xfer_buf, copy_len);
498498
fflush(stdout);
499499
#endif
500-
memcpy((char*)buf + copied_bytes, xfer_buf_pos + skip, copy_len);
500+
memcpy((char*)s + copied_bytes, xfer_buf_pos + skip, copy_len);
501501
copied_bytes += copy_len;
502502

503503
if (read_cd && !cached_read && request_len >= 2352)
@@ -570,7 +570,6 @@ static int cdrom_send_command(libretro_vfs_implementation_file *stream, CDROM_CM
570570

571571
if (xfer_buf)
572572
memalign_free(xfer_buf);
573-
574573
return rv;
575574
}
576575

@@ -1168,7 +1167,10 @@ int cdrom_get_inquiry(libretro_vfs_implementation_file *stream, char *s, size_t
11681167
return 0;
11691168
}
11701169

1171-
int cdrom_read(libretro_vfs_implementation_file *stream, cdrom_group_timeouts_t *timeouts, unsigned char min, unsigned char sec, unsigned char frame, void *s, size_t len, size_t skip)
1170+
int cdrom_read(libretro_vfs_implementation_file *stream,
1171+
cdrom_group_timeouts_t *timeouts, unsigned char min,
1172+
unsigned char sec, unsigned char frame, void *s,
1173+
size_t len, size_t skip)
11721174
{
11731175
/* MMC Command: READ CD MSF */
11741176
unsigned char cdb[] = {0xB9, 0, 0, 0, 0, 0, 0, 0, 0, 0xF8, 0, 0};

hash/lrc_hash.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ static void sha256_chunk(struct sha256_ctx *p,
129129

130130
while (len)
131131
{
132-
unsigned l = 64 - p->inlen;
132+
size_t l = 64 - p->inlen;
133133

134134
if (len < l)
135135
l = len;

include/streams/memory_stream.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ int memstream_getc(memstream_t *stream);
4444

4545
void memstream_putc(memstream_t *stream, int c);
4646

47-
char *memstream_gets(memstream_t *stream, char *buffer, size_t len);
47+
char *memstream_gets(memstream_t *stream, char *s, size_t len);
4848

4949
uint64_t memstream_pos(memstream_t *stream);
5050

streams/file_stream.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -240,7 +240,7 @@ int filestream_vscanf(RFILE *stream, const char* format, va_list *args)
240240
{
241241
if (*format == '%')
242242
{
243-
int sublen;
243+
int sublen = 0;
244244
char* subfmtiter = subfmt;
245245
bool asterisk = false;
246246

streams/memory_stream.c

+6-17
Original file line numberDiff line numberDiff line change
@@ -40,15 +40,10 @@ struct memstream
4040
unsigned writing;
4141
};
4242

43-
void memstream_set_buffer(uint8_t *buffer, uint64_t size)
43+
void memstream_set_buffer(uint8_t *s, uint64_t len)
4444
{
45-
g_buffer = buffer;
46-
g_size = size;
47-
}
48-
49-
uint64_t memstream_get_last_size(void)
50-
{
51-
return last_file_size;
45+
g_buffer = s;
46+
g_size = len;
5247
}
5348

5449
memstream_t *memstream_open(unsigned writing)
@@ -158,15 +153,9 @@ void memstream_rewind(memstream_t *stream)
158153
memstream_seek(stream, 0L, SEEK_SET);
159154
}
160155

161-
uint64_t memstream_pos(memstream_t *stream)
162-
{
163-
return stream->ptr;
164-
}
165-
166-
char *memstream_gets(memstream_t *stream, char *buffer, size_t len)
167-
{
168-
return NULL;
169-
}
156+
uint64_t memstream_pos(memstream_t *stream) { return stream->ptr; }
157+
char *memstream_gets(memstream_t *stream, char *s, size_t len) { return NULL; }
158+
uint64_t memstream_get_last_size(void) { return last_file_size; }
170159

171160
int memstream_getc(memstream_t *stream)
172161
{

streams/rzip_stream.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -647,20 +647,20 @@ char* rzipstream_gets(rzipstream_t *stream, char *s, size_t len)
647647
* - 'buf' will be allocated and must be free()'d manually.
648648
* - Allocated 'buf' size is equal to 'len'.
649649
* Returns false in the event of an error */
650-
bool rzipstream_read_file(const char *path, void **buf, int64_t *len)
650+
bool rzipstream_read_file(const char *path, void **s, int64_t *len)
651651
{
652652
int64_t bytes_read = 0;
653653
void *content_buf = NULL;
654654
int64_t content_buf_size = 0;
655655
rzipstream_t *stream = NULL;
656656

657-
if (!buf)
657+
if (!s)
658658
return false;
659659

660660
/* Attempt to open file */
661661
if (!(stream = rzipstream_open(path, RETRO_VFS_FILE_ACCESS_READ)))
662662
{
663-
*buf = NULL;
663+
*s = NULL;
664664
return false;
665665
}
666666

@@ -689,7 +689,7 @@ bool rzipstream_read_file(const char *path, void **buf, int64_t *len)
689689
((char*)content_buf)[bytes_read] = '\0';
690690

691691
/* Assign buffer */
692-
*buf = content_buf;
692+
*s = content_buf;
693693

694694
/* Assign length value, if required */
695695
if (len)
@@ -709,7 +709,7 @@ bool rzipstream_read_file(const char *path, void **buf, int64_t *len)
709709
if (len)
710710
*len = -1;
711711

712-
*buf = NULL;
712+
*s = NULL;
713713

714714
return false;
715715
}

streams/stdin_stream.c

+9-10
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,9 @@
3939
#include <streams/stdin_stream.h>
4040

4141
#if (defined(_WIN32) && defined(_XBOX)) || defined(__WINRT__) || !defined(__PSL1GHT__) && defined(__PS3__)
42-
size_t read_stdin(char *buf, size_t len) { return 0; } /* not implemented */
42+
size_t read_stdin(char *s, size_t len) { return 0; } /* not implemented */
4343
#elif defined(_WIN32)
44-
size_t read_stdin(char *buf, size_t len)
44+
size_t read_stdin(char *s, size_t len)
4545
{
4646
DWORD i;
4747
DWORD has_read = 0;
@@ -104,12 +104,12 @@ size_t read_stdin(char *buf, size_t len)
104104
if (avail > len)
105105
avail = len;
106106

107-
if (!ReadFile(hnd, buf, avail, &has_read, NULL))
107+
if (!ReadFile(hnd, s, avail, &has_read, NULL))
108108
return 0;
109109

110110
for (i = 0; i < has_read; i++)
111-
if (buf[i] == '\r')
112-
buf[i] = '\n';
111+
if (s[i] == '\r')
112+
s[i] = '\n';
113113

114114
/* Console won't echo for us while in non-line mode,
115115
* so do it manually ... */
@@ -119,22 +119,21 @@ size_t read_stdin(char *buf, size_t len)
119119
if (hnd_out != INVALID_HANDLE_VALUE)
120120
{
121121
DWORD has_written;
122-
WriteConsole(hnd_out, buf, has_read, &has_written, NULL);
122+
WriteConsole(hnd_out, s, has_read, &has_written, NULL);
123123
}
124124
}
125-
126125
return has_read;
127126
}
128127
#else
129-
size_t read_stdin(char *buf, size_t len)
128+
size_t read_stdin(char *s, size_t len)
130129
{
131130
size_t has_read = 0;
132131
while (len)
133132
{
134-
ssize_t ret = read(STDIN_FILENO, buf, len);
133+
ssize_t ret = read(STDIN_FILENO, s, len);
135134
if (ret <= 0)
136135
break;
137-
buf += ret;
136+
s += ret;
138137
has_read += ret;
139138
len -= ret;
140139
}

0 commit comments

Comments
 (0)