diff options
Diffstat (limited to 'src/server/shared/Packets/ByteBuffer.h')
| -rwxr-xr-x | src/server/shared/Packets/ByteBuffer.h | 36 |
1 files changed, 18 insertions, 18 deletions
diff --git a/src/server/shared/Packets/ByteBuffer.h b/src/server/shared/Packets/ByteBuffer.h index 8ad5af56d1a..08318aa7a5b 100755 --- a/src/server/shared/Packets/ByteBuffer.h +++ b/src/server/shared/Packets/ByteBuffer.h @@ -147,14 +147,14 @@ class ByteBuffer ByteBuffer &operator<<(const std::string &value) { - append((uint8 const* )value.c_str(), value.length()); + append((uint8 const*)value.c_str(), value.length()); append((uint8)0); return *this; } ByteBuffer &operator<<(const char *str) { - append((uint8 const* )str, str ? strlen(str) : 0); + append((uint8 const*)str, str ? strlen(str) : 0); append((uint8)0); return *this; } @@ -270,7 +270,7 @@ class ByteBuffer void read_skip(size_t skip) { - if(_rpos + skip > size()) + if (_rpos + skip > size()) throw ByteBufferException(false, _rpos, skip, size()); _rpos += skip; } @@ -284,7 +284,7 @@ class ByteBuffer template <typename T> T read(size_t pos) const { - if(pos + sizeof(T) > size()) + if (pos + sizeof(T) > size()) throw ByteBufferException(false, pos, sizeof(T), size()); T val = *((T const*)&_storage[pos]); EndianConvert(val); @@ -293,7 +293,7 @@ class ByteBuffer void read(uint8 *dest, size_t len) { - if(_rpos + len > size()) + if (_rpos + len > size()) throw ByteBufferException(false, _rpos, len, size()); memcpy(dest, &_storage[_rpos], len); _rpos += len; @@ -301,7 +301,7 @@ class ByteBuffer void readPackGUID(uint64& guid) { - if(rpos() + 1 > size()) + if (rpos() + 1 > size()) throw ByteBufferException(false, _rpos, 1, size()); guid = 0; @@ -311,9 +311,9 @@ class ByteBuffer for (int i = 0; i < 8; ++i) { - if(guidmark & (uint8(1) << i)) + if (guidmark & (uint8(1) << i)) { - if(rpos() + 1 > size()) + if (rpos() + 1 > size()) throw ByteBufferException(false, _rpos, 1, size()); uint8 bit; @@ -371,7 +371,7 @@ class ByteBuffer void append(const ByteBuffer& buffer) { - if(buffer.wpos()) + if (buffer.wpos()) append(buffer.contents(), buffer.wpos()); } @@ -390,9 +390,9 @@ class ByteBuffer uint8 packGUID[8+1]; packGUID[0] = 0; size_t size = 1; - for(uint8 i = 0;guid != 0;++i) + for (uint8 i = 0;guid != 0;++i) { - if(guid & 0xFF) + if (guid & 0xFF) { packGUID[0] |= uint8(1 << i); packGUID[size] = uint8(guid & 0xFF); @@ -406,14 +406,14 @@ class ByteBuffer void put(size_t pos, const uint8 *src, size_t cnt) { - if(pos + cnt > size()) + if (pos + cnt > size()) throw ByteBufferException(true, pos, cnt, size()); memcpy(&_storage[pos], src, cnt); } void print_storage() const { - if(!sLog->IsOutDebug()) // optimize disabled debug output + if (!sLog->IsOutDebug()) // optimize disabled debug output return; sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE_SIZE: %lu", (unsigned long)size() ); @@ -424,7 +424,7 @@ class ByteBuffer void textlike() const { - if(!sLog->IsOutDebug()) // optimize disabled debug output + if (!sLog->IsOutDebug()) // optimize disabled debug output return; sLog->outDebug(LOG_FILTER_NETWORKIO, "STORAGE_SIZE: %lu", (unsigned long)size() ); @@ -435,7 +435,7 @@ class ByteBuffer void hexlike() const { - if(!sLog->IsOutDebug()) // optimize disabled debug output + if (!sLog->IsOutDebug()) // optimize disabled debug output return; uint32 j = 1, k = 1; @@ -510,7 +510,7 @@ inline ByteBuffer &operator>>(ByteBuffer &b, std::vector<T> &v) uint32 vsize; b >> vsize; v.clear(); - while(vsize--) + while (vsize--) { T t; b >> t; @@ -536,7 +536,7 @@ inline ByteBuffer &operator>>(ByteBuffer &b, std::list<T> &v) uint32 vsize; b >> vsize; v.clear(); - while(vsize--) + while (vsize--) { T t; b >> t; @@ -562,7 +562,7 @@ inline ByteBuffer &operator>>(ByteBuffer &b, std::map<K, V> &m) uint32 msize; b >> msize; m.clear(); - while(msize--) + while (msize--) { K k; V v; |
