diff options
Diffstat (limited to 'cpp/include/IceUtil')
-rw-r--r-- | cpp/include/IceUtil/AbstractMutex.h | 18 | ||||
-rw-r--r-- | cpp/include/IceUtil/Cache.h | 298 | ||||
-rw-r--r-- | cpp/include/IceUtil/Cond.h | 40 | ||||
-rw-r--r-- | cpp/include/IceUtil/DisableWarnings.h | 4 | ||||
-rw-r--r-- | cpp/include/IceUtil/Functional.h | 32 | ||||
-rw-r--r-- | cpp/include/IceUtil/Handle.h | 184 | ||||
-rw-r--r-- | cpp/include/IceUtil/InputUtil.h | 4 | ||||
-rw-r--r-- | cpp/include/IceUtil/Lock.h | 58 | ||||
-rw-r--r-- | cpp/include/IceUtil/Monitor.h | 100 | ||||
-rw-r--r-- | cpp/include/IceUtil/Mutex.h | 74 | ||||
-rwxr-xr-x | cpp/include/IceUtil/Options.h | 6 | ||||
-rw-r--r-- | cpp/include/IceUtil/OutputUtil.h | 4 | ||||
-rw-r--r-- | cpp/include/IceUtil/RWRecMutex.h | 158 | ||||
-rw-r--r-- | cpp/include/IceUtil/RecMutex.h | 6 | ||||
-rw-r--r-- | cpp/include/IceUtil/ScopedArray.h | 24 | ||||
-rw-r--r-- | cpp/include/IceUtil/Shared.h | 112 | ||||
-rw-r--r-- | cpp/include/IceUtil/StaticMutex.h | 78 | ||||
-rw-r--r-- | cpp/include/IceUtil/Thread.h | 4 | ||||
-rw-r--r-- | cpp/include/IceUtil/Time.h | 88 | ||||
-rw-r--r-- | cpp/include/IceUtil/Unicode.h | 14 |
20 files changed, 653 insertions, 653 deletions
diff --git a/cpp/include/IceUtil/AbstractMutex.h b/cpp/include/IceUtil/AbstractMutex.h index b2756a71821..1e8b2e0ed3b 100644 --- a/cpp/include/IceUtil/AbstractMutex.h +++ b/cpp/include/IceUtil/AbstractMutex.h @@ -43,17 +43,17 @@ public: virtual void lock() const { - T::lock(); + T::lock(); } virtual void unlock() const { - T::unlock(); + T::unlock(); } virtual bool tryLock() const { - return T::tryLock(); + return T::tryLock(); } virtual ~AbstractMutexI() @@ -72,17 +72,17 @@ public: virtual void lock() const { - T::readLock(); + T::readLock(); } virtual void unlock() const { - T::unlock(); + T::unlock(); } virtual bool tryLock() const { - return T::tryReadLock(); + return T::tryReadLock(); } virtual ~AbstractMutexReadI() @@ -101,17 +101,17 @@ public: virtual void lock() const { - T::writeLock(); + T::writeLock(); } virtual void unlock() const { - T::unlock(); + T::unlock(); } virtual bool tryLock() const { - return T::tryWriteLock(); + return T::tryWriteLock(); } virtual ~AbstractMutexWriteI() diff --git a/cpp/include/IceUtil/Cache.h b/cpp/include/IceUtil/Cache.h index f03afafdbd6..a4d1532a969 100644 --- a/cpp/include/IceUtil/Cache.h +++ b/cpp/include/IceUtil/Cache.h @@ -35,24 +35,24 @@ public: struct Latch : public CountDownLatch { - Latch() : - CountDownLatch(1), - useCount(0) - { - } - int useCount; + Latch() : + CountDownLatch(1), + useCount(0) + { + } + int useCount; }; struct CacheValue { - CacheValue(const Handle<Value>& o) : - obj(o), - latch(0) - { - } - - Handle<Value> obj; - Latch* latch; + CacheValue(const Handle<Value>& o) : + obj(o), + latch(0) + { + } + + Handle<Value> obj; + Latch* latch; }; typedef typename std::map<Key, CacheValue>::iterator Position; @@ -101,11 +101,11 @@ Cache<Key, Value>::getIfPinned(const Key& key) const typename CacheMap::const_iterator p = _map.find(key); if(p != _map.end()) { - return (*p).second.obj; + return (*p).second.obj; } else { - return 0; + return 0; } } @@ -156,7 +156,7 @@ Cache<Key, Value>::pin(const Key& key, const Handle<Value>& obj) if(ir.second) { - pinned(obj, ir.first); + pinned(obj, ir.first); } return ir.second; } @@ -181,145 +181,145 @@ Cache<Key, Value>::pinImpl(const Key& key, const Handle<Value>& newObj) for(;;) { - { - Mutex::Lock sync(_mutex); - - // - // Clean up latch from previous loop - // - if(latch != 0) - { - if(--latch->useCount == 0) - { - delete latch; - } - latch = 0; - } + { + Mutex::Lock sync(_mutex); + + // + // Clean up latch from previous loop + // + if(latch != 0) + { + if(--latch->useCount == 0) + { + delete latch; + } + latch = 0; + } #if defined(_MSC_VER) && (_MSC_VER < 1300) - std::pair<CacheMap::iterator, bool> ir = + std::pair<CacheMap::iterator, bool> ir = #else - std::pair<typename CacheMap::iterator, bool> ir = -#endif - + std::pair<typename CacheMap::iterator, bool> ir = +#endif + #if defined(_MSC_VER) || defined(__BCPLUSPLUS__) - _map.insert(CacheMap::value_type(key, CacheValue(0))); + _map.insert(CacheMap::value_type(key, CacheValue(0))); #else - _map.insert(typename CacheMap::value_type(key, CacheValue(0))); + _map.insert(typename CacheMap::value_type(key, CacheValue(0))); #endif - if(ir.second == false) - { - CacheValue& val = ir.first->second; - if(val.obj != 0) - { - return val.obj; - } - - // - // Otherwise wait - // - if(val.latch == 0) - { - // - // The first queued thread creates the latch - // - val.latch = new Latch; - } - latch = val.latch; - latch->useCount++; - } - - p = ir.first; - } - - if(latch != 0) - { - latch->await(); - - // - // p could be stale now, e.g. some other thread pinned and unpinned the - // object while we were waiting. - // So start over. - // - continue; - } - else - { - Handle<Value> obj; - try - { - obj = load(key); - } - catch(...) - { - { - Mutex::Lock sync(_mutex); - latch = p->second.latch; - p->second.latch = 0; - _map.erase(p); - } - if(latch != 0) - { - assert(latch->getCount() == 1); - latch->countDown(); - } - throw; - } - - { - Mutex::Lock sync(_mutex); - - latch = p->second.latch; - p->second.latch = 0; - - try - { - if(obj != 0) - { - p->second.obj = obj; - pinned(obj, p); - } - else - { - if(newObj == 0) - { - // - // pin() did not find the object - // - - // - // The waiting threads will have to call load() to see by themselves. - // - _map.erase(p); - } - else - { - // - // putIfAbsent() inserts key/newObj - // - p->second.obj = newObj; - pinned(newObj, p); - } - } - } - catch(...) - { - if(latch != 0) - { - assert(latch->getCount() == 1); - latch->countDown(); - } - throw; - } - } - if(latch != 0) - { - assert(latch->getCount() == 1); - latch->countDown(); - } - return obj; - } + if(ir.second == false) + { + CacheValue& val = ir.first->second; + if(val.obj != 0) + { + return val.obj; + } + + // + // Otherwise wait + // + if(val.latch == 0) + { + // + // The first queued thread creates the latch + // + val.latch = new Latch; + } + latch = val.latch; + latch->useCount++; + } + + p = ir.first; + } + + if(latch != 0) + { + latch->await(); + + // + // p could be stale now, e.g. some other thread pinned and unpinned the + // object while we were waiting. + // So start over. + // + continue; + } + else + { + Handle<Value> obj; + try + { + obj = load(key); + } + catch(...) + { + { + Mutex::Lock sync(_mutex); + latch = p->second.latch; + p->second.latch = 0; + _map.erase(p); + } + if(latch != 0) + { + assert(latch->getCount() == 1); + latch->countDown(); + } + throw; + } + + { + Mutex::Lock sync(_mutex); + + latch = p->second.latch; + p->second.latch = 0; + + try + { + if(obj != 0) + { + p->second.obj = obj; + pinned(obj, p); + } + else + { + if(newObj == 0) + { + // + // pin() did not find the object + // + + // + // The waiting threads will have to call load() to see by themselves. + // + _map.erase(p); + } + else + { + // + // putIfAbsent() inserts key/newObj + // + p->second.obj = newObj; + pinned(newObj, p); + } + } + } + catch(...) + { + if(latch != 0) + { + assert(latch->getCount() == 1); + latch->countDown(); + } + throw; + } + } + if(latch != 0) + { + assert(latch->getCount() == 1); + latch->countDown(); + } + return obj; + } } } diff --git a/cpp/include/IceUtil/Cond.h b/cpp/include/IceUtil/Cond.h index 2aedc67952c..ae47c4f6456 100644 --- a/cpp/include/IceUtil/Cond.h +++ b/cpp/include/IceUtil/Cond.h @@ -88,11 +88,11 @@ public: template <typename Lock> inline void wait(const Lock& lock) const { - if(!lock.acquired()) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - waitImpl(lock._mutex); + if(!lock.acquired()) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + waitImpl(lock._mutex); } // @@ -105,11 +105,11 @@ public: template <typename Lock> inline bool timedWait(const Lock& lock, const Time& timeout) const { - if(!lock.acquired()) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - return timedWaitImpl(lock._mutex, timeout); + if(!lock.acquired()) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + return timedWaitImpl(lock._mutex, timeout); } private: @@ -205,7 +205,7 @@ Cond::waitImpl(const M& mutex) const if(rc != 0) { - throw ThreadSyscallException(__FILE__, __LINE__, rc); + throw ThreadSyscallException(__FILE__, __LINE__, rc); } } @@ -226,15 +226,15 @@ Cond::timedWaitImpl(const M& mutex, const Time& timeout) const if(rc != 0) { - // - // pthread_cond_timedwait returns ETIMEOUT in the event of a - // timeout. - // - if(rc != ETIMEDOUT) - { - throw ThreadSyscallException(__FILE__, __LINE__, rc); - } - return false; + // + // pthread_cond_timedwait returns ETIMEOUT in the event of a + // timeout. + // + if(rc != ETIMEDOUT) + { + throw ThreadSyscallException(__FILE__, __LINE__, rc); + } + return false; } return true; } diff --git a/cpp/include/IceUtil/DisableWarnings.h b/cpp/include/IceUtil/DisableWarnings.h index 1803a0bdc19..ff68c2e0e4b 100644 --- a/cpp/include/IceUtil/DisableWarnings.h +++ b/cpp/include/IceUtil/DisableWarnings.h @@ -21,11 +21,11 @@ // #if defined(_MSC_VER) && _MSC_VER >= 1400 -# define _CRT_SECURE_NO_DEPRECATE 1 // C4996 '<C function>' was declared deprecated/ +# define _CRT_SECURE_NO_DEPRECATE 1 // C4996 '<C function>' was declared deprecated/ #endif #if defined(_MSC_VER) && _MSC_VER >= 1300 -# pragma warning( 4 : 4996 ) // C4996 'std::<function>' was declared deprecated +# pragma warning( 4 : 4996 ) // C4996 'std::<function>' was declared deprecated #endif #endif diff --git a/cpp/include/IceUtil/Functional.h b/cpp/include/IceUtil/Functional.h index c0a7bf25623..29effa43b9a 100644 --- a/cpp/include/IceUtil/Functional.h +++ b/cpp/include/IceUtil/Functional.h @@ -32,7 +32,7 @@ public: explicit MemFun(MemberFN p) : _mfn(p) { } R operator()(H handle) const { - return (handle.get() ->* _mfn)(); + return (handle.get() ->* _mfn)(); } }; @@ -47,7 +47,7 @@ public: explicit MemFun1(MemberFN p) : _mfn(p) { } R operator()(H handle, A arg) const { - return (handle.get() ->* _mfn)(arg); + return (handle.get() ->* _mfn)(arg); } }; @@ -62,7 +62,7 @@ public: explicit VoidMemFun(MemberFN p) : _mfn(p) { } void operator()(H handle) const { - (handle.get() ->* _mfn)(); + (handle.get() ->* _mfn)(); } }; @@ -77,7 +77,7 @@ public: explicit VoidMemFun1(MemberFN p) : _mfn(p) { } void operator()(H handle, A arg) const { - (handle.get() ->* _mfn)(arg); + (handle.get() ->* _mfn)(arg); } }; @@ -92,7 +92,7 @@ public: explicit SecondMemFun(MemberFN p) : _mfn(p) { } R operator()(std::pair<K, H> pair) const { - return (pair.second.get() ->* _mfn)(); + return (pair.second.get() ->* _mfn)(); } }; @@ -107,7 +107,7 @@ public: explicit SecondMemFun1(MemberFN p) : _mfn(p) { } R operator()(std::pair<K, H> pair, A arg) const { - return (pair.second.get() ->* _mfn)(arg); + return (pair.second.get() ->* _mfn)(arg); } }; @@ -122,7 +122,7 @@ public: explicit SecondVoidMemFun(MemberFN p) : _mfn(p) { } void operator()(std::pair<K, H> pair) const { - (pair.second.get() ->* _mfn)(); + (pair.second.get() ->* _mfn)(); } }; @@ -137,7 +137,7 @@ public: explicit SecondVoidMemFun1(MemberFN p) : _mfn(p) { } void operator()(std::pair<K, H> pair, A arg) const { - (pair.second.get() ->* _mfn)(arg); + (pair.second.get() ->* _mfn)(arg); } }; @@ -152,7 +152,7 @@ public: explicit ConstMemFun(MemberFN p) : _mfn(p) { } R operator()(H handle) const { - return (handle.get() ->* _mfn)(); + return (handle.get() ->* _mfn)(); } }; @@ -167,7 +167,7 @@ public: explicit ConstMemFun1(MemberFN p) : _mfn(p) { } R operator()(H handle, A arg) const { - return (handle.get() ->* _mfn)(arg); + return (handle.get() ->* _mfn)(arg); } }; @@ -182,7 +182,7 @@ public: explicit ConstVoidMemFun(MemberFN p) : _mfn(p) { } void operator()(H handle) const { - (handle.get() ->* _mfn)(); + (handle.get() ->* _mfn)(); } }; @@ -197,7 +197,7 @@ public: explicit ConstVoidMemFun1(MemberFN p) : _mfn(p) { } void operator()(H handle, A arg) const { - (handle.get() ->* _mfn)(arg); + (handle.get() ->* _mfn)(arg); } }; @@ -212,7 +212,7 @@ public: explicit SecondConstMemFun(MemberFN p) : _mfn(p) { } R operator()(std::pair<K, H> pair) const { - return (pair.second.get() ->* _mfn)(); + return (pair.second.get() ->* _mfn)(); } }; @@ -227,7 +227,7 @@ public: explicit SecondConstMemFun1(MemberFN p) : _mfn(p) { } R operator()(std::pair<K, H> pair, A arg) const { - return (pair.second.get() ->* _mfn)(arg); + return (pair.second.get() ->* _mfn)(arg); } }; @@ -242,7 +242,7 @@ public: explicit SecondConstVoidMemFun(MemberFN p) : _mfn(p) { } void operator()(std::pair<K, H> pair) const { - (pair.second.get() ->* _mfn)(); + (pair.second.get() ->* _mfn)(); } }; @@ -257,7 +257,7 @@ public: explicit SecondConstVoidMemFun1(MemberFN p) : _mfn(p) { } void operator()(std::pair<K, H> pair, A arg) const { - (pair.second.get() ->* _mfn)(arg); + (pair.second.get() ->* _mfn)(arg); } }; diff --git a/cpp/include/IceUtil/Handle.h b/cpp/include/IceUtil/Handle.h index c20616ec21f..0f48e2ee71b 100644 --- a/cpp/include/IceUtil/Handle.h +++ b/cpp/include/IceUtil/Handle.h @@ -29,13 +29,13 @@ public: T* get() const { - return _ptr; + return _ptr; } T* operator->() const { - if(!_ptr) - { + if(!_ptr) + { // // We don't throw directly NullHandleException here to // keep the code size of this method to a minimun (the @@ -43,16 +43,16 @@ public: // than just a function call). This maximises the chances // of inlining by compiler optimization. // - throwNullHandleException(__FILE__, __LINE__); - } + throwNullHandleException(__FILE__, __LINE__); + } - return _ptr; + return _ptr; } T& operator*() const { - if(!_ptr) - { + if(!_ptr) + { // // We don't throw directly NullHandleException here to // keep the code size of this method to a minimun (the @@ -60,20 +60,20 @@ public: // than just a function call). This maximises the chances // of inlining by compiler optimization. // - throwNullHandleException(__FILE__, __LINE__); - } + throwNullHandleException(__FILE__, __LINE__); + } - return *_ptr; + return *_ptr; } operator bool() const { - return _ptr ? true : false; + return _ptr ? true : false; } void swap(HandleBase& other) { - std::swap(_ptr, other._ptr); + std::swap(_ptr, other._ptr); } T* _ptr; @@ -96,12 +96,12 @@ inline bool operator==(const HandleBase<T>& lhs, const HandleBase<U>& rhs) U* r = rhs.get(); if(l && r) { - return *l == *r; + return *l == *r; } else { - return !l && !r; - } + return !l && !r; + } } template<typename T, typename U> @@ -111,12 +111,12 @@ inline bool operator!=(const HandleBase<T>& lhs, const HandleBase<U>& rhs) U* r = rhs.get(); if(l && r) { - return *l != *r; + return *l != *r; } else { - return l || r; - } + return l || r; + } } template<typename T, typename U> @@ -126,11 +126,11 @@ inline bool operator<(const HandleBase<T>& lhs, const HandleBase<U>& rhs) U* r = rhs.get(); if(l && r) { - return *l < *r; + return *l < *r; } else { - return !l && r; + return !l && r; } } @@ -141,111 +141,111 @@ public: Handle(T* p = 0) { - this->_ptr = p; + this->_ptr = p; - if(this->_ptr) - { - this->_ptr->__incRef(); - } + if(this->_ptr) + { + this->_ptr->__incRef(); + } } template<typename Y> Handle(const Handle<Y>& r) { - this->_ptr = r._ptr; + this->_ptr = r._ptr; - if(this->_ptr) - { - this->_ptr->__incRef(); - } + if(this->_ptr) + { + this->_ptr->__incRef(); + } } Handle(const Handle& r) { - this->_ptr = r._ptr; + this->_ptr = r._ptr; - if(this->_ptr) - { - this->_ptr->__incRef(); - } + if(this->_ptr) + { + this->_ptr->__incRef(); + } } ~Handle() { - if(this->_ptr) - { - this->_ptr->__decRef(); - } + if(this->_ptr) + { + this->_ptr->__decRef(); + } } Handle& operator=(T* p) { - if(this->_ptr != p) - { - if(p) - { - p->__incRef(); - } - - T* ptr = this->_ptr; - this->_ptr = p; - - if(ptr) - { - ptr->__decRef(); - } - } - return *this; + if(this->_ptr != p) + { + if(p) + { + p->__incRef(); + } + + T* ptr = this->_ptr; + this->_ptr = p; + + if(ptr) + { + ptr->__decRef(); + } + } + return *this; } template<typename Y> Handle& operator=(const Handle<Y>& r) { - if(this->_ptr != r._ptr) - { - if(r._ptr) - { - r._ptr->__incRef(); - } - - T* ptr = this->_ptr; - this->_ptr = r._ptr; - - if(ptr) - { - ptr->__decRef(); - } - } - return *this; + if(this->_ptr != r._ptr) + { + if(r._ptr) + { + r._ptr->__incRef(); + } + + T* ptr = this->_ptr; + this->_ptr = r._ptr; + + if(ptr) + { + ptr->__decRef(); + } + } + return *this; } Handle& operator=(const Handle& r) { - if(this->_ptr != r._ptr) - { - if(r._ptr) - { - r._ptr->__incRef(); - } - - T* ptr = this->_ptr; - this->_ptr = r._ptr; - - if(ptr) - { - ptr->__decRef(); - } - } - return *this; + if(this->_ptr != r._ptr) + { + if(r._ptr) + { + r._ptr->__incRef(); + } + + T* ptr = this->_ptr; + this->_ptr = r._ptr; + + if(ptr) + { + ptr->__decRef(); + } + } + return *this; } template<class Y> static Handle dynamicCast(const HandleBase<Y>& r) { #ifdef __BCPLUSPLUS__ - return Handle<T>(dynamic_cast<T*>(r._ptr)); + return Handle<T>(dynamic_cast<T*>(r._ptr)); #else - return Handle(dynamic_cast<T*>(r._ptr)); + return Handle(dynamic_cast<T*>(r._ptr)); #endif } @@ -253,9 +253,9 @@ public: static Handle dynamicCast(Y* p) { #ifdef __BCPLUSPLUS__ - return Handle<T>(dynamic_cast<T*>(p)); + return Handle<T>(dynamic_cast<T*>(p)); #else - return Handle(dynamic_cast<T*>(p)); + return Handle(dynamic_cast<T*>(p)); #endif } }; diff --git a/cpp/include/IceUtil/InputUtil.h b/cpp/include/IceUtil/InputUtil.h index 89ce9990373..480147bffdd 100644 --- a/cpp/include/IceUtil/InputUtil.h +++ b/cpp/include/IceUtil/InputUtil.h @@ -37,8 +37,8 @@ ICE_UTIL_API Int64 strToInt64(const char*, char**, int); // // - return value == true indicates a successful conversion and result contains the converted value // - return value == false indicates an unsuccessful conversion: -// - result == 0 indicates that no digits were available for conversion -// - result == "Int64 Min" or result == "Int64 Max" indicate underflow or overflow. +// - result == 0 indicates that no digits were available for conversion +// - result == "Int64 Min" or result == "Int64 Max" indicate underflow or overflow. // ICE_UTIL_API bool stringToInt64(const std::string&, Int64&); diff --git a/cpp/include/IceUtil/Lock.h b/cpp/include/IceUtil/Lock.h index 9aaf24bcf56..5fdfbddcdd8 100644 --- a/cpp/include/IceUtil/Lock.h +++ b/cpp/include/IceUtil/Lock.h @@ -44,63 +44,63 @@ class LockT public: LockT(const T& mutex) : - _mutex(mutex) + _mutex(mutex) { - _mutex.lock(); - _acquired = true; + _mutex.lock(); + _acquired = true; } ~LockT() { - if (_acquired) - { - _mutex.unlock(); - } + if (_acquired) + { + _mutex.unlock(); + } } void acquire() const { - if (_acquired) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - _mutex.lock(); - _acquired = true; + if (_acquired) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + _mutex.lock(); + _acquired = true; } bool tryAcquire() const { - if (_acquired) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - _acquired = _mutex.tryLock(); - return _acquired; + if (_acquired) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + _acquired = _mutex.tryLock(); + return _acquired; } void release() const { - if (!_acquired) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - _mutex.unlock(); - _acquired = false; + if (!_acquired) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + _mutex.unlock(); + _acquired = false; } bool acquired() const { - return _acquired; + return _acquired; } protected: // TryLockT's contructor LockT(const T& mutex, bool) : - _mutex(mutex) + _mutex(mutex) { - _acquired = _mutex.tryLock(); + _acquired = _mutex.tryLock(); } private: @@ -126,7 +126,7 @@ class TryLockT : public LockT<T> public: TryLockT(const T& mutex) : - LockT<T>(mutex, true) + LockT<T>(mutex, true) {} }; diff --git a/cpp/include/IceUtil/Monitor.h b/cpp/include/IceUtil/Monitor.h index 2e9fd0e456f..e64830e0979 100644 --- a/cpp/include/IceUtil/Monitor.h +++ b/cpp/include/IceUtil/Monitor.h @@ -89,11 +89,11 @@ IceUtil::Monitor<T>::lock() const _mutex.lock(); if(_mutex.willUnlock()) { - // - // On the first mutex acquisition reset the number pending - // notifications. - // - _nnotify = 0; + // + // On the first mutex acquisition reset the number pending + // notifications. + // + _nnotify = 0; } } @@ -102,10 +102,10 @@ IceUtil::Monitor<T>::unlock() const { if(_mutex.willUnlock()) { - // - // Perform any pending notifications. - // - notifyImpl(_nnotify); + // + // Perform any pending notifications. + // + notifyImpl(_nnotify); } _mutex.unlock(); @@ -113,10 +113,10 @@ IceUtil::Monitor<T>::unlock() const int nnotify = _nnotify; if(_mutex.unlock()) { - // - // Perform any pending notifications. - // - notifyImpl(nnotify); + // + // Perform any pending notifications. + // + notifyImpl(nnotify); } */ } @@ -127,11 +127,11 @@ IceUtil::Monitor<T>::tryLock() const bool result = _mutex.tryLock(); if(result && _mutex.willUnlock()) { - // - // On the first mutex acquisition reset the number pending - // notifications. - // - _nnotify = 0; + // + // On the first mutex acquisition reset the number pending + // notifications. + // + _nnotify = 0; } return result; } @@ -149,15 +149,15 @@ IceUtil::Monitor<T>::wait() const // try { - _cond.waitImpl(_mutex); - // - // Reset the nnotify count once wait() returns. - // + _cond.waitImpl(_mutex); + // + // Reset the nnotify count once wait() returns. + // } catch(...) { - _nnotify = 0; - throw; + _nnotify = 0; + throw; } _nnotify = 0; @@ -177,16 +177,16 @@ IceUtil::Monitor<T>::timedWait(const Time& timeout) const // try { - rc = _cond.timedWaitImpl(_mutex, timeout); + rc = _cond.timedWaitImpl(_mutex, timeout); - // - // Reset the nnotify count once wait() returns. - // + // + // Reset the nnotify count once wait() returns. + // } catch(...) { - _nnotify = 0; - throw; + _nnotify = 0; + throw; } _nnotify = 0; @@ -202,7 +202,7 @@ IceUtil::Monitor<T>::notify() // if(_nnotify != -1) { - ++_nnotify; + ++_nnotify; } } @@ -224,25 +224,25 @@ IceUtil::Monitor<T>::notifyImpl(int nnotify) const // if(nnotify != 0) { - // - // -1 means notifyAll. - // - if(nnotify == -1) - { - _cond.broadcast(); - return; - } - else - { - // - // Otherwise notify n times. - // - while(nnotify > 0) - { - _cond.signal(); - --nnotify; - } - } + // + // -1 means notifyAll. + // + if(nnotify == -1) + { + _cond.broadcast(); + return; + } + else + { + // + // Otherwise notify n times. + // + while(nnotify > 0) + { + _cond.signal(); + --nnotify; + } + } } } diff --git a/cpp/include/IceUtil/Mutex.h b/cpp/include/IceUtil/Mutex.h index da2c36b9bca..ca08324d28b 100644 --- a/cpp/include/IceUtil/Mutex.h +++ b/cpp/include/IceUtil/Mutex.h @@ -87,7 +87,7 @@ private: #else struct LockState { - pthread_mutex_t* mutex; + pthread_mutex_t* mutex; }; #endif @@ -140,12 +140,12 @@ Mutex::tryLock() const { if(!TryEnterCriticalSection(&_mutex)) { - return false; + return false; } if(_mutex.RecursionCount > 1) { - LeaveCriticalSection(&_mutex); - throw ThreadLockedException(__FILE__, __LINE__); + LeaveCriticalSection(&_mutex); + throw ThreadLockedException(__FILE__, __LINE__); } return true; } @@ -178,7 +178,7 @@ Mutex::Mutex() : _mutex = CreateMutex(0, false, 0); if(_mutex == 0) { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); + throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } @@ -188,7 +188,7 @@ Mutex::~Mutex() BOOL rc = CloseHandle(_mutex); if(rc == 0) { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); + throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } @@ -198,14 +198,14 @@ Mutex::lock() const DWORD rc = WaitForSingleObject(_mutex, INFINITE); if(rc != WAIT_OBJECT_0) { - if(rc == WAIT_FAILED) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } - else - { - throw ThreadSyscallException(__FILE__, __LINE__, 0); - } + if(rc == WAIT_FAILED) + { + throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); + } + else + { + throw ThreadSyscallException(__FILE__, __LINE__, 0); + } } _recursionCount++; } @@ -216,18 +216,18 @@ Mutex::tryLock() const DWORD rc = WaitForSingleObject(_mutex, 0); if(rc != WAIT_OBJECT_0) { - return false; + return false; } else if(_recursionCount == 1) { - _recursionCount++; - unlock(); - throw ThreadLockedException(__FILE__, __LINE__); + _recursionCount++; + unlock(); + throw ThreadLockedException(__FILE__, __LINE__); } else { - _recursionCount++; - return true; + _recursionCount++; + return true; } } @@ -238,7 +238,7 @@ Mutex::unlock() const BOOL rc = ReleaseMutex(_mutex); if(rc == 0) { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); + throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } @@ -287,7 +287,7 @@ Mutex::Mutex() if(rc != 0) { - throw ThreadSyscallException(__FILE__, __LINE__, rc); + throw ThreadSyscallException(__FILE__, __LINE__, rc); } } @@ -306,13 +306,13 @@ Mutex::lock() const if(rc != 0) { if(rc == EDEADLK) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - else - { - throw ThreadSyscallException(__FILE__, __LINE__, rc); - } + { + throw ThreadLockedException(__FILE__, __LINE__); + } + else + { + throw ThreadSyscallException(__FILE__, __LINE__, rc); + } } } @@ -323,13 +323,13 @@ Mutex::tryLock() const if(rc != 0 && rc != EBUSY) { if(rc == EDEADLK) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - else - { - throw ThreadSyscallException(__FILE__, __LINE__, rc); - } + { + throw ThreadLockedException(__FILE__, __LINE__); + } + else + { + throw ThreadSyscallException(__FILE__, __LINE__, rc); + } } return (rc == 0); } @@ -340,7 +340,7 @@ Mutex::unlock() const int rc = pthread_mutex_unlock(&_mutex); if(rc != 0) { - throw ThreadSyscallException(__FILE__, __LINE__, rc); + throw ThreadSyscallException(__FILE__, __LINE__, rc); } } diff --git a/cpp/include/IceUtil/Options.h b/cpp/include/IceUtil/Options.h index f7af12c47a5..ef14133eb7e 100755 --- a/cpp/include/IceUtil/Options.h +++ b/cpp/include/IceUtil/Options.h @@ -87,10 +87,10 @@ private: struct OptionDetails : public IceUtil::Shared { - LengthType length; - ArgType arg; + LengthType length; + ArgType arg; RepeatType repeat; - bool hasDefault; + bool hasDefault; }; typedef IceUtil::Handle<OptionDetails> ODPtr; diff --git a/cpp/include/IceUtil/OutputUtil.h b/cpp/include/IceUtil/OutputUtil.h index c6b6c021f89..ec86158f1d1 100644 --- a/cpp/include/IceUtil/OutputUtil.h +++ b/cpp/include/IceUtil/OutputUtil.h @@ -127,7 +127,7 @@ operator<<(Output& out, const std::vector<T>& val) { for(typename std::vector<T>::const_iterator p = val.begin(); p != val.end(); ++p) { - out << *p; + out << *p; } return out; } @@ -145,7 +145,7 @@ operator<<(Output& out, std::vector<T>& val) { for(typename std::vector<T>::const_iterator p = val.begin(); p != val.end(); ++p) { - out << *p; + out << *p; } return out; } diff --git a/cpp/include/IceUtil/RWRecMutex.h b/cpp/include/IceUtil/RWRecMutex.h index bdcefeb676d..396aae37cf3 100644 --- a/cpp/include/IceUtil/RWRecMutex.h +++ b/cpp/include/IceUtil/RWRecMutex.h @@ -37,83 +37,83 @@ class RLockT public: RLockT(const T& mutex) : - _mutex(mutex) + _mutex(mutex) { - _mutex.readLock(); - _acquired = true; + _mutex.readLock(); + _acquired = true; } ~RLockT() { - if (_acquired) - { - _mutex.unlock(); - } + if (_acquired) + { + _mutex.unlock(); + } } void acquire() const { - if (_acquired) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - _mutex.readLock(); - _acquired = true; + if (_acquired) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + _mutex.readLock(); + _acquired = true; } bool tryAcquire() const { - if (_acquired) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - _acquired = _mutex.tryReadLock(); - return _acquired; + if (_acquired) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + _acquired = _mutex.tryReadLock(); + return _acquired; } bool timedAcquire(const Time& timeout) const { - if (_acquired) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - _acquired = _mutex.timedReadLock(timeout); - return _acquired; + if (_acquired) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + _acquired = _mutex.timedReadLock(timeout); + return _acquired; } void release() const { - if (!_acquired) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - _mutex.unlock(); - _acquired = false; + if (!_acquired) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + _mutex.unlock(); + _acquired = false; } bool acquired() const { - return _acquired; + return _acquired; } void upgrade() const { - _mutex.upgrade(); + _mutex.upgrade(); } bool timedUpgrade(const Time& timeout) const { - return _mutex.timedUpgrade(timeout); + return _mutex.timedUpgrade(timeout); } void downgrade() const { - _mutex.downgrade(); + _mutex.downgrade(); } protected: @@ -121,16 +121,16 @@ protected: // TryRLockT's constructors RLockT(const T& mutex, bool) : - _mutex(mutex) + _mutex(mutex) { - _acquired = _mutex.tryReadLock(); + _acquired = _mutex.tryReadLock(); } RLockT(const T& mutex, const Time& timeout) : - _mutex(mutex) + _mutex(mutex) { - _acquired = _mutex.timedReadLock(timeout); + _acquired = _mutex.timedReadLock(timeout); } @@ -151,12 +151,12 @@ class TryRLockT : public RLockT<T> public: TryRLockT(const T& mutex) : - RLockT<T>(mutex, true) + RLockT<T>(mutex, true) { } TryRLockT(const T& mutex, const Time& timeout) : - RLockT<T>(mutex, timeout) + RLockT<T>(mutex, timeout) { } }; @@ -167,63 +167,63 @@ class WLockT public: WLockT(const T& mutex) : - _mutex(mutex) + _mutex(mutex) { - _mutex.writeLock(); - _acquired = true; + _mutex.writeLock(); + _acquired = true; } ~WLockT() { - if (_acquired) - { - _mutex.unlock(); - } + if (_acquired) + { + _mutex.unlock(); + } } void acquire() const { - if (_acquired) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - _mutex.writeLock(); - _acquired = true; + if (_acquired) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + _mutex.writeLock(); + _acquired = true; } bool tryAcquire() const { - if (_acquired) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - _acquired = _mutex.tryWriteLock(); - return _acquired; + if (_acquired) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + _acquired = _mutex.tryWriteLock(); + return _acquired; } bool timedAcquire(const Time& timeout) const { - if (_acquired) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - _acquired = _mutex.timedWriteLock(timeout); - return _acquired; + if (_acquired) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + _acquired = _mutex.timedWriteLock(timeout); + return _acquired; } void release() const { - if (!_acquired) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - _mutex.unlock(); - _acquired = false; + if (!_acquired) + { + throw ThreadLockedException(__FILE__, __LINE__); + } + _mutex.unlock(); + _acquired = false; } bool acquired() const { - return _acquired; + return _acquired; } protected: @@ -231,15 +231,15 @@ protected: // TryWLockT's constructor WLockT(const T& mutex, bool) : - _mutex(mutex) + _mutex(mutex) { - _acquired = _mutex.tryWriteLock(); + _acquired = _mutex.tryWriteLock(); } WLockT(const T& mutex, const Time& timeout) : - _mutex(mutex) + _mutex(mutex) { - _acquired = _mutex.timedWriteLock(timeout); + _acquired = _mutex.timedWriteLock(timeout); } private: @@ -259,12 +259,12 @@ class TryWLockT : public WLockT<T> public: TryWLockT(const T& mutex) : - WLockT<T>(mutex, true) + WLockT<T>(mutex, true) { } TryWLockT(const T& mutex, const Time& timeout) : - WLockT<T>(mutex, timeout) + WLockT<T>(mutex, timeout) { } }; diff --git a/cpp/include/IceUtil/RecMutex.h b/cpp/include/IceUtil/RecMutex.h index 898123834c4..5c89feb21b2 100644 --- a/cpp/include/IceUtil/RecMutex.h +++ b/cpp/include/IceUtil/RecMutex.h @@ -78,13 +78,13 @@ private: #ifdef _WIN32 struct LockState { - int count; + int count; }; #else struct LockState { - pthread_mutex_t* mutex; - int count; + pthread_mutex_t* mutex; + int count; }; #endif diff --git a/cpp/include/IceUtil/ScopedArray.h b/cpp/include/IceUtil/ScopedArray.h index edc033f0c8c..52be7c0ae12 100644 --- a/cpp/include/IceUtil/ScopedArray.h +++ b/cpp/include/IceUtil/ScopedArray.h @@ -28,25 +28,25 @@ public: ~ScopedArray() { if(_ptr != 0) - { - delete[] _ptr; - } + { + delete[] _ptr; + } } void reset(T* ptr = 0) { - assert(ptr == 0 || ptr != _ptr); + assert(ptr == 0 || ptr != _ptr); if(_ptr != 0) - { - delete[] _ptr; - } - _ptr = ptr; + { + delete[] _ptr; + } + _ptr = ptr; } T& operator[](size_t i) const { - assert(_ptr != 0); - assert(i >= 0); + assert(_ptr != 0); + assert(i >= 0); return _ptr[i]; } @@ -58,8 +58,8 @@ public: void swap(ScopedArray& a) { T* tmp = a._ptr; - a._ptr = _ptr; - _ptr = tmp; + a._ptr = _ptr; + _ptr = tmp; } private: diff --git a/cpp/include/IceUtil/Shared.h b/cpp/include/IceUtil/Shared.h index 8abb33f0c34..c80b6b35c5b 100644 --- a/cpp/include/IceUtil/Shared.h +++ b/cpp/include/IceUtil/Shared.h @@ -62,9 +62,9 @@ inline void ice_atomic_set(ice_atomic_t* v, int i) inline void ice_atomic_inc(ice_atomic_t *v) { __asm__ __volatile__( - "lock ; incl %0" - :"=m" (v->counter) - :"m" (v->counter)); + "lock ; incl %0" + :"=m" (v->counter) + :"m" (v->counter)); } /** @@ -81,9 +81,9 @@ inline int ice_atomic_dec_and_test(ice_atomic_t *v) { unsigned char c; __asm__ __volatile__( - "lock ; decl %0; sete %1" - :"=m" (v->counter), "=qm" (c) - :"m" (v->counter) : "memory"); + "lock ; decl %0; sete %1" + :"=m" (v->counter), "=qm" (c) + :"m" (v->counter) : "memory"); return c != 0; } @@ -98,10 +98,10 @@ inline int ice_atomic_exchange_add(int i, ice_atomic_t* v) { int tmp = i; __asm__ __volatile__( - "lock ; xadd %0,(%2)" - :"+r"(tmp), "=m"(v->counter) - :"r"(v), "m"(v->counter) - : "memory"); + "lock ; xadd %0,(%2)" + :"+r"(tmp), "=m"(v->counter) + :"r"(v), "m"(v->counter) + : "memory"); return tmp + i; } @@ -148,31 +148,31 @@ public: void __incRef() { - assert(_ref >= 0); - ++_ref; + assert(_ref >= 0); + ++_ref; } void __decRef() { - assert(_ref > 0); - if(--_ref == 0) - { - if(!_noDelete) - { - _noDelete = true; - delete this; - } - } + assert(_ref > 0); + if(--_ref == 0) + { + if(!_noDelete) + { + _noDelete = true; + delete this; + } + } } int __getRef() const { - return _ref; + return _ref; } void __setNoDelete(bool b) { - _noDelete = b; + _noDelete = b; } private: @@ -200,49 +200,49 @@ public: void __incRef() { #if defined(_WIN32) - assert(InterlockedExchangeAdd(&_ref, 0) >= 0); - InterlockedIncrement(&_ref); + assert(InterlockedExchangeAdd(&_ref, 0) >= 0); + InterlockedIncrement(&_ref); #elif defined(ICE_HAS_ATOMIC_FUNCTIONS) - assert(ice_atomic_exchange_add(0, &_ref) >= 0); - ice_atomic_inc(&_ref); + assert(ice_atomic_exchange_add(0, &_ref) >= 0); + ice_atomic_inc(&_ref); #else - _mutex.lock(); - assert(_ref >= 0); - ++_ref; - _mutex.unlock(); + _mutex.lock(); + assert(_ref >= 0); + ++_ref; + _mutex.unlock(); #endif } void __decRef() { #if defined(_WIN32) - assert(InterlockedExchangeAdd(&_ref, 0) > 0); - if(InterlockedDecrement(&_ref) == 0 && !_noDelete) - { - _noDelete = true; - delete this; - } + assert(InterlockedExchangeAdd(&_ref, 0) > 0); + if(InterlockedDecrement(&_ref) == 0 && !_noDelete) + { + _noDelete = true; + delete this; + } #elif defined(ICE_HAS_ATOMIC_FUNCTIONS) - assert(ice_atomic_exchange_add(0, &_ref) > 0); - if(ice_atomic_dec_and_test(&_ref) && !_noDelete) - { - _noDelete = true; - delete this; - } + assert(ice_atomic_exchange_add(0, &_ref) > 0); + if(ice_atomic_dec_and_test(&_ref) && !_noDelete) + { + _noDelete = true; + delete this; + } #else - _mutex.lock(); - bool doDelete = false; - assert(_ref > 0); - if(--_ref == 0) - { - doDelete = !_noDelete; - _noDelete = true; - } - _mutex.unlock(); - if(doDelete) - { - delete this; - } + _mutex.lock(); + bool doDelete = false; + assert(_ref > 0); + if(--_ref == 0) + { + doDelete = !_noDelete; + _noDelete = true; + } + _mutex.unlock(); + if(doDelete) + { + delete this; + } #endif } diff --git a/cpp/include/IceUtil/StaticMutex.h b/cpp/include/IceUtil/StaticMutex.h index bf67e79635e..4bf6ccf2fad 100644 --- a/cpp/include/IceUtil/StaticMutex.h +++ b/cpp/include/IceUtil/StaticMutex.h @@ -95,7 +95,7 @@ private: #else struct LockState { - pthread_mutex_t* mutex; + pthread_mutex_t* mutex; }; #endif @@ -149,7 +149,7 @@ StaticMutex::lock() const { if(!initialized()) { - initialize(); + initialize(); } EnterCriticalSection(_mutex); assert(_mutex->RecursionCount == 1); @@ -160,16 +160,16 @@ StaticMutex::tryLock() const { if(!initialized()) { - initialize(); + initialize(); } if(!TryEnterCriticalSection(_mutex)) { - return false; + return false; } if(_mutex->RecursionCount > 1) { - LeaveCriticalSection(_mutex); - throw ThreadLockedException(__FILE__, __LINE__); + LeaveCriticalSection(_mutex); + throw ThreadLockedException(__FILE__, __LINE__); } return true; } @@ -195,7 +195,7 @@ StaticMutex::lock(LockState&) const { if(!initialized()) { - initialize(); + initialize(); } EnterCriticalSection(_mutex); } @@ -207,20 +207,20 @@ StaticMutex::lock() const { if(!initialized()) { - initialize(); + initialize(); } DWORD rc = WaitForSingleObject(_mutex, INFINITE); if(rc != WAIT_OBJECT_0) { - if(rc == WAIT_FAILED) - { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); - } - else - { - throw ThreadSyscallException(__FILE__, __LINE__, 0); - } + if(rc == WAIT_FAILED) + { + throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); + } + else + { + throw ThreadSyscallException(__FILE__, __LINE__, 0); + } } _recursionCount++; assert(_recursionCount == 1); @@ -231,24 +231,24 @@ StaticMutex::tryLock() const { if(!initialized()) { - initialize(); + initialize(); } DWORD rc = WaitForSingleObject(_mutex, 0); if(rc != WAIT_OBJECT_0) { - return false; + return false; } else if(_recursionCount == 1) { - _recursionCount++; - unlock(); - throw ThreadLockedException(__FILE__, __LINE__); + _recursionCount++; + unlock(); + throw ThreadLockedException(__FILE__, __LINE__); } else { - _recursionCount++; - return true; + _recursionCount++; + return true; } } @@ -259,7 +259,7 @@ StaticMutex::unlock() const BOOL rc = ReleaseMutex(_mutex); if(rc == 0) { - throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); + throw ThreadSyscallException(__FILE__, __LINE__, GetLastError()); } } @@ -286,13 +286,13 @@ StaticMutex::lock() const if(rc != 0) { if(rc == EDEADLK) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - else - { - throw ThreadSyscallException(__FILE__, __LINE__, rc); - } + { + throw ThreadLockedException(__FILE__, __LINE__); + } + else + { + throw ThreadSyscallException(__FILE__, __LINE__, rc); + } } } @@ -303,13 +303,13 @@ StaticMutex::tryLock() const if(rc != 0 && rc != EBUSY) { if(rc == EDEADLK) - { - throw ThreadLockedException(__FILE__, __LINE__); - } - else - { - throw ThreadSyscallException(__FILE__, __LINE__, rc); - } + { + throw ThreadLockedException(__FILE__, __LINE__); + } + else + { + throw ThreadSyscallException(__FILE__, __LINE__, rc); + } } return (rc == 0); } @@ -320,7 +320,7 @@ StaticMutex::unlock() const int rc = pthread_mutex_unlock(&_mutex); if(rc != 0) { - throw ThreadSyscallException(__FILE__, __LINE__, rc); + throw ThreadSyscallException(__FILE__, __LINE__, rc); } } diff --git a/cpp/include/IceUtil/Thread.h b/cpp/include/IceUtil/Thread.h index ce70f933336..f46182b2476 100644 --- a/cpp/include/IceUtil/Thread.h +++ b/cpp/include/IceUtil/Thread.h @@ -140,8 +140,8 @@ protected: #endif private: - Thread(const Thread&); // Copying is forbidden - void operator=(const Thread&); // Assignment is forbidden + Thread(const Thread&); // Copying is forbidden + void operator=(const Thread&); // Assignment is forbidden }; typedef Handle<Thread> ThreadPtr; diff --git a/cpp/include/IceUtil/Time.h b/cpp/include/IceUtil/Time.h index 857c9a680d0..b2b5981776a 100644 --- a/cpp/include/IceUtil/Time.h +++ b/cpp/include/IceUtil/Time.h @@ -51,142 +51,142 @@ public: Time operator-() const { - return Time(-_usec); + return Time(-_usec); } Time operator-(const Time& rhs) const { - return Time(_usec - rhs._usec); + return Time(_usec - rhs._usec); } Time operator+(const Time& rhs) const { - return Time(_usec + rhs._usec); + return Time(_usec + rhs._usec); } Time& operator+=(const Time& rhs) { - _usec += rhs._usec; - return *this; + _usec += rhs._usec; + return *this; } Time& operator-=(const Time& rhs) { - _usec -= rhs._usec; - return *this; + _usec -= rhs._usec; + return *this; } bool operator<(const Time& rhs) const { - return _usec < rhs._usec; + return _usec < rhs._usec; } bool operator<=(const Time& rhs) const { - return _usec <= rhs._usec; + return _usec <= rhs._usec; } bool operator>(const Time& rhs) const { - return _usec > rhs._usec; + return _usec > rhs._usec; } bool operator>=(const Time& rhs) const { - return _usec >= rhs._usec; + return _usec >= rhs._usec; } bool operator==(const Time& rhs) const { - return _usec == rhs._usec; + return _usec == rhs._usec; } bool operator!=(const Time& rhs) const { - return _usec != rhs._usec; + return _usec != rhs._usec; } double operator/(const Time& rhs) const { - return (double)_usec / (double)rhs._usec; + return (double)_usec / (double)rhs._usec; } Time& operator*=(int rhs) { - _usec *= rhs; - return *this; + _usec *= rhs; + return *this; } Time operator*(int rhs) const { - Time t; - t._usec = _usec * rhs; - return t; + Time t; + t._usec = _usec * rhs; + return t; } Time& operator/=(int rhs) { - _usec /= rhs; - return *this; + _usec /= rhs; + return *this; } Time operator/(int rhs) const { - Time t; - t._usec = _usec / rhs; - return t; + Time t; + t._usec = _usec / rhs; + return t; } Time& operator*=(Int64 rhs) { - _usec *= rhs; - return *this; + _usec *= rhs; + return *this; } Time operator*(Int64 rhs) const { - Time t; - t._usec = _usec * rhs; - return t; + Time t; + t._usec = _usec * rhs; + return t; } Time& operator/=(Int64 rhs) { - _usec /= rhs; - return *this; + _usec /= rhs; + return *this; } Time operator/(Int64 rhs) const { - Time t; - t._usec = _usec / rhs; - return t; + Time t; + t._usec = _usec / rhs; + return t; } Time& operator*=(double rhs) { - _usec = static_cast<Int64>(static_cast<double>(_usec) * rhs); - return *this; + _usec = static_cast<Int64>(static_cast<double>(_usec) * rhs); + return *this; } Time operator*(double rhs) const { - Time t; - t._usec = static_cast<Int64>(static_cast<double>(_usec) * rhs); - return t; + Time t; + t._usec = static_cast<Int64>(static_cast<double>(_usec) * rhs); + return t; } Time& operator/=(double rhs) { - _usec = static_cast<Int64>(static_cast<double>(_usec) / rhs); - return *this; + _usec = static_cast<Int64>(static_cast<double>(_usec) / rhs); + return *this; } Time operator/(double rhs) const { - Time t; - t._usec = static_cast<Int64>(static_cast<double>(_usec) / rhs); - return t; + Time t; + t._usec = static_cast<Int64>(static_cast<double>(_usec) / rhs); + return t; } private: diff --git a/cpp/include/IceUtil/Unicode.h b/cpp/include/IceUtil/Unicode.h index caebf5b2a5d..03c95a3fa56 100644 --- a/cpp/include/IceUtil/Unicode.h +++ b/cpp/include/IceUtil/Unicode.h @@ -97,10 +97,10 @@ ICE_UTIL_API std::wstring stringToWstring(const std::string&); enum ConversionResult { - conversionOK, /* conversion successful */ - sourceExhausted, /* partial character in source, but hit end */ - targetExhausted, /* insuff. room in target for conversion */ - sourceIllegal /* source sequence is illegal/malformed */ + conversionOK, /* conversion successful */ + sourceExhausted, /* partial character in source, but hit end */ + targetExhausted, /* insuff. room in target for conversion */ + sourceIllegal /* source sequence is illegal/malformed */ }; @@ -117,15 +117,15 @@ isLegalUTF8Sequence(const Byte* source, const Byte* end); ICE_UTIL_API ConversionResult convertUTFWstringToUTF8(const wchar_t*& sourceStart, const wchar_t* sourceEnd, - Byte*& targetStart, Byte* targetEnd, ConversionFlags flags); + Byte*& targetStart, Byte* targetEnd, ConversionFlags flags); ICE_UTIL_API ConversionResult convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd, - wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags); + wchar_t*& targetStart, wchar_t* targetEnd, ConversionFlags flags); ICE_UTIL_API ConversionResult convertUTF8ToUTFWstring(const Byte*& sourceStart, const Byte* sourceEnd, - std::wstring& target, ConversionFlags flags); + std::wstring& target, ConversionFlags flags); |