Use standart types instead of int/long in specific files. This fixes a problem in Windows, were PP was not computed correctly. Compiling with C99

This commit is contained in:
Dr-Noob
2020-06-22 12:47:14 +02:00
parent 08ce1de122
commit a2dab8129c
9 changed files with 97 additions and 80 deletions

View File

@@ -2,6 +2,7 @@
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>
#include "global.h"
@@ -18,16 +19,15 @@
#define DEFAULT_FILE_SIZE 4096
long get_freq_from_file(char* path) {
FILE *file = fopen(path, "r");
int fd = open(path, O_RDONLY);
if(file == NULL) {
perror("fopen");
if(fd == -1) {
perror("open");
printBug("Could not open '%s'", path);
return UNKNOWN;
}
//File exists, read it
int fd = fileno(file);
int bytes_read = 0;
int offset = 0;
int block = 1;
@@ -57,7 +57,10 @@ long get_freq_from_file(char* path) {
}
free(buf);
fclose(file);
if (close(fd) == -1) {
perror("close");
printErr("Closing '%s' failed\n", path);
}
return ret/1000;
}