[base] Use unsigned zero-based refcounts.

This reverts 67cf7a88 to unsigned refcounts, with conditional decrements.

* include/freetype/internal/ftobjs.c (FT_Face_InternalRec,
FT_LibraryRec): Make `refcount' unsigned.
* src/base/ftobjs.c (FT_New_Library, ft_open_face_internal): Keep it zero.
(FT_Done_Library, FT_Done_Face): ... and decrement it conditionally.
This commit is contained in:
Alexei Podtelezhnikov
2026-11-03 10:25:11 -05:00
parent 36db6edb84
commit 2045ea3920
2 changed files with 8 additions and 8 deletions
+2 -2
View File
@@ -386,7 +386,7 @@ FT_BEGIN_HEADER
FT_Char no_stem_darkening;
FT_Int32 random_seed;
FT_Int refcount;
FT_UInt refcount;
} FT_Face_InternalRec;
@@ -916,7 +916,7 @@ FT_BEGIN_HEADER
FT_Vector lcd_geometry[3]; /* RGB subpixel positions */
#endif
FT_Int refcount;
FT_UInt refcount;
} FT_LibraryRec;
+6 -6
View File
@@ -2838,8 +2838,6 @@
internal->transform_delta.x = 0;
internal->transform_delta.y = 0;
internal->refcount = 1;
internal->no_stem_darkening = -1;
}
@@ -2970,9 +2968,11 @@
error = FT_ERR( Invalid_Face_Handle );
if ( face && face->driver )
{
face->internal->refcount--;
if ( face->internal->refcount > 0 )
{
face->internal->refcount--;
error = FT_Err_Ok;
}
else
{
driver = face->driver;
@@ -5525,8 +5525,6 @@
library->version_minor = FREETYPE_MINOR;
library->version_patch = FREETYPE_PATCH;
library->refcount = 1;
/* That's ok now */
*alibrary = library;
@@ -5576,9 +5574,11 @@
if ( !library )
return FT_THROW( Invalid_Library_Handle );
library->refcount--;
if ( library->refcount > 0 )
{
library->refcount--;
goto Exit;
}
memory = library->memory;