Commit Graph

120 Commits

Author SHA1 Message Date
Behdad Esfahbod d11455f285 [blob] Fix strncpy() use in Mac resource opening code
Fixes https://github.com/harfbuzz/harfbuzz/issues/3616
2022-05-30 06:59:03 -06:00
Khaled Hosny 88bb746b42 [blob] Return nullptr from create_from_file_or_fail
Fix a couple of cases where it would return empty blob, possibly
missed in bdfed8f113.
2022-04-01 02:38:23 +02:00
Khaled Hosny 63e15eac4f 2.8.2 2021-07-08 23:02:49 +02:00
Behdad Esfahbod 2337f0d047 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
2021-07-08 10:54:09 -07:00
Behdad Esfahbod cc9bb29491 [blob] Fix-up recent mistake in hb_blob_create() destroy(user_data)
https://github.com/harfbuzz/harfbuzz/pull/3026#discussion_r653437491
2021-06-20 18:47:03 -06:00
Behdad Esfahbod bdfed8f113 [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.
2021-06-15 13:56:30 -06:00
Behdad Esfahbod 7cb22ba7eb
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
2021-03-01 11:44:06 -08:00
Behdad Esfahbod 82928d9cf6 m[blob] Move immutable check to C API boundary
Similarly to 08ed9e3f77
2021-02-19 18:40:48 -07:00
Behdad Esfahbod 4020c6b286 m[blob] An empty blob can always be made writable 2021-02-19 18:40:48 -07:00
Khaled Hosny 9936490c04 [docs] Invalid use of "optional" annotation
It is valid only for out and inout parameters.

Fixes https://github.com/harfbuzz/harfbuzz/issues/1787
2020-12-30 19:21:49 -08:00
Khaled Hosny c9c3b3c94c [docs] Use correct syntax 2020-12-30 23:28:26 +02:00
Khaled Hosny a8e72ee784 [docs] Use %true and %false consistently 2020-12-30 23:28:26 +02:00
Khaled Hosny 22468c8a90 [docs] Give destroy callbacks have (optional) annotation 2020-12-24 22:38:06 +02:00
Khaled Hosny 9af0edd951 [docs] Document return value of hb_blob_get_data() 2020-12-24 21:41:14 +02:00
Khaled Hosny f88e845fc7 [docs] Minor fixes 2020-12-24 21:34:14 +02:00
Nathan Willis d13b7eaaf1 [docs] Add gtkdoc comments to hb-blob 2020-12-24 21:34:14 +02:00
Hugo Beauzée-Luyssen 40ec187dec 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)
2020-07-01 13:05:14 +04:30
Khaled Hosny b169a52c1e [blob] Fix build when HAVE_MMAP is not defined 2020-05-11 17:21:41 +04:30
Ebrahim Byagowi 9fc774ab00 minor spacing 2020-04-30 23:14:54 +04:30
Khaled Hosny 09b9d63e56 [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
2020-04-30 22:22:10 +04:30
Ebrahim Byagowi a22e6de0e9
[blob] close file reader handle
fortunately it isn't in that use as having mmap reader as the default
2020-04-28 19:25:37 +04:30
Ebrahim Byagowi 2be859d289 minor, replace nullptr checks with implicit ones 2020-04-21 00:30:34 +04:30
Ebrahim Byagowi 2dda6dd744 minor, tweak spacing
turn 8 spaces to tab, add space before Null/Crap
2020-04-20 16:18:29 +04:30
Ebrahim Byagowi 8ed27757b1
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
2020-01-06 19:01:13 +03:30
Ebrahim Byagowi 412d6cac3a Extract an avoid errno compile flag 2019-09-17 20:58:13 +04:30
Ebrahim Byagowi a0b4ac4dce Turn 8 spaces to tab across the project
According to the current code style of the project
2019-08-27 02:40:41 +04:30
Ebrahim Byagowi 12cec6c12e
Don't define hb_blob_create_from_file if HB_NO_OPEN is defined 2019-06-21 22:39:42 +04:30
Behdad Esfahbod 0c5da57d1a Fix typo :) 2019-06-10 14:06:25 -07:00
Ebrahim Byagowi b4a5a69ad8
Add HB_NO_OEPN (#1767) 2019-06-11 01:33:09 +04:30
Ebrahim Byagowi e66eb21a46
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
2019-05-18 07:44:48 -07:00
Behdad Esfahbod 41248cce0e Remove MIN/MAX in favor of hb_min/hb_max 2019-05-07 20:54:31 -07:00
Maks Naumov 4c19aa2620 Fix MSVC C4068 warning (#1656) 2019-04-05 11:46:27 -07:00
Behdad Esfahbod 8874eef8ff Add pragram GCC diagnostic ignored "-Wunused-macros" 2019-01-17 15:04:44 -05:00
Behdad Esfahbod 9f6172d669 Move _POSIX_SOURCE definition
Fixes https://github.com/harfbuzz/harfbuzz/issues/1308
2019-01-14 20:45:31 -05:00
Ebrahim Byagowi e412008599 Remove redundant void from C++ sources (#1486) 2018-12-17 13:01:01 -05:00
Ken Brown eee5b5ed04 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.
2018-11-12 21:07:34 -05:00
Behdad Esfahbod 34185ff3bc [blob] Use default null object 2018-11-11 00:12:30 -05:00
Behdad Esfahbod 2ee1d9f555 [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.
2018-11-11 00:11:28 -05:00
Behdad Esfahbod da408fce98 [blob] Allow null parent in create_sub_blob()
Like font and unicode.
2018-11-03 15:49:37 -04:00
Behdad Esfahbod 5570c87f21 Port objects to use header.writable instead of immutable
Saves 4 or 8 bytes per object on 64bit archs.
2018-11-03 14:59:40 -04:00
Behdad Esfahbod cf5fa57f00 [docs] Change section titles again
I think I like the uniform "hb-*" more.
2018-10-27 04:51:42 -07:00
Behdad Esfahbod 5dd86aa33b [docs] Rename section titles to object names
More useful.
2018-10-27 04:47:41 -07:00
Behdad Esfahbod 00cf4e5eb6 [docs] Fill in some sections 2018-10-27 04:47:41 -07:00
Khaled Hosny 30cbe6158d Use O_BINARY instead of _O_BINARY
Cygwin does not seem to have the later
2018-10-19 22:46:40 +02:00
Behdad Esfahbod 6e07076fd0 [blob] Fix UBSan error 2018-10-14 22:22:45 -07:00
Behdad Esfahbod 3f08750fa6 Move _POSIX_SOURCE to hb.hh 2018-09-30 18:23:34 +02:00
Behdad Esfahbod 90a0f9fa0c Make TSan happy with make_immutable() 2018-09-26 15:03:07 -04:00
Matt Oliver 24dd6c1a9d src/hb-blob.cc: Fix mmap functionality with UWP. 2018-09-23 07:23:58 -07:00
Behdad Esfahbod c77ae40852 Rename hb-*private.hh to hb-*.hh
Sorry for the noise, downstream custom builders.  Please adjust.
2018-08-25 22:36:36 -07:00
Behdad Esfahbod 3506672ce9 Port _nil objects to Null() machinery
Finally, unified!
2018-08-06 06:17:48 -07:00