mirror of
https://github.com/libretro/RetroArch
synced 2025-02-04 12:40:07 +00:00
Standardize local len variable naming conventions
This commit is contained in:
parent
47d199297a
commit
047e04ed3e
@ -64,9 +64,9 @@ static void bluetoothctl_scan(void *data)
|
||||
|
||||
while (fgets(line, 512, dev_file))
|
||||
{
|
||||
size_t len = strlen(line);
|
||||
if (len > 0 && line[len-1] == '\n')
|
||||
line[--len] = '\0';
|
||||
size_t _len = strlen(line);
|
||||
if (_len > 0 && line[_len - 1] == '\n')
|
||||
line[--_len] = '\0';
|
||||
|
||||
string_list_append(btctl->lines, line, attr);
|
||||
}
|
||||
|
@ -4088,7 +4088,6 @@ static bool input_keyboard_line_event(
|
||||
bool ret = false;
|
||||
const char *word = NULL;
|
||||
char c = (character >= 128) ? '?' : character;
|
||||
|
||||
#ifdef HAVE_LANGEXTRA
|
||||
static uint32_t composition = 0;
|
||||
/* reset composition, when edit box is opened. */
|
||||
@ -4099,12 +4098,12 @@ static bool input_keyboard_line_event(
|
||||
composition = 0;
|
||||
if (IS_COMPOSITION(character) || IS_END_COMPOSITION(character))
|
||||
{
|
||||
size_t len = strlen((char*)&composition);
|
||||
if (composition && state->buffer && state->size >= len && state->ptr >= len)
|
||||
size_t _len = strlen((char*)&composition);
|
||||
if (composition && state->buffer && state->size >= _len && state->ptr >= _len)
|
||||
{
|
||||
memmove(state->buffer + state->ptr-len, state->buffer + state->ptr, len + 1);
|
||||
state->ptr -= len;
|
||||
state->size -= len;
|
||||
memmove(state->buffer + state->ptr - _len, state->buffer + state->ptr, _len + 1);
|
||||
state->ptr -= _len;
|
||||
state->size -= _len;
|
||||
}
|
||||
if (IS_COMPOSITION_KR(character) && composition)
|
||||
{
|
||||
@ -4123,7 +4122,7 @@ static bool input_keyboard_line_event(
|
||||
composition = character & 0xffffff;
|
||||
character &= 0xffffff;
|
||||
}
|
||||
if (len && composition == 0)
|
||||
if (_len && composition == 0)
|
||||
word = state->buffer;
|
||||
if (character)
|
||||
input_keyboard_line_append(state, (char*)&character, strlen((char*)&character));
|
||||
@ -4134,7 +4133,6 @@ static bool input_keyboard_line_event(
|
||||
|
||||
/* Treat extended chars as ? as we cannot support
|
||||
* printable characters for unicode stuff. */
|
||||
|
||||
if (c == '\r' || c == '\n')
|
||||
{
|
||||
state->cb(state->userdata, state->buffer);
|
||||
|
@ -1000,12 +1000,11 @@ int cdrom_set_read_speed(libretro_vfs_implementation_file *stream, unsigned spee
|
||||
|
||||
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)
|
||||
{
|
||||
int i;
|
||||
unsigned char buf[2352] = {0};
|
||||
unsigned short data_len = 0;
|
||||
size_t len = 0;
|
||||
size_t pos = 0;
|
||||
size_t _len = 0, pos = 0;
|
||||
int rv = 0;
|
||||
int i;
|
||||
|
||||
if (!out_buf || !out_len || !num_tracks || !toc)
|
||||
{
|
||||
@ -1052,10 +1051,10 @@ int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, si
|
||||
return 1;
|
||||
}
|
||||
|
||||
len = CDROM_CUE_TRACK_BYTES * (*num_tracks);
|
||||
_len = CDROM_CUE_TRACK_BYTES * (*num_tracks);
|
||||
toc->num_tracks = *num_tracks;
|
||||
*out_buf = (char*)calloc(1, len);
|
||||
*out_len = len;
|
||||
*out_buf = (char*)calloc(1, _len);
|
||||
*out_len = _len;
|
||||
|
||||
for (i = 0; i < (data_len - 2) / 11; i++)
|
||||
{
|
||||
@ -1104,11 +1103,11 @@ int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, si
|
||||
track_type = "MODE2/2352";
|
||||
|
||||
#if defined(_WIN32) && !defined(_XBOX)
|
||||
pos += snprintf(*out_buf + pos, len - pos, "FILE \"cdrom://%c:/drive-track%02d.bin\" BINARY\n", cdrom_drive, point);
|
||||
pos += snprintf(*out_buf + pos, _len - pos, "FILE \"cdrom://%c:/drive-track%02d.bin\" BINARY\n", cdrom_drive, point);
|
||||
#else
|
||||
pos += snprintf(*out_buf + pos, len - pos, "FILE \"cdrom://drive%c-track%02d.bin\" BINARY\n", cdrom_drive, point);
|
||||
pos += snprintf(*out_buf + pos, _len - pos, "FILE \"cdrom://drive%c-track%02d.bin\" BINARY\n", cdrom_drive, point);
|
||||
#endif
|
||||
pos += snprintf(*out_buf + pos, len - pos, " TRACK %02d %s\n", point, track_type);
|
||||
pos += snprintf(*out_buf + pos, _len - pos, " TRACK %02d %s\n", point, track_type);
|
||||
|
||||
{
|
||||
unsigned pregap_lba_len = toc->track[point - 1].lba - toc->track[point - 1].lba_start;
|
||||
@ -1121,11 +1120,11 @@ int cdrom_write_cue(libretro_vfs_implementation_file *stream, char **out_buf, si
|
||||
|
||||
cdrom_lba_to_msf(pregap_lba_len, &min, &sec, &frame);
|
||||
|
||||
pos += snprintf(*out_buf + pos, len - pos, " INDEX 00 00:00:00\n");
|
||||
pos += snprintf(*out_buf + pos, len - pos, " INDEX 01 %02u:%02u:%02u\n", (unsigned)min, (unsigned)sec, (unsigned)frame);
|
||||
pos += snprintf(*out_buf + pos, _len - pos, " INDEX 00 00:00:00\n");
|
||||
pos += snprintf(*out_buf + pos, _len - pos, " INDEX 01 %02u:%02u:%02u\n", (unsigned)min, (unsigned)sec, (unsigned)frame);
|
||||
}
|
||||
else
|
||||
pos += snprintf(*out_buf + pos, len - pos, " INDEX 01 00:00:00\n");
|
||||
pos += snprintf(*out_buf + pos, _len - pos, " INDEX 01 00:00:00\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -56,12 +56,11 @@ int retro_strcasecmp__(const char *a, const char *b)
|
||||
|
||||
char *retro_strdup__(const char *orig)
|
||||
{
|
||||
size_t len = strlen(orig) + 1;
|
||||
char *ret = (char*)malloc(len);
|
||||
size_t _len = strlen(orig) + 1;
|
||||
char *ret = (char*)malloc(_len);
|
||||
if (!ret)
|
||||
return NULL;
|
||||
|
||||
strlcpy(ret, orig, len);
|
||||
strlcpy(ret, orig, _len);
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
@ -28,35 +28,28 @@
|
||||
/* Implementation of strlcpy()/strlcat() based on OpenBSD. */
|
||||
|
||||
#ifndef __MACH__
|
||||
|
||||
size_t strlcpy(char *dest, const char *source, size_t size)
|
||||
size_t strlcpy(char *s, const char *source, size_t len)
|
||||
{
|
||||
size_t src_size = 0;
|
||||
size_t n = size;
|
||||
|
||||
if (n)
|
||||
while (--n && (*dest++ = *source++)) src_size++;
|
||||
|
||||
if (!n)
|
||||
size_t _len = len;
|
||||
size_t __len = 0;
|
||||
if (_len)
|
||||
while (--_len && (*s++ = *source++)) __len++;
|
||||
if (!_len)
|
||||
{
|
||||
if (size) *dest = '\0';
|
||||
while (*source++) src_size++;
|
||||
if (len) *s = '\0';
|
||||
while (*source++) __len++;
|
||||
}
|
||||
|
||||
return src_size;
|
||||
return __len;
|
||||
}
|
||||
|
||||
size_t strlcat(char *dest, const char *source, size_t size)
|
||||
size_t strlcat(char *s, const char *source, size_t len)
|
||||
{
|
||||
size_t len = strlen(dest);
|
||||
|
||||
dest += len;
|
||||
|
||||
if (len > size)
|
||||
size = 0;
|
||||
size_t _len = strlen(s);
|
||||
s += _len;
|
||||
if (_len > len)
|
||||
len = 0;
|
||||
else
|
||||
size -= len;
|
||||
|
||||
return len + strlcpy(dest, source, size);
|
||||
len -= _len;
|
||||
return _len + strlcpy(s, source, len);
|
||||
}
|
||||
#endif
|
||||
|
@ -1414,11 +1414,11 @@ size_t fill_pathname_application_path(char *s, size_t len)
|
||||
}
|
||||
#elif defined(__QNX__)
|
||||
char *buff = malloc(len);
|
||||
size_t rv = 0;
|
||||
size_t _len = 0;
|
||||
if (_cmdname(buff))
|
||||
rv = strlcpy(s, buff, len);
|
||||
_len = strlcpy(s, buff, len);
|
||||
free(buff);
|
||||
return rv;
|
||||
return _len;
|
||||
#else
|
||||
size_t i;
|
||||
static const char *exts[] = { "exe", "file", "path/a.out" };
|
||||
|
@ -182,16 +182,16 @@ static bool m3u_file_load(m3u_file_t *m3u_file)
|
||||
|
||||
if (token_ptr)
|
||||
{
|
||||
size_t len = (size_t)(1 + token_ptr - line);
|
||||
size_t _len = (size_t)(1 + token_ptr - line);
|
||||
|
||||
/* Get entry_path segment */
|
||||
if (len > 0)
|
||||
if (_len > 0)
|
||||
{
|
||||
memset(entry_path, 0, sizeof(entry_path));
|
||||
strlcpy(
|
||||
entry_path, line,
|
||||
((len < PATH_MAX_LENGTH ?
|
||||
len : PATH_MAX_LENGTH) * sizeof(char)));
|
||||
((_len < PATH_MAX_LENGTH ?
|
||||
_len : PATH_MAX_LENGTH) * sizeof(char)));
|
||||
string_trim_whitespace_right(entry_path);
|
||||
string_trim_whitespace_left(entry_path);
|
||||
}
|
||||
|
@ -28,34 +28,31 @@
|
||||
|
||||
/*#define MEDIA_CUE_PARSE_DEBUG*/
|
||||
|
||||
static void media_zero_trailing_spaces(char *buf, size_t len)
|
||||
static void media_zero_trailing_spaces(char *s, size_t len)
|
||||
{
|
||||
int i;
|
||||
|
||||
for (i = len - 1; i >= 0; i--)
|
||||
{
|
||||
if (buf[i] == ' ')
|
||||
buf[i] = '\0';
|
||||
else if (buf[i] != '\0')
|
||||
if (s[i] == ' ')
|
||||
s[i] = '\0';
|
||||
else if (s[i] != '\0')
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
static bool media_skip_spaces(const char **buf, size_t len)
|
||||
static bool media_skip_spaces(const char **s, size_t len)
|
||||
{
|
||||
if (buf && *buf && **buf)
|
||||
if (s && *s && **s)
|
||||
{
|
||||
size_t i;
|
||||
for (i = 0; i < len; i++)
|
||||
{
|
||||
if ((*buf)[i] == ' ' || (*buf)[i] == '\t')
|
||||
if ((*s)[i] == ' ' || (*s)[i] == '\t')
|
||||
continue;
|
||||
|
||||
*buf += i;
|
||||
*s += i;
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -86,7 +83,7 @@ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info)
|
||||
|
||||
while (!filestream_eof(file) && (line = filestream_getline(file)))
|
||||
{
|
||||
size_t len = 0;
|
||||
size_t _len = 0;
|
||||
const char *command = NULL;
|
||||
|
||||
if (string_is_empty(line))
|
||||
@ -95,15 +92,15 @@ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info)
|
||||
continue;
|
||||
}
|
||||
|
||||
len = strlen(line);
|
||||
_len = strlen(line);
|
||||
command = line;
|
||||
|
||||
media_skip_spaces(&command, len);
|
||||
media_skip_spaces(&command, _len);
|
||||
|
||||
if (!found_file && !strncasecmp(command, "FILE", 4))
|
||||
{
|
||||
const char *file = command + 4;
|
||||
media_skip_spaces(&file, len - 4);
|
||||
media_skip_spaces(&file, _len - 4);
|
||||
|
||||
if (!string_is_empty(file))
|
||||
{
|
||||
@ -137,7 +134,7 @@ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info)
|
||||
else if (found_file && !found_track && !strncasecmp(command, "TRACK", 5))
|
||||
{
|
||||
const char *track = command + 5;
|
||||
media_skip_spaces(&track, len - 5);
|
||||
media_skip_spaces(&track, _len - 5);
|
||||
|
||||
if (!string_is_empty(track))
|
||||
{
|
||||
@ -173,7 +170,7 @@ bool media_detect_cd_info_cue(const char *path, media_detect_cd_info_t *info)
|
||||
else if (found_file && found_track && first_data_track && !strncasecmp(command, "INDEX", 5))
|
||||
{
|
||||
const char *index = command + 5;
|
||||
media_skip_spaces(&index, len - 5);
|
||||
media_skip_spaces(&index, _len - 5);
|
||||
|
||||
if (!string_is_empty(index))
|
||||
{
|
||||
|
@ -94,9 +94,7 @@ void* mmap(void *addr, size_t len, int prot, int flags,
|
||||
|
||||
int munmap(void *addr, size_t len)
|
||||
{
|
||||
if (!UnmapViewOfFile(addr))
|
||||
return -1;
|
||||
return 0;
|
||||
return (UnmapViewOfFile(addr)) ? 0 : -1;
|
||||
}
|
||||
|
||||
int mprotect(void *addr, size_t len, int prot)
|
||||
@ -137,23 +135,21 @@ int mprotect(void *addr, size_t len, int prot)
|
||||
|
||||
int memsync(void *start, void *end)
|
||||
{
|
||||
size_t len = (char*)end - (char*)start;
|
||||
size_t _len = (char*)end - (char*)start;
|
||||
#if defined(__MACH__) && defined(__arm__)
|
||||
sys_dcache_flush(start ,len);
|
||||
sys_icache_invalidate(start, len);
|
||||
sys_dcache_flush(start, _len);
|
||||
sys_icache_invalidate(start, _len);
|
||||
return 0;
|
||||
#elif defined(__arm__) && !defined(__QNX__)
|
||||
(void)len;
|
||||
__clear_cache(start, end);
|
||||
return 0;
|
||||
#elif defined(HAVE_MMAN)
|
||||
return msync(start, len, MS_SYNC | MS_INVALIDATE
|
||||
return msync(start, _len, MS_SYNC | MS_INVALIDATE
|
||||
#ifdef __QNX__
|
||||
MS_CACHE_ONLY
|
||||
#endif
|
||||
);
|
||||
#else
|
||||
(void)len;
|
||||
return 0;
|
||||
#endif
|
||||
}
|
||||
|
@ -1074,7 +1074,7 @@ libretro_vfs_implementation_dir *retro_vfs_opendir_impl(
|
||||
{
|
||||
#if defined(_WIN32)
|
||||
char path_buf[1024];
|
||||
size_t copied = 0;
|
||||
size_t _len;
|
||||
#if defined(LEGACY_WIN32)
|
||||
char *path_local = NULL;
|
||||
#else
|
||||
@ -1095,25 +1095,21 @@ libretro_vfs_implementation_dir *retro_vfs_opendir_impl(
|
||||
rdir->orig_path = strdup(name);
|
||||
|
||||
#if defined(_WIN32)
|
||||
copied = strlcpy(path_buf, name, sizeof(path_buf));
|
||||
|
||||
_len = strlcpy(path_buf, name, sizeof(path_buf));
|
||||
/* Non-NT platforms don't like extra slashes in the path */
|
||||
if (path_buf[copied - 1] != '\\')
|
||||
path_buf [copied++] = '\\';
|
||||
|
||||
path_buf[copied ] = '*';
|
||||
path_buf[copied+1] = '\0';
|
||||
if (path_buf[_len - 1] != '\\')
|
||||
path_buf [_len++] = '\\';
|
||||
|
||||
path_buf[_len ] = '*';
|
||||
path_buf[_len + 1] = '\0';
|
||||
#if defined(LEGACY_WIN32)
|
||||
path_local = utf8_to_local_string_alloc(path_buf);
|
||||
rdir->directory = FindFirstFile(path_local, &rdir->entry);
|
||||
|
||||
if (path_local)
|
||||
free(path_local);
|
||||
#else
|
||||
path_wide = utf8_to_utf16_string_alloc(path_buf);
|
||||
rdir->directory = FindFirstFileW(path_wide, &rdir->entry);
|
||||
|
||||
if (path_wide)
|
||||
free(path_wide);
|
||||
#endif
|
||||
|
@ -659,8 +659,8 @@ struct libretro_vfs_implementation_dir
|
||||
libretro_vfs_implementation_dir* retro_vfs_opendir_impl(
|
||||
const char* name, bool include_hidden)
|
||||
{
|
||||
size_t _len;
|
||||
char path_buf[1024];
|
||||
size_t copied = 0;
|
||||
wchar_t* path_wide = NULL;
|
||||
libretro_vfs_implementation_dir* rdir;
|
||||
|
||||
@ -674,14 +674,14 @@ libretro_vfs_implementation_dir* retro_vfs_opendir_impl(
|
||||
|
||||
rdir->orig_path = strdup(name);
|
||||
|
||||
copied = strlcpy(path_buf, name, sizeof(path_buf));
|
||||
_len = strlcpy(path_buf, name, sizeof(path_buf));
|
||||
|
||||
/* Non-NT platforms don't like extra slashes in the path */
|
||||
if (path_buf[copied - 1] != '\\')
|
||||
path_buf[copied++] = '\\';
|
||||
if (path_buf[_len - 1] != '\\')
|
||||
path_buf[_len++] = '\\';
|
||||
|
||||
path_buf[copied] = '*';
|
||||
path_buf[copied + 1] = '\0';
|
||||
path_buf[_len] = '*';
|
||||
path_buf[_len + 1] = '\0';
|
||||
|
||||
path_wide = utf8_to_utf16_string_alloc(path_buf);
|
||||
rdir->directory = FindFirstFileExFromAppW(
|
||||
|
@ -70,26 +70,24 @@ webdav_state_t *webdav_state_get_ptr(void)
|
||||
|
||||
static char *webdav_create_basic_auth(void)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
size_t len = 0;
|
||||
char userpass[512];
|
||||
char *base64auth;
|
||||
int flen;
|
||||
|
||||
char *base64auth;
|
||||
char userpass[512];
|
||||
settings_t *settings = config_get_ptr();
|
||||
size_t _len = 0;
|
||||
if (!string_is_empty(settings->arrays.webdav_username))
|
||||
len += strlcpy(userpass + len, settings->arrays.webdav_username, sizeof(userpass) - len);
|
||||
userpass[len++] = ':';
|
||||
_len += strlcpy(userpass + _len, settings->arrays.webdav_username, sizeof(userpass) - _len);
|
||||
userpass[_len++] = ':';
|
||||
if (!string_is_empty(settings->arrays.webdav_password))
|
||||
len += strlcpy(userpass + len, settings->arrays.webdav_password, sizeof(userpass) - len);
|
||||
userpass[len] = '\0';
|
||||
base64auth = base64(userpass, (int)len, &flen);
|
||||
len = strlcpy(userpass, "Authorization: Basic ", sizeof(userpass));
|
||||
len += strlcpy(userpass + len, base64auth, sizeof(userpass) - len);
|
||||
_len += strlcpy(userpass + _len, settings->arrays.webdav_password, sizeof(userpass) - _len);
|
||||
userpass[_len] = '\0';
|
||||
base64auth = base64(userpass, (int)_len, &flen);
|
||||
_len = strlcpy(userpass, "Authorization: Basic ", sizeof(userpass));
|
||||
_len += strlcpy(userpass + _len, base64auth, sizeof(userpass) - _len);
|
||||
free(base64auth);
|
||||
userpass[len++] = '\r';
|
||||
userpass[len++] = '\n';
|
||||
userpass[len ] = '\0';
|
||||
|
||||
userpass[_len++] = '\r';
|
||||
userpass[_len++] = '\n';
|
||||
userpass[_len ] = '\0';
|
||||
return strdup(userpass);
|
||||
}
|
||||
|
||||
@ -357,13 +355,13 @@ static char *webdav_create_digest_response(const char *method, const char *path)
|
||||
|
||||
static char *webdav_create_digest_auth_header(const char *method, const char *url)
|
||||
{
|
||||
size_t _len;
|
||||
char nonceCount[10];
|
||||
webdav_state_t *webdav_st = webdav_state_get_ptr();
|
||||
char *header;
|
||||
char *response;
|
||||
char nonceCount[10];
|
||||
char *header = NULL;
|
||||
char *response = NULL;
|
||||
const char *path = url;
|
||||
int count = 0;
|
||||
size_t len = 0;
|
||||
size_t total = 0;
|
||||
|
||||
do
|
||||
@ -376,48 +374,46 @@ static char *webdav_create_digest_auth_header(const char *method, const char *ur
|
||||
response = webdav_create_digest_response(method, path);
|
||||
snprintf(nonceCount, sizeof(nonceCount), "%08x", webdav_st->nc++);
|
||||
|
||||
len = STRLEN_CONST("Authorization: Digest ");
|
||||
len += STRLEN_CONST("username=\"") + strlen(webdav_st->username) + STRLEN_CONST("\", ");
|
||||
len += STRLEN_CONST("realm=\"") + strlen(webdav_st->realm) + STRLEN_CONST("\", ");
|
||||
len += STRLEN_CONST("nonce=\"") + strlen(webdav_st->nonce) + STRLEN_CONST("\", ");
|
||||
len += STRLEN_CONST("uri=\"") + strlen(path) + STRLEN_CONST("\", ");
|
||||
len += STRLEN_CONST("nc=\"") + strlen(nonceCount) + STRLEN_CONST("\", ");
|
||||
len += STRLEN_CONST("cnonce=\"") + strlen(webdav_st->cnonce) + STRLEN_CONST("\", ");
|
||||
_len = STRLEN_CONST("Authorization: Digest ");
|
||||
_len += STRLEN_CONST("username=\"") + strlen(webdav_st->username) + STRLEN_CONST("\", ");
|
||||
_len += STRLEN_CONST("realm=\"") + strlen(webdav_st->realm) + STRLEN_CONST("\", ");
|
||||
_len += STRLEN_CONST("nonce=\"") + strlen(webdav_st->nonce) + STRLEN_CONST("\", ");
|
||||
_len += STRLEN_CONST("uri=\"") + strlen(path) + STRLEN_CONST("\", ");
|
||||
_len += STRLEN_CONST("nc=\"") + strlen(nonceCount) + STRLEN_CONST("\", ");
|
||||
_len += STRLEN_CONST("cnonce=\"") + strlen(webdav_st->cnonce) + STRLEN_CONST("\", ");
|
||||
if (webdav_st->qop_auth)
|
||||
len += STRLEN_CONST("qop=\"auth\", ");
|
||||
_len += STRLEN_CONST("qop=\"auth\", ");
|
||||
if (webdav_st->opaque)
|
||||
len += STRLEN_CONST("opaque=\"") + strlen(webdav_st->opaque) + STRLEN_CONST("\", ");
|
||||
len += STRLEN_CONST("response=\"") + strlen(response) + STRLEN_CONST("\"\r\n");
|
||||
len += 1;
|
||||
_len += STRLEN_CONST("opaque=\"") + strlen(webdav_st->opaque) + STRLEN_CONST("\", ");
|
||||
_len += STRLEN_CONST("response=\"") + strlen(response) + STRLEN_CONST("\"\r\n");
|
||||
_len += 1;
|
||||
|
||||
total = len;
|
||||
len = 0;
|
||||
header = malloc(total);
|
||||
len = strlcpy(header, "Authorization: Digest username=\"", total - len);
|
||||
len += strlcpy(header + len, webdav_st->username, total - len);
|
||||
len += strlcpy(header + len, "\", realm=\"", total - len);
|
||||
len += strlcpy(header + len, webdav_st->realm, total - len);
|
||||
len += strlcpy(header + len, "\", nonce=\"", total - len);
|
||||
len += strlcpy(header + len, webdav_st->nonce, total - len);
|
||||
len += strlcpy(header + len, "\", uri=\"", total - len);
|
||||
len += strlcpy(header + len, path, total - len);
|
||||
len += strlcpy(header + len, "\", nc=\"", total - len);
|
||||
len += strlcpy(header + len, nonceCount, total - len);
|
||||
len += strlcpy(header + len, "\", cnonce=\"", total - len);
|
||||
len += strlcpy(header + len, webdav_st->cnonce, total - len);
|
||||
total = _len;
|
||||
_len = 0;
|
||||
header = (char*)malloc(total);
|
||||
_len = strlcpy(header, "Authorization: Digest username=\"", total - _len);
|
||||
_len += strlcpy(header + _len, webdav_st->username, total - _len);
|
||||
_len += strlcpy(header + _len, "\", realm=\"", total - _len);
|
||||
_len += strlcpy(header + _len, webdav_st->realm, total - _len);
|
||||
_len += strlcpy(header + _len, "\", nonce=\"", total - _len);
|
||||
_len += strlcpy(header + _len, webdav_st->nonce, total - _len);
|
||||
_len += strlcpy(header + _len, "\", uri=\"", total - _len);
|
||||
_len += strlcpy(header + _len, path, total - _len);
|
||||
_len += strlcpy(header + _len, "\", nc=\"", total - _len);
|
||||
_len += strlcpy(header + _len, nonceCount, total - _len);
|
||||
_len += strlcpy(header + _len, "\", cnonce=\"", total - _len);
|
||||
_len += strlcpy(header + _len, webdav_st->cnonce, total - _len);
|
||||
if (webdav_st->qop_auth)
|
||||
len += strlcpy(header + len, "\", qop=\"auth", total - len);
|
||||
_len += strlcpy(header + _len, "\", qop=\"auth", total - _len);
|
||||
if (webdav_st->opaque)
|
||||
{
|
||||
len += strlcpy(header + len, "\", opaque=\"", total - len);
|
||||
len += strlcpy(header + len, webdav_st->opaque, total - len);
|
||||
_len += strlcpy(header + _len, "\", opaque=\"", total - _len);
|
||||
_len += strlcpy(header + _len, webdav_st->opaque, total - _len);
|
||||
}
|
||||
len += strlcpy(header + len, "\", response=\"", total - len);
|
||||
len += strlcpy(header + len, response, total - len);
|
||||
strlcpy(header + len, "\"\r\n", total - len);
|
||||
|
||||
_len += strlcpy(header + _len, "\", response=\"", total - _len);
|
||||
_len += strlcpy(header + _len, response, total - _len);
|
||||
strlcpy(header + _len, "\"\r\n", total - _len);
|
||||
free(response);
|
||||
|
||||
return header;
|
||||
}
|
||||
|
||||
|
@ -175,13 +175,11 @@ static file_list_t *task_cloud_sync_create_manifest(RFILE *file)
|
||||
return list;
|
||||
}
|
||||
|
||||
static void task_cloud_sync_manifest_filename(char *path, size_t len, bool server)
|
||||
static void task_cloud_sync_manifest_filename(char *s, size_t len, bool server)
|
||||
{
|
||||
settings_t *settings = config_get_ptr();
|
||||
const char *path_dir_core_assets = settings->paths.directory_core_assets;
|
||||
|
||||
fill_pathname_join_special(path,
|
||||
path_dir_core_assets,
|
||||
fill_pathname_join_special(s, path_dir_core_assets,
|
||||
server ? MANIFEST_FILENAME_SERVER : MANIFEST_FILENAME_LOCAL,
|
||||
len);
|
||||
}
|
||||
@ -1121,15 +1119,15 @@ static void task_cloud_sync_end_handler(void *user_data, const char *path, bool
|
||||
if ((sync_state = (task_cloud_sync_state_t *)task->state))
|
||||
{
|
||||
char title[128];
|
||||
size_t len = strlcpy(title, "Cloud Sync finished", sizeof(title));
|
||||
size_t _len = strlcpy(title, "Cloud Sync finished", sizeof(title));
|
||||
if (sync_state->failures || sync_state->conflicts)
|
||||
len += strlcpy(title + len, " with ", sizeof(title) - len);
|
||||
_len += strlcpy(title + _len, " with ", sizeof(title) - _len);
|
||||
if (sync_state->failures)
|
||||
len += strlcpy(title + len, "failures", sizeof(title) - len);
|
||||
_len += strlcpy(title + _len, "failures", sizeof(title) - _len);
|
||||
if (sync_state->failures && sync_state->conflicts)
|
||||
len += strlcpy(title + len, " and ", sizeof(title) - len);
|
||||
_len += strlcpy(title + _len, " and ", sizeof(title) - _len);
|
||||
if (sync_state->conflicts)
|
||||
strlcpy(title + len, "conflicts", sizeof(title) - len);
|
||||
strlcpy(title + _len, "conflicts", sizeof(title) - _len);
|
||||
task_set_title(task, strdup(title));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user