diff --git a/common/include/dxxerror.h b/common/include/dxxerror.h index 3e8e22715..e24adda0b 100644 --- a/common/include/dxxerror.h +++ b/common/include/dxxerror.h @@ -39,6 +39,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #define __noreturn #endif +inline namespace dcx { + int error_init(void (*func)(const char *)); //init error system, returns 0=ok void Warning_puts(const char *str) __attribute_nonnull(); void Warning(const char *fmt,...) __attribute_format_printf(1, 2); //print out warning message to user @@ -116,4 +118,6 @@ static inline void d_debugbreak() } +} + #endif diff --git a/common/include/hash.h b/common/include/hash.h index bde91b888..9b3946046 100644 --- a/common/include/hash.h +++ b/common/include/hash.h @@ -18,13 +18,12 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. */ +#pragma once -#ifndef _HASH_H -#define _HASH_H - -#ifdef __cplusplus #include +inline namespace dcx { + struct hashtable { struct compare_t @@ -37,6 +36,4 @@ struct hashtable int hashtable_search( hashtable *ht, const char *key ); void hashtable_insert( hashtable *ht, const char *key, int value ); -#endif - -#endif +} diff --git a/common/include/hmp.h b/common/include/hmp.h index df4626f5f..178a32bef 100644 --- a/common/include/hmp.h +++ b/common/include/hmp.h @@ -16,6 +16,7 @@ #include "physfsx.h" #ifdef __cplusplus +inline namespace dcx { #define HMP_TRACKS 32 #ifdef _WIN32 @@ -101,6 +102,7 @@ void hmp_resume(hmp_file *hmp); void hmp_reset(); #endif +} #endif #endif diff --git a/common/include/ignorecase.h b/common/include/ignorecase.h index e5b243108..e4b220674 100644 --- a/common/include/ignorecase.h +++ b/common/include/ignorecase.h @@ -54,6 +54,8 @@ #ifdef __cplusplus +inline namespace dcx { + /** * \fn int PHYSFSEXT_locateCorrectCase(char *buf) * \brief Find an existing filename with matching case. @@ -82,5 +84,7 @@ int PHYSFSEXT_locateCorrectCase(char *buf); /* end of ignorecase.h ... */ +} + #endif diff --git a/common/include/strutil.h b/common/include/strutil.h index 69fe8a258..0f970c9a0 100644 --- a/common/include/strutil.h +++ b/common/include/strutil.h @@ -13,6 +13,8 @@ #include "dxxsconf.h" #include +inline namespace dcx { + #if defined(macintosh) #define snprintf macintosh_snprintf extern void snprintf(char *out_string, int size, const char * format, ... ); @@ -80,4 +82,6 @@ public: int string_array_sort_func(char **e0, char **e1); +} + #endif diff --git a/common/misc/error.cpp b/common/misc/error.cpp index c5a2d5f9d..cfdb21689 100644 --- a/common/misc/error.cpp +++ b/common/misc/error.cpp @@ -31,6 +31,8 @@ COPYRIGHT 1993-1998 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "console.h" #include "dxxerror.h" +inline namespace dcx { + #define MAX_MSG_LEN 2048 static void (*ErrorPrintFunc)(const char *); @@ -148,3 +150,5 @@ int error_init(void (*func)(const char *)) ErrorPrintFunc = func; // Set Error Print Functions return 0; } + +} diff --git a/common/misc/hash.cpp b/common/misc/hash.cpp index f7720e4ff..291111a46 100644 --- a/common/misc/hash.cpp +++ b/common/misc/hash.cpp @@ -25,6 +25,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include #include "hash.h" +inline namespace dcx { + bool hashtable::compare_t::operator()(const char *l, const char *r) const { for (;; ++l, ++r) @@ -49,3 +51,5 @@ void hashtable_insert(hashtable *ht, const char *key, int value) { ht->m.insert(std::make_pair(key, value)); } + +} diff --git a/common/misc/hmp.cpp b/common/misc/hmp.cpp index 66f75eea9..552b27089 100644 --- a/common/misc/hmp.cpp +++ b/common/misc/hmp.cpp @@ -27,6 +27,8 @@ #include "compiler-range_for.h" #include "partial_range.h" +inline namespace dcx { + #define MIDIINT(x) (words_bigendian ? (x) : (SWAPINT(x))) #define MIDISHORT(x) (words_bigendian ? (x) : (SWAPSHORT(x))) @@ -712,3 +714,5 @@ void hmp2mid(const char *hmp_name, std::vector &midbuf) serial::process_buffer(bbmi, static_cast(size_after - size_before)); } } + +} diff --git a/common/misc/ignorecase.cpp b/common/misc/ignorecase.cpp index 4dd2294fb..9ad632bdf 100644 --- a/common/misc/ignorecase.cpp +++ b/common/misc/ignorecase.cpp @@ -36,6 +36,8 @@ * \author Ryan C. Gordon. */ +inline namespace dcx { + /* I'm not screwing around with stricmp vs. strcasecmp... */ static int caseInsensitiveStringCompare(const char *x, const char *y) { @@ -115,6 +117,7 @@ int PHYSFSEXT_locateCorrectCase(char *buf) return a() ? 0 : -1; } /* PHYSFSEXT_locateCorrectCase */ +} #ifdef TEST_PHYSFSEXT_LOCATECORRECTCASE #define con_printf(A,B,...) printf(B "\n", ##__VA_ARGS__) diff --git a/common/misc/strutil.cpp b/common/misc/strutil.cpp index b7f5d3986..196754d3a 100644 --- a/common/misc/strutil.cpp +++ b/common/misc/strutil.cpp @@ -36,6 +36,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED. #include "compiler-range_for.h" +inline namespace dcx { + #ifdef macintosh void snprintf(char *out_string, int size, char * format, ... ) { @@ -230,3 +232,5 @@ void string_array_t::tidy(std::size_t offset, int (*comp)( const char *, const c // Can't do this before reallocating, otherwise it makes a mess of things (the strings in the buffer aren't ordered) ptr.erase(std::unique(b, e, [=](const char *sa, const char *sb) { return (*comp)(sa, sb) == 0; }), e); } + +}