1
0
mirror of https://github.com/janet-lang/janet synced 2025-11-05 01:53:01 +00:00

Format source.

This commit is contained in:
Calvin Rose
2020-11-11 09:40:59 -06:00
parent 6f1d5d3b73
commit c192caa349
2 changed files with 15 additions and 16 deletions

View File

@@ -103,12 +103,12 @@ static Janet net_lasterr(void) {
char msgbuf[256]; char msgbuf[256];
msgbuf[0] = '\0'; msgbuf[0] = '\0';
FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS, FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
NULL, NULL,
code, code,
MAKELANGID (LANG_NEUTRAL, SUBLANG_DEFAULT), MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
msgbuf, msgbuf,
sizeof (msgbuf), sizeof(msgbuf),
NULL); NULL);
if (!*msgbuf) sprintf(msgbuf, "%d", code); if (!*msgbuf) sprintf(msgbuf, "%d", code);
char *c = msgbuf; char *c = msgbuf;
while (*c) { while (*c) {
@@ -244,8 +244,7 @@ JanetAsyncStatus net_machine_read(JanetListenerState *s, JanetAsyncEvent event)
} }
/* fallthrough */ /* fallthrough */
case JANET_ASYNC_EVENT_USER: case JANET_ASYNC_EVENT_USER: {
{
state->flags = 0; state->flags = 0;
int32_t chunk_size = state->bytes_left > JANET_NET_CHUNKSIZE ? JANET_NET_CHUNKSIZE : state->bytes_left; int32_t chunk_size = state->bytes_left > JANET_NET_CHUNKSIZE ? JANET_NET_CHUNKSIZE : state->bytes_left;
state->wbuf.len = (ULONG) chunk_size; state->wbuf.len = (ULONG) chunk_size;
@@ -565,12 +564,12 @@ JanetAsyncStatus net_machine_accept(JanetListenerState *s, JanetAsyncEvent event
int seconds; int seconds;
int bytes = sizeof(seconds); int bytes = sizeof(seconds);
if (NO_ERROR != getsockopt((SOCKET) state->astream->handle, SOL_SOCKET, SO_CONNECT_TIME, if (NO_ERROR != getsockopt((SOCKET) state->astream->handle, SOL_SOCKET, SO_CONNECT_TIME,
(char *)&seconds, &bytes)) { (char *)&seconds, &bytes)) {
janet_cancel(s->fiber, janet_cstringv("failed to accept connection")); janet_cancel(s->fiber, janet_cstringv("failed to accept connection"));
return JANET_ASYNC_STATUS_DONE; return JANET_ASYNC_STATUS_DONE;
} }
if (NO_ERROR != setsockopt((SOCKET) state->astream->handle, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT, if (NO_ERROR != setsockopt((SOCKET) state->astream->handle, SOL_SOCKET, SO_UPDATE_ACCEPT_CONTEXT,
(char *)&(state->lstream->handle), sizeof(SOCKET))) { (char *) & (state->lstream->handle), sizeof(SOCKET))) {
janet_cancel(s->fiber, janet_cstringv("failed to accept connection")); janet_cancel(s->fiber, janet_cstringv("failed to accept connection"));
return JANET_ASYNC_STATUS_DONE; return JANET_ASYNC_STATUS_DONE;
} }