mirror of
https://github.com/libretro/RetroArch.git
synced 2025-04-02 10:51:52 -04:00
Style nits
This commit is contained in:
parent
1170373494
commit
c57c4fbd1a
28 changed files with 182 additions and 226 deletions
|
@ -110,7 +110,7 @@ typedef struct audio_driver
|
||||||
* Unless said otherwise with set_nonblock_state(), all writes
|
* Unless said otherwise with set_nonblock_state(), all writes
|
||||||
* are blocking, and it should block till it has written all frames.
|
* are blocking, and it should block till it has written all frames.
|
||||||
*/
|
*/
|
||||||
ssize_t (*write)(void *data, const void *buf, size_t len);
|
ssize_t (*write)(void *data, const void *s, size_t len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Temporarily pauses the audio driver.
|
* Temporarily pauses the audio driver.
|
||||||
|
|
|
@ -157,7 +157,7 @@ error:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t alsa_thread_write(void *data, const void *buf, size_t len)
|
static ssize_t alsa_thread_write(void *data, const void *s, size_t len)
|
||||||
{
|
{
|
||||||
ssize_t written = 0;
|
ssize_t written = 0;
|
||||||
alsa_thread_t *alsa = (alsa_thread_t*)data;
|
alsa_thread_t *alsa = (alsa_thread_t*)data;
|
||||||
|
@ -173,7 +173,7 @@ static ssize_t alsa_thread_write(void *data, const void *buf, size_t len)
|
||||||
avail = FIFO_WRITE_AVAIL(alsa->info.buffer);
|
avail = FIFO_WRITE_AVAIL(alsa->info.buffer);
|
||||||
written = MIN(avail, len);
|
written = MIN(avail, len);
|
||||||
|
|
||||||
fifo_write(alsa->info.buffer, buf, written);
|
fifo_write(alsa->info.buffer, s, written);
|
||||||
slock_unlock(alsa->info.fifo_lock);
|
slock_unlock(alsa->info.fifo_lock);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -196,7 +196,7 @@ static ssize_t alsa_thread_write(void *data, const void *buf, size_t len)
|
||||||
{
|
{
|
||||||
size_t write_amt = MIN(len - written, avail);
|
size_t write_amt = MIN(len - written, avail);
|
||||||
fifo_write(alsa->info.buffer,
|
fifo_write(alsa->info.buffer,
|
||||||
(const char*)buf + written, write_amt);
|
(const char*)s + written, write_amt);
|
||||||
slock_unlock(alsa->info.fifo_lock);
|
slock_unlock(alsa->info.fifo_lock);
|
||||||
written += write_amt;
|
written += write_amt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ error:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t audioio_write(void *data, const void *buf, size_t len)
|
static ssize_t audioio_write(void *data, const void *s, size_t len)
|
||||||
{
|
{
|
||||||
ssize_t written;
|
ssize_t written;
|
||||||
int *fd = (int*)data;
|
int *fd = (int*)data;
|
||||||
|
@ -90,7 +90,7 @@ static ssize_t audioio_write(void *data, const void *buf, size_t len)
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((written = write(*fd, buf, len)) < 0)
|
if ((written = write(*fd, s, len)) < 0)
|
||||||
{
|
{
|
||||||
if (errno == EAGAIN && (fcntl(*fd, F_GETFL) & O_NONBLOCK))
|
if (errno == EAGAIN && (fcntl(*fd, F_GETFL) & O_NONBLOCK))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -103,7 +103,7 @@ error:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t oss_write(void *data, const void *buf, size_t len)
|
static ssize_t oss_write(void *data, const void *s, size_t len)
|
||||||
{
|
{
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
oss_audio_t *ossaudio = (oss_audio_t*)data;
|
oss_audio_t *ossaudio = (oss_audio_t*)data;
|
||||||
|
@ -111,7 +111,7 @@ static ssize_t oss_write(void *data, const void *buf, size_t len)
|
||||||
if (len == 0)
|
if (len == 0)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
if ((ret = write(ossaudio->fd, buf, len)) < 0)
|
if ((ret = write(ossaudio->fd, s, len)) < 0)
|
||||||
{
|
{
|
||||||
if (errno == EAGAIN && (fcntl(ossaudio->fd, F_GETFL) & O_NONBLOCK))
|
if (errno == EAGAIN && (fcntl(ossaudio->fd, F_GETFL) & O_NONBLOCK))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -71,12 +71,12 @@ static void ps2_audio_free(void *data)
|
||||||
free(ps2);
|
free(ps2);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t ps2_audio_write(void *data, const void *buf, size_t len)
|
static ssize_t ps2_audio_write(void *data, const void *s, size_t len)
|
||||||
{
|
{
|
||||||
ps2_audio_t* ps2 = (ps2_audio_t*)data;
|
ps2_audio_t* ps2 = (ps2_audio_t*)data;
|
||||||
if (!ps2->running)
|
if (!ps2->running)
|
||||||
return -1;
|
return -1;
|
||||||
return audsrv_play_audio(buf, len);
|
return audsrv_play_audio(s, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static bool ps2_audio_alive(void *data)
|
static bool ps2_audio_alive(void *data)
|
||||||
|
|
|
@ -142,7 +142,7 @@ static void *ps3_audio_init(const char *device,
|
||||||
return data;
|
return data;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t ps3_audio_write(void *data, const void *buf, size_t len)
|
static ssize_t ps3_audio_write(void *data, const void *s, size_t len)
|
||||||
{
|
{
|
||||||
ps3_audio_t *aud = data;
|
ps3_audio_t *aud = data;
|
||||||
|
|
||||||
|
@ -156,9 +156,8 @@ static ssize_t ps3_audio_write(void *data, const void *buf, size_t len)
|
||||||
sysLwCondWait(&aud->cond, 0);
|
sysLwCondWait(&aud->cond, 0);
|
||||||
|
|
||||||
sysLwMutexLock(&aud->lock, PS3_SYS_NO_TIMEOUT);
|
sysLwMutexLock(&aud->lock, PS3_SYS_NO_TIMEOUT);
|
||||||
fifo_write(aud->buffer, buf, len);
|
fifo_write(aud->buffer, s, len);
|
||||||
sysLwMutexUnlock(&aud->lock);
|
sysLwMutexUnlock(&aud->lock);
|
||||||
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -202,7 +202,7 @@ static void psp_audio_free(void *data)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t psp_audio_write(void *data, const void *buf, size_t len)
|
static ssize_t psp_audio_write(void *data, const void *s, size_t len)
|
||||||
{
|
{
|
||||||
psp_audio_t* psp = (psp_audio_t*)data;
|
psp_audio_t* psp = (psp_audio_t*)data;
|
||||||
uint16_t write_pos = psp->write_pos;
|
uint16_t write_pos = psp->write_pos;
|
||||||
|
@ -227,14 +227,14 @@ static ssize_t psp_audio_write(void *data, const void *buf, size_t len)
|
||||||
slock_lock(psp->fifo_lock);
|
slock_lock(psp->fifo_lock);
|
||||||
if ((write_pos + sampleCount) > AUDIO_BUFFER_SIZE)
|
if ((write_pos + sampleCount) > AUDIO_BUFFER_SIZE)
|
||||||
{
|
{
|
||||||
memcpy(psp->buffer + write_pos, buf,
|
memcpy(psp->buffer + write_pos, s,
|
||||||
(AUDIO_BUFFER_SIZE - write_pos) * sizeof(uint32_t));
|
(AUDIO_BUFFER_SIZE - write_pos) * sizeof(uint32_t));
|
||||||
memcpy(psp->buffer, (uint32_t*) buf +
|
memcpy(psp->buffer, (uint32_t*)s +
|
||||||
(AUDIO_BUFFER_SIZE - write_pos),
|
(AUDIO_BUFFER_SIZE - write_pos),
|
||||||
(write_pos + sampleCount - AUDIO_BUFFER_SIZE) * sizeof(uint32_t));
|
(write_pos + sampleCount - AUDIO_BUFFER_SIZE) * sizeof(uint32_t));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
memcpy(psp->buffer + write_pos, buf, len);
|
memcpy(psp->buffer + write_pos, s, len);
|
||||||
|
|
||||||
write_pos += sampleCount;
|
write_pos += sampleCount;
|
||||||
write_pos &= AUDIO_BUFFER_SIZE_MASK;
|
write_pos &= AUDIO_BUFFER_SIZE_MASK;
|
||||||
|
|
|
@ -110,8 +110,6 @@ static void *sdl_audio_init(const char *device,
|
||||||
sdl_audio_t *sdl = NULL;
|
sdl_audio_t *sdl = NULL;
|
||||||
uint32_t sdl_subsystem_flags = SDL_WasInit(0);
|
uint32_t sdl_subsystem_flags = SDL_WasInit(0);
|
||||||
|
|
||||||
(void)device;
|
|
||||||
|
|
||||||
/* Initialise audio subsystem, if required */
|
/* Initialise audio subsystem, if required */
|
||||||
if (sdl_subsystem_flags == 0)
|
if (sdl_subsystem_flags == 0)
|
||||||
{
|
{
|
||||||
|
@ -210,7 +208,7 @@ error:
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t sdl_audio_write(void *data, const void *buf, size_t len)
|
static ssize_t sdl_audio_write(void *data, const void *s, size_t len)
|
||||||
{
|
{
|
||||||
ssize_t ret = 0;
|
ssize_t ret = 0;
|
||||||
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
sdl_audio_t *sdl = (sdl_audio_t*)data;
|
||||||
|
@ -222,7 +220,7 @@ static ssize_t sdl_audio_write(void *data, const void *buf, size_t len)
|
||||||
SDL_LockAudioDevice(sdl->speaker_device); /* Stop the SDL speaker thread from running */
|
SDL_LockAudioDevice(sdl->speaker_device); /* Stop the SDL speaker thread from running */
|
||||||
avail = FIFO_WRITE_AVAIL(sdl->speaker_buffer);
|
avail = FIFO_WRITE_AVAIL(sdl->speaker_buffer);
|
||||||
write_amt = (avail > len) ? len : avail; /* Enqueue as much data as we can */
|
write_amt = (avail > len) ? len : avail; /* Enqueue as much data as we can */
|
||||||
fifo_write(sdl->speaker_buffer, buf, write_amt);
|
fifo_write(sdl->speaker_buffer, s, write_amt);
|
||||||
SDL_UnlockAudioDevice(sdl->speaker_device); /* Let the speaker thread run again */
|
SDL_UnlockAudioDevice(sdl->speaker_device); /* Let the speaker thread run again */
|
||||||
ret = write_amt; /* If the queue was full...well, too bad. */
|
ret = write_amt; /* If the queue was full...well, too bad. */
|
||||||
}
|
}
|
||||||
|
@ -256,7 +254,7 @@ static ssize_t sdl_audio_write(void *data, const void *buf, size_t len)
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t write_amt = len - written > avail ? avail : len - written;
|
size_t write_amt = len - written > avail ? avail : len - written;
|
||||||
fifo_write(sdl->speaker_buffer, (const char*)buf + written, write_amt);
|
fifo_write(sdl->speaker_buffer, (const char*)s + written, write_amt);
|
||||||
/* Enqueue as many samples as we have available without overflowing the queue */
|
/* Enqueue as many samples as we have available without overflowing the queue */
|
||||||
SDL_UnlockAudioDevice(sdl->speaker_device); /* Let the SDL speaker thread run again */
|
SDL_UnlockAudioDevice(sdl->speaker_device); /* Let the SDL speaker thread run again */
|
||||||
written += write_amt;
|
written += write_amt;
|
||||||
|
|
|
@ -73,10 +73,10 @@ static size_t switch_audio_buffer_size(void *data)
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t switch_audio_write(void *data, const void *buf, size_t len)
|
static ssize_t switch_audio_write(void *data, const void *s, size_t len)
|
||||||
{
|
{
|
||||||
size_t to_write = len;
|
size_t to_write = len;
|
||||||
switch_audio_t *swa = (switch_audio_t*) data;
|
switch_audio_t *swa = (switch_audio_t*)data;
|
||||||
|
|
||||||
if (!swa)
|
if (!swa)
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -125,9 +125,9 @@ static ssize_t switch_audio_write(void *data, const void *buf, size_t len)
|
||||||
to_write = switch_audio_buffer_size(NULL) - swa->current_buffer->data_size;
|
to_write = switch_audio_buffer_size(NULL) - swa->current_buffer->data_size;
|
||||||
|
|
||||||
#ifndef HAVE_LIBNX
|
#ifndef HAVE_LIBNX
|
||||||
memcpy(((uint8_t*) swa->current_buffer->sample_data) + swa->current_buffer->data_size, buf, to_write);
|
memcpy(((uint8_t*) swa->current_buffer->sample_data) + swa->current_buffer->data_size, s, to_write);
|
||||||
#else
|
#else
|
||||||
memcpy(((uint8_t*) swa->current_buffer->buffer) + swa->current_buffer->data_size, buf, to_write);
|
memcpy(((uint8_t*) swa->current_buffer->buffer) + swa->current_buffer->data_size, s, to_write);
|
||||||
#endif
|
#endif
|
||||||
swa->current_buffer->data_size += to_write;
|
swa->current_buffer->data_size += to_write;
|
||||||
swa->current_buffer->buffer_size = switch_audio_buffer_size(NULL);
|
swa->current_buffer->buffer_size = switch_audio_buffer_size(NULL);
|
||||||
|
|
|
@ -186,7 +186,7 @@ static ssize_t libnx_audren_audio_get_free_wavebuf_idx(libnx_audren_t* aud)
|
||||||
}
|
}
|
||||||
|
|
||||||
static size_t libnx_audren_audio_append(
|
static size_t libnx_audren_audio_append(
|
||||||
libnx_audren_t* aud, const void *buf, size_t len)
|
libnx_audren_t* aud, const void *s, size_t len)
|
||||||
{
|
{
|
||||||
void *dstbuf = NULL;
|
void *dstbuf = NULL;
|
||||||
ssize_t free_idx = -1;
|
ssize_t free_idx = -1;
|
||||||
|
@ -206,7 +206,7 @@ static size_t libnx_audren_audio_append(
|
||||||
len = aud->buffer_size - aud->current_size;
|
len = aud->buffer_size - aud->current_size;
|
||||||
|
|
||||||
dstbuf = aud->current_pool_ptr + aud->current_size;
|
dstbuf = aud->current_pool_ptr + aud->current_size;
|
||||||
memcpy(dstbuf, buf, len);
|
memcpy(dstbuf, s, len);
|
||||||
armDCacheFlush(dstbuf, len);
|
armDCacheFlush(dstbuf, len);
|
||||||
|
|
||||||
aud->current_size += len;
|
aud->current_size += len;
|
||||||
|
|
|
@ -338,7 +338,7 @@ static void switch_thread_audio_free(void *data)
|
||||||
swa = NULL;
|
swa = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t switch_thread_audio_write(void *data, const void *buf, size_t len)
|
static ssize_t switch_thread_audio_write(void *data, const void *s, size_t len)
|
||||||
{
|
{
|
||||||
size_t avail, written;
|
size_t avail, written;
|
||||||
switch_thread_audio_t *swa = (switch_thread_audio_t *)data;
|
switch_thread_audio_t *swa = (switch_thread_audio_t *)data;
|
||||||
|
@ -352,7 +352,7 @@ static ssize_t switch_thread_audio_write(void *data, const void *buf, size_t len
|
||||||
avail = FIFO_WRITE_AVAIL(swa->fifo);
|
avail = FIFO_WRITE_AVAIL(swa->fifo);
|
||||||
written = MIN(avail, len);
|
written = MIN(avail, len);
|
||||||
if (written > 0)
|
if (written > 0)
|
||||||
fifo_write(swa->fifo, buf, written);
|
fifo_write(swa->fifo, s, written);
|
||||||
compat_mutex_unlock(&swa->fifoLock);
|
compat_mutex_unlock(&swa->fifoLock);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -373,7 +373,7 @@ static ssize_t switch_thread_audio_write(void *data, const void *buf, size_t len
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
size_t write_amt = MIN(len - written, avail);
|
size_t write_amt = MIN(len - written, avail);
|
||||||
fifo_write(swa->fifo, (const char*)buf + written, write_amt);
|
fifo_write(swa->fifo, (const char*)s + written, write_amt);
|
||||||
compat_mutex_unlock(&swa->fifoLock);
|
compat_mutex_unlock(&swa->fifoLock);
|
||||||
written += write_amt;
|
written += write_amt;
|
||||||
}
|
}
|
||||||
|
|
|
@ -341,12 +341,12 @@ static void *xa_init(const char *device, unsigned rate, unsigned latency,
|
||||||
return xa;
|
return xa;
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t xa_write(void *data, const void *buf, size_t len)
|
static ssize_t xa_write(void *data, const void *s, size_t len)
|
||||||
{
|
{
|
||||||
unsigned bytes = len;
|
unsigned bytes = len;
|
||||||
xa_t *xa = (xa_t*)data;
|
xa_t *xa = (xa_t*)data;
|
||||||
xaudio2_t *handle = xa->xa;
|
xaudio2_t *handle = xa->xa;
|
||||||
const uint8_t *buffer = (const uint8_t*)buf;
|
const uint8_t *buffer = (const uint8_t*)s;
|
||||||
|
|
||||||
if (xa->flags & XA2_FLAG_NONBLOCK)
|
if (xa->flags & XA2_FLAG_NONBLOCK)
|
||||||
{
|
{
|
||||||
|
|
|
@ -57,11 +57,11 @@ static INLINE uint32_t bswap_32(uint32_t val)
|
||||||
((val >> 8) & 0xff00) | ((val << 8) & 0xff0000);
|
((val >> 8) & 0xff00) | ((val << 8) & 0xff0000);
|
||||||
}
|
}
|
||||||
|
|
||||||
static ssize_t xenon360_audio_write(void *data, const void *buf, size_t len)
|
static ssize_t xenon360_audio_write(void *data, const void *s, size_t len)
|
||||||
{
|
{
|
||||||
size_t written = 0, i;
|
size_t written = 0, i;
|
||||||
const uint32_t *in_buf = buf;
|
const uint32_t *in_buf = s;
|
||||||
xenon_audio_t *xa = data;
|
xenon_audio_t *xa = data;
|
||||||
|
|
||||||
for (i = 0; i < (len >> 2); i++)
|
for (i = 0; i < (len >> 2); i++)
|
||||||
xa->buffer[i] = bswap_32(in_buf[i]);
|
xa->buffer[i] = bswap_32(in_buf[i]);
|
||||||
|
|
|
@ -1272,8 +1272,7 @@ bool config_load_remap(const char *directory_input_remapping,
|
||||||
**/
|
**/
|
||||||
|
|
||||||
void config_get_autoconf_profile_filename(
|
void config_get_autoconf_profile_filename(
|
||||||
const char *device_name, unsigned user,
|
const char *device_name, unsigned user, char *s, size_t len);
|
||||||
char *buf, size_t len_buf);
|
|
||||||
/**
|
/**
|
||||||
* config_save_autoconf_profile:
|
* config_save_autoconf_profile:
|
||||||
* @device_name : Input device name
|
* @device_name : Input device name
|
||||||
|
|
|
@ -146,17 +146,14 @@ static void audio_callback(void)
|
||||||
static void audio_set_state(bool enable) { }
|
static void audio_set_state(bool enable) { }
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static void
|
static void appendstr(char *s, const char *in, size_t len)
|
||||||
appendstr(char *dst, const char *src, size_t dstsize)
|
|
||||||
{
|
{
|
||||||
size_t resid = dstsize - (strlen(dst) + 1);
|
size_t resid = len - (strlen(s) + 1);
|
||||||
if (resid == 0)
|
if (resid != 0)
|
||||||
return;
|
strncat(s, in, resid);
|
||||||
strncat(dst, src, resid);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void enumerate_video_devices(char *s, size_t len)
|
||||||
enumerate_video_devices(char *buf, size_t buflen)
|
|
||||||
{
|
{
|
||||||
#ifdef HAVE_UDEV
|
#ifdef HAVE_UDEV
|
||||||
int ndevs;
|
int ndevs;
|
||||||
|
@ -167,9 +164,8 @@ enumerate_video_devices(char *buf, size_t buflen)
|
||||||
struct udev *udev = NULL;
|
struct udev *udev = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
memset(buf, 0, buflen);
|
memset(s, 0, len);
|
||||||
|
appendstr(s, "Video capture device; ", len);
|
||||||
appendstr(buf, "Video capture device; ", buflen);
|
|
||||||
|
|
||||||
#ifdef HAVE_UDEV
|
#ifdef HAVE_UDEV
|
||||||
/* Get a list of devices matching the "video4linux" subsystem from udev */
|
/* Get a list of devices matching the "video4linux" subsystem from udev */
|
||||||
|
@ -211,8 +207,8 @@ enumerate_video_devices(char *buf, size_t buflen)
|
||||||
if (strncmp(name, "/dev/video", strlen("/dev/video")) == 0)
|
if (strncmp(name, "/dev/video", strlen("/dev/video")) == 0)
|
||||||
{
|
{
|
||||||
if (ndevs > 0)
|
if (ndevs > 0)
|
||||||
appendstr(buf, "|", buflen);
|
appendstr(s, "|", len);
|
||||||
appendstr(buf, name, buflen);
|
appendstr(s, name, len);
|
||||||
ndevs++;
|
ndevs++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -223,23 +219,22 @@ enumerate_video_devices(char *buf, size_t buflen)
|
||||||
udev_unref(udev);
|
udev_unref(udev);
|
||||||
#else
|
#else
|
||||||
/* Just return a few options. We'll fail later if the device is not found. */
|
/* Just return a few options. We'll fail later if the device is not found. */
|
||||||
appendstr(buf, "/dev/video0|/dev/video1|/dev/video2|/dev/video3", buflen);
|
appendstr(s, "/dev/video0|/dev/video1|/dev/video2|/dev/video3", len);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void enumerate_audio_devices(char *s, size_t len)
|
||||||
enumerate_audio_devices(char *buf, size_t buflen)
|
|
||||||
{
|
{
|
||||||
memset(buf, 0, buflen);
|
|
||||||
|
|
||||||
appendstr(buf, "Audio capture device; ", buflen);
|
|
||||||
|
|
||||||
#ifdef HAVE_ALSA
|
#ifdef HAVE_ALSA
|
||||||
|
int ndevs;
|
||||||
void **hints, **n;
|
void **hints, **n;
|
||||||
char *ioid, *name;
|
char *ioid, *name;
|
||||||
int ndevs;
|
#endif
|
||||||
|
|
||||||
|
memset(s, 0, len);
|
||||||
|
appendstr(s, "Audio capture device; ", len);
|
||||||
|
|
||||||
|
#ifdef HAVE_ALSA
|
||||||
if (snd_device_name_hint(-1, "pcm", &hints) < 0)
|
if (snd_device_name_hint(-1, "pcm", &hints) < 0)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
@ -248,13 +243,14 @@ enumerate_audio_devices(char *buf, size_t buflen)
|
||||||
{
|
{
|
||||||
name = snd_device_name_get_hint(*n, "NAME");
|
name = snd_device_name_get_hint(*n, "NAME");
|
||||||
ioid = snd_device_name_get_hint(*n, "IOID");
|
ioid = snd_device_name_get_hint(*n, "IOID");
|
||||||
if ((ioid == NULL || string_is_equal(ioid, "Input")) &&
|
if ( (ioid == NULL
|
||||||
(!strncmp(name, "hw:", strlen("hw:")) ||
|
|| string_is_equal(ioid, "Input"))
|
||||||
!strncmp(name, "default:", strlen("default:"))))
|
&& ( !strncmp(name, "hw:", strlen("hw:"))
|
||||||
|
|| !strncmp(name, "default:", strlen("default:"))))
|
||||||
{
|
{
|
||||||
if (ndevs > 0)
|
if (ndevs > 0)
|
||||||
appendstr(buf, "|", buflen);
|
appendstr(s, "|", len);
|
||||||
appendstr(buf, name, buflen);
|
appendstr(s, name, len);
|
||||||
++ndevs;
|
++ndevs;
|
||||||
}
|
}
|
||||||
free(name);
|
free(name);
|
||||||
|
|
|
@ -766,12 +766,11 @@ static void btpad_increment_position(uint32_t *ptr)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void btpad_connection_send_control(void *data,
|
static void btpad_connection_send_control(void *data,
|
||||||
uint8_t* data_buf, size_t len)
|
uint8_t *s, size_t len)
|
||||||
{
|
{
|
||||||
struct btstack_hid_adapter *connection = (struct btstack_hid_adapter*)data;
|
struct btstack_hid_adapter *connection = (struct btstack_hid_adapter*)data;
|
||||||
|
|
||||||
if (connection)
|
if (connection)
|
||||||
bt_send_l2cap_ptr(connection->channels[0], data_buf, len);
|
bt_send_l2cap_ptr(connection->channels[0], s, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void btpad_queue_process_cmd(struct btpad_queue_command *cmd)
|
static void btpad_queue_process_cmd(struct btpad_queue_command *cmd)
|
||||||
|
|
|
@ -585,13 +585,12 @@ static uint32_t iohidmanager_hid_device_get_location_id(IOHIDDeviceRef device)
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iohidmanager_hid_device_get_product_string(
|
static void iohidmanager_hid_device_get_product_string(
|
||||||
IOHIDDeviceRef device, char *buf, size_t len)
|
IOHIDDeviceRef device, char *s, size_t len)
|
||||||
{
|
{
|
||||||
CFStringRef ref = (CFStringRef)
|
CFStringRef ref = (CFStringRef)
|
||||||
IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey));
|
IOHIDDeviceGetProperty(device, CFSTR(kIOHIDProductKey));
|
||||||
|
|
||||||
if (ref)
|
if (ref)
|
||||||
CFStringGetCString(ref, buf, len, kCFStringEncodingUTF8);
|
CFStringGetCString(ref, s, len, kCFStringEncodingUTF8);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void iohidmanager_hid_device_add_autodetect(unsigned idx,
|
static void iohidmanager_hid_device_add_autodetect(unsigned idx,
|
||||||
|
|
|
@ -147,8 +147,7 @@ static int16_t wiiu_hid_joypad_axis(void *data, unsigned slot, uint32_t joyaxis)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int16_t wiiu_hid_joypad_state(
|
static int16_t wiiu_hid_joypad_state(void *data,
|
||||||
void *data,
|
|
||||||
rarch_joypad_info_t *joypad_info,
|
rarch_joypad_info_t *joypad_info,
|
||||||
const void *binds_data,
|
const void *binds_data,
|
||||||
unsigned port)
|
unsigned port)
|
||||||
|
@ -748,7 +747,7 @@ static void wiiu_hid_poll(void *data)
|
||||||
synchronized_process_adapters(hid);
|
synchronized_process_adapters(hid);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wiiu_hid_send_control(void *data, uint8_t *buf, size_t len)
|
static void wiiu_hid_send_control(void *data, uint8_t *s, size_t len)
|
||||||
{
|
{
|
||||||
wiiu_adapter_t *adapter = (wiiu_adapter_t *)data;
|
wiiu_adapter_t *adapter = (wiiu_adapter_t *)data;
|
||||||
int32_t result;
|
int32_t result;
|
||||||
|
@ -760,7 +759,7 @@ static void wiiu_hid_send_control(void *data, uint8_t *buf, size_t len)
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(adapter->tx_buffer, 0, adapter->tx_size);
|
memset(adapter->tx_buffer, 0, adapter->tx_size);
|
||||||
memcpy(adapter->tx_buffer, buf, len);
|
memcpy(adapter->tx_buffer, s, len);
|
||||||
|
|
||||||
/* From testing, HIDWrite returns an error that looks like it's two
|
/* From testing, HIDWrite returns an error that looks like it's two
|
||||||
* int16_t's bitmasked together. For example, one error I saw when trying
|
* int16_t's bitmasked together. For example, one error I saw when trying
|
||||||
|
@ -775,12 +774,12 @@ static void wiiu_hid_send_control(void *data, uint8_t *buf, size_t len)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void _fixup_report_buffer(uint8_t **buffer, uint8_t report_id, size_t *length)
|
static void _fixup_report_buffer(uint8_t **s, uint8_t report_id, size_t *len)
|
||||||
{
|
{
|
||||||
if ((*buffer)[0] == report_id)
|
if ((*s)[0] == report_id)
|
||||||
{
|
{
|
||||||
*buffer = (*buffer)+ 1;
|
*s = (*s)+ 1;
|
||||||
*length = *length - 1;
|
*len = *len - 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -804,7 +803,8 @@ static int32_t wiiu_hid_set_report(void *data, uint8_t report_type,
|
||||||
NULL, NULL);
|
NULL, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t wiiu_hid_get_report(void *handle, uint8_t report_type, uint8_t report_id, uint8_t *report_data, size_t report_length)
|
static int32_t wiiu_hid_get_report(void *handle, uint8_t report_type, uint8_t report_id,
|
||||||
|
uint8_t *report_data, size_t report_length)
|
||||||
{
|
{
|
||||||
wiiu_adapter_t *adapter = (wiiu_adapter_t *)handle;
|
wiiu_adapter_t *adapter = (wiiu_adapter_t *)handle;
|
||||||
if (!adapter || report_length > adapter->tx_size)
|
if (!adapter || report_length > adapter->tx_size)
|
||||||
|
@ -860,7 +860,8 @@ static int32_t wiiu_hid_read(void *data, void *buffer, size_t len)
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void wiiu_hid_init_cachealigned_buffer(int32_t min_size, uint8_t **out_buf_ptr, int32_t *actual_size)
|
static void wiiu_hid_init_cachealigned_buffer(int32_t min_size,
|
||||||
|
uint8_t **out_buf_ptr, int32_t *actual_size)
|
||||||
{
|
{
|
||||||
*actual_size = (min_size + 0x3f) & ~0x3f;
|
*actual_size = (min_size + 0x3f) & ~0x3f;
|
||||||
*out_buf_ptr = wiiu_hid_alloc_zeroed(64, *actual_size);
|
*out_buf_ptr = wiiu_hid_alloc_zeroed(64, *actual_size);
|
||||||
|
|
|
@ -49,12 +49,12 @@ struct hid_driver
|
||||||
bool (*set_rumble)(void *handle, unsigned pad, enum retro_rumble_effect effect, uint16_t);
|
bool (*set_rumble)(void *handle, unsigned pad, enum retro_rumble_effect effect, uint16_t);
|
||||||
const char *(*name)(void *handle, unsigned pad);
|
const char *(*name)(void *handle, unsigned pad);
|
||||||
const char *ident;
|
const char *ident;
|
||||||
void (*send_control)(void *handle, uint8_t *buf, size_t len);
|
void (*send_control)(void *handle, uint8_t *s, size_t len);
|
||||||
int32_t (*set_report)(void *handle, uint8_t report_type, uint8_t report_id, uint8_t *data, size_t len);
|
int32_t (*set_report)(void *handle, uint8_t report_type, uint8_t report_id, uint8_t *data, size_t len);
|
||||||
int32_t (*get_report)(void *handle, uint8_t report_type, uint8_t report_id, uint8_t *data, size_t len);
|
int32_t (*get_report)(void *handle, uint8_t report_type, uint8_t report_id, uint8_t *data, size_t len);
|
||||||
int32_t (*set_idle)(void *handle, uint8_t amount);
|
int32_t (*set_idle)(void *handle, uint8_t amount);
|
||||||
int32_t (*set_protocol)(void *handle, uint8_t protocol);
|
int32_t (*set_protocol)(void *handle, uint8_t protocol);
|
||||||
int32_t (*read)(void *handle, void *buf, size_t len);
|
int32_t (*read)(void *handle, void *s, size_t len);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* HID_DRIVER_H__ */
|
#endif /* HID_DRIVER_H__ */
|
||||||
|
|
|
@ -2091,12 +2091,6 @@ enum retro_key rarch_keysym_lut[RETROK_LAST];
|
||||||
static unsigned *rarch_keysym_rlut = NULL;
|
static unsigned *rarch_keysym_rlut = NULL;
|
||||||
static unsigned rarch_keysym_rlut_size = 0;
|
static unsigned rarch_keysym_rlut_size = 0;
|
||||||
|
|
||||||
/**
|
|
||||||
* input_keymaps_init_keyboard_lut:
|
|
||||||
* @map : Keyboard map.
|
|
||||||
*
|
|
||||||
* Initializes and sets the keyboard layout to a keyboard map (@map).
|
|
||||||
**/
|
|
||||||
void input_keymaps_init_keyboard_lut(const struct rarch_key_map *map)
|
void input_keymaps_init_keyboard_lut(const struct rarch_key_map *map)
|
||||||
{
|
{
|
||||||
const struct rarch_key_map *map_start = map;
|
const struct rarch_key_map *map_start = map;
|
||||||
|
@ -2124,15 +2118,6 @@ void input_keymaps_init_keyboard_lut(const struct rarch_key_map *map)
|
||||||
rarch_keysym_rlut_size = 0;
|
rarch_keysym_rlut_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* input_keymaps_translate_keysym_to_rk:
|
|
||||||
* @sym : Key symbol.
|
|
||||||
*
|
|
||||||
* Translates a key symbol from the keyboard layout table
|
|
||||||
* to an associated retro key identifier.
|
|
||||||
*
|
|
||||||
* Returns: Retro key identifier.
|
|
||||||
**/
|
|
||||||
enum retro_key input_keymaps_translate_keysym_to_rk(unsigned sym)
|
enum retro_key input_keymaps_translate_keysym_to_rk(unsigned sym)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
@ -2153,25 +2138,16 @@ enum retro_key input_keymaps_translate_keysym_to_rk(unsigned sym)
|
||||||
return RETROK_UNKNOWN;
|
return RETROK_UNKNOWN;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
void input_keymaps_translate_rk_to_str(enum retro_key key, char *s, size_t len)
|
||||||
* input_keymaps_translate_rk_to_str:
|
|
||||||
* @key : Retro key identifier.
|
|
||||||
* @buf : Buffer.
|
|
||||||
* @size : Size of @buf.
|
|
||||||
*
|
|
||||||
* Translates a retro key identifier to a human-readable
|
|
||||||
* identifier string.
|
|
||||||
**/
|
|
||||||
void input_keymaps_translate_rk_to_str(enum retro_key key, char *buf, size_t len)
|
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
|
|
||||||
*buf = '\0';
|
*s = '\0';
|
||||||
|
|
||||||
if (key >= RETROK_a && key <= RETROK_z)
|
if (key >= RETROK_a && key <= RETROK_z)
|
||||||
{
|
{
|
||||||
buf[0] = (key - RETROK_a) + 'a';
|
s[0] = (key - RETROK_a) + 'a';
|
||||||
buf[1] = '\0';
|
s[1] = '\0';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2180,7 +2156,7 @@ void input_keymaps_translate_rk_to_str(enum retro_key key, char *buf, size_t len
|
||||||
if (input_config_key_map[i].key != key)
|
if (input_config_key_map[i].key != key)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
strlcpy(buf, input_config_key_map[i].str, len);
|
strlcpy(s, input_config_key_map[i].str, len);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -223,13 +223,13 @@ enum retro_key input_keymaps_translate_keysym_to_rk(unsigned sym);
|
||||||
/**
|
/**
|
||||||
* input_keymaps_translate_rk_to_str:
|
* input_keymaps_translate_rk_to_str:
|
||||||
* @key : Retro key identifier.
|
* @key : Retro key identifier.
|
||||||
* @buf : Buffer.
|
* @s : Buffer.
|
||||||
* @len : Size of @buf.
|
* @len : Size of @s.
|
||||||
*
|
*
|
||||||
* Translates a retro key identifier to a human-readable
|
* Translates a retro key identifier to a human-readable
|
||||||
* identifier string.
|
* identifier string.
|
||||||
**/
|
**/
|
||||||
void input_keymaps_translate_rk_to_str(enum retro_key key, char *buf, size_t len);
|
void input_keymaps_translate_rk_to_str(enum retro_key key, char *s, size_t len);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* input_translate_rk_to_ascii:
|
* input_translate_rk_to_ascii:
|
||||||
|
|
|
@ -99,7 +99,7 @@ void increment_msf(unsigned char *min, unsigned char *sec, unsigned char *frame)
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CDROM_DEBUG
|
#ifdef CDROM_DEBUG
|
||||||
static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
|
static void cdrom_print_sense_data(const unsigned char *s, size_t len)
|
||||||
{
|
{
|
||||||
unsigned i;
|
unsigned i;
|
||||||
const char *sense_key_text = NULL;
|
const char *sense_key_text = NULL;
|
||||||
|
@ -114,20 +114,20 @@ static void cdrom_print_sense_data(const unsigned char *sense, size_t len)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
key = sense[2] & 0xF;
|
key = s[2] & 0xF;
|
||||||
asc = sense[12];
|
asc = s[12];
|
||||||
ascq = sense[13];
|
ascq = s[13];
|
||||||
|
|
||||||
printf("[CDROM] Sense Data: ");
|
printf("[CDROM] Sense Data: ");
|
||||||
|
|
||||||
for (i = 0; i < MIN(len, 16); i++)
|
for (i = 0; i < MIN(len, 16); i++)
|
||||||
printf("%02X ", sense[i]);
|
printf("%02X ", s[i]);
|
||||||
|
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
|
||||||
if (sense[0] == 0x70)
|
if (s[0] == 0x70)
|
||||||
printf("[CDROM] CURRENT ERROR:\n");
|
printf("[CDROM] CURRENT ERROR:\n");
|
||||||
if (sense[0] == 0x71)
|
if (s[0] == 0x71)
|
||||||
printf("[CDROM] DEFERRED ERROR:\n");
|
printf("[CDROM] DEFERRED ERROR:\n");
|
||||||
|
|
||||||
switch (key)
|
switch (key)
|
||||||
|
@ -371,17 +371,17 @@ static int cdrom_send_command_linux(const libretro_vfs_implementation_file *stre
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int cdrom_send_command(libretro_vfs_implementation_file *stream, CDROM_CMD_Direction dir,
|
static int cdrom_send_command(libretro_vfs_implementation_file *stream, CDROM_CMD_Direction dir,
|
||||||
void *buf, size_t len, unsigned char *cmd, size_t cmd_len, size_t skip)
|
void *s, size_t len, unsigned char *cmd, size_t cmd_len, size_t skip)
|
||||||
{
|
{
|
||||||
unsigned char *xfer_buf = NULL;
|
|
||||||
unsigned char *xfer_buf_pos = xfer_buf;
|
|
||||||
unsigned char sense[CDROM_MAX_SENSE_BYTES] = {0};
|
|
||||||
unsigned char retries_left = CDROM_MAX_RETRIES;
|
|
||||||
int i, rv = 0;
|
int i, rv = 0;
|
||||||
int frames = 1;
|
int frames = 1;
|
||||||
|
unsigned char *xfer_buf = NULL;
|
||||||
|
unsigned char *xfer_buf_pos = xfer_buf;
|
||||||
|
unsigned char sense[CDROM_MAX_SENSE_BYTES] = {0};
|
||||||
|
unsigned char retries_left = CDROM_MAX_RETRIES;
|
||||||
size_t padded_req_bytes;
|
size_t padded_req_bytes;
|
||||||
size_t copied_bytes = 0;
|
size_t copied_bytes = 0;
|
||||||
bool read_cd = false;
|
bool read_cd = false;
|
||||||
|
|
||||||
if (!cmd || cmd_len == 0 || cmd_len < CDROM_MIN_BUFSIZE)
|
if (!cmd || cmd_len == 0 || cmd_len < CDROM_MIN_BUFSIZE)
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -491,13 +491,13 @@ retry:
|
||||||
{
|
{
|
||||||
rv = 0;
|
rv = 0;
|
||||||
|
|
||||||
if (buf)
|
if (s)
|
||||||
{
|
{
|
||||||
#if 0
|
#if 0
|
||||||
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);
|
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);
|
||||||
fflush(stdout);
|
fflush(stdout);
|
||||||
#endif
|
#endif
|
||||||
memcpy((char*)buf + copied_bytes, xfer_buf_pos + skip, copy_len);
|
memcpy((char*)s + copied_bytes, xfer_buf_pos + skip, copy_len);
|
||||||
copied_bytes += copy_len;
|
copied_bytes += copy_len;
|
||||||
|
|
||||||
if (read_cd && !cached_read && request_len >= 2352)
|
if (read_cd && !cached_read && request_len >= 2352)
|
||||||
|
@ -570,7 +570,6 @@ retry:
|
||||||
|
|
||||||
if (xfer_buf)
|
if (xfer_buf)
|
||||||
memalign_free(xfer_buf);
|
memalign_free(xfer_buf);
|
||||||
|
|
||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1168,7 +1167,10 @@ int cdrom_get_inquiry(libretro_vfs_implementation_file *stream, char *s, size_t
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
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)
|
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)
|
||||||
{
|
{
|
||||||
/* MMC Command: READ CD MSF */
|
/* MMC Command: READ CD MSF */
|
||||||
unsigned char cdb[] = {0xB9, 0, 0, 0, 0, 0, 0, 0, 0, 0xF8, 0, 0};
|
unsigned char cdb[] = {0xB9, 0, 0, 0, 0, 0, 0, 0, 0, 0xF8, 0, 0};
|
||||||
|
|
|
@ -44,7 +44,7 @@ int memstream_getc(memstream_t *stream);
|
||||||
|
|
||||||
void memstream_putc(memstream_t *stream, int c);
|
void memstream_putc(memstream_t *stream, int c);
|
||||||
|
|
||||||
char *memstream_gets(memstream_t *stream, char *buffer, size_t len);
|
char *memstream_gets(memstream_t *stream, char *s, size_t len);
|
||||||
|
|
||||||
uint64_t memstream_pos(memstream_t *stream);
|
uint64_t memstream_pos(memstream_t *stream);
|
||||||
|
|
||||||
|
|
|
@ -40,15 +40,10 @@ struct memstream
|
||||||
unsigned writing;
|
unsigned writing;
|
||||||
};
|
};
|
||||||
|
|
||||||
void memstream_set_buffer(uint8_t *buffer, uint64_t size)
|
void memstream_set_buffer(uint8_t *s, uint64_t len)
|
||||||
{
|
{
|
||||||
g_buffer = buffer;
|
g_buffer = s;
|
||||||
g_size = size;
|
g_size = len;
|
||||||
}
|
|
||||||
|
|
||||||
uint64_t memstream_get_last_size(void)
|
|
||||||
{
|
|
||||||
return last_file_size;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
memstream_t *memstream_open(unsigned writing)
|
memstream_t *memstream_open(unsigned writing)
|
||||||
|
@ -158,15 +153,9 @@ void memstream_rewind(memstream_t *stream)
|
||||||
memstream_seek(stream, 0L, SEEK_SET);
|
memstream_seek(stream, 0L, SEEK_SET);
|
||||||
}
|
}
|
||||||
|
|
||||||
uint64_t memstream_pos(memstream_t *stream)
|
uint64_t memstream_pos(memstream_t *stream) { return stream->ptr; }
|
||||||
{
|
char *memstream_gets(memstream_t *stream, char *s, size_t len) { return NULL; }
|
||||||
return stream->ptr;
|
uint64_t memstream_get_last_size(void) { return last_file_size; }
|
||||||
}
|
|
||||||
|
|
||||||
char *memstream_gets(memstream_t *stream, char *buffer, size_t len)
|
|
||||||
{
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
int memstream_getc(memstream_t *stream)
|
int memstream_getc(memstream_t *stream)
|
||||||
{
|
{
|
||||||
|
|
|
@ -647,20 +647,20 @@ char* rzipstream_gets(rzipstream_t *stream, char *s, size_t len)
|
||||||
* - 'buf' will be allocated and must be free()'d manually.
|
* - 'buf' will be allocated and must be free()'d manually.
|
||||||
* - Allocated 'buf' size is equal to 'len'.
|
* - Allocated 'buf' size is equal to 'len'.
|
||||||
* Returns false in the event of an error */
|
* Returns false in the event of an error */
|
||||||
bool rzipstream_read_file(const char *path, void **buf, int64_t *len)
|
bool rzipstream_read_file(const char *path, void **s, int64_t *len)
|
||||||
{
|
{
|
||||||
int64_t bytes_read = 0;
|
int64_t bytes_read = 0;
|
||||||
void *content_buf = NULL;
|
void *content_buf = NULL;
|
||||||
int64_t content_buf_size = 0;
|
int64_t content_buf_size = 0;
|
||||||
rzipstream_t *stream = NULL;
|
rzipstream_t *stream = NULL;
|
||||||
|
|
||||||
if (!buf)
|
if (!s)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
/* Attempt to open file */
|
/* Attempt to open file */
|
||||||
if (!(stream = rzipstream_open(path, RETRO_VFS_FILE_ACCESS_READ)))
|
if (!(stream = rzipstream_open(path, RETRO_VFS_FILE_ACCESS_READ)))
|
||||||
{
|
{
|
||||||
*buf = NULL;
|
*s = NULL;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -689,7 +689,7 @@ bool rzipstream_read_file(const char *path, void **buf, int64_t *len)
|
||||||
((char*)content_buf)[bytes_read] = '\0';
|
((char*)content_buf)[bytes_read] = '\0';
|
||||||
|
|
||||||
/* Assign buffer */
|
/* Assign buffer */
|
||||||
*buf = content_buf;
|
*s = content_buf;
|
||||||
|
|
||||||
/* Assign length value, if required */
|
/* Assign length value, if required */
|
||||||
if (len)
|
if (len)
|
||||||
|
@ -709,7 +709,7 @@ error:
|
||||||
if (len)
|
if (len)
|
||||||
*len = -1;
|
*len = -1;
|
||||||
|
|
||||||
*buf = NULL;
|
*s = NULL;
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,9 +39,9 @@
|
||||||
#include <streams/stdin_stream.h>
|
#include <streams/stdin_stream.h>
|
||||||
|
|
||||||
#if (defined(_WIN32) && defined(_XBOX)) || defined(__WINRT__) || !defined(__PSL1GHT__) && defined(__PS3__)
|
#if (defined(_WIN32) && defined(_XBOX)) || defined(__WINRT__) || !defined(__PSL1GHT__) && defined(__PS3__)
|
||||||
size_t read_stdin(char *buf, size_t len) { return 0; } /* not implemented */
|
size_t read_stdin(char *s, size_t len) { return 0; } /* not implemented */
|
||||||
#elif defined(_WIN32)
|
#elif defined(_WIN32)
|
||||||
size_t read_stdin(char *buf, size_t len)
|
size_t read_stdin(char *s, size_t len)
|
||||||
{
|
{
|
||||||
DWORD i;
|
DWORD i;
|
||||||
DWORD has_read = 0;
|
DWORD has_read = 0;
|
||||||
|
@ -104,12 +104,12 @@ size_t read_stdin(char *buf, size_t len)
|
||||||
if (avail > len)
|
if (avail > len)
|
||||||
avail = len;
|
avail = len;
|
||||||
|
|
||||||
if (!ReadFile(hnd, buf, avail, &has_read, NULL))
|
if (!ReadFile(hnd, s, avail, &has_read, NULL))
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
for (i = 0; i < has_read; i++)
|
for (i = 0; i < has_read; i++)
|
||||||
if (buf[i] == '\r')
|
if (s[i] == '\r')
|
||||||
buf[i] = '\n';
|
s[i] = '\n';
|
||||||
|
|
||||||
/* Console won't echo for us while in non-line mode,
|
/* Console won't echo for us while in non-line mode,
|
||||||
* so do it manually ... */
|
* so do it manually ... */
|
||||||
|
@ -119,22 +119,21 @@ size_t read_stdin(char *buf, size_t len)
|
||||||
if (hnd_out != INVALID_HANDLE_VALUE)
|
if (hnd_out != INVALID_HANDLE_VALUE)
|
||||||
{
|
{
|
||||||
DWORD has_written;
|
DWORD has_written;
|
||||||
WriteConsole(hnd_out, buf, has_read, &has_written, NULL);
|
WriteConsole(hnd_out, s, has_read, &has_written, NULL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return has_read;
|
return has_read;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
size_t read_stdin(char *buf, size_t len)
|
size_t read_stdin(char *s, size_t len)
|
||||||
{
|
{
|
||||||
size_t has_read = 0;
|
size_t has_read = 0;
|
||||||
while (len)
|
while (len)
|
||||||
{
|
{
|
||||||
ssize_t ret = read(STDIN_FILENO, buf, len);
|
ssize_t ret = read(STDIN_FILENO, s, len);
|
||||||
if (ret <= 0)
|
if (ret <= 0)
|
||||||
break;
|
break;
|
||||||
buf += ret;
|
s += ret;
|
||||||
has_read += ret;
|
has_read += ret;
|
||||||
len -= ret;
|
len -= ret;
|
||||||
}
|
}
|
||||||
|
|
|
@ -189,8 +189,8 @@ char *string_trim_whitespace(char *const s)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* word_wrap:
|
* word_wrap:
|
||||||
* @dst : pointer to destination buffer.
|
* @s : pointer to destination buffer.
|
||||||
* @dst_size : size of destination buffer.
|
* @len : size of destination buffer.
|
||||||
* @src : pointer to input string.
|
* @src : pointer to input string.
|
||||||
* @line_width : max number of characters per line.
|
* @line_width : max number of characters per line.
|
||||||
* @wideglyph_width : not used, but is necessary to keep
|
* @wideglyph_width : not used, but is necessary to keep
|
||||||
|
@ -198,8 +198,8 @@ char *string_trim_whitespace(char *const s)
|
||||||
* @max_lines : max lines of destination string.
|
* @max_lines : max lines of destination string.
|
||||||
* 0 means no limit.
|
* 0 means no limit.
|
||||||
*
|
*
|
||||||
* Wraps string specified by 'src' to destination buffer
|
* Wraps string specified by @src to destination buffer
|
||||||
* specified by 'dst' and 'dst_size'.
|
* specified by @s and @len.
|
||||||
* This function assumes that all glyphs in the string
|
* This function assumes that all glyphs in the string
|
||||||
* have an on-screen pixel width similar to that of
|
* have an on-screen pixel width similar to that of
|
||||||
* regular Latin characters - i.e. it will not wrap
|
* regular Latin characters - i.e. it will not wrap
|
||||||
|
@ -207,7 +207,7 @@ char *string_trim_whitespace(char *const s)
|
||||||
* characters (e.g. CJK languages, emojis, etc.).
|
* characters (e.g. CJK languages, emojis, etc.).
|
||||||
**/
|
**/
|
||||||
size_t word_wrap(
|
size_t word_wrap(
|
||||||
char *dst, size_t dst_size,
|
char *s, size_t len,
|
||||||
const char *src, size_t src_len,
|
const char *src, size_t src_len,
|
||||||
int line_width, int wideglyph_width, unsigned max_lines)
|
int line_width, int wideglyph_width, unsigned max_lines)
|
||||||
{
|
{
|
||||||
|
@ -217,13 +217,13 @@ size_t word_wrap(
|
||||||
const char *src_end = src + src_len;
|
const char *src_end = src + src_len;
|
||||||
|
|
||||||
/* Prevent buffer overflow */
|
/* Prevent buffer overflow */
|
||||||
if (dst_size < src_len + 1)
|
if (len < src_len + 1)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Early return if src string length is less
|
/* Early return if src string length is less
|
||||||
* than line width */
|
* than line width */
|
||||||
if (src_len < (size_t)line_width)
|
if (src_len < (size_t)line_width)
|
||||||
return strlcpy(dst, src, dst_size);
|
return strlcpy(s, src, len);
|
||||||
|
|
||||||
while (*src != '\0')
|
while (*src != '\0')
|
||||||
{
|
{
|
||||||
|
@ -231,7 +231,7 @@ size_t word_wrap(
|
||||||
counter++;
|
counter++;
|
||||||
|
|
||||||
if (*src == ' ')
|
if (*src == ' ')
|
||||||
last_space = dst; /* Remember the location of the whitespace */
|
last_space = s; /* Remember the location of the whitespace */
|
||||||
else if (*src == '\n')
|
else if (*src == '\n')
|
||||||
{
|
{
|
||||||
/* If newlines embedded in the input,
|
/* If newlines embedded in the input,
|
||||||
|
@ -242,11 +242,11 @@ size_t word_wrap(
|
||||||
/* Early return if remaining src string
|
/* Early return if remaining src string
|
||||||
* length is less than line width */
|
* length is less than line width */
|
||||||
if (src_end - src <= line_width)
|
if (src_end - src <= line_width)
|
||||||
return strlcpy(dst, src, dst_size);
|
return strlcpy(s, src, len);
|
||||||
}
|
}
|
||||||
|
|
||||||
while (char_len--)
|
while (char_len--)
|
||||||
*dst++ = *src++;
|
*s++ = *src++;
|
||||||
|
|
||||||
if (counter >= (unsigned)line_width)
|
if (counter >= (unsigned)line_width)
|
||||||
{
|
{
|
||||||
|
@ -259,26 +259,26 @@ size_t word_wrap(
|
||||||
*last_space = '\n';
|
*last_space = '\n';
|
||||||
lines++;
|
lines++;
|
||||||
|
|
||||||
src -= dst - last_space - 1;
|
src -= s - last_space - 1;
|
||||||
dst = last_space + 1;
|
s = last_space + 1;
|
||||||
last_space = NULL;
|
last_space = NULL;
|
||||||
|
|
||||||
/* Early return if remaining src string
|
/* Early return if remaining src string
|
||||||
* length is less than line width */
|
* length is less than line width */
|
||||||
if (src_end - src < line_width)
|
if (src_end - src < line_width)
|
||||||
return strlcpy(dst, src, dst_size);
|
return strlcpy(s, src, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*dst = '\0';
|
*s = '\0';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* word_wrap_wideglyph:
|
* word_wrap_wideglyph:
|
||||||
* @dst : pointer to destination buffer.
|
* @dst : pointer to destination buffer.
|
||||||
* @dst_size : size of destination buffer.
|
* @len : size of destination buffer.
|
||||||
* @src : pointer to input string.
|
* @src : pointer to input string.
|
||||||
* @line_width : max number of characters per line.
|
* @line_width : max number of characters per line.
|
||||||
* @wideglyph_width : effective width of 'wide' Unicode glyphs.
|
* @wideglyph_width : effective width of 'wide' Unicode glyphs.
|
||||||
|
@ -296,7 +296,7 @@ size_t word_wrap(
|
||||||
* 0 means no limit.
|
* 0 means no limit.
|
||||||
*
|
*
|
||||||
* Wraps string specified by @src to destination buffer
|
* Wraps string specified by @src to destination buffer
|
||||||
* specified by @dst and @dst_size.
|
* specified by @dst and @len.
|
||||||
* This function assumes that all glyphs in the string
|
* This function assumes that all glyphs in the string
|
||||||
* are:
|
* are:
|
||||||
* - EITHER 'non-wide' Unicode glyphs, with an on-screen
|
* - EITHER 'non-wide' Unicode glyphs, with an on-screen
|
||||||
|
@ -308,7 +308,7 @@ size_t word_wrap(
|
||||||
* on-screen pixel width deviates greatly from the set
|
* on-screen pixel width deviates greatly from the set
|
||||||
* @wideglyph_width value.
|
* @wideglyph_width value.
|
||||||
**/
|
**/
|
||||||
size_t word_wrap_wideglyph(char *dst, size_t dst_size,
|
size_t word_wrap_wideglyph(char *s, size_t len,
|
||||||
const char *src, size_t src_len, int line_width,
|
const char *src, size_t src_len, int line_width,
|
||||||
int wideglyph_width, unsigned max_lines)
|
int wideglyph_width, unsigned max_lines)
|
||||||
{
|
{
|
||||||
|
@ -344,7 +344,7 @@ size_t word_wrap_wideglyph(char *dst, size_t dst_size,
|
||||||
/* Early return if src string length is less
|
/* Early return if src string length is less
|
||||||
* than line width */
|
* than line width */
|
||||||
if (src_end - src < line_width)
|
if (src_end - src < line_width)
|
||||||
return strlcpy(dst, src, dst_size);
|
return strlcpy(s, src, len);
|
||||||
|
|
||||||
while (*src != '\0')
|
while (*src != '\0')
|
||||||
{
|
{
|
||||||
|
@ -352,11 +352,11 @@ size_t word_wrap_wideglyph(char *dst, size_t dst_size,
|
||||||
counter_normalized += 100;
|
counter_normalized += 100;
|
||||||
|
|
||||||
/* Prevent buffer overflow */
|
/* Prevent buffer overflow */
|
||||||
if (char_len >= dst_size)
|
if (char_len >= len)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (*src == ' ')
|
if (*src == ' ')
|
||||||
lastspace = dst; /* Remember the location of the whitespace */
|
lastspace = s; /* Remember the location of the whitespace */
|
||||||
else if (*src == '\n')
|
else if (*src == '\n')
|
||||||
{
|
{
|
||||||
/* If newlines embedded in the input,
|
/* If newlines embedded in the input,
|
||||||
|
@ -367,19 +367,19 @@ size_t word_wrap_wideglyph(char *dst, size_t dst_size,
|
||||||
/* Early return if remaining src string
|
/* Early return if remaining src string
|
||||||
* length is less than line width */
|
* length is less than line width */
|
||||||
if (src_end - src <= line_width)
|
if (src_end - src <= line_width)
|
||||||
return strlcpy(dst, src, dst_size);
|
return strlcpy(s, src, len);
|
||||||
}
|
}
|
||||||
else if (char_len >= 3)
|
else if (char_len >= 3)
|
||||||
{
|
{
|
||||||
/* Remember the location of the first byte
|
/* Remember the location of the first byte
|
||||||
* whose length as UTF-8 >= 3*/
|
* whose length as UTF-8 >= 3*/
|
||||||
lastwideglyph = dst;
|
lastwideglyph = s;
|
||||||
counter_normalized += additional_counter_normalized;
|
counter_normalized += additional_counter_normalized;
|
||||||
}
|
}
|
||||||
|
|
||||||
dst_size -= char_len;
|
len -= char_len;
|
||||||
while (char_len--)
|
while (char_len--)
|
||||||
*dst++ = *src++;
|
*s++ = *src++;
|
||||||
|
|
||||||
if (counter_normalized >= (unsigned)line_width_normalized)
|
if (counter_normalized >= (unsigned)line_width_normalized)
|
||||||
{
|
{
|
||||||
|
@ -392,14 +392,14 @@ size_t word_wrap_wideglyph(char *dst, size_t dst_size,
|
||||||
/* Insert newline character */
|
/* Insert newline character */
|
||||||
*lastwideglyph = '\n';
|
*lastwideglyph = '\n';
|
||||||
lines++;
|
lines++;
|
||||||
src -= dst - lastwideglyph;
|
src -= s - lastwideglyph;
|
||||||
dst = lastwideglyph + 1;
|
s = lastwideglyph + 1;
|
||||||
lastwideglyph = NULL;
|
lastwideglyph = NULL;
|
||||||
|
|
||||||
/* Early return if remaining src string
|
/* Early return if remaining src string
|
||||||
* length is less than line width */
|
* length is less than line width */
|
||||||
if (src_end - src <= line_width)
|
if (src_end - src <= line_width)
|
||||||
return strlcpy(dst, src, dst_size);
|
return strlcpy(s, src, len);
|
||||||
}
|
}
|
||||||
else if (lastspace)
|
else if (lastspace)
|
||||||
{
|
{
|
||||||
|
@ -407,19 +407,19 @@ size_t word_wrap_wideglyph(char *dst, size_t dst_size,
|
||||||
* with newline character */
|
* with newline character */
|
||||||
*lastspace = '\n';
|
*lastspace = '\n';
|
||||||
lines++;
|
lines++;
|
||||||
src -= dst - lastspace - 1;
|
src -= s - lastspace - 1;
|
||||||
dst = lastspace + 1;
|
s = lastspace + 1;
|
||||||
lastspace = NULL;
|
lastspace = NULL;
|
||||||
|
|
||||||
/* Early return if remaining src string
|
/* Early return if remaining src string
|
||||||
* length is less than line width */
|
* length is less than line width */
|
||||||
if (src_end - src < line_width)
|
if (src_end - src < line_width)
|
||||||
return strlcpy(dst, src, dst_size);
|
return strlcpy(s, src, len);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
*dst = '\0';
|
*s = '\0';
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -455,7 +455,6 @@ char* string_tokenize(char **str, const char *delim)
|
||||||
if (!str || string_is_empty(delim))
|
if (!str || string_is_empty(delim))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
|
||||||
/* Note: we don't check string_is_empty() here,
|
/* Note: we don't check string_is_empty() here,
|
||||||
* empty strings are valid */
|
* empty strings are valid */
|
||||||
if (!(str_ptr = *str))
|
if (!(str_ptr = *str))
|
||||||
|
@ -483,16 +482,16 @@ char* string_tokenize(char **str, const char *delim)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* string_remove_all_chars:
|
* string_remove_all_chars:
|
||||||
* @str : input string (must be non-NULL, otherwise UB)
|
* @s : input string (must be non-NULL, otherwise UB)
|
||||||
*
|
*
|
||||||
* Leaf function.
|
* Leaf function.
|
||||||
*
|
*
|
||||||
* Removes every instance of character @c from @str
|
* Removes every instance of character @c from @s
|
||||||
**/
|
**/
|
||||||
void string_remove_all_chars(char *str, char c)
|
void string_remove_all_chars(char *s, char c)
|
||||||
{
|
{
|
||||||
char *read_ptr = str;
|
char *read_ptr = s;
|
||||||
char *write_ptr = str;
|
char *write_ptr = s;
|
||||||
|
|
||||||
while (*read_ptr != '\0')
|
while (*read_ptr != '\0')
|
||||||
{
|
{
|
||||||
|
@ -506,16 +505,16 @@ void string_remove_all_chars(char *str, char c)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* string_replace_all_chars:
|
* string_replace_all_chars:
|
||||||
* @str : input string (must be non-NULL, otherwise UB)
|
* @s : input string (must be non-NULL, otherwise UB)
|
||||||
* @find : character to find
|
* @find : character to find
|
||||||
* @replace : character to replace @find with
|
* @replace : character to replace @find with
|
||||||
*
|
*
|
||||||
* Replaces every instance of character @find in @str
|
* Replaces every instance of character @find in @s
|
||||||
* with character @replace
|
* with character @replace
|
||||||
**/
|
**/
|
||||||
void string_replace_all_chars(char *str, char find, char replace)
|
void string_replace_all_chars(char *s, char find, char replace)
|
||||||
{
|
{
|
||||||
char *str_ptr = str;
|
char *str_ptr = s;
|
||||||
while ((str_ptr = strchr(str_ptr, find)))
|
while ((str_ptr = strchr(str_ptr, find)))
|
||||||
*str_ptr++ = replace;
|
*str_ptr++ = replace;
|
||||||
}
|
}
|
||||||
|
@ -561,9 +560,9 @@ unsigned string_hex_to_unsigned(const char *str)
|
||||||
/* Remove leading '0x', if required */
|
/* Remove leading '0x', if required */
|
||||||
if (str[0] != '\0' && str[1] != '\0')
|
if (str[0] != '\0' && str[1] != '\0')
|
||||||
{
|
{
|
||||||
if ( (str[0] == '0') &&
|
if ( (str[0] == '0')
|
||||||
((str[1] == 'x') ||
|
&& ((str[1] == 'x')
|
||||||
(str[1] == 'X')))
|
|| (str[1] == 'X')))
|
||||||
{
|
{
|
||||||
hex_str = str + 2;
|
hex_str = str + 2;
|
||||||
if (string_is_empty(hex_str))
|
if (string_is_empty(hex_str))
|
||||||
|
@ -610,11 +609,11 @@ int string_count_occurrences_single_character(const char *str, char c)
|
||||||
*
|
*
|
||||||
* Replaces all spaces with given character @c.
|
* Replaces all spaces with given character @c.
|
||||||
**/
|
**/
|
||||||
void string_replace_whitespace_with_single_character(char *str, char c)
|
void string_replace_whitespace_with_single_character(char *s, char c)
|
||||||
{
|
{
|
||||||
for (; *str; str++)
|
for (; *s; s++)
|
||||||
if (ISSPACE(*str))
|
if (ISSPACE(*s))
|
||||||
*str = c;
|
*s = c;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -624,18 +623,18 @@ void string_replace_whitespace_with_single_character(char *str, char c)
|
||||||
*
|
*
|
||||||
* Replaces multiple spaces with a single space in a string.
|
* Replaces multiple spaces with a single space in a string.
|
||||||
**/
|
**/
|
||||||
void string_replace_multi_space_with_single_space(char *str)
|
void string_replace_multi_space_with_single_space(char *s)
|
||||||
{
|
{
|
||||||
char *str_trimmed = str;
|
char *str_trimmed = s;
|
||||||
bool prev_is_space = false;
|
bool prev_is_space = false;
|
||||||
bool curr_is_space = false;
|
bool curr_is_space = false;
|
||||||
|
|
||||||
for (; *str; str++)
|
for (; *s; s++)
|
||||||
{
|
{
|
||||||
curr_is_space = ISSPACE(*str);
|
curr_is_space = ISSPACE(*s);
|
||||||
if (prev_is_space && curr_is_space)
|
if (prev_is_space && curr_is_space)
|
||||||
continue;
|
continue;
|
||||||
*str_trimmed++ = *str;
|
*str_trimmed++ = *s;
|
||||||
prev_is_space = curr_is_space;
|
prev_is_space = curr_is_space;
|
||||||
}
|
}
|
||||||
*str_trimmed = '\0';
|
*str_trimmed = '\0';
|
||||||
|
@ -648,12 +647,12 @@ void string_replace_multi_space_with_single_space(char *str)
|
||||||
*
|
*
|
||||||
* Remove all spaces from the given string.
|
* Remove all spaces from the given string.
|
||||||
**/
|
**/
|
||||||
void string_remove_all_whitespace(char *str_trimmed, const char *str)
|
void string_remove_all_whitespace(char *s, const char *str)
|
||||||
{
|
{
|
||||||
for (; *str; str++)
|
for (; *str; str++)
|
||||||
if (!ISSPACE(*str))
|
if (!ISSPACE(*str))
|
||||||
*str_trimmed++ = *str;
|
*s++ = *str;
|
||||||
*str_trimmed = '\0';
|
*s = '\0';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -689,10 +688,10 @@ int string_find_index_substring_string(const char *str, const char *substr)
|
||||||
*
|
*
|
||||||
* Strips non-ASCII characters from a string.
|
* Strips non-ASCII characters from a string.
|
||||||
**/
|
**/
|
||||||
void string_copy_only_ascii(char *str_stripped, const char *str)
|
void string_copy_only_ascii(char *s, const char *str)
|
||||||
{
|
{
|
||||||
for (; *str; str++)
|
for (; *str; str++)
|
||||||
if (*str > 0x1F && *str < 0x7F)
|
if (*str > 0x1F && *str < 0x7F)
|
||||||
*str_stripped++ = *str;
|
*s++ = *str;
|
||||||
*str_stripped = '\0';
|
*s = '\0';
|
||||||
}
|
}
|
||||||
|
|
|
@ -153,7 +153,7 @@ typedef struct menu_file_list_cbs
|
||||||
unsigned *w, unsigned type, unsigned i,
|
unsigned *w, unsigned type, unsigned i,
|
||||||
const char *label, char *s, size_t len,
|
const char *label, char *s, size_t len,
|
||||||
const char *path,
|
const char *path,
|
||||||
char *path_buf, size_t path_buf_size);
|
char *s2, size_t len2);
|
||||||
menu_search_terms_t search;
|
menu_search_terms_t search;
|
||||||
enum msg_hash_enums enum_idx;
|
enum msg_hash_enums enum_idx;
|
||||||
char action_sublabel_cache[MENU_LABEL_MAX_LENGTH];
|
char action_sublabel_cache[MENU_LABEL_MAX_LENGTH];
|
||||||
|
|
Loading…
Add table
Reference in a new issue