Hi,
I will split my patches into 3 pieces for each jobs as you suggested. :)
Please review again.
Thank you.
2011/11/28 Daniel Juyung Seo <[email protected]>:
> hello, i think it will be better if you split this into three patches
> according to each job.
>
> Daniel Juyung Seo (SeoZ)
> On Nov 28, 2011 2:10 PM, "Bluezery" <[email protected]> wrote:
>
>> Dear all,
>>
>> I have done 3 jobs in this patch
>> (1) I have fixed memory leaks in _nominatim_url_cb() function.
>> (2) Add error handling to see the definite error log because sometimes
>> evas_object_image_file_set() is failed.
>> (3) Move zoom_min_get()/zoom_max_get() to source_init() to simplify code.
>>
>> Please review this patch.
>>
>> Index: src/lib/elm_map.c
>> ===================================================================
>> --- src/lib/elm_map.c (리비전 65632)
>> +++ src/lib/elm_map.c (작업 사본)
>> @@ -700,46 +700,14 @@ source_init(void *data)
>> {
>> wd->source_names[idx] = strdup(s->name);
>> INF("source : %s", wd->source_names[idx]);
>> + if (s->zoom_min < wd->zoom_min) wd->zoom_min = s->zoom_min;
>> + if (s->zoom_max > wd->zoom_max) wd->zoom_max = s->zoom_max;
>> idx++;
>> }
>> wd->source_names[idx] = NULL;
>> }
>>
>> static void
>> -zoom_min_get(void *data)
>> -{
>> - ELM_CHECK_WIDTYPE(data, widtype);
>> - Widget_Data *wd = elm_widget_data_get(data);
>> - Map_Sources_Tab *s;
>> - Eina_List *l;
>> - int tz;
>> -
>> - if (!wd) return;
>> - EINA_LIST_FOREACH(wd->map_sources_tab, l, s)
>> - {
>> - tz = s->zoom_min;
>> - if (tz < wd->zoom_min) wd->zoom_min = tz;
>> - }
>> -}
>> -
>> -static void
>> -zoom_max_get(void *data)
>> -{
>> - ELM_CHECK_WIDTYPE(data, widtype);
>> - Widget_Data *wd = elm_widget_data_get(data);
>> - Map_Sources_Tab *s;
>> - Eina_List *l;
>> - int tz;
>> -
>> - if (!wd) return;
>> - EINA_LIST_FOREACH(wd->map_sources_tab, l, s)
>> - {
>> - tz = s->zoom_max;
>> - if (tz > wd->zoom_max) wd->zoom_max = tz;
>> - }
>> -}
>> -
>> -static void
>> obj_rotate_zoom(void *data, Evas_Object *obj)
>> {
>> ELM_CHECK_WIDTYPE(data, widtype);
>> @@ -1187,21 +1155,21 @@ _tile_update(Grid_Item *gi)
>> gi->want = EINA_FALSE;
>> gi->download = EINA_FALSE;
>> evas_object_image_file_set(gi->img, gi->file, NULL);
>> - if (evas_object_image_load_error_get(gi->img) != EVAS_LOAD_ERROR_NONE)
>> + Evas_Load_Error err = evas_object_image_load_error_get(gi->img);
>> + if (err != EVAS_LOAD_ERROR_NONE)
>> {
>> - ERR("Image loading error (%s)", gi->file);
>> + ERR("Image loading error (%s): %s", gi->file,
>> evas_load_error_str(err));
>> ecore_file_remove(gi->file);
>> gi->have = EINA_FALSE;
>> - return;
>> }
>> -
>> - obj_rotate_zoom(gi->wd->obj, gi->img);
>> - evas_object_show(gi->img);
>> -
>> - //evas_object_text_text_set(gi->txt, gi->file);
>> - //evas_object_show(gi->txt);
>> -
>> - gi->have = EINA_TRUE;
>> + else
>> + {
>> + obj_rotate_zoom(gi->wd->obj, gi->img);
>> + evas_object_show(gi->img);
>> + gi->have = EINA_TRUE;
>> + //evas_object_text_text_set(gi->txt, gi->file);
>> + //evas_object_show(gi->txt);
>> + }
>> }
>>
>> static void
>> @@ -3190,18 +3158,17 @@ elm_map_add(Evas_Object *parent)
>> evas_object_smart_callback_add(wd->scr, "scroll", _scr_scroll, obj);
>>
>> elm_smart_scroller_bounce_allow_set(wd->scr, bounce, bounce);
>> +
>> + wd->zoom_min = 0xFF;
>> + wd->zoom_max = 0X00;
>> source_init(obj);
>>
>> wd->obj = obj;
>> wd->map = evas_map_new(4);
>> if (!wd->map) return NULL;
>>
>> - wd->zoom_min = 0xFF;
>> - wd->zoom_max = 0X00;
>> wd->markers_max_num = 30;
>> wd->pinch.level = 1.0;
>> - zoom_min_get(obj);
>> - zoom_max_get(obj);
>> wd->markers = calloc(wd->zoom_max + 1, sizeof(void*));
>>
>> evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
>> @@ -5067,6 +5034,12 @@ _nominatim_url_cb(Evas_Object *obj, int
>> if (!(idx == (ele-1))) eina_strlcat(search_url, "+",
>> sizeof(search_url));
>> }
>> snprintf(buf, sizeof(buf),
>> "%s/search?q=%s&format=xml&polygon=0&addressdetails=0",
>> NAME_NOMINATIM_URL, search_url);
>> +
>> + if (str && str[0])
>> + {
>> + free(str[0]);
>> + free(str);
>> + }
>> }
>> else if (method == ELM_MAP_NAME_METHOD_REVERSE) snprintf(buf,
>> sizeof(buf),
>> "%s/reverse?format=xml&lat=%lf&lon=%lf&zoom=%d&addressdetails=0",
>> NAME_NOMINATIM_URL, lat, lon, wd->zoom);
>> else strcpy(buf, "");
>>
>>
>> --
>> BRs,
>> Kim.
>>
>>
>> ------------------------------------------------------------------------------
>> All the data continuously generated in your IT infrastructure
>> contains a definitive record of customers, application performance,
>> security threats, fraudulent activity, and more. Splunk takes this
>> data and makes sense of it. IT sense. And common sense.
>> http://p.sf.net/sfu/splunk-novd2d
>> _______________________________________________
>> enlightenment-devel mailing list
>> [email protected]
>> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>>
>>
> ------------------------------------------------------------------------------
> All the data continuously generated in your IT infrastructure
> contains a definitive record of customers, application performance,
> security threats, fraudulent activity, and more. Splunk takes this
> data and makes sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-novd2d
> _______________________________________________
> enlightenment-devel mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
>
--
BRs,
Kim.
Index: src/lib/elm_map.c
===================================================================
--- src/lib/elm_map.c (리비전 65667)
+++ src/lib/elm_map.c (작업 사본)
@@ -700,46 +700,14 @@ source_init(void *data)
{
wd->source_names[idx] = strdup(s->name);
INF("source : %s", wd->source_names[idx]);
+ if (s->zoom_min < wd->zoom_min) wd->zoom_min = s->zoom_min;
+ if (s->zoom_max > wd->zoom_max) wd->zoom_max = s->zoom_max;
idx++;
}
wd->source_names[idx] = NULL;
}
static void
-zoom_min_get(void *data)
-{
- ELM_CHECK_WIDTYPE(data, widtype);
- Widget_Data *wd = elm_widget_data_get(data);
- Map_Sources_Tab *s;
- Eina_List *l;
- int tz;
-
- if (!wd) return;
- EINA_LIST_FOREACH(wd->map_sources_tab, l, s)
- {
- tz = s->zoom_min;
- if (tz < wd->zoom_min) wd->zoom_min = tz;
- }
-}
-
-static void
-zoom_max_get(void *data)
-{
- ELM_CHECK_WIDTYPE(data, widtype);
- Widget_Data *wd = elm_widget_data_get(data);
- Map_Sources_Tab *s;
- Eina_List *l;
- int tz;
-
- if (!wd) return;
- EINA_LIST_FOREACH(wd->map_sources_tab, l, s)
- {
- tz = s->zoom_max;
- if (tz > wd->zoom_max) wd->zoom_max = tz;
- }
-}
-
-static void
obj_rotate_zoom(void *data, Evas_Object *obj)
{
ELM_CHECK_WIDTYPE(data, widtype);
@@ -3190,18 +3158,17 @@ elm_map_add(Evas_Object *parent)
evas_object_smart_callback_add(wd->scr, "scroll", _scr_scroll, obj);
elm_smart_scroller_bounce_allow_set(wd->scr, bounce, bounce);
+
+ wd->zoom_min = 0xFF;
+ wd->zoom_max = 0X00;
source_init(obj);
wd->obj = obj;
wd->map = evas_map_new(4);
if (!wd->map) return NULL;
- wd->zoom_min = 0xFF;
- wd->zoom_max = 0X00;
wd->markers_max_num = 30;
wd->pinch.level = 1.0;
- zoom_min_get(obj);
- zoom_max_get(obj);
wd->markers = calloc(wd->zoom_max + 1, sizeof(void*));
evas_object_smart_callback_add(obj, "scroll-hold-on", _hold_on, obj);
Index: src/lib/elm_map.c
===================================================================
--- src/lib/elm_map.c (리비전 65667)
+++ src/lib/elm_map.c (작업 사본)
@@ -5067,6 +5067,12 @@ _nominatim_url_cb(Evas_Object *obj, int
if (!(idx == (ele-1))) eina_strlcat(search_url, "+", sizeof(search_url));
}
snprintf(buf, sizeof(buf), "%s/search?q=%s&format=xml&polygon=0&addressdetails=0", NAME_NOMINATIM_URL, search_url);
+
+ if (str && str[0])
+ {
+ free(str[0]);
+ free(str);
+ }
}
else if (method == ELM_MAP_NAME_METHOD_REVERSE) snprintf(buf, sizeof(buf), "%s/reverse?format=xml&lat=%lf&lon=%lf&zoom=%d&addressdetails=0", NAME_NOMINATIM_URL, lat, lon, wd->zoom);
else strcpy(buf, "");
Index: src/lib/elm_map.c
===================================================================
--- src/lib/elm_map.c (리비전 65667)
+++ src/lib/elm_map.c (작업 사본)
@@ -1187,21 +1187,21 @@ _tile_update(Grid_Item *gi)
gi->want = EINA_FALSE;
gi->download = EINA_FALSE;
evas_object_image_file_set(gi->img, gi->file, NULL);
- if (evas_object_image_load_error_get(gi->img) != EVAS_LOAD_ERROR_NONE)
+ Evas_Load_Error err = evas_object_image_load_error_get(gi->img);
+ if (err != EVAS_LOAD_ERROR_NONE)
{
- ERR("Image loading error (%s)", gi->file);
+ ERR("Image loading error (%s): %s", gi->file, evas_load_error_str(err));
ecore_file_remove(gi->file);
gi->have = EINA_FALSE;
- return;
}
-
- obj_rotate_zoom(gi->wd->obj, gi->img);
- evas_object_show(gi->img);
-
- //evas_object_text_text_set(gi->txt, gi->file);
- //evas_object_show(gi->txt);
-
- gi->have = EINA_TRUE;
+ else
+ {
+ obj_rotate_zoom(gi->wd->obj, gi->img);
+ evas_object_show(gi->img);
+ gi->have = EINA_TRUE;
+ //evas_object_text_text_set(gi->txt, gi->file);
+ //evas_object_show(gi->txt);
+ }
}
static void
------------------------------------------------------------------------------
All the data continuously generated in your IT infrastructure
contains a definitive record of customers, application performance,
security threats, fraudulent activity, and more. Splunk takes this
data and makes sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-novd2d
_______________________________________________
enlightenment-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel