Skip to content

Commit 339239c

Browse files
committed
Cleanup and fix includes for MSVC
- Remove some unused includes - #ifdef includes if the code consuming it is also ifdefed - Add some replacements for POSIX only includes
1 parent 2d06777 commit 339239c

7 files changed

Lines changed: 25 additions & 6 deletions

File tree

src/framework/mlt_producer.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@
3333
#include <sys/stat.h> // for stat()
3434
#include <sys/types.h> // for stat()
3535
#include <time.h> // for strftime() and gtime()
36-
#include <unistd.h> // for stat()
3736

3837
/* Forward references. */
3938

src/framework/mlt_slices.c

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,10 +28,14 @@
2828
#include <pthread.h>
2929
#include <sched.h>
3030
#include <stdlib.h>
31-
#include <unistd.h>
31+
3232
#ifdef _WIN32
3333
#include <windows.h>
34+
#else
35+
// For _SC_NPROCESSORS_ONLN
36+
#include <unistd.h>
3437
#endif
38+
3539
#define MAX_SLICES 32
3640
#define ENV_SLICES "MLT_SLICES_COUNT"
3741

src/melt/io.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,14 @@
2828
#include <string.h>
2929
#ifndef _WIN32
3030
#include <termios.h>
31+
#include <unistd.h>
3132
#else
3233
// MinGW defines struct timespec in pthread.h
3334
#include <pthread.h>
3435
// for nanosleep()
3536
#include <framework/mlt_types.h>
3637
#include <windows.h>
3738
#endif
38-
#include <sys/time.h>
39-
#include <unistd.h>
4039

4140
/* Application header files */
4241
#include "io.h"

src/melt/melt.c

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,18 @@
2222
#endif
2323
#include <libgen.h>
2424
#include <locale.h>
25-
#include <sched.h>
2625
#include <signal.h>
2726
#include <stdio.h>
2827
#include <stdlib.h>
2928
#include <string.h>
29+
30+
#ifdef _MSC_VER
31+
#ifndef STDIN_FILENO
32+
#define STDIN_FILENO _fileno(stdin)
33+
#endif
34+
#else
3035
#include <unistd.h>
36+
#endif
3137

3238
#include <framework/mlt.h>
3339

src/modules/core/consumer_multi.c

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
#include <stdio.h>
2323
#include <stdlib.h>
2424
#include <string.h>
25-
#include <sys/time.h>
2625

2726
// Forward references
2827
static int start(mlt_consumer consumer);

src/modules/plusgpl/consumer_cbrts.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@
5151
#include <sys/time.h>
5252
#include <time.h>
5353

54+
#ifdef _MSC_VER
55+
#define strncasecmp _strnicmp
56+
#define strcasecmp _stricmp
57+
#endif
58+
5459
#define TSP_BYTES (188)
5560
#define MAX_PID (8192)
5661
#define SCR_HZ (27000000ULL)

src/win32/strptime.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,13 @@ __RCSID("$NetBSD: strptime.c,v 1.36 2012/03/13 21:13:48 christos Exp $");
5151
__weak_alias(strptime,_strptime)
5252
#endif
5353
*/
54+
55+
#ifdef _MSC_VER
56+
#define strncasecmp _strnicmp
57+
#define strcasecmp _stricmp
58+
#endif
59+
60+
5461
typedef unsigned char u_char;
5562
typedef unsigned int uint;
5663
typedef unsigned __int64 uint64_t;

0 commit comments

Comments
 (0)