Kaydet (Commit) 72d94418 authored tarafından Stephan Bergmann's avatar Stephan Bergmann

loplugin:nullptr (automatic rewrite)

Change-Id: I60189077f872dd5da3633b15b67b7b7729a75d0d
üst 8d12f43b
...@@ -216,7 +216,7 @@ ds_status deserializeScore(ds_device* device, const unsigned char* serializedSco ...@@ -216,7 +216,7 @@ ds_status deserializeScore(ds_device* device, const unsigned char* serializedSco
/* Releases memory held by score */ /* Releases memory held by score */
ds_status releaseScore(void* score) ds_status releaseScore(void* score)
{ {
if (NULL != score) if (nullptr != score)
{ {
delete static_cast<LibreOfficeDeviceScore*>(score); delete static_cast<LibreOfficeDeviceScore*>(score);
} }
...@@ -233,15 +233,15 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData) ...@@ -233,15 +233,15 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData)
cl_int clStatus; cl_int clStatus;
/* Check for 64-bit float extensions */ /* Check for 64-bit float extensions */
size_t aDevExtInfoSize = 0; size_t aDevExtInfoSize = 0;
clStatus = clGetDeviceInfo(device->oclDeviceID, CL_DEVICE_EXTENSIONS, 0, NULL, &aDevExtInfoSize); clStatus = clGetDeviceInfo(device->oclDeviceID, CL_DEVICE_EXTENSIONS, 0, nullptr, &aDevExtInfoSize);
DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clGetDeviceInfo"); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clGetDeviceInfo");
char* aExtInfo = new char[aDevExtInfoSize]; char* aExtInfo = new char[aDevExtInfoSize];
clStatus = clGetDeviceInfo(device->oclDeviceID, CL_DEVICE_EXTENSIONS, sizeof(char) * aDevExtInfoSize, aExtInfo, NULL); clStatus = clGetDeviceInfo(device->oclDeviceID, CL_DEVICE_EXTENSIONS, sizeof(char) * aDevExtInfoSize, aExtInfo, nullptr);
DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clGetDeviceInfo"); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clGetDeviceInfo");
bool bKhrFp64Flag = false; bool bKhrFp64Flag = false;
bool bAmdFp64Flag = false; bool bAmdFp64Flag = false;
const char* buildOption = NULL; const char* buildOption = nullptr;
std::string tmpStr("-Dfp_t=double -Dfp_t4=double4 -Dfp_t16=double16 -DINPUTSIZE="); std::string tmpStr("-Dfp_t=double -Dfp_t4=double4 -Dfp_t16=double16 -DINPUTSIZE=");
std::ostringstream tmpOStrStr; std::ostringstream tmpOStrStr;
tmpOStrStr << std::dec << INPUTSIZE; tmpOStrStr << std::dec << INPUTSIZE;
...@@ -278,7 +278,7 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData) ...@@ -278,7 +278,7 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData)
/* 64-bit float support present */ /* 64-bit float support present */
/* Create context and command queue */ /* Create context and command queue */
cl_context clContext = clCreateContext(NULL, 1, &device->oclDeviceID, NULL, NULL, &clStatus); cl_context clContext = clCreateContext(nullptr, 1, &device->oclDeviceID, nullptr, nullptr, &clStatus);
DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clCreateContext"); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clCreateContext");
cl_command_queue clQueue = clCreateCommandQueue(clContext, device->oclDeviceID, 0, &clStatus); cl_command_queue clQueue = clCreateCommandQueue(clContext, device->oclDeviceID, 0, &clStatus);
DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clCreateCommandQueue"); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clCreateCommandQueue");
...@@ -286,14 +286,14 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData) ...@@ -286,14 +286,14 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData)
/* Build program */ /* Build program */
cl_program clProgram = clCreateProgramWithSource(clContext, 1, &source, sourceSize, &clStatus); cl_program clProgram = clCreateProgramWithSource(clContext, 1, &source, sourceSize, &clStatus);
DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clCreateProgramWithSource"); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clCreateProgramWithSource");
clStatus = clBuildProgram(clProgram, 1, &device->oclDeviceID, buildOption, NULL, NULL); clStatus = clBuildProgram(clProgram, 1, &device->oclDeviceID, buildOption, nullptr, nullptr);
DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clBuildProgram"); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clBuildProgram");
if (CL_SUCCESS != clStatus) if (CL_SUCCESS != clStatus)
{ {
/* Build program failed */ /* Build program failed */
size_t length; size_t length;
char* buildLog; char* buildLog;
clStatus = clGetProgramBuildInfo(clProgram, device->oclDeviceID, CL_PROGRAM_BUILD_LOG, 0, NULL, &length); clStatus = clGetProgramBuildInfo(clProgram, device->oclDeviceID, CL_PROGRAM_BUILD_LOG, 0, nullptr, &length);
buildLog = static_cast<char*>(malloc(length)); buildLog = static_cast<char*>(malloc(length));
clGetProgramBuildInfo(clProgram, device->oclDeviceID, CL_PROGRAM_BUILD_LOG, length, buildLog, &length); clGetProgramBuildInfo(clProgram, device->oclDeviceID, CL_PROGRAM_BUILD_LOG, length, buildLog, &length);
SAL_INFO("opencl.device", "Build Errors:\n" << buildLog); SAL_INFO("opencl.device", "Build Errors:\n" << buildLog);
...@@ -335,7 +335,7 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData) ...@@ -335,7 +335,7 @@ ds_status evaluateScoreForDevice(ds_device* device, void* evalData)
DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clSetKernelArg::clInput3"); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clSetKernelArg::clInput3");
size_t globalWS[1] = { testData->outputSize }; size_t globalWS[1] = { testData->outputSize };
size_t localSize[1] = { 64 }; size_t localSize[1] = { 64 };
clStatus = clEnqueueNDRangeKernel(clQueue, clKernel, 1, 0, globalWS, localSize, 0, NULL, NULL); clStatus = clEnqueueNDRangeKernel(clQueue, clKernel, 1, nullptr, globalWS, localSize, 0, nullptr, nullptr);
DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clEnqueueNDRangeKernel"); DS_CHECK_STATUS(clStatus, "evaluateScoreForDevice::clEnqueueNDRangeKernel");
clFinish(clQueue); clFinish(clQueue);
clReleaseMemObject(clInput3); clReleaseMemObject(clInput3);
...@@ -485,7 +485,7 @@ ds_device getDeviceSelection(const char* sProfilePath, bool bForceSelection) ...@@ -485,7 +485,7 @@ ds_device getDeviceSelection(const char* sProfilePath, bool bForceSelection)
if (!bIsDeviceSelected || bForceSelection) if (!bIsDeviceSelected || bForceSelection)
{ {
/* Setup */ /* Setup */
ds_profile* profile = NULL; ds_profile* profile = nullptr;
initDSProfile(&profile, "LibreOffice v0.1"); initDSProfile(&profile, "LibreOffice v0.1");
if (!profile) if (!profile)
...@@ -559,7 +559,7 @@ ds_device getDeviceSelection(const char* sProfilePath, bool bForceSelection) ...@@ -559,7 +559,7 @@ ds_device getDeviceSelection(const char* sProfilePath, bool bForceSelection)
/* Override if necessary */ /* Override if necessary */
char* overrideDeviceStr = getenv("SC_OPENCL_DEVICE_OVERRIDE"); char* overrideDeviceStr = getenv("SC_OPENCL_DEVICE_OVERRIDE");
if (NULL != overrideDeviceStr) if (nullptr != overrideDeviceStr)
{ {
int overrideDeviceIdx = matchDevice(profile, overrideDeviceStr); int overrideDeviceIdx = matchDevice(profile, overrideDeviceStr);
if (-1 != overrideDeviceIdx) if (-1 != overrideDeviceIdx)
......
This diff is collapsed.
...@@ -12,7 +12,7 @@ ...@@ -12,7 +12,7 @@
#include <opencl/platforminfo.hxx> #include <opencl/platforminfo.hxx>
OpenCLDeviceInfo::OpenCLDeviceInfo() OpenCLDeviceInfo::OpenCLDeviceInfo()
: device(0) : device(nullptr)
, mnMemory(0) , mnMemory(0)
, mnComputeUnits(0) , mnComputeUnits(0)
, mnFrequency(0) , mnFrequency(0)
...@@ -20,7 +20,7 @@ OpenCLDeviceInfo::OpenCLDeviceInfo() ...@@ -20,7 +20,7 @@ OpenCLDeviceInfo::OpenCLDeviceInfo()
} }
OpenCLPlatformInfo::OpenCLPlatformInfo() OpenCLPlatformInfo::OpenCLPlatformInfo()
: platform(NULL) : platform(nullptr)
{ {
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment