[bytes] Rename content to arrayZ
This commit is contained in:
parent
dbb764dceb
commit
07e0ca930c
|
@ -529,18 +529,18 @@ struct hb_array_t
|
||||||
|
|
||||||
struct hb_bytes_t
|
struct hb_bytes_t
|
||||||
{
|
{
|
||||||
inline hb_bytes_t (void) : bytes (nullptr), len (0) {}
|
inline hb_bytes_t (void) : arrayZ (nullptr), len (0) {}
|
||||||
inline hb_bytes_t (const char *bytes_, unsigned int len_) : bytes (bytes_), len (len_) {}
|
inline hb_bytes_t (const char *bytes_, unsigned int len_) : arrayZ (bytes_), len (len_) {}
|
||||||
inline hb_bytes_t (const void *bytes_, unsigned int len_) : bytes ((const char *) bytes_), len (len_) {}
|
inline hb_bytes_t (const void *bytes_, unsigned int len_) : arrayZ ((const char *) bytes_), len (len_) {}
|
||||||
template <typename T>
|
template <typename T>
|
||||||
inline hb_bytes_t (const T& array) : bytes ((const char *) array.arrayZ), len (array.len) {}
|
inline hb_bytes_t (const T& array) : arrayZ ((const char *) array.arrayZ), len (array.len) {}
|
||||||
|
|
||||||
inline void free (void) { ::free ((void *) bytes); bytes = nullptr; len = 0; }
|
inline void free (void) { ::free ((void *) arrayZ); arrayZ = nullptr; len = 0; }
|
||||||
|
|
||||||
template <typename Type>
|
template <typename Type>
|
||||||
inline const Type* as (void) const
|
inline const Type* as (void) const
|
||||||
{
|
{
|
||||||
return unlikely (!bytes) ? &Null(Type) : reinterpret_cast<const Type *> (bytes);
|
return unlikely (!arrayZ) ? &Null(Type) : reinterpret_cast<const Type *> (arrayZ);
|
||||||
}
|
}
|
||||||
|
|
||||||
inline int cmp (const hb_bytes_t &a) const
|
inline int cmp (const hb_bytes_t &a) const
|
||||||
|
@ -548,7 +548,7 @@ struct hb_bytes_t
|
||||||
if (len != a.len)
|
if (len != a.len)
|
||||||
return (int) a.len - (int) len;
|
return (int) a.len - (int) len;
|
||||||
|
|
||||||
return memcmp (a.bytes, bytes, len);
|
return memcmp (a.arrayZ, arrayZ, len);
|
||||||
}
|
}
|
||||||
static inline int cmp (const void *pa, const void *pb)
|
static inline int cmp (const void *pa, const void *pb)
|
||||||
{
|
{
|
||||||
|
@ -557,7 +557,7 @@ struct hb_bytes_t
|
||||||
return b->cmp (*a);
|
return b->cmp (*a);
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *bytes;
|
const char *arrayZ;
|
||||||
unsigned int len;
|
unsigned int len;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -143,7 +143,7 @@ struct post
|
||||||
return true;
|
return true;
|
||||||
if (buf_len <= s.len) /* What to do with truncation? Returning false for now. */
|
if (buf_len <= s.len) /* What to do with truncation? Returning false for now. */
|
||||||
return false;
|
return false;
|
||||||
strncpy (buf, s.bytes, s.len);
|
strncpy (buf, s.arrayZ, s.len);
|
||||||
buf[s.len] = '\0';
|
buf[s.len] = '\0';
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue