From: Christopher Michael Date: Tue, 11 Sep 2012 11:41:26 +0000 (+0000) Subject: Ecore_X: Fix more memcpy madness causing problems in randr. This fixes X-Git-Tag: submit/devel/efl/20131022.203902~4310 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b1e2578b0a2c6e1066adcb5b010e4abfa7f551a;p=platform%2Fupstream%2Fefl.git Ecore_X: Fix more memcpy madness causing problems in randr. This fixes crtc_possible_outputs_get and crtc_outputs_get. SVN revision: 76454 --- diff --git a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c index 8a00b8b..0ee009a 100644 --- a/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c +++ b/legacy/ecore/src/lib/ecore_x/xlib/ecore_x_randr_12.c @@ -681,19 +681,19 @@ ecore_x_randr_crtc_outputs_get(Ecore_X_Window root, Ecore_X_Randr_Output *ret = NULL; XRRCrtcInfo *crtc_info = NULL; - if (_ecore_x_randr_crtc_validate(root, - crtc) && + if (_ecore_x_randr_crtc_validate(root, crtc) && (res = - _ecore_x_randr_get_screen_resources (_ecore_x_disp, - root)) && + _ecore_x_randr_get_screen_resources (_ecore_x_disp, root)) && (crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) { if ((ret = malloc(sizeof(Ecore_X_Randr_Output) * crtc_info->noutput))) { - memcpy(ret, crtc_info->outputs, - (sizeof(Ecore_X_Randr_Output) * crtc_info->noutput)); - if (num) - *num = crtc_info->noutput; + int i = 0; + + if (num) *num = crtc_info->noutput; + + for (i = 0; i < crtc_info->noutput; i++) + ret[i] = crtc_info->outputs[i]; } if (crtc_info) @@ -725,8 +725,7 @@ ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, Ecore_X_Randr_Output *ret = NULL; XRRCrtcInfo *crtc_info = NULL; - if (_ecore_x_randr_crtc_validate(root, - crtc) && + if (_ecore_x_randr_crtc_validate(root, crtc) && (res = _ecore_x_randr_get_screen_resources (_ecore_x_disp, root))) { if ((crtc_info = XRRGetCrtcInfo(_ecore_x_disp, res, crtc))) @@ -734,10 +733,12 @@ ecore_x_randr_crtc_possible_outputs_get(Ecore_X_Window root, if ((ret = malloc(sizeof(Ecore_X_Randr_Output) * crtc_info->npossible))) { - memcpy(ret, crtc_info->possible, - (sizeof(Ecore_X_Randr_Output) * crtc_info->npossible)); - if (num) - *num = res->ncrtc; + int i = 0; + + if (num) *num = crtc_info->npossible; + + for (i = 0; i < crtc_info->npossible; i++) + ret[i] = crtc_info->possible[i]; } XRRFreeCrtcInfo(crtc_info);