Skip to content
Snippets Groups Projects
Commit c045251b authored by Rye Mutt's avatar Rye Mutt :bread:
Browse files

Fix ODR violations

parent 3d92ed98
No related branches found
No related tags found
No related merge requests found
...@@ -500,7 +500,7 @@ bool filter_llsd_with_template( ...@@ -500,7 +500,7 @@ bool filter_llsd_with_template(
* Helpers for llsd_matches() * Helpers for llsd_matches()
*****************************************************************************/ *****************************************************************************/
// raw data used for LLSD::Type lookup // raw data used for LLSD::Type lookup
struct Data struct LLSDTypeData
{ {
LLSD::Type type; LLSD::Type type;
const char* name; const char* name;
...@@ -529,7 +529,7 @@ class TypeLookup ...@@ -529,7 +529,7 @@ class TypeLookup
public: public:
TypeLookup() TypeLookup()
{ {
for (const Data *di(boost::begin(typedata)), *dend(boost::end(typedata)); di != dend; ++di) for (const LLSDTypeData *di(boost::begin(typedata)), *dend(boost::end(typedata)); di != dend; ++di)
{ {
mMap[di->type] = di->name; mMap[di->type] = di->name;
} }
......
...@@ -27,24 +27,24 @@ void append(std::string* dest, const std::string& src) ...@@ -27,24 +27,24 @@ void append(std::string* dest, const std::string& src)
} }
/*-------------------------- Data-struct testing ---------------------------*/ /*-------------------------- Data-struct testing ---------------------------*/
struct Data struct PounceableData
{ {
Data(const std::string& data): PounceableData(const std::string& data):
mData(data) mData(data)
{} {}
const std::string mData; const std::string mData;
}; };
void setter(Data** dest, Data* ptr) void setter(PounceableData** dest, PounceableData* ptr)
{ {
*dest = ptr; *dest = ptr;
} }
static Data* static_check = 0; static PounceableData* static_check = 0;
// Set up an extern pointer to an LLPounceableStatic so the linker will fill // Set up an extern pointer to an LLPounceableStatic so the linker will fill
// in the forward reference from below, before runtime. // in the forward reference from below, before runtime.
extern LLPounceable<Data*, LLPounceableStatic> gForward; extern LLPounceable<PounceableData*, LLPounceableStatic> gForward;
struct EnqueueCall struct EnqueueCall
{ {
...@@ -64,7 +64,7 @@ struct EnqueueCall ...@@ -64,7 +64,7 @@ struct EnqueueCall
// to remark, we want this call not to crash. // to remark, we want this call not to crash.
// Now declare gForward. Its constructor should not run until after nqcall's. // Now declare gForward. Its constructor should not run until after nqcall's.
LLPounceable<Data*, LLPounceableStatic> gForward; LLPounceable<PounceableData*, LLPounceableStatic> gForward;
/***************************************************************************** /*****************************************************************************
* TUT * TUT
...@@ -90,7 +90,7 @@ namespace tut ...@@ -90,7 +90,7 @@ namespace tut
// implementing it with an LLSingleton queue. This models (say) // implementing it with an LLSingleton queue. This models (say)
// LLPounceableStatic<LLMessageSystem*, LLPounceableStatic>. // LLPounceableStatic<LLMessageSystem*, LLPounceableStatic>.
ensure("static_check should still be null", ! static_check); ensure("static_check should still be null", ! static_check);
Data myData("test<1>"); PounceableData myData("test<1>");
gForward = &myData; // should run setter gForward = &myData; // should run setter
ensure_equals("static_check should be &myData", static_check, &myData); ensure_equals("static_check should be &myData", static_check, &myData);
} }
...@@ -105,13 +105,13 @@ namespace tut ...@@ -105,13 +105,13 @@ namespace tut
// We expect that LLPounceable<T, LLPounceableQueue> should have // We expect that LLPounceable<T, LLPounceableQueue> should have
// different queues because that specialization stores the queue // different queues because that specialization stores the queue
// directly in the LLPounceable instance. // directly in the LLPounceable instance.
Data *aptr = 0, *bptr = 0; PounceableData*aptr = 0, *bptr = 0;
LLPounceable<Data*> a, b; LLPounceable<PounceableData*> a, b;
a.callWhenReady(boost::bind(setter, &aptr, _1)); a.callWhenReady(boost::bind(setter, &aptr, _1));
b.callWhenReady(boost::bind(setter, &bptr, _1)); b.callWhenReady(boost::bind(setter, &bptr, _1));
ensure("aptr should be null", ! aptr); ensure("aptr should be null", ! aptr);
ensure("bptr should be null", ! bptr); ensure("bptr should be null", ! bptr);
Data adata("a"), bdata("b"); PounceableData adata("a"), bdata("b");
a = &adata; a = &adata;
ensure_equals("aptr should be &adata", aptr, &adata); ensure_equals("aptr should be &adata", aptr, &adata);
// but we haven't yet set b // but we haven't yet set b
...@@ -127,13 +127,13 @@ namespace tut ...@@ -127,13 +127,13 @@ namespace tut
// LLPounceable<T, LLPounceableStatic> should also have a distinct // LLPounceable<T, LLPounceableStatic> should also have a distinct
// queue for each instance, but that engages an additional map lookup // queue for each instance, but that engages an additional map lookup
// because there's only one LLSingleton for each T. // because there's only one LLSingleton for each T.
Data *aptr = 0, *bptr = 0; PounceableData*aptr = 0, *bptr = 0;
LLPounceable<Data*, LLPounceableStatic> a, b; LLPounceable<PounceableData*, LLPounceableStatic> a, b;
a.callWhenReady(boost::bind(setter, &aptr, _1)); a.callWhenReady(boost::bind(setter, &aptr, _1));
b.callWhenReady(boost::bind(setter, &bptr, _1)); b.callWhenReady(boost::bind(setter, &bptr, _1));
ensure("aptr should be null", ! aptr); ensure("aptr should be null", ! aptr);
ensure("bptr should be null", ! bptr); ensure("bptr should be null", ! bptr);
Data adata("a"), bdata("b"); PounceableData adata("a"), bdata("b");
a = &adata; a = &adata;
ensure_equals("aptr should be &adata", aptr, &adata); ensure_equals("aptr should be &adata", aptr, &adata);
// but we haven't yet set b // but we haven't yet set b
...@@ -149,11 +149,11 @@ namespace tut ...@@ -149,11 +149,11 @@ namespace tut
// We want LLPounceable<T, TAG> to be drop-in replaceable for a plain // We want LLPounceable<T, TAG> to be drop-in replaceable for a plain
// T for read constructs. In particular, it should behave like a dumb // T for read constructs. In particular, it should behave like a dumb
// pointer -- and with zero abstraction cost for such usage. // pointer -- and with zero abstraction cost for such usage.
Data* aptr = 0; PounceableData* aptr = 0;
Data a("a"); PounceableData a("a");
// should be able to initialize a pounceable (when its constructor // should be able to initialize a pounceable (when its constructor
// runs) // runs)
LLPounceable<Data*> pounceable(&a); LLPounceable<PounceableData*> pounceable(&a);
// should be able to pass LLPounceable<T> to function accepting T // should be able to pass LLPounceable<T> to function accepting T
setter(&aptr, pounceable); setter(&aptr, pounceable);
ensure_equals("aptr should be &a", aptr, &a); ensure_equals("aptr should be &a", aptr, &a);
...@@ -170,9 +170,9 @@ namespace tut ...@@ -170,9 +170,9 @@ namespace tut
void object::test<5>() void object::test<5>()
{ {
set_test_name("Multiple callWhenReady() queue items"); set_test_name("Multiple callWhenReady() queue items");
Data *p1 = 0, *p2 = 0, *p3 = 0; PounceableData*p1 = 0, *p2 = 0, *p3 = 0;
Data a("a"); PounceableData a("a");
LLPounceable<Data*> pounceable; LLPounceable<PounceableData*> pounceable;
// queue up a couple setter() calls for later // queue up a couple setter() calls for later
pounceable.callWhenReady(boost::bind(setter, &p1, _1)); pounceable.callWhenReady(boost::bind(setter, &p1, _1));
pounceable.callWhenReady(boost::bind(setter, &p2, _1)); pounceable.callWhenReady(boost::bind(setter, &p2, _1));
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment