[Libreoffice-commits] core.git: Branch 'feature/calc-opencl-cache' - sc/source

Markus Mohrhard markus.mohrhard at googlemail.com
Wed Sep 18 03:54:19 PDT 2013


 sc/source/core/opencl/openclwrapper.cxx |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

New commits:
commit 2b3ff8cfc545c604653e6f98395cde3ecff0853f
Author: Markus Mohrhard <markus.mohrhard at googlemail.com>
Date:   Wed Sep 18 12:45:37 2013 +0200

    void* is dangerous
    
    no idea how that ever worked
    
    Change-Id: Ie14c86a241a2fa7e1963385987245cd0ee965fcf

diff --git a/sc/source/core/opencl/openclwrapper.cxx b/sc/source/core/opencl/openclwrapper.cxx
index 780365e..c630939 100644
--- a/sc/source/core/opencl/openclwrapper.cxx
+++ b/sc/source/core/opencl/openclwrapper.cxx
@@ -421,17 +421,19 @@ int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
     if (aGeneratedFiles.size() == numDevices)
     {
         bBinaryExisted = true;
-        boost::scoped_array<char*> pBinary(new char*[numDevices]);
+        boost::scoped_array<unsigned char*> pBinary(new unsigned char*[numDevices]);
         for(size_t i = 0; i < numDevices; ++i)
         {
             sal_uInt64 nSize;
             aGeneratedFiles[i]->getSize(nSize);
-            char* binary = new char[nSize];
+            unsigned char* binary = new unsigned char[nSize];
             sal_uInt64 nBytesRead;
             aGeneratedFiles[i]->read(binary, nSize, nBytesRead);
             if(nSize != nBytesRead)
                 assert(false);
 
+            length = nBytesRead;
+
             pBinary[i] = binary;
         }
 
@@ -451,7 +453,7 @@ int OpenclDevice::compileKernelFile( GPUEnv *gpuInfo, const char *buildOption )
 
         fprintf(stderr, "Create kernel from binary\n");
         gpuInfo->mpArryPrograms[idx] = clCreateProgramWithBinary( gpuInfo->mpContext,numDevices,
-                                           mpArryDevsID.get(), &length, (const unsigned char**) &pBinary,
+                                           mpArryDevsID.get(), &length, (const unsigned char**) pBinary.get(),
                                            &binary_status, &clStatus );
         if(clStatus != CL_SUCCESS)
         {


More information about the Libreoffice-commits mailing list