aboutsummaryrefslogtreecommitdiff
path: root/freetype/src/base/ftutil.c
diff options
context:
space:
mode:
Diffstat (limited to 'freetype/src/base/ftutil.c')
-rw-r--r--freetype/src/base/ftutil.c63
1 files changed, 34 insertions, 29 deletions
diff --git a/freetype/src/base/ftutil.c b/freetype/src/base/ftutil.c
index 879d02752..56e2800eb 100644
--- a/freetype/src/base/ftutil.c
+++ b/freetype/src/base/ftutil.c
@@ -245,6 +245,9 @@
FT_ListNode cur;
+ if ( !list )
+ return NULL;
+
cur = list->head;
while ( cur )
{
@@ -254,7 +257,7 @@
cur = cur->next;
}
- return (FT_ListNode)0;
+ return NULL;
}
@@ -264,8 +267,13 @@
FT_List_Add( FT_List list,
FT_ListNode node )
{
- FT_ListNode before = list->tail;
+ FT_ListNode before;
+
+
+ if ( !list || !node )
+ return;
+ before = list->tail;
node->next = 0;
node->prev = before;
@@ -285,8 +293,13 @@
FT_List_Insert( FT_List list,
FT_ListNode node )
{
- FT_ListNode after = list->head;
+ FT_ListNode after;
+
+
+ if ( !list || !node )
+ return;
+ after = list->head;
node->next = after;
node->prev = 0;
@@ -309,6 +322,9 @@
FT_ListNode before, after;
+ if ( !list || !node )
+ return;
+
before = node->prev;
after = node->next;
@@ -333,6 +349,9 @@
FT_ListNode before, after;
+ if ( !list || !node )
+ return;
+
before = node->prev;
after = node->next;
@@ -357,14 +376,19 @@
/* documentation is in ftlist.h */
FT_EXPORT_DEF( FT_Error )
- FT_List_Iterate( FT_List list,
- FT_List_Iterator iterator,
- void* user )
+ FT_List_Iterate( FT_List list,
+ FT_List_Iterator iterator,
+ void* user )
{
- FT_ListNode cur = list->head;
+ FT_ListNode cur;
FT_Error error = FT_Err_Ok;
+ if ( !list || !iterator )
+ return FT_THROW( Invalid_Argument );
+
+ cur = list->head;
+
while ( cur )
{
FT_ListNode next = cur->next;
@@ -392,6 +416,9 @@
FT_ListNode cur;
+ if ( !list || !memory )
+ return;
+
cur = list->head;
while ( cur )
{
@@ -411,26 +438,4 @@
}
- FT_BASE_DEF( FT_UInt32 )
- ft_highpow2( FT_UInt32 value )
- {
- FT_UInt32 value2;
-
-
- /*
- * We simply clear the lowest bit in each iteration. When
- * we reach 0, we know that the previous value was our result.
- */
- for ( ;; )
- {
- value2 = value & (value - 1); /* clear lowest bit */
- if ( value2 == 0 )
- break;
-
- value = value2;
- }
- return value;
- }
-
-
/* END */