Fixed even more warnings
This commit is contained in:
parent
fc518e8df0
commit
f02b2c4776
8 changed files with 11 additions and 14 deletions
|
@ -4,6 +4,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
2
main.c
2
main.c
|
@ -1,4 +1,4 @@
|
||||||
#define CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
|
@ -5,6 +5,7 @@
|
||||||
|
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#include "../utility.h"
|
#include "../utility.h"
|
||||||
#include "../lib/map.h"
|
#include "../lib/map.h"
|
||||||
#ifdef RANDOM_PORT
|
#ifdef RANDOM_PORT
|
||||||
|
|
|
@ -2,10 +2,8 @@
|
||||||
* @author Toldi Balázs Ádám
|
* @author Toldi Balázs Ádám
|
||||||
* @date 2019. 10. 09.
|
* @date 2019. 10. 09.
|
||||||
*/
|
*/
|
||||||
#ifndef CRT_SECURE_NO_WARNINGS
|
|
||||||
#define CRT_SECURE_NO_WARNINGS
|
|
||||||
#endif
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#include "../utility.h"
|
#include "../utility.h"
|
||||||
#include "config.h"
|
#include "config.h"
|
||||||
#include "../lib/tcp-listener.h"
|
#include "../lib/tcp-listener.h"
|
||||||
|
|
|
@ -41,7 +41,7 @@ void serverThread(SOCKET listening, fd_set *master, WebIO webIo, PeerList list,N
|
||||||
while (run) {
|
while (run) {
|
||||||
fd_set copy = *master;
|
fd_set copy = *master;
|
||||||
SOCKET last = (list.length > 0) ? list.array[list.length - 1].socket : webIo.socket;
|
SOCKET last = (list.length > 0) ? list.array[list.length - 1].socket : webIo.socket;
|
||||||
int count = select(last+1, ©, NULL, NULL, NULL);
|
int count = select(((int)last)+1, ©, NULL, NULL, NULL);
|
||||||
|
|
||||||
if (FD_ISSET(listening, ©)) {
|
if (FD_ISSET(listening, ©)) {
|
||||||
if (peer_HandleConnection(listening, &list, mynode, master) != 0)
|
if (peer_HandleConnection(listening, &list, mynode, master) != 0)
|
||||||
|
|
|
@ -52,7 +52,7 @@ int webio_handleRequest(WebIO wio, const PeerList *list) {
|
||||||
res = webio_handleGETrequest(client, wio, file, list);
|
res = webio_handleGETrequest(client, wio, file, list);
|
||||||
|
|
||||||
} else if (strncmp(buf, "POST",4) == 0) {
|
} else if (strncmp(buf, "POST",4) == 0) {
|
||||||
int i = strlen(buf) - 1;
|
int i =(int) strlen(buf) - 1;
|
||||||
while (buf[i] != '\n') {
|
while (buf[i] != '\n') {
|
||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
|
@ -177,7 +177,7 @@ static int webio_handlePOSTrequest(SOCKET client, WebIO wio, const PeerList *lis
|
||||||
shutdown(client, SD_RECEIVE);
|
shutdown(client, SD_RECEIVE);
|
||||||
char *response = "HTTP/1.1 304 Not Modified ";
|
char *response = "HTTP/1.1 304 Not Modified ";
|
||||||
|
|
||||||
int res = send(client, response, strlen(response), 0);
|
int res = send(client, response,(int) strlen(response), 0);
|
||||||
if (res == SOCKET_ERROR) {
|
if (res == SOCKET_ERROR) {
|
||||||
logger_log("Error with io");
|
logger_log("Error with io");
|
||||||
return -1;
|
return -1;
|
||||||
|
@ -190,7 +190,6 @@ static int webio_handlePOSTrequest(SOCKET client, WebIO wio, const PeerList *lis
|
||||||
char folder[72];
|
char folder[72];
|
||||||
sprintf(folder, "%s/peers/", wio.folder);
|
sprintf(folder, "%s/peers/", wio.folder);
|
||||||
#if defined(_WIN32)
|
#if defined(_WIN32)
|
||||||
|
|
||||||
mkdir(folder);
|
mkdir(folder);
|
||||||
#else
|
#else
|
||||||
mkdir(folder, 0777); // notice that 777 is different than 0777
|
mkdir(folder, 0777); // notice that 777 is different than 0777
|
||||||
|
@ -314,7 +313,7 @@ void webio_sendOKHeader(SOCKET socket, char *file) {
|
||||||
"Content-Encoding: gzip\r\n"
|
"Content-Encoding: gzip\r\n"
|
||||||
"Content-Language: en\r\n"
|
"Content-Language: en\r\n"
|
||||||
"Content-Type: %s\r\n\r\n", webio_getMIMEtype(file));
|
"Content-Type: %s\r\n\r\n", webio_getMIMEtype(file));
|
||||||
int res = send(socket, response, strlen(response), 0);
|
int res = send(socket, response, (int)strlen(response), 0);
|
||||||
if (res == SOCKET_ERROR) {
|
if (res == SOCKET_ERROR) {
|
||||||
logger_log("Error sending http ok header!");
|
logger_log("Error sending http ok header!");
|
||||||
}
|
}
|
||||||
|
@ -326,7 +325,7 @@ void webio_sendOKHeader_wSize(SOCKET socket, char *file,int size) {
|
||||||
"Content-Language: en\r\n"
|
"Content-Language: en\r\n"
|
||||||
"Content-Length: %d\r\n"
|
"Content-Length: %d\r\n"
|
||||||
"Content-Type: %s\r\n\r\n",size, webio_getMIMEtype(file));
|
"Content-Type: %s\r\n\r\n",size, webio_getMIMEtype(file));
|
||||||
int res = send(socket, response, strlen(response), 0);
|
int res = send(socket, response,(int) strlen(response), 0);
|
||||||
if (res == SOCKET_ERROR) {
|
if (res == SOCKET_ERROR) {
|
||||||
logger_log("Error sending http ok header!");
|
logger_log("Error sending http ok header!");
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,7 +4,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#define CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#include "../utility.h"
|
#include "../utility.h"
|
||||||
#include "../lib/tcp-listener.h"
|
#include "../lib/tcp-listener.h"
|
||||||
#include "peer.h"
|
#include "peer.h"
|
||||||
|
|
|
@ -4,9 +4,7 @@
|
||||||
//
|
//
|
||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
#ifndef CRT_SECURE_NO_WARNINGS
|
#define _CRT_SECURE_NO_WARNINGS
|
||||||
#define CRT_SECURE_NO_WARNINGS
|
|
||||||
#endif
|
|
||||||
#include "lib/map.h"
|
#include "lib/map.h"
|
||||||
#include "lib/net.h"
|
#include "lib/net.h"
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
|
|
Loading…
Reference in a new issue