summaryrefslogtreecommitdiff
path: root/legacy
diff options
context:
space:
mode:
authorChristopher Michael <cpmichael1@comcast.net>2011-08-23 16:38:24 +0000
committerChristopher Michael <cpmichael1@comcast.net>2011-08-23 16:38:24 +0000
commit921497a9fc85a934614f990f1c65ebf3797d42ff (patch)
tree60e700dc0ce982ce17169793d15fe70fe6ca8d29 /legacy
parentca93d80a3c26b426c4fe50380fb495b9b589138e (diff)
Ecore_X(cb): Make selection code more like the Xlib version. Fix
return from parser_files function. SVN revision: 62725
Diffstat (limited to 'legacy')
-rw-r--r--legacy/ecore/src/lib/ecore_x/xcb/ecore_xcb_selection.c31
1 files changed, 23 insertions, 8 deletions
diff --git a/legacy/ecore/src/lib/ecore_x/xcb/ecore_xcb_selection.c b/legacy/ecore/src/lib/ecore_x/xcb/ecore_xcb_selection.c
index e01709acd1..80bab3f309 100644
--- a/legacy/ecore/src/lib/ecore_x/xcb/ecore_xcb_selection.c
+++ b/legacy/ecore/src/lib/ecore_x/xcb/ecore_xcb_selection.c
@@ -690,7 +690,7 @@ static void *
690_ecore_xcb_selection_parser_files(const char *target, void *data, int size, int format __UNUSED__) 690_ecore_xcb_selection_parser_files(const char *target, void *data, int size, int format __UNUSED__)
691{ 691{
692 Ecore_X_Selection_Data_Files *sel; 692 Ecore_X_Selection_Data_Files *sel;
693 char *_data, *tmp; 693 char *_data, *tmp, *t, **t2;
694 int i = 0, is = 0; 694 int i = 0, is = 0;
695 695
696 LOGFN(__FILE__, __LINE__, __FUNCTION__); 696 LOGFN(__FILE__, __LINE__, __FUNCTION__);
@@ -708,7 +708,13 @@ _ecore_xcb_selection_parser_files(const char *target, void *data, int size, int
708 if (_data[size - 1]) 708 if (_data[size - 1])
709 { 709 {
710 size++; 710 size++;
711 _data = realloc(_data, size); 711 t = realloc(_data, size);
712 if (!t)
713 {
714 free(sel);
715 return NULL;
716 }
717 _data = t;
712 _data[size - 1] = 0; 718 _data[size - 1] = 0;
713 } 719 }
714 720
@@ -729,9 +735,12 @@ _ecore_xcb_selection_parser_files(const char *target, void *data, int size, int
729 is++; 735 is++;
730 tmp[i] = 0; 736 tmp[i] = 0;
731 sel->num_files++; 737 sel->num_files++;
732 sel->files = 738 t2 = realloc(sel->files, sel->num_files * sizeof(char *));
733 realloc(sel->files, sel->num_files * sizeof(char *)); 739 if (t2)
734 sel->files[sel->num_files - 1] = strdup(tmp); 740 {
741 sel->files = t2;
742 sel->files[sel->num_files - 1] = strdup(tmp);
743 }
735 tmp[0] = 0; 744 tmp[0] = 0;
736 i = 0; 745 i = 0;
737 } 746 }
@@ -741,13 +750,19 @@ _ecore_xcb_selection_parser_files(const char *target, void *data, int size, int
741 { 750 {
742 tmp[i] = 0; 751 tmp[i] = 0;
743 sel->num_files++; 752 sel->num_files++;
744 sel->files = realloc(sel->files, sel->num_files * sizeof(char *)); 753 t2 = realloc(sel->files, sel->num_files * sizeof(char *));
745 sel->files[sel->num_files - 1] = strdup(tmp); 754 if (t2)
755 {
756 sel->files = t2;
757 sel->files[sel->num_files - 1] = strdup(tmp);
758 }
746 } 759 }
747 if (tmp) free(tmp); 760 if (tmp) free(tmp);
748 if (_data) free(_data); 761 if (_data) free(_data);
762
749 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_FILES; 763 ECORE_XCB_SELECTION_DATA(sel)->content = ECORE_X_SELECTION_CONTENT_FILES;
750 ECORE_XCB_SELECTION_DATA(sel)->length = sel->num_files; 764 ECORE_XCB_SELECTION_DATA(sel)->length = sel->num_files;
765
751 return ECORE_XCB_SELECTION_DATA(sel); 766 return ECORE_XCB_SELECTION_DATA(sel);
752} 767}
753 768
@@ -863,7 +878,7 @@ _ecore_xcb_selection_data_files_free(void *data)
863 if (sel->files) free(sel->files); 878 if (sel->files) free(sel->files);
864 } 879 }
865 free(sel); 880 free(sel);
866 return 1; 881 return 0;
867} 882}
868 883
869static int 884static int