mirror of https://github.com/OpenTTD/OpenTTD
(svn r19134) -Fix (r16983, r17219): YAPF debug output was quite broken.
parent
d0122644af
commit
30b215a82b
|
@ -64,8 +64,12 @@ protected:
|
||||||
} ptr_u;
|
} ptr_u;
|
||||||
|
|
||||||
private:
|
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:
|
public:
|
||||||
static const bsize_t Ttail_reserve = 4; ///< four extra bytes will be always allocated and zeroed at the end
|
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 */
|
/** blob header accessor - use it rather than using the pointer arithmetics directly - non-const version */
|
||||||
FORCEINLINE CHdr& Hdr()
|
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 */
|
/** blob header accessor - use it rather than using the pointer arithmetics directly - const version */
|
||||||
FORCEINLINE const CHdr& Hdr() const
|
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 */
|
/** return reference to the actual blob size - used when the size needs to be modified */
|
||||||
|
|
|
@ -109,7 +109,9 @@ bool DumpTarget::FindKnownName(size_t type_id, const void *ptr, CStrA &name)
|
||||||
void DumpTarget::WriteIndent()
|
void DumpTarget::WriteIndent()
|
||||||
{
|
{
|
||||||
int num_spaces = 2 * m_indent;
|
int num_spaces = 2 * m_indent;
|
||||||
memset(m_out.GrowSizeNC(num_spaces), ' ', num_spaces);
|
if (num_spaces > 0) {
|
||||||
|
memset(m_out.GrowSizeNC(num_spaces), ' ', num_spaces);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Write a line with indent at the beginning and <LF> at the end. */
|
/** Write a line with indent at the beginning and <LF> at the end. */
|
||||||
|
@ -175,4 +177,4 @@ void DumpTarget::EndStruct()
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Just to silence an unsilencable GCC 4.4+ warning */
|
/** Just to silence an unsilencable GCC 4.4+ warning */
|
||||||
/* static */ const CBlobBaseSimple::CHdr CBlobBaseSimple::hdrEmpty[] = {{0, 0}, {0, 0}};
|
/* static */ CBlobBaseSimple::CHdr CBlobBaseSimple::hdrEmpty[] = {{0, 0}, {0, 0}};
|
||||||
|
|
|
@ -27,6 +27,12 @@ struct CStrA : public CBlobT<char>
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Copy constructor */
|
||||||
|
FORCEINLINE CStrA(const CStrA &src) : base(src)
|
||||||
|
{
|
||||||
|
base::FixTail();
|
||||||
|
}
|
||||||
|
|
||||||
/** Take over ownership constructor */
|
/** Take over ownership constructor */
|
||||||
FORCEINLINE CStrA(const OnTransfer& ot)
|
FORCEINLINE CStrA(const OnTransfer& ot)
|
||||||
: base(ot)
|
: base(ot)
|
||||||
|
@ -50,14 +56,34 @@ struct CStrA : public CBlobT<char>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Append another CStrA. */
|
||||||
|
FORCEINLINE void Append(const CStrA &src)
|
||||||
|
{
|
||||||
|
if (src.RawSize() > 0) {
|
||||||
|
base::AppendRaw(src);
|
||||||
|
base::FixTail();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/** Assignment from C string. */
|
/** Assignment from C string. */
|
||||||
FORCEINLINE CStrA& operator = (const char *src)
|
FORCEINLINE CStrA &operator = (const char *src)
|
||||||
{
|
{
|
||||||
base::Clear();
|
base::Clear();
|
||||||
AppendStr(src);
|
AppendStr(src);
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** Assignment from another CStrA. */
|
||||||
|
FORCEINLINE CStrA &operator = (const CStrA &src)
|
||||||
|
{
|
||||||
|
if (&src != this) {
|
||||||
|
base::Clear();
|
||||||
|
base::AppendRaw(src);
|
||||||
|
base::FixTail();
|
||||||
|
}
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
/** Lower-than operator (to support stl collections) */
|
/** Lower-than operator (to support stl collections) */
|
||||||
FORCEINLINE bool operator < (const CStrA &other) const
|
FORCEINLINE bool operator < (const CStrA &other) const
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue