diff options
author | frosch <frosch@openttd.org> | 2010-02-14 18:33:57 +0000 |
---|---|---|
committer | frosch <frosch@openttd.org> | 2010-02-14 18:33:57 +0000 |
commit | 30b215a82b8a7272d28898df83b70e254cd04c6d (patch) | |
tree | 1299697ec19e1b013d301cf9a252b623bcba3cb7 /src/misc/blob.hpp | |
parent | d0122644afc79b163c3727fa3d382fd6c7cdc774 (diff) | |
download | openttd-30b215a82b8a7272d28898df83b70e254cd04c6d.tar.xz |
(svn r19134) -Fix (r16983, r17219): YAPF debug output was quite broken.
Diffstat (limited to 'src/misc/blob.hpp')
-rw-r--r-- | src/misc/blob.hpp | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/misc/blob.hpp b/src/misc/blob.hpp index d475231b6..e2e130d61 100644 --- a/src/misc/blob.hpp +++ b/src/misc/blob.hpp @@ -64,8 +64,12 @@ protected: } ptr_u; private: - /** Just to silence an unsilencable GCC 4.4+ warning */ - static const CHdr hdrEmpty[]; + /** + * Just to silence an unsilencable GCC 4.4+ warning + * Note: This cannot be 'const' as we do a lot of 'hdrEmpty[0]->m_size += 0;' and 'hdrEmpty[0]->m_max_size += 0;' + * after const_casting. + */ + static CHdr hdrEmpty[]; public: static const bsize_t Ttail_reserve = 4; ///< four extra bytes will be always allocated and zeroed at the end @@ -117,13 +121,13 @@ protected: /** blob header accessor - use it rather than using the pointer arithmetics directly - non-const version */ FORCEINLINE CHdr& Hdr() { - return ptr_u.m_pHdr_1[-1]; + return *(ptr_u.m_pHdr_1 - 1); } /** blob header accessor - use it rather than using the pointer arithmetics directly - const version */ FORCEINLINE const CHdr& Hdr() const { - return ptr_u.m_pHdr_1[-1]; + return *(ptr_u.m_pHdr_1 - 1); } /** return reference to the actual blob size - used when the size needs to be modified */ |