summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCarsten Haitzler <raster@rasterman.com>2012-09-12 07:35:18 +0000
committerCarsten Haitzler <raster@rasterman.com>2012-09-12 07:35:18 +0000
commitbf41a5e786002f2b635921e65c63e2b1af5b3c8b (patch)
treeac77d0d345dbed0c6978eb01c9bbd92af524beb4
parent0dc3a60472401b841da66b72482dcff3e39de658 (diff)
backport eina nullcheck things.
SVN revision: 76499
-rw-r--r--AUTHORS1
-rw-r--r--ChangeLog7
-rw-r--r--NEWS5
-rw-r--r--src/include/eina_list.h4
-rw-r--r--src/include/eina_stringshare.h2
-rw-r--r--src/lib/eina_list.c2
-rw-r--r--src/lib/eina_quadtree.c2
-rw-r--r--src/lib/eina_rectangle.c3
-rw-r--r--src/lib/eina_str.c3
-rw-r--r--src/lib/eina_tiler.c11
10 files changed, 37 insertions, 3 deletions
diff --git a/AUTHORS b/AUTHORS
index ef0d3cc..7ee2d6c 100644
--- a/AUTHORS
+++ b/AUTHORS
@@ -25,3 +25,4 @@ Jonas M. Gastal <jgastal@profusion.mobi>
25Raphael Kubo da Costa <rakuco@freebsd.org> 25Raphael Kubo da Costa <rakuco@freebsd.org>
26Jérôme Pinot <ngc891@gmail.com> 26Jérôme Pinot <ngc891@gmail.com>
27Mike Blumenkrantz <michael.blumenkrantz@gmail.com> 27Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
28Patryk Kaczmarek <patryk.k@samsung.com>
diff --git a/ChangeLog b/ChangeLog
index 39662ab..fc57f4f 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -332,3 +332,10 @@
3322012-08-30 Carsten Haitzler (The Rasterman) 3322012-08-30 Carsten Haitzler (The Rasterman)
333 333
334 1.7.0 release 334 1.7.0 release
335
3362012-09-12 Patryk Kaczmarek <patryk.k@samsung.com>
337
338 * Add EINA_SAFETY checks for proper function arguments.
339 * Add check if given arguments (distance and coordinates) in eina_tiler
340 and eina_rectangle are not below zero
341 * Documentation for eina list specified and eina stringshare fixed
diff --git a/NEWS b/NEWS
index 2c364ce..a17ec50 100644
--- a/NEWS
+++ b/NEWS
@@ -7,6 +7,9 @@ Additions:
7 * Add backtrace support to Eina_Log, use EINA_LOG_BACKTRACE to enable it. 7 * Add backtrace support to Eina_Log, use EINA_LOG_BACKTRACE to enable it.
8 * Add an helper to iterate over line in a mapped file. 8 * Add an helper to iterate over line in a mapped file.
9 * Add EINA_SENTINEL to protect variadic functions 9 * Add EINA_SENTINEL to protect variadic functions
10 * Add EINA_SAFETY checks for proper function arguments.
11 * Add check if given arguments (distance and coordinates) in eina_tiler
12 and eina_rectangle are not below zero
10 13
11Fixes: 14Fixes:
12 * Add missing files in the tarball. 15 * Add missing files in the tarball.
@@ -19,6 +22,8 @@ Fixes:
19 * Implement eina_file_map_lines() on Windows. 22 * Implement eina_file_map_lines() on Windows.
20 * Handle NULL in all eina_*_free function. 23 * Handle NULL in all eina_*_free function.
21 * eina_log_console_color_set() 24 * eina_log_console_color_set()
25 * Documentation for eina list specified and eina stringshare fixed.
26 * eina_convert_atofp wrong return value if fp is NULL.
22 27
23Removal: 28Removal:
24 * configure options: --disable-posix-threads, --disable-win32-threads, 29 * configure options: --disable-posix-threads, --disable-win32-threads,
diff --git a/src/include/eina_list.h b/src/include/eina_list.h
index b78eb64..a36bd21 100644
--- a/src/include/eina_list.h
+++ b/src/include/eina_list.h
@@ -954,8 +954,8 @@ EAPI Eina_List *eina_list_merge(Eina_List *left, Eina_List *right) EI
954 * smallest one to be head of the returned list. It will continue this process 954 * smallest one to be head of the returned list. It will continue this process
955 * for all entry of both list. 955 * for all entry of both list.
956 * 956 *
957 * Both left and right do not exist anymore after the merge. 957 * Both left and right lists are not vailid anymore after the merge and should
958 * If @p func is @c NULL, it will return @c NULL. 958 * not be used. If @p func is @c NULL, it will return @c NULL.
959 * 959 *
960 * Example: 960 * Example:
961 * @code 961 * @code
diff --git a/src/include/eina_stringshare.h b/src/include/eina_stringshare.h
index 9a05bcd..21daeaf 100644
--- a/src/include/eina_stringshare.h
+++ b/src/include/eina_stringshare.h
@@ -311,7 +311,7 @@ EAPI void eina_stringshare_del(Eina_Stringshare *str);
311 * @brief Note that the given string @b must be shared. 311 * @brief Note that the given string @b must be shared.
312 * 312 *
313 * @param str the shared string to know the length. It is safe to 313 * @param str the shared string to know the length. It is safe to
314 * give @c NULL, in that case @c -1 is returned. 314 * give @c NULL, in that case @c 0 is returned.
315 * @return The length of a shared string. 315 * @return The length of a shared string.
316 * 316 *
317 * This function is a cheap way to known the length of a shared 317 * This function is a cheap way to known the length of a shared
diff --git a/src/lib/eina_list.c b/src/lib/eina_list.c
index ea5dfb9..7ef219d 100644
--- a/src/lib/eina_list.c
+++ b/src/lib/eina_list.c
@@ -1466,6 +1466,8 @@ eina_list_accessor_new(const Eina_List *list)
1466{ 1466{
1467 Eina_Accessor_List *ac; 1467 Eina_Accessor_List *ac;
1468 1468
1469 EINA_SAFETY_ON_NULL_RETURN_VAL(list, NULL);
1470
1469 eina_error_set(0); 1471 eina_error_set(0);
1470 ac = calloc(1, sizeof (Eina_Accessor_List)); 1472 ac = calloc(1, sizeof (Eina_Accessor_List));
1471 if (!ac) 1473 if (!ac)
diff --git a/src/lib/eina_quadtree.c b/src/lib/eina_quadtree.c
index f0a2dd4..e163e6f 100644
--- a/src/lib/eina_quadtree.c
+++ b/src/lib/eina_quadtree.c
@@ -875,6 +875,8 @@ eina_quadtree_increase(Eina_QuadTree_Item *object)
875{ 875{
876 size_t tmp; 876 size_t tmp;
877 877
878 EINA_MAGIC_CHECK_QUADTREE_ITEM(object);
879
878 tmp = object->quad->index++; 880 tmp = object->quad->index++;
879 if (object->index == tmp) 881 if (object->index == tmp)
880 return; 882 return;
diff --git a/src/lib/eina_rectangle.c b/src/lib/eina_rectangle.c
index cfa5ac2..85cf310 100644
--- a/src/lib/eina_rectangle.c
+++ b/src/lib/eina_rectangle.c
@@ -361,6 +361,9 @@ eina_rectangle_pool_new(int w, int h)
361{ 361{
362 Eina_Rectangle_Pool *new; 362 Eina_Rectangle_Pool *new;
363 363
364 if ((w <= 0) || (h <= 0))
365 return NULL;
366
364 new = malloc(sizeof (Eina_Rectangle_Pool)); 367 new = malloc(sizeof (Eina_Rectangle_Pool));
365 if (!new) 368 if (!new)
366 return NULL; 369 return NULL;
diff --git a/src/lib/eina_str.c b/src/lib/eina_str.c
index 2a54c00..9a1a369 100644
--- a/src/lib/eina_str.c
+++ b/src/lib/eina_str.c
@@ -544,6 +544,9 @@ eina_str_escape(const char *str)
544 char *s2, *d; 544 char *s2, *d;
545 const char *s; 545 const char *s;
546 546
547 if (!str)
548 return NULL;
549
547 s2 = malloc((strlen(str) * 2) + 1); 550 s2 = malloc((strlen(str) * 2) + 1);
548 if (!s2) 551 if (!s2)
549 return NULL; 552 return NULL;
diff --git a/src/lib/eina_tiler.c b/src/lib/eina_tiler.c
index 155b0e0..b436ba6 100644
--- a/src/lib/eina_tiler.c
+++ b/src/lib/eina_tiler.c
@@ -1115,6 +1115,9 @@ EAPI Eina_Tiler *eina_tiler_new(int w, int h)
1115{ 1115{
1116 Eina_Tiler *t; 1116 Eina_Tiler *t;
1117 1117
1118 if ((w <= 0) || (h <= 0))
1119 return NULL;
1120
1118 t = calloc(1, sizeof(Eina_Tiler)); 1121 t = calloc(1, sizeof(Eina_Tiler));
1119 t->area.w = w; 1122 t->area.w = w;
1120 t->area.h = h; 1123 t->area.h = h;
@@ -1151,6 +1154,8 @@ EAPI Eina_Bool eina_tiler_rect_add(Eina_Tiler *t, const Eina_Rectangle *r)
1151 Eina_Rectangle tmp; 1154 Eina_Rectangle tmp;
1152 1155
1153 EINA_MAGIC_CHECK_TILER(t, EINA_FALSE); 1156 EINA_MAGIC_CHECK_TILER(t, EINA_FALSE);
1157 EINA_SAFETY_ON_NULL_RETURN_VAL(r, EINA_FALSE);
1158
1154 if ((r->w <= 0) || (r->h <= 0)) 1159 if ((r->w <= 0) || (r->h <= 0))
1155 return EINA_FALSE; 1160 return EINA_FALSE;
1156 1161
@@ -1169,6 +1174,8 @@ EAPI void eina_tiler_rect_del(Eina_Tiler *t, const Eina_Rectangle *r)
1169 Eina_Rectangle tmp; 1174 Eina_Rectangle tmp;
1170 1175
1171 EINA_MAGIC_CHECK_TILER(t); 1176 EINA_MAGIC_CHECK_TILER(t);
1177 EINA_SAFETY_ON_NULL_RETURN(r);
1178
1172 if ((r->w <= 0) || (r->h <= 0)) 1179 if ((r->w <= 0) || (r->h <= 0))
1173 return; 1180 return;
1174 1181
@@ -1260,6 +1267,10 @@ eina_tile_grid_slicer_iterator_new(int x,
1260{ 1267{
1261 Eina_Tile_Grid_Slicer_Iterator *it; 1268 Eina_Tile_Grid_Slicer_Iterator *it;
1262 1269
1270 if ((x < 0) || (y < 0) || (w <= 0) || (h <= 0) ||
1271 (tile_w <= 0) || (tile_h <= 0))
1272 return NULL;
1273
1263 it = calloc(1, sizeof(*it)); 1274 it = calloc(1, sizeof(*it));
1264 if (!it) 1275 if (!it)
1265 { 1276 {