From: Behdad Esfahbod Date: Thu, 30 Aug 2018 01:28:39 +0000 (-0700) Subject: Shuffle X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=a23b892fe6cc4859a30edc7ffc003ab7624aa5f0;p=platform%2Fupstream%2FlibHarfBuzzSharp.git Shuffle --- diff --git a/src/hb-machinery.hh b/src/hb-machinery.hh index 35a8b6c..1e0f7cc 100644 --- a/src/hb-machinery.hh +++ b/src/hb-machinery.hh @@ -464,36 +464,6 @@ struct hb_serialize_context_t } template - inline Type *copy (void) const - { - assert (!this->ran_out_of_room); - unsigned int len = this->head - this->start; - void *p = malloc (len); - if (p) - memcpy (p, this->start, len); - return reinterpret_cast (p); - } - inline hb_bytes_t copy_bytes (void) const - { - assert (!this->ran_out_of_room); - unsigned int len = this->head - this->start; - void *p = malloc (len); - if (p) - memcpy (p, this->start, len); - else - return hb_bytes_t (); - return hb_bytes_t (p, len); - } - inline hb_blob_t *copy_blob (void) const - { - assert (!this->ran_out_of_room); - return hb_blob_create (this->start, - this->head - this->start, - HB_MEMORY_MODE_DUPLICATE, - nullptr, nullptr); - } - - template inline Type *allocate_size (unsigned int size) { if (unlikely (this->ran_out_of_room || this->end - this->head < ptrdiff_t (size))) { @@ -547,6 +517,38 @@ struct hb_serialize_context_t return reinterpret_cast (&obj); } + /* Output routines. */ + template + inline Type *copy (void) const + { + assert (!this->ran_out_of_room); + unsigned int len = this->head - this->start; + void *p = malloc (len); + if (p) + memcpy (p, this->start, len); + return reinterpret_cast (p); + } + inline hb_bytes_t copy_bytes (void) const + { + assert (!this->ran_out_of_room); + unsigned int len = this->head - this->start; + void *p = malloc (len); + if (p) + memcpy (p, this->start, len); + else + return hb_bytes_t (); + return hb_bytes_t (p, len); + } + inline hb_blob_t *copy_blob (void) const + { + assert (!this->ran_out_of_room); + return hb_blob_create (this->start, + this->head - this->start, + HB_MEMORY_MODE_DUPLICATE, + nullptr, nullptr); + } + + public: unsigned int debug_depth; char *start, *end, *head; bool ran_out_of_room;