aboutsummaryrefslogtreecommitdiff
path: root/src/shared
diff options
context:
space:
mode:
authormegamage <none@none>2009-06-27 17:54:03 -0500
committermegamage <none@none>2009-06-27 17:54:03 -0500
commit7d24efd16dac4899de7a51268cde255aed1d3d77 (patch)
tree27da8deaadd50a818884cf7f221fbc9a1046a847 /src/shared
parentb9029be234312b1a4ae1c4b7d89641d49eff91aa (diff)
[8080] Portability fixes for some Unix platforms. Author: VladimirMangos
* Add #include <stdio.h> to some fiels where related functions call. * Avoid template dependent lookup for fields in class LockedQueue. --HG-- branch : trunk
Diffstat (limited to 'src/shared')
-rw-r--r--src/shared/LockedQueue.h53
-rw-r--r--src/shared/vmap/CoordModelMapping.cpp9
-rw-r--r--src/shared/vmap/CoordModelMapping.h7
-rw-r--r--src/shared/vmap/DebugCmdLogger.cpp1
4 files changed, 29 insertions, 41 deletions
diff --git a/src/shared/LockedQueue.h b/src/shared/LockedQueue.h
index 5109b171677..4087ebff0cf 100644
--- a/src/shared/LockedQueue.h
+++ b/src/shared/LockedQueue.h
@@ -27,11 +27,9 @@
namespace ACE_Based
{
-
template <class T, class LockType, typename StorageType=std::deque<T> >
class LockedQueue
{
-
//! Serialize access to the Queue
LockType _lock;
@@ -54,14 +52,12 @@ namespace ACE_Based
*/
void add(const T& item)
{
+ ACE_Guard<LockType> g(this->_lock);
- ACE_Guard<LockType> g(_lock);
-
- ASSERT(!_canceled);
+ ASSERT(!this->_canceled);
// throw Cancellation_Exception();
- _queue.push_back(item);
-
+ this->_queue.push_back(item);
}
/**
@@ -69,27 +65,25 @@ namespace ACE_Based
*/
T next()
{
+ ACE_Guard<LockType> g(this->_lock);
- ACE_Guard<LockType> g(_lock);
-
- ASSERT (!_queue.empty() || !_canceled);
+ ASSERT (!_queue.empty() || !this->_canceled);
// throw Cancellation_Exception();
- T item = _queue.front();
- _queue.pop_front();
+ T item = this->_queue.front();
+ this->_queue.pop_front();
return item;
-
}
T front()
{
- ACE_Guard<LockType> g(_lock);
+ ACE_Guard<LockType> g(this->_lock);
- ASSERT (!_queue.empty());
+ ASSERT (!this->_queue.empty());
// throw NoSuchElement_Exception();
- return _queue.front();
+ return this->_queue.front();
}
/**
@@ -97,11 +91,9 @@ namespace ACE_Based
*/
void cancel()
{
+ ACE_Guard<LockType> g(this->_lock);
- ACE_Guard<LockType> g(_lock);
-
- _canceled = true;
-
+ this->_canceled = true;
}
/**
@@ -109,15 +101,13 @@ namespace ACE_Based
*/
bool isCanceled()
{
-
// Faster check since the queue will not become un-canceled
- if(_canceled)
+ if(this->_canceled)
return true;
- ACE_Guard<LockType> g(_lock);
-
- return _canceled;
+ ACE_Guard<LockType> g(this->_lock);
+ return this->_canceled;
}
/**
@@ -125,20 +115,15 @@ namespace ACE_Based
*/
size_t size()
{
-
- ACE_Guard<LockType> g(_lock);
- return _queue.size();
-
+ ACE_Guard<LockType> g(this->_lock);
+ return this->_queue.size();
}
bool empty()
{
-
- ACE_Guard<LockType> g(_lock);
- return _queue.empty();
+ ACE_Guard<LockType> g(this->_lock);
+ return this->_queue.empty();
}
-
};
-
}
#endif
diff --git a/src/shared/vmap/CoordModelMapping.cpp b/src/shared/vmap/CoordModelMapping.cpp
index 86e3347a614..39d1165f115 100644
--- a/src/shared/vmap/CoordModelMapping.cpp
+++ b/src/shared/vmap/CoordModelMapping.cpp
@@ -21,7 +21,7 @@
#include "CoordModelMapping.h"
#include <string.h>
-#include <cstdio>
+#include <stdio.h>
using namespace G3D;
@@ -45,6 +45,13 @@ namespace VMAP
return(CMappingEntry::getKeyString(iMapId,xPos, yPos));
}
+ const std::string CMappingEntry::getKeyString( unsigned int pMapId, int pXPos, int pYPos )
+ {
+ char b[100];
+ sprintf(b,"%03u_%d_%d", pMapId, pXPos, pYPos);
+ return(std::string(b));
+ }
+
//============================================================
//============================================================
//============================================================
diff --git a/src/shared/vmap/CoordModelMapping.h b/src/shared/vmap/CoordModelMapping.h
index c1f49462962..7684bf1b373 100644
--- a/src/shared/vmap/CoordModelMapping.h
+++ b/src/shared/vmap/CoordModelMapping.h
@@ -75,12 +75,7 @@ namespace VMAP
const std::string getKeyString() const;
inline const G3D::Array<std::string>& getFilenames() const { return(iFilenames); }
- static const std::string getKeyString(unsigned int pMapId, int pXPos, int pYPos)
- {
- char b[100];
- sprintf(b,"%03u_%d_%d", pMapId, pXPos, pYPos);
- return(std::string(b));
- }
+ static const std::string getKeyString(unsigned int pMapId, int pXPos, int pYPos);
};
diff --git a/src/shared/vmap/DebugCmdLogger.cpp b/src/shared/vmap/DebugCmdLogger.cpp
index e6b36572c45..c899606045b 100644
--- a/src/shared/vmap/DebugCmdLogger.cpp
+++ b/src/shared/vmap/DebugCmdLogger.cpp
@@ -21,6 +21,7 @@
#include <cstdio>
#include "DebugCmdLogger.h"
+#include <stdio.h>
using namespace G3D;