login about faq

Looking through the CkByteData API documentation, I've noticed what might seem like some redundant functionality:

const unsigned char *CkByteData_getBytes(HCkByteData cHandle);

Returns a pointer to the bytes contained within the object. Be very careful with the pointer that is returned. If more data is appended to the object, an internal reallocation may occur such that the previously returned pointer is no longer valid.

const unsigned char *CkByteData_getData(HCkByteData cHandle);

Returns a pointer to the internal buffer. Be careful with this method because if additional data is appended, the data within the object may be relocated and the pointer may cease to be valid.


BOOL CkByteData_preAllocate(HCkByteData cHandle, unsigned long expectedNumBytes);

This method can be called to help optimize internal memory re-allocation. If, for example, many calls will be made to append data, and the total size is approximately known, then this method can be called to pre-allocate the internal buffer to the expected total size.

void CkByteData_ensureBuffer(HCkByteData cHandle, unsigned long expectedNumBytes);

This method can be called to help optimize internal memory re-allocation. If, for example, many calls will be made to append data, and the total size is approximately known, then this method can be called to pre-allocate the internal buffer to the expected total size.

Are there any differences between these pairs of functions?

Also, is there a way to copy one HCkByteData object to another?

asked Nov 03 '15 at 04:53

malin's gravatar image

malin
73


There's no difference between the functions. I'll mark one of each as deprecated..

link

answered Nov 03 '15 at 18:27

chilkat's gravatar image

chilkat ♦♦
11.8k316358420

Thanks! And is there any function to make a deep copy of a HCkByteData object?

(Nov 04 '15 at 03:40) malin
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or __italic__
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×6

Asked: Nov 03 '15 at 04:53

Seen: 532 times

Last updated: Nov 04 '15 at 03:40

powered by OSQA