fclose(pFile);
}
+struct _Deleter
+{
+ void operator()(char* pStr)
+ {
+ free(pStr);
+ }
+};
+
tbm_bufmgr
bufmgr_get(Display* pDisplay, Pixmap pixmap)
{
return null;
}
- char* pDriverName = null;
- char* pDeviceName = null;
- if (!DRI2Connect(pDisplay, RootWindow(pDisplay, screen), &pDriverName, &pDeviceName))
+ char* pDriverNameTemp = null;
+ char* pDeviceNameTemp = null;
+ if (!DRI2Connect(pDisplay, RootWindow(pDisplay, screen), &pDriverNameTemp, &pDeviceNameTemp))
{
SysSecureLog(NID_UI_CTRL, "Failed to get value of DRI2Connect.");
return null;
}
- SysSecureLog(NID_UI_CTRL, "The current name of open drm device is %s.", pDeviceName);
+ unique_ptr<char, _Deleter> pDriverName(pDriverNameTemp);
+ unique_ptr<char, _Deleter> pDeviceName(pDeviceNameTemp);
// Get the drm_fd though opening the deviceName
- __drmFileDescriptor = open(pDeviceName, O_RDWR);
+ __drmFileDescriptor = open(pDeviceName.get(), O_RDWR);
if (__drmFileDescriptor < 0)
{
- SysSecureLog(NID_UI_CTRL, "Failed to open drm device (%s)", pDeviceName);
+ SysSecureLog(NID_UI_CTRL, "Failed to open drm device (%s)", pDeviceName.get());
return null;
}
int opt = TBM_OPTION_READ|TBM_OPTION_WRITE;
char imgFile[100] = {0,};
- tbm_bo bo;
- tbm_bo_handle bo_handle;
-
DRI2Buffer* pDri2_buffers = DRI2GetBuffers (pDisplay, pixmap, &dri2_width, &dri2_height, attachments, dri2_count, &dri2_out_count);
- SysTryLogCatch(NID_UI_CTRL, pDri2_buffers != null, , "Failed to get buffers.");
- SysTryLogCatch(NID_UI_CTRL, pDri2_buffers[0].name != null, , "Failed to get a handle of the dri2 buffer.");
+ SysTryReturnVoidResult(NID_SHELL, pDri2_buffers != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
+ SysTryReturnVoidResult(NID_SHELL, pDri2_buffers[0].name != null, E_OUT_OF_MEMORY, "[E_OUT_OF_MEMORY] Memory is insufficient.");
- SysSecureLog(NID_UI_CTRL, "The current name of Dri2_buffers[0] is %d.", pDri2_buffers[0].name);
+ tbm_bo bo = null;
+ tbm_bo_handle bo_handle;
+ bo_handle.ptr = null;
bo = tbm_bo_import(bufmgr, pDri2_buffers[0].name);
SysTryLogCatch(NID_UI_CTRL, bo != null, , "Failed to import bo (key : %d).", pDri2_buffers[0].name);