mirror of
https://github.com/freetype/freetype.git
synced 2026-11-30 16:48:29 +01:00
[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:
@@ -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
@@ -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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user