Fix compilation warnings
This commit is contained in:
+61
-11
@@ -1373,11 +1373,16 @@ HANDLE mock_CreateFileW(WCHAR *lpFileName, DWORD dwDesiredAccess,
|
||||
|
||||
BOOL mock_CloseHandle(HANDLE handle)
|
||||
{
|
||||
if (handle == INVALID_HANDLE_VALUE || (int)handle < 0 || (int)handle >= MAX_DESCRIPTORS) {
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int idx = (int) handle;
|
||||
if (idx < 0 || idx >= MAX_DESCRIPTORS) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Descriptor *desc = ¤t_process->desc[idx];
|
||||
if (desc->type != DESC_FILE) {
|
||||
@@ -1397,11 +1402,16 @@ BOOL mock_LockFile(HANDLE hFile,
|
||||
DWORD nNumberOfBytesToLockLow,
|
||||
DWORD nNumberOfBytesToLockHigh)
|
||||
{
|
||||
if (hFile == INVALID_HANDLE_VALUE || (int)hFile < 0 || (int)hFile >= MAX_DESCRIPTORS) {
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int idx = (int) hFile;
|
||||
if (idx < 0 || idx >= MAX_DESCRIPTORS) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Descriptor *desc = ¤t_process->desc[idx];
|
||||
if (desc->type != DESC_FILE) {
|
||||
@@ -1425,11 +1435,16 @@ BOOL mock_UnlockFile(
|
||||
DWORD nNumberOfBytesToUnlockLow,
|
||||
DWORD nNumberOfBytesToUnlockHigh)
|
||||
{
|
||||
if (hFile == INVALID_HANDLE_VALUE || (int)hFile < 0 || (int)hFile >= MAX_DESCRIPTORS) {
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int idx = (int) hFile;
|
||||
if (idx < 0 || idx >= MAX_DESCRIPTORS) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Descriptor *desc = ¤t_process->desc[idx];
|
||||
if (desc->type != DESC_FILE) {
|
||||
@@ -1448,11 +1463,16 @@ BOOL mock_UnlockFile(
|
||||
|
||||
BOOL mock_FlushFileBuffers(HANDLE handle)
|
||||
{
|
||||
if (handle == INVALID_HANDLE_VALUE || (int)handle < 0 || (int)handle >= MAX_DESCRIPTORS) {
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int idx = (int) handle;
|
||||
if (idx < 0 || idx >= MAX_DESCRIPTORS) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Descriptor *desc = ¤t_process->desc[idx];
|
||||
if (desc->type != DESC_FILE) {
|
||||
@@ -1466,11 +1486,16 @@ BOOL mock_FlushFileBuffers(HANDLE handle)
|
||||
|
||||
BOOL mock_ReadFile(HANDLE handle, char *dst, DWORD len, DWORD *num, OVERLAPPED *ov)
|
||||
{
|
||||
if (handle == INVALID_HANDLE_VALUE || (int)handle < 0 || (int)handle >= MAX_DESCRIPTORS) {
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int idx = (int) handle;
|
||||
if (idx < 0 || idx >= MAX_DESCRIPTORS) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Descriptor *desc = ¤t_process->desc[idx];
|
||||
if (desc->type != DESC_FILE) {
|
||||
@@ -1484,11 +1509,16 @@ BOOL mock_ReadFile(HANDLE handle, char *dst, DWORD len, DWORD *num, OVERLAPPED *
|
||||
|
||||
BOOL mock_WriteFile(HANDLE handle, char *src, DWORD len, DWORD *num, OVERLAPPED *ov)
|
||||
{
|
||||
if (handle == INVALID_HANDLE_VALUE || (int)handle < 0 || (int)handle >= MAX_DESCRIPTORS) {
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int idx = (int) handle;
|
||||
if (idx < 0 || idx >= MAX_DESCRIPTORS) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Descriptor *desc = ¤t_process->desc[idx];
|
||||
if (desc->type != DESC_FILE) {
|
||||
@@ -1502,11 +1532,16 @@ BOOL mock_WriteFile(HANDLE handle, char *src, DWORD len, DWORD *num, OVERLAPPED
|
||||
|
||||
DWORD mock_SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceToMoveHigh, DWORD dwMoveMethod)
|
||||
{
|
||||
if (hFile == INVALID_HANDLE_VALUE || (int)hFile < 0 || (int)hFile >= MAX_DESCRIPTORS) {
|
||||
if (hFile == INVALID_HANDLE_VALUE) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return INVALID_SET_FILE_POINTER;
|
||||
}
|
||||
|
||||
int idx = (int) hFile;
|
||||
if (idx < 0 || idx >= MAX_DESCRIPTORS) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return INVALID_SET_FILE_POINTER;
|
||||
}
|
||||
|
||||
Descriptor *desc = ¤t_process->desc[idx];
|
||||
if (desc->type != DESC_FILE) {
|
||||
@@ -1520,11 +1555,16 @@ DWORD mock_SetFilePointer(HANDLE hFile, LONG lDistanceToMove, PLONG lpDistanceTo
|
||||
|
||||
BOOL mock_GetFileSizeEx(HANDLE handle, LARGE_INTEGER *buf)
|
||||
{
|
||||
if (handle == INVALID_HANDLE_VALUE || (int)handle < 0 || (int)handle >= MAX_DESCRIPTORS) {
|
||||
if (handle == INVALID_HANDLE_VALUE) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int idx = (int) handle;
|
||||
if (idx < 0 || idx >= MAX_DESCRIPTORS) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Descriptor *desc = ¤t_process->desc[idx];
|
||||
if (desc->type != DESC_FILE) {
|
||||
@@ -1599,7 +1639,7 @@ int mock_ioctlsocket(SOCKET fd, long cmd, u_long *argp)
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cmd == FIONBIO) {
|
||||
if ((long unsigned int) cmd == FIONBIO) {
|
||||
desc->is_nonblocking = (*argp != 0);
|
||||
return 0;
|
||||
}
|
||||
@@ -1637,11 +1677,16 @@ HANDLE mock_FindFirstFileA(char *lpFileName, WIN32_FIND_DATAA *lpFindFileData)
|
||||
|
||||
BOOL mock_FindNextFileA(HANDLE hFindFile, WIN32_FIND_DATAA *lpFindFileData)
|
||||
{
|
||||
if (hFindFile == INVALID_HANDLE_VALUE || (int)hFindFile < 0 || (int)hFindFile >= MAX_DESCRIPTORS) {
|
||||
if (hFindFile == INVALID_HANDLE_VALUE) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int idx = (int) hFindFile;
|
||||
if (idx < 0 || idx >= MAX_DESCRIPTORS) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Descriptor *desc = ¤t_process->desc[idx];
|
||||
if (desc->type != DESC_DIRECTORY) {
|
||||
@@ -1655,11 +1700,16 @@ BOOL mock_FindNextFileA(HANDLE hFindFile, WIN32_FIND_DATAA *lpFindFileData)
|
||||
|
||||
BOOL mock_FindClose(HANDLE hFindFile)
|
||||
{
|
||||
if (hFindFile == INVALID_HANDLE_VALUE || (int)hFindFile < 0 || (int)hFindFile >= MAX_DESCRIPTORS) {
|
||||
if (hFindFile == INVALID_HANDLE_VALUE) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
int idx = (int) hFindFile;
|
||||
if (idx < 0 || idx >= MAX_DESCRIPTORS) {
|
||||
SetLastError(ERROR_INVALID_HANDLE);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
Descriptor *desc = ¤t_process->desc[idx];
|
||||
if (desc->type != DESC_DIRECTORY) {
|
||||
|
||||
@@ -22,6 +22,7 @@ int main(int argc, char **argv)
|
||||
}
|
||||
http_server_set_reuse_addr(&server, config.reuse_addr);
|
||||
http_server_set_trace_bytes(&server, config.trace_bytes);
|
||||
|
||||
if (http_server_listen_tcp(&server, config.local_addr, config.local_port) < 0) {
|
||||
printf("http_server_listen_tcp error\n");
|
||||
return -1;
|
||||
|
||||
+2
-1
@@ -108,7 +108,8 @@ bool process_completion_read_file(ProxyState *state,
|
||||
operation->request->url.path.ptr,
|
||||
operation->request->url.path.len,
|
||||
};
|
||||
operation->handle = toasty_begin_read(state->backend, path, operation->transferred, dst, cap, TOASTY_VERSION_TAG_EMPTY);
|
||||
operation->handle = toasty_begin_read(state->backend, path,
|
||||
operation->transferred, dst, cap, TOASTY_VERSION_TAG_EMPTY);
|
||||
if (operation->handle == TOASTY_INVALID) {
|
||||
assert(0); // TODO
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user