| 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. |
| 11 * | 11 * |
| 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR | 12 * IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE TO ANY PARTY FOR |
| 13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES | 13 * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES |
| 14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN | 14 * ARISING OUT OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN |
| 15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH | 15 * IF THE COPYRIGHT HOLDER HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH |
| 16 * DAMAGE. | 16 * DAMAGE. |
| 17 * | 17 * |
| 18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, | 18 * THE COPYRIGHT HOLDER SPECIFICALLY DISCLAIMS ANY WARRANTIES, INCLUDING, |
| 19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND | 19 * BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND |
| 20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS | 20 * FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS |
| 21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO | 21 * ON AN "AS IS" BASIS, AND THE COPYRIGHT HOLDER HAS NO OBLIGATION TO |
| 22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. | 22 * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS. |
| 23 * | 23 * |
| 24 * Red Hat Author(s): Behdad Esfahbod | 24 * Red Hat Author(s): Behdad Esfahbod |
| 25 */ | 25 */ |
| 26 | 26 |
| 27 /* http://www.oracle.com/technetwork/articles/servers-storage-dev/standardheader
files-453865.html */ |
| 28 #define _POSIX_C_SOURCE 199309L |
| 29 |
| 27 #include "hb-private.hh" | 30 #include "hb-private.hh" |
| 28 | 31 |
| 29 #include "hb-blob.h" | 32 #include "hb-blob.h" |
| 30 #include "hb-object-private.hh" | 33 #include "hb-object-private.hh" |
| 31 | 34 |
| 32 #ifdef HAVE_SYS_MMAN_H | 35 #ifdef HAVE_SYS_MMAN_H |
| 33 #ifdef HAVE_UNISTD_H | 36 #ifdef HAVE_UNISTD_H |
| 34 #include <unistd.h> | 37 #include <unistd.h> |
| 35 #endif /* HAVE_UNISTD_H */ | 38 #endif /* HAVE_UNISTD_H */ |
| 36 #include <sys/mman.h> | 39 #include <sys/mman.h> |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 { | 116 { |
| 114 hb_blob_t *blob; | 117 hb_blob_t *blob; |
| 115 | 118 |
| 116 if (!length || offset >= parent->length) | 119 if (!length || offset >= parent->length) |
| 117 return hb_blob_get_empty (); | 120 return hb_blob_get_empty (); |
| 118 | 121 |
| 119 hb_blob_make_immutable (parent); | 122 hb_blob_make_immutable (parent); |
| 120 | 123 |
| 121 blob = hb_blob_create (parent->data + offset, | 124 blob = hb_blob_create (parent->data + offset, |
| 122 MIN (length, parent->length - offset), | 125 MIN (length, parent->length - offset), |
| 123 » » » parent->mode, | 126 » » » HB_MEMORY_MODE_READONLY, |
| 124 hb_blob_reference (parent), | 127 hb_blob_reference (parent), |
| 125 (hb_destroy_func_t) hb_blob_destroy); | 128 (hb_destroy_func_t) hb_blob_destroy); |
| 126 | 129 |
| 127 return blob; | 130 return blob; |
| 128 } | 131 } |
| 129 | 132 |
| 130 hb_blob_t * | 133 hb_blob_t * |
| 131 hb_blob_get_empty (void) | 134 hb_blob_get_empty (void) |
| 132 { | 135 { |
| 133 static const hb_blob_t _hb_blob_nil = { | 136 static const hb_blob_t _hb_blob_nil = { |
| (...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 316 _hb_blob_destroy_user_data (blob); | 319 _hb_blob_destroy_user_data (blob); |
| 317 blob->mode = HB_MEMORY_MODE_WRITABLE; | 320 blob->mode = HB_MEMORY_MODE_WRITABLE; |
| 318 blob->data = new_data; | 321 blob->data = new_data; |
| 319 blob->user_data = new_data; | 322 blob->user_data = new_data; |
| 320 blob->destroy = free; | 323 blob->destroy = free; |
| 321 | 324 |
| 322 return true; | 325 return true; |
| 323 } | 326 } |
| 324 | 327 |
| 325 | 328 |
| OLD | NEW |