Disabling windows warnings

This commit is contained in:
Zoe Roux
2021-04-16 22:35:24 +02:00
parent ec0312e578
commit 4b5551e7df
5 changed files with 17 additions and 12 deletions

View File

@@ -4,7 +4,6 @@ set(CMAKE_C_STANDARD 11)
set(PROJECT_VERSION "1.0")
project(transcoder VERSION ${PROJECT_VERSION} LANGUAGES C)
include_directories(include)
add_library(transcoder SHARED
src/helper.c
src/info.c
@@ -17,13 +16,15 @@ add_library(transcoder SHARED
set_property(TARGET transcoder PROPERTY C_STANDARD 11)
set_property(TARGET transcoder PROPERTY POSITION_INDEPENDENT_CODE ON)
include_directories(include)
target_link_directories(transcoder PRIVATE ${CMAKE_SOURCE_DIR}/lib)
target_link_libraries(transcoder avformat avcodec avutil)
if(WIN32)
target_link_libraries(transcoder wsock32 ws2_32)
target_link_libraries(transcoder Secur32 Secur32)
target_link_libraries(transcoder Bcrypt Bcrypt)
target_link_directories(transcoder PRIVATE ${CMAKE_SOURCE_DIR}/lib)
else()
target_link_libraries(transcoder m pthread)
endif()

View File

@@ -4,10 +4,13 @@
#pragma once
#define _GNU_SOURCE // For asprintf
#include <stdio.h>
#define _GNU_SOURCE
#if defined(_WIN32) || defined(WIN32)
#define _CRT_SECURE_NO_WARNINGS
#define _CRT_NONSTDC_NO_DEPRECATE
#include <io.h>
#include <stddef.h>
#include <stdarg.h>
@@ -24,6 +27,4 @@
#define kmkdir(dir, mode) mkdir(dir, mode)
#endif
#ifdef __MINGW32__
#define asprintf __mingw_asprintf
#endif
#include <stdio.h>

View File

@@ -98,7 +98,7 @@ void extract_attachment(stream *font, const char *out_path, AVStream *stream)
return;
}
strcat(font->path, filename->value);
unsigned long count = strchr(filename->value, '.') - filename->value;
size_t count = strchr(filename->value, '.') - filename->value;
if (count > 0)
font->title = strndup(filename->value, count);

View File

@@ -47,7 +47,7 @@ void write_to_outputs(AVFormatContext **output_list, AVFormatContext *in_ctx)
bool list_empty(void **list, unsigned count)
{
for (int i = 0; i < count; i++)
for (unsigned i = 0; i < count; i++)
if (list[i])
return false;
return true;

View File

@@ -63,7 +63,10 @@ static AVDictionary *create_options_context(const char *out_path)
return options;
}
static void write_to_output(AVFormatContext *in_ctx, AVFormatContext *out_ctx, int *stream_map, float *playable_duration)
static void write_to_output(AVFormatContext *in_ctx,
AVFormatContext *out_ctx,
int *stream_map,
float *playable_duration)
{
AVPacket pkt;
AVStream *istream;
@@ -111,11 +114,11 @@ int transmux(const char *path, const char *out_path, float *playable_duration)
*playable_duration = 0;
av_log_set_level(AV_LOG_LEVEL);
if (open_input_context(&in_ctx, path) != 0) {
fprintf(stderr, "Error: Coudln't open the input file.\n");
fprintf(stderr, "Error: Could not open the input file.\n");
return -1;
}
if (avformat_alloc_output_context2(&out_ctx, NULL, NULL, out_path) < 0) {
fprintf(stderr, "Error: Couldn't create an output file.\n");
fprintf(stderr, "Error: Could not create an output file.\n");
avformat_close_input(&in_ctx);
return -1;
}