src/hb-blob.cc

Branch


Log

Author Commit Date CI Message
Behdad Esfahbod b12acba4 2024-10-12T19:29:02 [face] Add hb_face_create_from_file_or_fail() New API: + hb_face_create_from_file_or_fail()
utelle 0d9f4979 2023-12-04T21:25:02 Adjust function hb_blob_create_from_file_or_fail On Windows the filename will be interpreted as UTF-8. If the filename is NOT valid UTF-8, it will be interpreted according to the system codepage.
Pedro J. Estébanez b1680e91 2023-02-10T14:14:43 Use proper preprocessor checks for UWP
Behdad Esfahbod 59c45f6d 2022-11-22T12:54:50 Use hb_memcpy instead of memcpy consistently
Behdad Esfahbod 1945b400 2022-07-25T10:45:55 [cpluscplus] Wrap hb-subset types as well Also changes signature of get_user_data of hb.h types to take const object. This is safe.
Behdad Esfahbod 60a9175f 2022-07-20T15:59:46 [blob] Remove fini_shallow()
Khaled Hosny 98e90cc6 2022-06-30T08:43:57 [docs] Reduce warnings Use markdown syntax for inline code blocks instead of %true, %false, and %NULL.
Matthias Clasen e72506d0 2022-06-27T07:41:13 Fix the annotation for hb_blob_get_data This function will return NULL for the the empty blob. That is important information for bindings that treat nullability as a type trait.
Behdad Esfahbod d11455f2 2022-05-30T06:59:03 [blob] Fix strncpy() use in Mac resource opening code Fixes https://github.com/harfbuzz/harfbuzz/issues/3616
Khaled Hosny 88bb746b 2022-04-01T02:18:37 [blob] Return nullptr from create_from_file_or_fail Fix a couple of cases where it would return empty blob, possibly missed in bdfed8f113431a2156e13d59a4b21e19feb7efd9.
Khaled Hosny 63e15eac 2021-07-08T22:46:33 2.8.2
Behdad Esfahbod 2337f0d0 2021-07-08T10:58:50 Internally use hb_malloc/.../hb_free instead of malloc/.../free Redefining those stock names as macros was conflicting with gcc 10 headers. Fixes https://github.com/harfbuzz/harfbuzz/issues/3044
Behdad Esfahbod cc9bb294 2021-06-20T18:47:03 [blob] Fix-up recent mistake in hb_blob_create() destroy(user_data) https://github.com/harfbuzz/harfbuzz/pull/3026#discussion_r653437491
Behdad Esfahbod bdfed8f1 2021-06-14T15:46:04 [blob] Add failing versions of create API Fixes https://github.com/harfbuzz/harfbuzz/issues/2567 New API: +hb_blob_create_or_fail() +hb_blob_create_from_file_or_fail() Use these in util/ to distinguish empty file from not-found file. Only err on the latter.
Behdad Esfahbod 7cb22ba7 2021-03-01T12:44:06 Include C headers with their C++ names (#2882) Remove unnecessary includes. Fixes build with some known broken SDKs (Nintendo Switch?) https://en.cppreference.com/w/cpp/header Fixes https://github.com/harfbuzz/harfbuzz/pull/2881
Behdad Esfahbod 82928d9c 2020-06-28T22:03:57 m[blob] Move immutable check to C API boundary Similarly to 08ed9e3f779253e3b5f01c38d44d0e5db2d5e7aa
Behdad Esfahbod 4020c6b2 2020-06-28T21:59:46 m[blob] An empty blob can always be made writable
Khaled Hosny 9936490c 2020-12-31T00:19:29 [docs] Invalid use of "optional" annotation It is valid only for out and inout parameters. Fixes https://github.com/harfbuzz/harfbuzz/issues/1787
Khaled Hosny c9c3b3c9 2020-12-30T23:09:59 [docs] Use correct syntax
Khaled Hosny a8e72ee7 2020-12-30T23:08:40 [docs] Use %true and %false consistently
Khaled Hosny 22468c8a 2020-12-24T22:38:06 [docs] Give destroy callbacks have (optional) annotation
Khaled Hosny 9af0edd9 2020-12-24T21:40:41 [docs] Document return value of hb_blob_get_data()
Khaled Hosny f88e845f 2020-12-24T21:28:37 [docs] Minor fixes
Nathan Willis d13b7eaa 2019-04-21T20:31:31 [docs] Add gtkdoc comments to hb-blob
Hugo Beauzée-Luyssen 40ec187d 2020-04-24T14:01:07 win32: Cleanup PARTITION handling Use the WINAPI_PARTITION macro to filter desktop/app flavors. We use a negated desktop check because the default (for mingw-w64 at least) is to allow all API by combining desktop + app partitions. This causes build failures if we were to filter using WINAPI_PARTITION(WINAPI_FAMILY_APP) because it would always be true, but those API also require Windows 8 or later, while we only require Vista Fixes warnings like ../src/hb-blob.cc:572:47: warning: 'WINAPI_FAMILY_PC_APP' is not defined, evaluates to 0 [-Wundef] #if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP) ^ ../src/hb-blob.cc:572:86: warning: 'WINAPI_FAMILY_PHONE_APP' is not defined, evaluates to 0 [-Wundef] #if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_PC_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
Khaled Hosny b169a52c 2020-05-11T14:35:11 [blob] Fix build when HAVE_MMAP is not defined
Ebrahim Byagowi 9fc774ab 2020-04-30T23:14:54 minor spacing
Khaled Hosny 09b9d63e 2020-04-30T18:51:46 [blob] Try to support resource fork fonts on macOS If the size of opened file is zero, try opening resource fork by appending "/..namedfork/rsrc" to the file name. This is guarded with __APPLE__ ifdef and uses _PATH_RSRCFORKSPEC macro from sys/paths.h. Defining HB_NO_RESOURCE_FORK will disable this fallback. Fixes https://github.com/harfbuzz/harfbuzz/issues/2383
Ebrahim Byagowi a22e6de0 2020-04-28T19:25:37 [blob] close file reader handle fortunately it isn't in that use as having mmap reader as the default
Ebrahim Byagowi 2be859d2 2020-04-20T23:48:23 minor, replace nullptr checks with implicit ones
Ebrahim Byagowi 2dda6dd7 2020-04-20T14:12:45 minor, tweak spacing turn 8 spaces to tab, add space before Null/Crap
Ebrahim Byagowi 8ed27757 2020-01-06T19:01:13 Remove _POSIX_C_SOURCE definition from the project Added fpr suncc support but apparently is causing more issues even on suncc so let's see if we can go without it. Fixes #2084
Ebrahim Byagowi 412d6cac 2019-09-16T13:50:11 Extract an avoid errno compile flag
Ebrahim Byagowi a0b4ac4d 2019-08-24T17:57:14 Turn 8 spaces to tab across the project According to the current code style of the project
Ebrahim Byagowi 12cec6c1 2019-06-21T22:39:42 Don't define hb_blob_create_from_file if HB_NO_OPEN is defined
Behdad Esfahbod 0c5da57d 2019-06-10T14:06:25 Fix typo :)
Ebrahim Byagowi b4a5a69a 2019-06-11T01:33:09 Add HB_NO_OEPN (#1767)
Ebrahim Byagowi e66eb21a 2019-05-18T07:44:48 Don't set _POSIX_C_SOURCE in NetBSD According to a harfbuzz package patch on NetBSD project https://github.com/NetBSD/pkgsrc/blob/trunk/fonts/harfbuzz/patches/patch-src_hb-blob.cc
Behdad Esfahbod 41248cce 2019-05-07T20:54:31 Remove MIN/MAX in favor of hb_min/hb_max
Maks Naumov 4c19aa26 2019-04-05T21:46:27 Fix MSVC C4068 warning (#1656)
Behdad Esfahbod 8874eef8 2019-01-17T15:04:44 Add pragram GCC diagnostic ignored "-Wunused-macros"
Behdad Esfahbod 9f6172d6 2019-01-14T20:45:31 Move _POSIX_SOURCE definition Fixes https://github.com/harfbuzz/harfbuzz/issues/1308
Ebrahim Byagowi e4120085 2018-12-17T21:31:01 Remove redundant void from C++ sources (#1486)
Ken Brown eee5b5ed 2018-11-12T21:05:39 Don't use Win32 API on Cygwin Cygwin is a Posix platform to the extent possible. It should use the Posix API except in special circumstances.
Behdad Esfahbod 34185ff3 2018-11-11T00:12:30 [blob] Use default null object
Behdad Esfahbod 2ee1d9f5 2018-11-11T00:11:28 [blob] Change null object memory mode to DUPLICATE We never rely on that being equal to readonly. Just not being writable. Maybe not even that given that the object is inert. In prep for next commit, using default null pool.
Behdad Esfahbod da408fce 2018-11-03T15:49:37 [blob] Allow null parent in create_sub_blob() Like font and unicode.
Behdad Esfahbod 5570c87f 2018-11-03T14:51:38 Port objects to use header.writable instead of immutable Saves 4 or 8 bytes per object on 64bit archs.
Behdad Esfahbod cf5fa57f 2018-10-27T04:50:38 [docs] Change section titles again I think I like the uniform "hb-*" more.
Behdad Esfahbod 5dd86aa3 2018-10-27T04:28:40 [docs] Rename section titles to object names More useful.
Behdad Esfahbod 00cf4e5e 2018-10-27T04:07:33 [docs] Fill in some sections
Khaled Hosny 30cbe615 2018-10-19T22:04:56 Use O_BINARY instead of _O_BINARY Cygwin does not seem to have the later
Behdad Esfahbod 6e07076f 2018-10-14T22:22:45 [blob] Fix UBSan error
Behdad Esfahbod 3f08750f 2018-09-30T18:23:34 Move _POSIX_SOURCE to hb.hh
Behdad Esfahbod 90a0f9fa 2018-09-26T15:03:07 Make TSan happy with make_immutable()
Matt Oliver 24dd6c1a 2018-09-23T18:08:30 src/hb-blob.cc: Fix mmap functionality with UWP.
Behdad Esfahbod c77ae408 2018-08-25T22:36:36 Rename hb-*private.hh to hb-*.hh Sorry for the noise, downstream custom builders. Please adjust.
Behdad Esfahbod 3506672c 2018-08-06T06:17:48 Port _nil objects to Null() machinery Finally, unified!
Behdad Esfahbod be458eb0 2018-07-10T14:41:04 Include more basic internal headers from hb-private.hh
Ebrahim Byagowi d8a7dedc 2018-07-04T15:33:39 Use CreateFileW explicitly and pass wchar_t to it (#1087)
Behdad Esfahbod 2cb075fe 2018-07-03T13:04:05 Fix unused function '_hb_mapped_file_destroy' if no mmap
Ebrahim Byagowi 5d8cafcf 2018-07-01T01:54:14 Improve nommap naming and use C style comments on create_from_file (#1084)
Ebrahim Byagowi 25970a93 2018-06-28T14:32:36 armcc compatibility, don't use EINTR if doesn't exist Fixes #1081
Ebrahim Byagowi 8a51f91b 2018-06-28T13:22:21 Minor on hb_blob_create_from_file, reuse ferror result Oops
Ebrahim Byagowi 7b4099f3 2018-06-27T16:54:44 Minor, rename blob to data on blob_from_file
Ebrahim Byagowi fa090ed4 2018-06-27T14:13:26 Minor touches on hb_blob_create_from_file (#1079) * Handle EINTR on fallback reader * Increase fallback reader limitation size limitation to 2 << 28 * Ensure _O_BINARY does exist if MMAP is used on Windows (maybe superfluous but makes me more confident)
Ebrahim Byagowi 7db2e9ea 2018-06-26T10:46:10 Minor on hb_blob_create_from_file Add one more "unlikely" annotation and use explicit nullptr check for more consistency.
Ebrahim Byagowi 35ce8f31 2018-06-25T22:23:43 Unify our pipe reader with the fallback reader (#1068) And assign one bot to use the path always using NOMMAPFILEREADER token. It's limited to 200mb so no more fun with using /dev/zero on hb-view!
Ebrahim Byagowi 941f2b85 2018-06-18T20:35:40 Support pipe and friends on hb_blob_create_from_file (#1061) With this hb-view/hb-shape support pipes and possibly socket and named pipe also, anything fails just on mmap. We can later do the same for Windows also. This however reveals two issues, the fact most of our bots don't have HAVE_MMAP and using this instead the other fread/fopen reader can make failure on CI. I should look at them separately this change however is very low risk I believe.
Behdad Esfahbod df01f3e5 2018-06-05T15:17:39 1.7.7
Ebrahim Byagowi 65c82179 2018-05-26T23:50:10 [blob] Use MAP_NORESERVE if available (#1039) MAP_NORESERVE is not available on macOS for example so set the flag to zero if not defined on the headers.
Ebrahim Byagowi 8eb53b85 2018-05-11T22:44:44 Minor, make CreateFile compatible with the disabled writable flag "writable" is not in use and probably we can go in the reverse direction and remove the flags that are useful for enabled writable, this is just for the sake of completeness however.
Ebrahim Byagowi 33eb1bd2 2018-05-11T14:36:41 Remove unnecessary headers and definitions of hb-blob (#1028) It removes io.h and other polyfills which we no longer need as 7e76d74
Ebrahim Byagowi 7e76d746 2018-05-11T13:40:33 Make hb_blob_create_from_file more portable (#1027) This makes it compatible with ARMCC which I had access in a collaboration with @imgtec, thanks! Basically hb_blob_create_from_file features three code paths, mmap, Win32 and fallback. We had fallback implementation even before this but it was relied to "open" which is not available on some environments. This change improved the situtation by using only fopen and friends for fallback path. Interestingly we could use "open" on Windows but in fact it was emulated by MSVCRT so I've completely split that from Unix path now that we have a distinct path for fallback path also.
Behdad Esfahbod 90baf721 2018-05-03T22:14:54 Move some blob functions to methods
Behdad Esfahbod 5c64d614 2018-05-03T21:10:57 Add hb-blob-private.hh Towards making blob more memory-allocation-friendly
Ebrahim Byagowi 5ad87a93 2018-04-25T16:44:04 Minor, improve file reading failing condition comment https://bugzilla.gnome.org/show_bug.cgi?id=659212 for more context
Ebrahim Byagowi 8100380d 2018-04-22T10:58:37 Minor, fix calloc call order
Ebrahim Byagowi ce17340b 2018-04-20T10:29:06 Add hb_blob_create_from_file, a new API (#926)
Behdad Esfahbod a989f3ed 2018-02-13T22:12:36 Add hb_blob_copy_writable_or_fail() New API: - hb_blob_copy_writable_or_fail()
Bruce Mitchener 90218fa9 2018-01-31T20:44:45 Fix typos.
Ting-Wei Lan e3a15d0c 2018-01-12T15:33:16 Update _POSIX_C_SOURCE to the latest version Defining _POSIX_C_SOURCE to an old version on FreeBSD can cause C99 to be disabled in libc.
Behdad Esfahbod 40ec3bbb 2017-11-03T16:57:30 Consolidate debug stuff into hb-debug.hh Part of fixing https://github.com/behdad/harfbuzz/pull/605
Behdad Esfahbod dbdbfe3d 2017-10-15T12:11:08 Use nullptr instead of NULL
Behdad Esfahbod e1b6d923 2017-10-11T15:51:31 Remove cast of functions to (hb_destroy_func_t) Fixes https://github.com/behdad/harfbuzz/issues/474
Behdad Esfahbod 568a0c60 2016-02-18T19:31:51 Remove pointless overflow check in pointer math Fixes https://github.com/behdad/harfbuzz/issues/227
Behdad Esfahbod b8811429 2015-09-03T15:53:22 Fix Since tags Fixes https://github.com/behdad/harfbuzz/issues/103
Behdad Esfahbod 2cd53235 2015-01-06T19:16:38 [bindings] Use hb_glib_blob_create() in sample hb_blob_create() is considered C-only API.
Behdad Esfahbod b91904a4 2015-01-06T15:43:14 [bindings] Replace deprecated allow-none with optional and nullable
Behdad Esfahbod b632e799 2015-01-06T14:05:26 Fix up gobject-introspection a bit Minimal shaping works now!
Behdad Esfahbod 7d5e7613 2014-12-18T18:22:21 Fail blob creation if length overflows or is too large Fail if blob start plus length overflows; or if blob length is greater than 2GB. It takes a while for fonts to get to that size. In the mean time, it protects against bugs like this: http://www.icu-project.org/trac/ticket/11450 Also avoids some weird issues with 32bit vs 64bit systems as we accept length as unsigned int. As such, a length of -1 will cause overflow on 32bit machines, but happily accepted on a 64bit machine. Avoid that.
Behdad Esfahbod 73f7f891 2014-07-09T17:17:18 Define _POSIX_C_SOURCE only if it is not defined Fixes https://github.com/behdad/harfbuzz/pull/45
Behdad Esfahbod 2a8c49ad 2013-12-11T20:22:28 Remove unnecessary includes
Behdad Esfahbod a8949df4 2013-09-13T20:23:51 [introspection] Annotate Unicode / font callbacks Should move these out of the public header... We're "clean" of introspection warnings now. Remaining ones are about graphite2 / freetype types not being introspectable.
Behdad Esfahbod dfdbe7f9 2013-09-12T20:52:20 [introspection] Make hb_blob_create() introspectable
Behdad Esfahbod 085d4291 2013-09-12T17:14:33 [introspection] Disable constructors for now Since our types are not associated with their methods, marking constructors makes them inaccessible from bindings. Undo for now.
Behdad Esfahbod 288f2899 2013-09-06T15:40:22 [docs/introspection] More annotations
Behdad Esfahbod 5f512017 2013-09-04T18:28:39 [docs] Document a few symbols
Behdad Esfahbod c3ba49b6 2013-02-25T17:06:35 Always create sub-blobs in MEMORY_MODE_READONLY This fixes a design bug with sanitize and sub-blobs that can cause crashes. Jonathan and I found and debugged this issue when we tested a corrupt font with the md5sum / filename: ea395483d37af0cb933f40689ff7b60a. Two hours of intense debugging we found out that the font has overlapping GSUB/GPOS tables, and as such, sanitizing the second table can modify the first one, which can cause all kinds of undefined behavior. The correct way to fix this is to make sure sub-blobs are always created readonly, since we consider the parent blob to be a shared resource and can't modify it, even if it *is* writable. This essentially makes the READONLY_MAY_MAKE_WRITABLE mode unused... Maybe we should simply remove / deprecate it.
Behdad Esfahbod 52c8d122 2013-01-14T13:51:46 Minor