OLD | NEW |
1 /* | 1 /* |
2 * Copyright © 2009 Red Hat, Inc. | 2 * Copyright © 2009 Red Hat, Inc. |
3 * | 3 * |
4 * This is part of HarfBuzz, a text shaping library. | 4 * This is part of HarfBuzz, a text shaping library. |
5 * | 5 * |
6 * Permission is hereby granted, without written agreement and without | 6 * Permission is hereby granted, without written agreement and without |
7 * license or royalty fees, to use, copy, modify, and distribute this | 7 * license or royalty fees, to use, copy, modify, and distribute this |
8 * software and its documentation for any purpose, provided that the | 8 * software and its documentation for any purpose, provided that the |
9 * above copyright notice and the following two paragraphs appear in | 9 * above copyright notice and the following two paragraphs appear in |
10 * all copies of this software. | 10 * all copies of this software. |
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
294 if (blob->mode == HB_MEMORY_MODE_WRITABLE) | 294 if (blob->mode == HB_MEMORY_MODE_WRITABLE) |
295 return TRUE; | 295 return TRUE; |
296 | 296 |
297 if (blob->mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE && _try_writable_i
nplace (blob)) | 297 if (blob->mode == HB_MEMORY_MODE_READONLY_MAY_MAKE_WRITABLE && _try_writable_i
nplace (blob)) |
298 return TRUE; | 298 return TRUE; |
299 | 299 |
300 if (blob->mode == HB_MEMORY_MODE_WRITABLE) | 300 if (blob->mode == HB_MEMORY_MODE_WRITABLE) |
301 return TRUE; | 301 return TRUE; |
302 | 302 |
303 | 303 |
304 DEBUG_MSG_FUNC (BLOB, blob, "currect data is -> %p\n", blob->data); | 304 DEBUG_MSG_FUNC (BLOB, blob, "current data is -> %p\n", blob->data); |
305 | 305 |
306 char *new_data; | 306 char *new_data; |
307 | 307 |
308 new_data = (char *) malloc (blob->length); | 308 new_data = (char *) malloc (blob->length); |
309 if (unlikely (!new_data)) | 309 if (unlikely (!new_data)) |
310 return FALSE; | 310 return FALSE; |
311 | 311 |
312 DEBUG_MSG_FUNC (BLOB, blob, "dupped successfully -> %p\n", blob->data); | 312 DEBUG_MSG_FUNC (BLOB, blob, "dupped successfully -> %p\n", blob->data); |
313 | 313 |
314 memcpy (new_data, blob->data, blob->length); | 314 memcpy (new_data, blob->data, blob->length); |
315 _hb_blob_destroy_user_data (blob); | 315 _hb_blob_destroy_user_data (blob); |
316 blob->mode = HB_MEMORY_MODE_WRITABLE; | 316 blob->mode = HB_MEMORY_MODE_WRITABLE; |
317 blob->data = new_data; | 317 blob->data = new_data; |
318 blob->user_data = new_data; | 318 blob->user_data = new_data; |
319 blob->destroy = free; | 319 blob->destroy = free; |
320 | 320 |
321 return TRUE; | 321 return TRUE; |
322 } | 322 } |
323 | 323 |
324 | 324 |
OLD | NEW |