Skip to content

Commit 6efdb10

Browse files
committed
Naming convention standardizations
1 parent 98d4d5f commit 6efdb10

13 files changed

Lines changed: 125 additions & 130 deletions

File tree

audio/drivers/tinyalsa.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1128,21 +1128,21 @@ static void pcm_hw_munmap_status(struct pcm *pcm)
11281128
/* Unused for now */
11291129

11301130
static int pcm_areas_copy(struct pcm *pcm, unsigned int pcm_offset,
1131-
char *buf, unsigned int src_offset,
1132-
unsigned int frames)
1131+
char *s, unsigned int src_offset,
1132+
unsigned int frames)
11331133
{
1134-
int size_bytes = pcm_frames_to_bytes(pcm, frames);
1134+
int size_bytes = pcm_frames_to_bytes(pcm, frames);
11351135
int pcm_offset_bytes = pcm_frames_to_bytes(pcm, pcm_offset);
11361136
int src_offset_bytes = pcm_frames_to_bytes(pcm, src_offset);
11371137

11381138
/* interleaved only atm */
11391139
if (pcm->flags & PCM_IN)
1140-
memcpy(buf + src_offset_bytes,
1140+
memcpy(s + src_offset_bytes,
11411141
(char*)pcm->mmap_buffer + pcm_offset_bytes,
11421142
size_bytes);
11431143
else
11441144
memcpy((char*)pcm->mmap_buffer + pcm_offset_bytes,
1145-
buf + src_offset_bytes,
1145+
s + src_offset_bytes,
11461146
size_bytes);
11471147
return 0;
11481148
}

cheevos/cheevos_client.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -65,9 +65,9 @@
6565
* user agent construction *
6666
****************************/
6767

68-
static int append_no_spaces(char* buffer, char* stop, const char* text)
68+
static int append_no_spaces(char *s, char* stop, const char* text)
6969
{
70-
char* ptr = buffer;
70+
char *ptr = s;
7171

7272
while (ptr < stop && *text)
7373
{
@@ -81,11 +81,11 @@ static int append_no_spaces(char* buffer, char* stop, const char* text)
8181
}
8282

8383
*ptr = '\0';
84-
return (int)(ptr - buffer);
84+
return (int)(ptr - s);
8585
}
8686

8787
void rcheevos_get_user_agent(rcheevos_locals_t *locals,
88-
char *buffer, size_t len)
88+
char *s, size_t len)
8989
{
9090
char* ptr;
9191
struct retro_system_info *sysinfo = &runloop_state_get_ptr()->system.info;
@@ -110,13 +110,13 @@ void rcheevos_get_user_agent(rcheevos_locals_t *locals,
110110
}
111111

112112
/* append the non-changing portion */
113-
ptr = buffer + strlcpy(buffer, locals->user_agent_prefix, len);
113+
ptr = s + strlcpy(s, locals->user_agent_prefix, len);
114114

115115
/* if a core is loaded, append its information */
116116
if (sysinfo && !string_is_empty(sysinfo->library_name))
117117
{
118-
char* stop = buffer + len - 1;
119-
const char* path = path_get(RARCH_PATH_CORE);
118+
char *stop = s + len - 1;
119+
const char *path = path_get(RARCH_PATH_CORE);
120120
*ptr++ = ' ';
121121

122122
if (!string_is_empty(path))

gfx/drivers_shader/shader_glsl.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ struct cache_vbo
5656
{
5757
GLuint vbo_primary;
5858
GLuint vbo_secondary;
59-
size_t size_primary;
60-
size_t size_secondary;
59+
size_t len_primary;
60+
size_t len_secondary;
6161
GLfloat *buffer_primary;
6262
GLfloat *buffer_secondary;
6363
};
@@ -1559,7 +1559,7 @@ static void gl_glsl_set_params(void *dat, void *shader_data)
15591559
if (size)
15601560
gl_glsl_set_attribs(glsl, glsl->vbo[glsl->active_idx].vbo_secondary,
15611561
&glsl->vbo[glsl->active_idx].buffer_secondary,
1562-
&glsl->vbo[glsl->active_idx].size_secondary,
1562+
&glsl->vbo[glsl->active_idx].len_secondary,
15631563
buffer, size, attribs, attribs_size);
15641564

15651565
glActiveTexture(GL_TEXTURE0);
@@ -1691,7 +1691,7 @@ static bool gl_glsl_set_coords(void *shader_data,
16911691
gl_glsl_set_attribs(glsl,
16921692
glsl->vbo[glsl->active_idx].vbo_primary,
16931693
&glsl->vbo[glsl->active_idx].buffer_primary,
1694-
&glsl->vbo[glsl->active_idx].size_primary,
1694+
&glsl->vbo[glsl->active_idx].len_primary,
16951695
buffer, size,
16961696
attribs, attribs_size);
16971697

input/drivers/android_input.c

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -165,7 +165,7 @@ static void frontend_android_get_version_sdk(int32_t *sdk);
165165
static void frontend_android_get_name(char *s, size_t len);
166166

167167
bool (*engine_lookup_name)(char *buf,
168-
int *vendorId, int *productId, size_t size, int id);
168+
int *vendorId, int *productId, size_t len, int id);
169169
void (*engine_handle_dpad)(struct android_app *, AInputEvent*, int, int);
170170

171171
static void android_input_poll_input_gingerbread(android_input_t *android);
@@ -206,8 +206,8 @@ static void android_keyboard_free(void)
206206
kbd_num = 0;
207207
}
208208

209-
static bool android_input_lookup_name_prekitkat(char *buf,
210-
int *vendorId, int *productId, size_t size, int id)
209+
static bool android_input_lookup_name_prekitkat(char *s,
210+
int *vendorId, int *productId, size_t len, int id)
211211
{
212212
jobject name = NULL;
213213
jmethodID getName = NULL;
@@ -241,18 +241,17 @@ static bool android_input_lookup_name_prekitkat(char *buf,
241241
if (!name)
242242
return false;
243243

244-
buf[0] = '\0';
245-
246-
str = (*env)->GetStringUTFChars(env, name, 0);
244+
s[0] = '\0';
245+
str = (*env)->GetStringUTFChars(env, name, 0);
247246
if (str)
248-
strlcpy(buf, str, size);
247+
strlcpy(s, str, len);
249248
(*env)->ReleaseStringUTFChars(env, name, str);
250249

251250
return true;
252251
}
253252

254-
static bool android_input_lookup_name(char *buf,
255-
int *vendorId, int *productId, size_t size, int id)
253+
static bool android_input_lookup_name(char *s,
254+
int *vendorId, int *productId, size_t len, int id)
256255
{
257256
jmethodID getVendorId = NULL;
258257
jmethodID getProductId = NULL;
@@ -288,11 +287,11 @@ static bool android_input_lookup_name(char *buf,
288287
if (!name)
289288
return false;
290289

291-
buf[0] = '\0';
290+
s[0] = '\0';
292291

293292
str = (*env)->GetStringUTFChars(env, name, 0);
294293
if (str)
295-
strlcpy(buf, str, size);
294+
strlcpy(s, str, len);
296295
(*env)->ReleaseStringUTFChars(env, name, str);
297296

298297
GET_METHOD_ID(env, getVendorId, class, "getVendorId", "()I");

input/input_driver.c

Lines changed: 31 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -6344,19 +6344,19 @@ void bsv_movie_read_next_events(bsv_movie_t *handle)
63446344
}
63456345
else if (next_frame_type == REPLAY_TOKEN_CHECKPOINT_FRAME)
63466346
{
6347-
size_t size;
6347+
size_t _len;
63486348
uint8_t *state;
63496349
retro_ctx_serialize_info_t serial_info;
6350-
if (intfstream_read(handle->file, &size, sizeof(uint64_t)) != sizeof(uint64_t))
6350+
if (intfstream_read(handle->file, &_len, sizeof(uint64_t)) != sizeof(uint64_t))
63516351
{
63526352
/* Unnatural EOF */
63536353
RARCH_ERR("[Replay] Replay truncated before reading size.\n");
63546354
input_st->bsv_movie_state.flags |= BSV_FLAG_MOVIE_END;
63556355
return;
63566356
}
6357-
size = swap_if_big64(size);
6358-
state = calloc(size, sizeof(uint8_t));
6359-
if (intfstream_read(handle->file, state, size) != (int64_t)size)
6357+
_len = swap_if_big64(_len);
6358+
state = calloc(_len, sizeof(uint8_t));
6359+
if (intfstream_read(handle->file, state, _len) != (int64_t)_len)
63606360
{
63616361
/* Unnatural EOF */
63626362
RARCH_ERR("[Replay] Replay checkpoint truncated.\n");
@@ -6365,7 +6365,7 @@ void bsv_movie_read_next_events(bsv_movie_t *handle)
63656365
return;
63666366
}
63676367
serial_info.data_const = state;
6368-
serial_info.size = size;
6368+
serial_info.size = _len;
63696369
if (!core_unserialize(&serial_info))
63706370
{
63716371
RARCH_ERR("[Replay] Failed to load movie checkpoint, failing\n");
@@ -6447,10 +6447,10 @@ void bsv_movie_next_frame(input_driver_state_t *input_st)
64476447
uint8_t compression = REPLAY_CHECKPOINT2_COMPRESSION_NONE;
64486448
#endif
64496449
uint8_t encoding = REPLAY_CHECKPOINT2_ENCODING_RAW;
6450-
size_t len = core_serialize_size();
6451-
uint8_t *st = (uint8_t*)malloc(len);
6450+
size_t _len = core_serialize_size();
6451+
uint8_t *st = (uint8_t*)malloc(_len);
64526452
serial_info.data = st;
6453-
serial_info.size = len;
6453+
serial_info.size = _len;
64546454
core_serialize(&serial_info);
64556455
/* "next frame is a checkpoint" */
64566456
intfstream_write(handle->file, (uint8_t *)(&frame_tok), sizeof(uint8_t));
@@ -6510,27 +6510,31 @@ bool replay_get_serialized_data(void* buffer)
65106510
static bool replay_check_same_timeline(bsv_movie_t *movie,
65116511
uint8_t *other_movie, int64_t other_len)
65126512
{
6513-
int64_t check_limit = MIN(other_len, intfstream_tell(movie->file));
6514-
intfstream_t *check_stream = intfstream_open_memory(other_movie, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE, other_len);
6515-
bool ret = true;
6516-
int64_t check_cap = MAX(128 << 10, MAX(128*sizeof(bsv_key_data_t), 512*sizeof(bsv_input_data_t)));
6517-
uint8_t *buf1 = calloc(check_cap,1), *buf2 = calloc(check_cap,1);
6518-
size_t movie_pos = intfstream_tell(movie->file);
65196513
uint64_t size1, size2;
65206514
uint16_t btncount1, btncount2;
6521-
uint8_t frametok1 = 0;
6522-
uint8_t frametok2 = 0;
6523-
uint8_t keycount1 = 0;
6524-
uint8_t keycount2 = 0;
6515+
int64_t check_limit = MIN(other_len, intfstream_tell(movie->file));
6516+
intfstream_t *check_stream = intfstream_open_memory(other_movie, RETRO_VFS_FILE_ACCESS_READ, RETRO_VFS_FILE_ACCESS_HINT_NONE, other_len);
6517+
bool ret = true;
6518+
int64_t check_cap = MAX(128 << 10, MAX(128*sizeof(bsv_key_data_t), 512*sizeof(bsv_input_data_t)));
6519+
uint8_t *buf1 = (uint8_t*)calloc(check_cap,1);
6520+
uint8_t *buf2 = (uint8_t*)calloc(check_cap,1);
6521+
size_t movie_pos = intfstream_tell(movie->file);
6522+
uint8_t frametok1 = 0;
6523+
uint8_t frametok2 = 0;
6524+
uint8_t keycount1 = 0;
6525+
uint8_t keycount2 = 0;
6526+
65256527
intfstream_rewind(movie->file);
65266528
intfstream_read(movie->file, buf1, 6*sizeof(uint32_t));
65276529
intfstream_read(check_stream, buf2, 6*sizeof(uint32_t));
6530+
65286531
if (memcmp(buf1, buf2, 6*sizeof(uint32_t)) != 0)
65296532
{
65306533
RARCH_ERR("[Replay] Headers of two movies differ, not same timeline\n");
65316534
ret = false;
65326535
goto exit;
65336536
}
6537+
65346538
intfstream_seek(movie->file, movie->min_file_pos, SEEK_SET);
65356539
/* assumption: both headers have the same state size */
65366540
intfstream_seek(check_stream, movie->min_file_pos, SEEK_SET);
@@ -6714,9 +6718,9 @@ bool replay_set_serialized_data(void* buf)
67146718

67156719
if (ident == movie->identifier) /* is compatible? */
67166720
{
6717-
int64_t loaded_len = (int64_t)swap_if_big32(((uint32_t *)buffer)[0]);
6718-
int64_t handle_idx = intfstream_tell(movie->file);
6719-
bool same_timeline = replay_check_same_timeline(movie, (uint8_t *)header, loaded_len);
6721+
int64_t _len = (int64_t)swap_if_big32(((uint32_t *)buffer)[0]);
6722+
int64_t handle_idx = intfstream_tell(movie->file);
6723+
bool same_timeline = replay_check_same_timeline(movie, (uint8_t *)header, _len);
67206724
/* If the state is part of this replay, go back to that state
67216725
and rewind/fast forward the replay.
67226726
@@ -6727,7 +6731,7 @@ bool replay_set_serialized_data(void* buf)
67276731
67286732
This can truncate the current replay if we're in recording mode.
67296733
*/
6730-
if (playback && loaded_len > handle_idx)
6734+
if (playback && _len > handle_idx)
67316735
{
67326736
const char *_msg = msg_hash_to_str(MSG_REPLAY_LOAD_STATE_FAILED_FUTURE_STATE);
67336737
runloop_msg_queue_push(_msg, strlen(_msg), 1, 180, true, NULL,
@@ -6743,7 +6747,7 @@ bool replay_set_serialized_data(void* buf)
67436747
RARCH_ERR("[Replay] %s.\n", _msg);
67446748
return false;
67456749
}
6746-
else if (recording && (loaded_len > handle_idx || !same_timeline))
6750+
else if (recording && (_len > handle_idx || !same_timeline))
67476751
{
67486752
if (!same_timeline)
67496753
{
@@ -6753,13 +6757,13 @@ bool replay_set_serialized_data(void* buf)
67536757
RARCH_WARN("[Replay] %s.\n", _msg);
67546758
}
67556759
intfstream_rewind(movie->file);
6756-
intfstream_write(movie->file, buffer+sizeof(int32_t), loaded_len);
6760+
intfstream_write(movie->file, buffer+sizeof(int32_t), _len);
67576761
}
67586762
else
67596763
{
6760-
intfstream_seek(movie->file, loaded_len, SEEK_SET);
6764+
intfstream_seek(movie->file, _len, SEEK_SET);
67616765
if (recording)
6762-
intfstream_truncate(movie->file, loaded_len);
6766+
intfstream_truncate(movie->file, _len);
67636767
}
67646768
}
67656769
else

libretro-common/include/cdrom/cdrom.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ unsigned cdrom_msf_to_lba(unsigned char min, unsigned char sec, unsigned char fr
7474

7575
void increment_msf(unsigned char *min, unsigned char *sec, unsigned char *frame);
7676

77-
int cdrom_read_subq(libretro_vfs_implementation_file *stream, unsigned char *buf, size_t len);
77+
int cdrom_read_subq(libretro_vfs_implementation_file *stream, unsigned char *s, size_t len);
7878

7979
int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, size_t *out_len, char cdrom_drive, unsigned char *num_tracks, cdrom_toc_t *toc);
8080

0 commit comments

Comments
 (0)