Skip to content

Commit e9a4ccc

Browse files
committed
Resync
1 parent 80ed32d commit e9a4ccc

File tree

16 files changed

+138
-136
lines changed

16 files changed

+138
-136
lines changed

dynamic/dylib.c

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,19 @@
5353
#endif
5454

5555
#ifdef _WIN32
56-
static char last_dyn_error[512];
56+
static char last_dyn_err[512];
5757

58-
static void set_dl_error(void)
58+
static void set_dl_err(void)
5959
{
6060
DWORD err = GetLastError();
6161
if (FormatMessage(
6262
FORMAT_MESSAGE_IGNORE_INSERTS
6363
| FORMAT_MESSAGE_FROM_SYSTEM,
6464
NULL, err,
6565
MAKELANGID(LANG_ENGLISH, SUBLANG_DEFAULT),
66-
last_dyn_error, sizeof(last_dyn_error) - 1,
66+
last_dyn_err, sizeof(last_dyn_err) - 1,
6767
NULL) == 0)
68-
snprintf(last_dyn_error, sizeof(last_dyn_error) - 1,
68+
snprintf(last_dyn_err, sizeof(last_dyn_err) - 1,
6969
"unknown error %lu", err);
7070
}
7171
#endif
@@ -121,10 +121,10 @@ dylib_t dylib_load(const char *path)
121121

122122
if (!lib)
123123
{
124-
set_dl_error();
124+
set_dl_err();
125125
return NULL;
126126
}
127-
last_dyn_error[0] = 0;
127+
last_dyn_err[0] = 0;
128128
#elif defined(ORBIS)
129129
int res;
130130
dylib_t lib = (dylib_t)sceKernelLoadStartModule(path, 0, NULL, 0, NULL, &res);
@@ -153,8 +153,8 @@ dylib_t dylib_load(const char *path)
153153
char *dylib_error(void)
154154
{
155155
#ifdef _WIN32
156-
if (last_dyn_error[0])
157-
return last_dyn_error;
156+
if (last_dyn_err[0])
157+
return last_dyn_err;
158158
return NULL;
159159
#else
160160
return (char*)dlerror();
@@ -181,10 +181,10 @@ function_t dylib_proc(dylib_t lib, const char *proc)
181181
}
182182
if (!(sym = (function_t)GetProcAddress(mod, proc)))
183183
{
184-
set_dl_error();
184+
set_dl_err();
185185
return NULL;
186186
}
187-
last_dyn_error[0] = 0;
187+
last_dyn_err[0] = 0;
188188
#elif defined(ORBIS)
189189
void *ptr_sym = NULL;
190190
sym = NULL;
@@ -227,8 +227,8 @@ void dylib_close(dylib_t lib)
227227
{
228228
#ifdef _WIN32
229229
if (!FreeLibrary((HMODULE)lib))
230-
set_dl_error();
231-
last_dyn_error[0] = 0;
230+
set_dl_err();
231+
last_dyn_err[0] = 0;
232232
#elif defined(ORBIS)
233233
int res;
234234
sceKernelStopUnloadModule((SceKernelModule)lib, 0, NULL, 0, NULL, &res);

formats/png/rpng.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -753,7 +753,7 @@ static int rpng_load_image_argb_process_inflate_init(
753753
rpng_t *rpng, uint32_t **data)
754754
{
755755
bool zstatus;
756-
enum trans_stream_error terror;
756+
enum trans_stream_error err;
757757
uint32_t rd, wn;
758758
struct rpng_process *process = (struct rpng_process*)rpng->process;
759759
bool to_continue = (process->avail_in > 0
@@ -762,16 +762,16 @@ static int rpng_load_image_argb_process_inflate_init(
762762
if (!to_continue)
763763
goto end;
764764

765-
zstatus = process->stream_backend->trans(process->stream, false, &rd, &wn, &terror);
765+
zstatus = process->stream_backend->trans(process->stream, false, &rd, &wn, &err);
766766

767-
if (!zstatus && terror != TRANS_STREAM_ERROR_BUFFER_FULL)
767+
if (!zstatus && err != TRANS_STREAM_ERROR_BUFFER_FULL)
768768
goto error;
769769

770770
process->avail_in -= rd;
771771
process->avail_out -= wn;
772772
process->total_out += wn;
773773

774-
if (terror)
774+
if (err)
775775
return 0;
776776

777777
end:

formats/xml/rxml.c

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -257,9 +257,12 @@ rxml_document_t *rxml_load_document_string(const char *str)
257257
node->attrib = attr;
258258
}
259259

260-
if (attr->attrib)
261-
free(attr->attrib);
262-
attr->attrib = strdup(x.attr);
260+
if (attr)
261+
{
262+
if (attr->attrib)
263+
free(attr->attrib);
264+
attr->attrib = strdup(x.attr);
265+
}
263266

264267
valptr = buf->val;
265268
break;

gfx/gl_capabilities.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -78,27 +78,27 @@ bool gl_query_extension(const char *ext)
7878
return ret;
7979
}
8080

81-
bool gl_check_error(char **error_string)
81+
bool gl_check_error(char **err_string)
8282
{
83-
int error = glGetError();
84-
switch (error)
83+
int err = glGetError();
84+
switch (err)
8585
{
8686
case GL_INVALID_ENUM:
87-
*error_string = strdup("GL: Invalid enum.");
87+
*err_string = strdup("GL: Invalid enum.");
8888
break;
8989
case GL_INVALID_VALUE:
90-
*error_string = strdup("GL: Invalid value.");
90+
*err_string = strdup("GL: Invalid value.");
9191
break;
9292
case GL_INVALID_OPERATION:
93-
*error_string = strdup("GL: Invalid operation.");
93+
*err_string = strdup("GL: Invalid operation.");
9494
break;
9595
case GL_OUT_OF_MEMORY:
96-
*error_string = strdup("GL: Out of memory.");
96+
*err_string = strdup("GL: Out of memory.");
9797
break;
9898
case GL_NO_ERROR:
9999
return true;
100100
default:
101-
*error_string = strdup("Non specified GL error.");
101+
*err_string = strdup("Non specified GL error.");
102102
break;
103103
}
104104

lists/string_list.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,10 @@ struct string_list *string_list_new(void)
102102
if (!list)
103103
return NULL;
104104

105+
list->cap = 0;
106+
list->size = 0;
107+
list->elems = NULL;
108+
105109
if (!(elems = (struct string_list_elem*)
106110
calloc(32, sizeof(*elems))))
107111
{
@@ -110,7 +114,6 @@ struct string_list *string_list_new(void)
110114
}
111115

112116
list->elems = elems;
113-
list->size = 0;
114117
list->cap = 32;
115118

116119
return list;

net/net_http.c

Lines changed: 31 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ static slock_t *conn_pool_lock = NULL;
8282

8383
struct http_t
8484
{
85-
bool error;
85+
bool err;
8686

8787
struct conn_pool_entry *conn;
8888
bool ssl;
@@ -700,15 +700,15 @@ static void net_http_conn_pool_remove_expired(void)
700700
if (!entry->in_use && FD_ISSET(entry->fd, &fds))
701701
{
702702
char buf[4096];
703-
bool error = false;
703+
bool err = false;
704704
#ifdef HAVE_SSL
705705
if (entry->ssl && entry->ssl_ctx)
706-
ssl_socket_receive_all_nonblocking(entry->ssl_ctx, &error, buf, sizeof(buf));
706+
ssl_socket_receive_all_nonblocking(entry->ssl_ctx, &err, buf, sizeof(buf));
707707
else
708708
#endif
709-
socket_receive_all_nonblocking(entry->fd, &error, buf, sizeof(buf));
709+
socket_receive_all_nonblocking(entry->fd, &err, buf, sizeof(buf));
710710

711-
if (!error)
711+
if (!err)
712712
continue;
713713

714714
if (prev)
@@ -993,10 +993,10 @@ static bool net_http_connect(struct http_t *state)
993993
return true;
994994
}
995995
}
996-
conn->fd = -1; /* already closed */
996+
conn->fd = -1; /* already closed */
997997
net_http_conn_pool_remove(conn);
998998
state->conn = NULL;
999-
state->error = true;
999+
state->err = true;
10001000
return false;
10011001
}
10021002
else
@@ -1012,32 +1012,32 @@ static bool net_http_connect(struct http_t *state)
10121012

10131013
socket_close(conn->fd);
10141014
}
1015-
conn->fd = -1; /* already closed */
1015+
conn->fd = -1; /* already closed */
10161016
net_http_conn_pool_remove(conn);
10171017
state->conn = NULL;
1018-
state->error = true;
1018+
state->err = true;
10191019
return false;
10201020
}
10211021
}
10221022

10231023
static void net_http_send_str(
10241024
struct http_t *state, const char *text, size_t text_size)
10251025
{
1026-
if (state->error)
1026+
if (state->err)
10271027
return;
10281028
#ifdef HAVE_SSL
10291029
if (state->ssl)
10301030
{
10311031
if (!ssl_socket_send_all_blocking(
10321032
state->conn->ssl_ctx, text, text_size, true))
1033-
state->error = true;
1033+
state->err = true;
10341034
}
10351035
else
10361036
#endif
10371037
{
10381038
if (!socket_send_all_blocking(
10391039
state->conn->fd, text, text_size, true))
1040-
state->error = true;
1040+
state->err = true;
10411041
}
10421042
}
10431043

@@ -1090,7 +1090,7 @@ static bool net_http_send_request(struct http_t *state)
10901090

10911091
if (!request->postdata && !string_is_equal(request->method, "PUT"))
10921092
{
1093-
state->error = true;
1093+
state->err = true;
10941094
return true;
10951095
}
10961096

@@ -1133,7 +1133,7 @@ static bool net_http_send_request(struct http_t *state)
11331133
net_http_send_str(state, request->postdata, request->contentlength);
11341134

11351135
state->request_sent = true;
1136-
return state->error;
1136+
return state->err;
11371137
}
11381138

11391139
/**
@@ -1175,7 +1175,7 @@ static ssize_t net_http_receive_header(struct http_t *state, ssize_t newlen)
11751175
if (strncmp(response->data, "HTTP/1.", STRLEN_CONST("HTTP/1."))!=0)
11761176
{
11771177
response->part = P_DONE;
1178-
state->error = true;
1178+
state->err = true;
11791179
return -1;
11801180
}
11811181
response->status = (int)strtoul(response->data
@@ -1246,7 +1246,7 @@ static bool net_http_receive_body(struct http_t *state, ssize_t newlen)
12461246
{
12471247
struct response *response = &state->response;
12481248

1249-
if (newlen < 0 || state->error)
1249+
if (newlen < 0 || state->err)
12501250
{
12511251
if (response->bodytype != T_FULL)
12521252
return false;
@@ -1412,7 +1412,7 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
14121412
if (!state)
14131413
return true;
14141414

1415-
if (state->error)
1415+
if (state->err)
14161416
return true;
14171417

14181418
if (!state->conn)
@@ -1421,16 +1421,16 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
14211421
if (!state->conn)
14221422
{
14231423
if (!net_http_new_socket(state))
1424-
state->error = true;
1425-
return state->error;
1424+
state->err = true;
1425+
return state->err;
14261426
}
14271427
}
14281428

14291429
if (!state->conn->connected)
14301430
{
14311431
if (!net_http_connect(state))
1432-
state->error = true;
1433-
return state->error;
1432+
state->err = true;
1433+
return state->err;
14341434
}
14351435

14361436
if (!state->request_sent)
@@ -1440,18 +1440,18 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
14401440

14411441
#ifdef HAVE_SSL
14421442
if (state->ssl && state->conn->ssl_ctx)
1443-
newlen = ssl_socket_receive_all_nonblocking(state->conn->ssl_ctx, &state->error,
1443+
newlen = ssl_socket_receive_all_nonblocking(state->conn->ssl_ctx, &state->err,
14441444
(uint8_t*)response->data + response->pos,
14451445
response->buflen - response->pos);
14461446
else
14471447
#endif
1448-
newlen = socket_receive_all_nonblocking(state->conn->fd, &state->error,
1448+
newlen = socket_receive_all_nonblocking(state->conn->fd, &state->err,
14491449
(uint8_t*)response->data + response->pos,
14501450
response->buflen - response->pos);
14511451

14521452
if (response->part < P_BODY)
14531453
{
1454-
if (newlen < 0 || state->error)
1454+
if (newlen < 0 || state->err)
14551455
goto error;
14561456
newlen = net_http_receive_header(state, newlen);
14571457
}
@@ -1505,7 +1505,7 @@ bool net_http_update(struct http_t *state, size_t* progress, size_t* total)
15051505

15061506
error:
15071507
net_http_conn_pool_remove(state->conn);
1508-
state->error = true;
1508+
state->err = true;
15091509
response->part = P_DONE;
15101510
response->status = -1;
15111511
return true;
@@ -1534,14 +1534,14 @@ int net_http_status(struct http_t *state)
15341534
*
15351535
* @return the response headers. The returned buffer is owned by the
15361536
* caller of net_http_new; it is not freed by net_http_delete().
1537-
* If the status is not 20x and accept_error is false, it returns NULL.
1537+
* If the status is not 20x and accept_err is false, it returns NULL.
15381538
**/
15391539
struct string_list *net_http_headers(struct http_t *state)
15401540
{
15411541
if (!state)
15421542
return NULL;
15431543

1544-
if (state->error)
1544+
if (state->err)
15451545
return NULL;
15461546

15471547
return state->response.headers;
@@ -1554,14 +1554,14 @@ struct string_list *net_http_headers(struct http_t *state)
15541554
*
15551555
* @return the downloaded data. The returned buffer is owned by the
15561556
* HTTP handler; it's freed by net_http_delete().
1557-
* If the status is not 20x and accept_error is false, it returns NULL.
1557+
* If the status is not 20x and accept_err is false, it returns NULL.
15581558
**/
1559-
uint8_t* net_http_data(struct http_t *state, size_t* len, bool accept_error)
1559+
uint8_t* net_http_data(struct http_t *state, size_t* len, bool accept_err)
15601560
{
15611561
if (!state)
15621562
return NULL;
15631563

1564-
if (!accept_error && (state->error || state->response.status < 200 || state->response.status > 299))
1564+
if (!accept_err && (state->err || state->response.status < 200 || state->response.status > 299))
15651565
{
15661566
if (len)
15671567
*len = 0;
@@ -1610,5 +1610,5 @@ void net_http_delete(struct http_t *state)
16101610
**/
16111611
bool net_http_error(struct http_t *state)
16121612
{
1613-
return (state->error || state->response.status < 200 || state->response.status > 299);
1613+
return (state->err || state->response.status < 200 || state->response.status > 299);
16141614
}

0 commit comments

Comments
 (0)