Skip to content

Commit e1ae938

Browse files
Merge pull request #6948 from notimaginative/compile_warnings
address various build warnings
2 parents f92bc15 + af833f0 commit e1ae938

23 files changed

Lines changed: 60 additions & 33 deletions

File tree

code/cfile/cfile.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -902,7 +902,7 @@ static CFILE *cf_open_fill_cfblock(const char* source, int line, const char* ori
902902
cfp->source_file = source;
903903
cfp->line_num = line;
904904

905-
int pos = ftell(fp);
905+
auto pos = ftell(fp);
906906
if(pos == -1L)
907907
pos = 0;
908908
cf_init_lowlevel_read_code(cfp,0,filelength(fileno(fp)), 0 );

code/cfile/cfilecompression.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,7 +143,7 @@ void lz41_load_offsets(CFILE* cf)
143143
int* offsets_ptr = cf->compression_info.offsets;
144144

145145
/* Seek to the first offset position, remember to consider the trailing ints */
146-
fso_fseek(cf, ( ( sizeof(int) * cf->compression_info.num_offsets ) * -1 ) - (sizeof(int)*3 ), SEEK_END);
146+
fso_fseek(cf, static_cast<int>( ( sizeof(int) * cf->compression_info.num_offsets ) * -1 ) - (sizeof(int)*3 ), SEEK_END);
147147
for (block = 0; block < cf->compression_info.num_offsets; ++block)
148148
{
149149
auto bytes_read = fread(offsets_ptr++, sizeof(int), 1, cf->fp);

code/cutscene/ffmpeg/internal.cpp

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,10 @@ DecoderStatus::~DecoderStatus() {
1212
videoCodec = nullptr;
1313

1414
if (videoCodecCtx != nullptr) {
15-
avcodec_close(videoCodecCtx);
1615
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(57, 24, 255)
1716
avcodec_free_context(&videoCodecCtx);
17+
#else
18+
avcodec_close(videoCodecCtx);
1819
#endif
1920
videoCodecCtx = nullptr;
2021
}
@@ -24,9 +25,10 @@ DecoderStatus::~DecoderStatus() {
2425
audioCodec = nullptr;
2526

2627
if (audioCodecCtx != nullptr) {
27-
avcodec_close(audioCodecCtx);
2828
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(57, 24, 255)
2929
avcodec_free_context(&audioCodecCtx);
30+
#else
31+
avcodec_close(audioCodecCtx);
3032
#endif
3133
audioCodecCtx = nullptr;
3234
}
@@ -36,9 +38,10 @@ DecoderStatus::~DecoderStatus() {
3638
subtitleCodec = nullptr;
3739

3840
if (subtitleCodecCtx != nullptr) {
39-
avcodec_close(subtitleCodecCtx);
4041
#if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(57, 24, 255)
4142
avcodec_free_context(&subtitleCodecCtx);
43+
#else
44+
avcodec_close(subtitleCodecCtx);
4245
#endif
4346
subtitleCodecCtx = nullptr;
4447
}

code/debugconsole/consoleparse.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1083,7 +1083,7 @@ void dc_stuff_int(int *i)
10831083
value_l = dc_parse_long(token.c_str(), DCT_INT);
10841084

10851085
if ((value_l < INT_MAX) && (value_l > INT_MIN)) {
1086-
*i = value_l;
1086+
*i = static_cast<int>(value_l);
10871087

10881088
} else {
10891089
throw errParse(token.c_str(), DCT_INT);
@@ -1101,7 +1101,7 @@ void dc_stuff_uint(uint *i)
11011101
value_l = dc_parse_long(Cp, DCT_INT);
11021102

11031103
if (value_l < UINT_MAX) {
1104-
*i = value_l;
1104+
*i = static_cast<uint>(value_l);
11051105

11061106
} else {
11071107
throw errParse(token.c_str(), DCT_INT);

code/headtracking/freetrack.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
#ifdef _WIN32
3+
24
#include "headtracking/freetrack.h"
35

46
#define WIN32_LEAN_AND_MEAN
@@ -183,3 +185,5 @@ namespace headtracking
183185
}
184186
}
185187
}
188+
189+
#endif // _WIN32

code/headtracking/freetrack.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#ifndef HEADTRACKING_FREETRACK_H
33
#define HEADTRACKING_FREETRACK_H
44

5+
#ifdef _WIN32
6+
57
#include "headtracking/headtracking.h"
68
#include "headtracking/headtracking_internal.h"
79

@@ -92,4 +94,6 @@ namespace headtracking
9294
}
9395
}
9496

97+
#endif // _WIN32
98+
9599
#endif // HEADTRACKING_FREETRACK_H

code/headtracking/trackir.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
#ifdef _WIN32
3+
24
#include "headtracking/trackir.h"
35

46
#include "headtracking/trackirpublic.h"
@@ -53,3 +55,5 @@ namespace headtracking
5355
}
5456
}
5557
}
58+
59+
#endif // _WIN32

code/headtracking/trackir.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
#ifndef HEADTRACKING_TRACKIR_H
33
#define HEADTRACKING_TRACKIR_H
44

5+
#ifdef _WIN32
6+
57
#include "headtracking/headtracking.h"
68
#include "headtracking/headtracking_internal.h"
79
#include "headtracking/trackirpublic.h"
@@ -24,4 +26,6 @@ namespace headtracking
2426
}
2527
}
2628

29+
#endif // _WIN32
30+
2731
#endif // HEADTRACKING_TRACKIR_H

code/headtracking/trackirpublic.cpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11

2+
#ifdef _WIN32
3+
24
#include "headtracking/trackirpublic.h"
35

46
TrackIRDLL::TrackIRDLL()
@@ -126,3 +128,5 @@ float TrackIRDLL::GetYaw() const
126128
return m_GetYaw();
127129
return 0.0f;
128130
}
131+
132+
#endif // _WIN32

code/headtracking/trackirpublic.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
#ifndef TRACKIRPUBLIC_H_INCLUDED_
22
#define TRACKIRPUBLIC_H_INCLUDED_
33

4+
#ifdef _WIN32
5+
46
#include "external_dll/externalcode.h"
57
#include "globalincs/pstypes.h"
68
#include "osapi/osapi.h"
@@ -82,4 +84,6 @@ class TrackIRDLL : public SCP_ExternalCode
8284
bool m_enabled;
8385
};
8486

87+
#endif // _WIN32
88+
8589
#endif /* TRACKIRPUBLIC_H_INCLUDED_ */

0 commit comments

Comments
 (0)