Use inline namespace dcx for common/misc

This commit is contained in:
Kp 2015-12-05 22:57:24 +00:00
parent 463ed96b4b
commit 5b9e50a815
10 changed files with 37 additions and 7 deletions

View file

@ -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

View file

@ -18,13 +18,12 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
*/
#pragma once
#ifndef _HASH_H
#define _HASH_H
#ifdef __cplusplus
#include <map>
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
}

View file

@ -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

View file

@ -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

View file

@ -13,6 +13,8 @@
#include "dxxsconf.h"
#include <vector>
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

View file

@ -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;
}
}

View file

@ -25,6 +25,8 @@ COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
#include <string.h>
#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));
}
}

View file

@ -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<uint8_t> &midbuf)
serial::process_buffer(bbmi, static_cast<int32_t>(size_after - size_before));
}
}
}

View file

@ -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__)

View file

@ -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);
}
}