Skip to content

Commit 3f55018

Browse files
committed
More #ifdef cleanup, HAVE_STRLCPY introduction
1 parent ce6ac2c commit 3f55018

File tree

9 files changed

+18
-14
lines changed

9 files changed

+18
-14
lines changed

src/b2/misc.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -387,12 +387,11 @@ std::string GetTimeString(const struct tm &t) {
387387
//////////////////////////////////////////////////////////////////////////
388388
//////////////////////////////////////////////////////////////////////////
389389

390+
#ifndef B2_LIBRETRO_CORE
390391
AudioDeviceLock::AudioDeviceLock(uint32_t device)
391392
: m_device(device) {
392393
if (m_device != 0) {
393-
#ifndef B2_LIBRETRO_CORE
394394
SDL_LockAudioDevice(m_device);
395-
#endif // B2_LIBRETRO_CORE
396395
}
397396
}
398397

@@ -401,11 +400,10 @@ AudioDeviceLock::AudioDeviceLock(uint32_t device)
401400

402401
AudioDeviceLock::~AudioDeviceLock() {
403402
if (m_device != 0) {
404-
#ifndef B2_LIBRETRO_CORE
405403
SDL_UnlockAudioDevice(m_device);
406-
#endif // B2_LIBRETRO_CORE
407404
}
408405
}
406+
#endif // B2_LIBRETRO_CORE
409407

410408
//////////////////////////////////////////////////////////////////////////
411409
//////////////////////////////////////////////////////////////////////////

src/b2/roms.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
#else
77
#include "../libretro/adapters.h"
88
#endif // B2_LIBRETRO_CORE
9+
910
#include <shared/enum_def.h>
1011
#include "roms.inl"
1112
#include <shared/enum_end.h>

src/beeb/include/beeb/DiscInterface.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ extern const DiscInterfaceDef DISC_INTERFACE_OPUS;
9292
extern const DiscInterfaceDef DISC_INTERFACE_CHALLENGER_256K;
9393
extern const DiscInterfaceDef DISC_INTERFACE_CHALLENGER_512K;
9494
#endif
95+
9596
// This disc interface is used for the Master 128.
9697
extern const DiscInterfaceDef DISC_INTERFACE_MASTER128;
9798

src/libretro/core.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
/* TODO
2+
sudo docker run -it --rm -v "/media/storage/Documents/dev/b2-libretro:/build" git.libretro.com:5050/libretro-infrastructure/libretro-build-amd64-ubuntu:xenial-gcc9 bash
23
34
sudo docker run -it --rm -v "/media/storage/Documents/dev/b2-libretro:/build" git.libretro.com:5050/libretro-infrastructure/libretro-build-mxe-win32-cross:gcc10 bash
45
@@ -659,7 +660,7 @@ void retro_get_system_info(struct retro_system_info *info)
659660
{
660661
memset(info, 0, sizeof(*info));
661662
info->library_name = "b2";
662-
info->library_version = "v0.2";
663+
info->library_version = "v0.3";
663664
info->need_fullpath = true;
664665
info->valid_extensions = "ssd|dsd";
665666
//printf("retro_get_system_info \n");

src/shared/c/system_windows.cpp

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,7 @@ char **GetBacktraceSymbols(void *const *array, int size) {
134134
//////////////////////////////////////////////////////////////////////////
135135
//////////////////////////////////////////////////////////////////////////
136136

137+
#ifndef B2_LIBRETRO_CORE
137138
const char *GetLastErrorDescription(void) {
138139
return GetErrorDescription(GetLastError());
139140
}
@@ -147,7 +148,7 @@ const char *GetErrorDescription(DWORD error) {
147148

148149
if (n == 0) {
149150
/* Bleargh. */
150-
#ifndef B2_LIBRETRO_CORE
151+
151152
#define CASE(X) \
152153
case (X): \
153154
return #X
@@ -182,7 +183,7 @@ const char *GetErrorDescription(DWORD error) {
182183
}
183184

184185
#undef CASE
185-
#endif
186+
186187
} else {
187188
/* For some reason, Windows error strings end with a carriage
188189
* return. */
@@ -195,6 +196,7 @@ const char *GetErrorDescription(DWORD error) {
195196

196197
return g_last_error_description;
197198
}
199+
#endif
198200

199201
//////////////////////////////////////////////////////////////////////////
200202
//////////////////////////////////////////////////////////////////////////
@@ -308,6 +310,7 @@ int GetTerminalWidth(void) {
308310
// https://msdn.microsoft.com/en-us/library/windows/desktop/mt774976(v=vs.85).aspx...
309311
// but that's only from Windows 10 build 1607! Seems a bit rude to
310312
// require that when everything else only needs Vista+.
313+
311314
#ifndef B2_LIBRETRO_CORE
312315
#include <shared/pshpack8.h>
313316
struct THREADNAME_INFO {
@@ -362,6 +365,7 @@ void SetCurrentThreadNameInternal(const char *name) {
362365
#else
363366
void SetCurrentThreadNameInternal(const char *name) {}
364367
#endif
368+
365369
//////////////////////////////////////////////////////////////////////////
366370
//////////////////////////////////////////////////////////////////////////
367371

src/shared/h/shared/log.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -231,11 +231,13 @@ void LogStackTrace(Log *log);
231231
// the log is enabled).
232232

233233
#define LOG__IS_ENABLED(X) ((X).enabled)
234+
234235
#ifndef B2_LIBRETRO_CORE
235236
#define LOG(X) g_log_##X
236237
#else
237238
#define LOG(X) log_info_##X
238239
#endif // B2_LIBRETRO_CORE
240+
239241
#define LOG_EXTERN(X) extern Log LOG(X)
240242

241243
// C4456: declaration of 'IDENTIFIER' hides previous local

src/shared/h/shared/mutex.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
#ifdef B2_LIBRETRO_CORE
1111
#include "system.h"
1212
#endif
13+
1314
#ifndef MUTEX_DEBUGGING
1415
#define MUTEX_DEBUGGING 1
1516
#endif

src/shared/h/shared/system.h

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -280,12 +280,9 @@ int vasprintf(char **buf, const char *fmt, va_list v);
280280
// BSD extension.
281281
//
282282
// See https://lwn.net/Articles/612244/
283-
#ifndef B2_LIBRETRO_CORE
283+
#ifndef HAVE_STRLCPY
284284
size_t strlcpy(char *dest, const char *src, size_t size);
285-
#endif // B2_LIBRETRO_CORE
286-
#if SYSTEM_WINDOWS
287-
size_t strlcpy(char *dest, const char *src, size_t size);
288-
#endif // SYSTEM_WINDOWS
285+
#endif // HAVE_STRLCPY
289286
#endif
290287

291288
//////////////////////////////////////////////////////////////////////////

src/shared/h/shared/system_windows.h

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66

77
//////////////////////////////////////////////////////////////////////////
88
//////////////////////////////////////////////////////////////////////////
9+
910
#ifndef B2_LIBRETRO_CORE
1011
#ifdef _WIN32_WINNT
1112
// 0x600 = Vista+; 0x601 = Win7+; 0x602 = Win8+;
@@ -15,8 +16,6 @@
1516
#else
1617
#define _WIN32_WINNT 0x601
1718
#endif
18-
#else
19-
size_t strlcpy(char *dest, const char *src, size_t size);
2019
#endif
2120

2221
#define NOMINMAX

0 commit comments

Comments
 (0)