SHARE
TWEET

Untitled

a guest Apr 23rd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. int osc_bundle_add_message(struct osc_bundle *bundle, const struct osc_message *msg)
  2. {
  3.  
  4.     size_t length_of_bundle = *(int32_t *) bundle->raw_data;
  5.     size_t length_of_message = *(int32_t *) msg->raw_data;
  6.  
  7.     void *re_pointer = realloc(bundle->raw_data, length_of_bundle + 4 + length_of_message + 4);
  8.    
  9.     if (!re_pointer)
  10.     {
  11.         return 1;
  12.     }
  13.  
  14.     bundle->raw_data = re_pointer;
  15.  
  16.     void *t_pointer = ((char *) bundle->raw_data + 12);
  17.     bundle->timetag = (struct osc_timetag *) t_pointer;
  18.  
  19.     void *pointer = (char *) bundle->raw_data + length_of_bundle + 4;
  20.    
  21.     memcpy(pointer, msg->raw_data, length_of_message + 4);
  22.  
  23.     *(int32_t *) bundle->raw_data = length_of_bundle + length_of_message + 4;
  24.  
  25.     return 0;
  26. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top