Fixed even more warnings

This commit is contained in:
Bazsalanszky 2019-11-12 19:32:54 +01:00
parent fc518e8df0
commit f02b2c4776
Signed by: Bazsalanszky
GPG key ID: 3A1E008A6F682DA0
8 changed files with 11 additions and 14 deletions

View file

@ -4,6 +4,7 @@
//
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include <string.h>
#include <assert.h>
#include <stdbool.h>

2
main.c
View file

@ -1,4 +1,4 @@
#define CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>

View file

@ -5,6 +5,7 @@
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include "../utility.h"
#include "../lib/map.h"
#ifdef RANDOM_PORT

View file

@ -2,10 +2,8 @@
* @author Toldi Balázs Ádám
* @date 2019. 10. 09.
*/
#ifndef CRT_SECURE_NO_WARNINGS
#define CRT_SECURE_NO_WARNINGS
#endif
#pragma once
#define _CRT_SECURE_NO_WARNINGS
#include "../utility.h"
#include "config.h"
#include "../lib/tcp-listener.h"

View file

@ -41,7 +41,7 @@ void serverThread(SOCKET listening, fd_set *master, WebIO webIo, PeerList list,N
while (run) {
fd_set copy = *master;
SOCKET last = (list.length > 0) ? list.array[list.length - 1].socket : webIo.socket;
int count = select(last+1, &copy, NULL, NULL, NULL);
int count = select(((int)last)+1, &copy, NULL, NULL, NULL);
if (FD_ISSET(listening, &copy)) {
if (peer_HandleConnection(listening, &list, mynode, master) != 0)

View file

@ -52,7 +52,7 @@ int webio_handleRequest(WebIO wio, const PeerList *list) {
res = webio_handleGETrequest(client, wio, file, list);
} else if (strncmp(buf, "POST",4) == 0) {
int i = strlen(buf) - 1;
int i =(int) strlen(buf) - 1;
while (buf[i] != '\n') {
i--;
}
@ -177,7 +177,7 @@ static int webio_handlePOSTrequest(SOCKET client, WebIO wio, const PeerList *lis
shutdown(client, SD_RECEIVE);
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) {
logger_log("Error with io");
return -1;
@ -190,7 +190,6 @@ static int webio_handlePOSTrequest(SOCKET client, WebIO wio, const PeerList *lis
char folder[72];
sprintf(folder, "%s/peers/", wio.folder);
#if defined(_WIN32)
mkdir(folder);
#else
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-Language: en\r\n"
"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) {
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-Length: %d\r\n"
"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) {
logger_log("Error sending http ok header!");
}

View file

@ -4,7 +4,7 @@
//
#pragma once
#define CRT_SECURE_NO_WARNINGS
#define _CRT_SECURE_NO_WARNINGS
#include "../utility.h"
#include "../lib/tcp-listener.h"
#include "peer.h"

View file

@ -4,9 +4,7 @@
//
#pragma once
#ifndef CRT_SECURE_NO_WARNINGS
#define CRT_SECURE_NO_WARNINGS
#endif
#define _CRT_SECURE_NO_WARNINGS
#include "lib/map.h"
#include "lib/net.h"
#include <time.h>