diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-09-17 03:48:22 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2013-09-19 17:03:22 +0200 |
commit | 1500aae993c0a8b4fa9a5bcec1bc6203f3bcff66 (patch) | |
tree | f8a9791a174688ff650d699f2ef1d5d2529a3dc1 /sc | |
parent | e0eba2bc96bcd27a9c92e1a5cc80167b0b962da7 (diff) |
use OString instead of char* for file name
Change-Id: Idd69827c50056febd30f18bd8ade2b4160eafd02
Diffstat (limited to 'sc')
-rw-r--r-- | sc/source/core/opencl/openclwrapper.cxx | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx index a9c576dfe0cc..a04447aa7a38 100644 --- a/sc/source/core/opencl/openclwrapper.cxx +++ b/sc/source/core/opencl/openclwrapper.cxx @@ -239,10 +239,10 @@ int OpenclDevice::binaryGenerated( const char * clFileName, FILE ** fhandle ) } -int OpenclDevice::writeBinaryToFile( const char* fileName, const char* birary, size_t numBytes ) +int OpenclDevice::writeBinaryToFile( const OString& rFileName, const char* birary, size_t numBytes ) { FILE *output = NULL; - output = fopen( fileName, "wb" ); + output = fopen( rFileName.getStr(), "wb" ); if ( output == NULL ) { return 0; @@ -298,26 +298,25 @@ int OpenclDevice::generatBinFromKernelSource( cl_program program, const char * c /* dump out each binary into its own separate file. */ for ( size_t i = 0; i < numDevices; i++ ) { - char fileName[256] = { 0 }, cl_name[128] = { 0 }; if ( binarySizes[i] != 0 ) { + OString fileName(clFileName); + sal_Int32 nIndex = fileName.lastIndexOf(".cl"); + if(nIndex > 0) + fileName = fileName.copy(0, nIndex - 1); + char deviceName[DEVICE_NAME_LENGTH]; clStatus = clGetDeviceInfo(mpArryDevsID[i], CL_DEVICE_NAME, sizeof(deviceName), deviceName, NULL); CHECK_OPENCL( clStatus, "clGetDeviceInfo" ); - char* str = (char*) strstr( clFileName, (char*) ".cl" ); - memcpy( cl_name, clFileName, str - clFileName ); - cl_name[str - clFileName] = '\0'; - sprintf( fileName, "./%s-%s.bin", cl_name, deviceName ); - - if ( !writeBinaryToFile( fileName, binaries[i], binarySizes[i] ) ) + if ( !writeBinaryToFile( fileName + "-" + deviceName, binaries[i], binarySizes[i] ) ) { - printf("opencl-wrapper: write binary[%s] failds\n", fileName); + printf("opencl-wrapper: write binary[%s] failds\n", fileName.getStr()); } else - printf("opencl-wrapper: write binary[%s] succesfully\n", fileName); + printf("opencl-wrapper: write binary[%s] succesfully\n", fileName.getStr()); } } |