]> granicus.if.org Git - imagemagick/commitdiff
Fix for reading OpenCL device name/version.
authordirk <dirk@git.imagemagick.org>
Tue, 10 Dec 2013 06:04:40 +0000 (06:04 +0000)
committerdirk <dirk@git.imagemagick.org>
Tue, 10 Dec 2013 06:04:40 +0000 (06:04 +0000)
Fixed warnings.

MagickCore/accelerate.c
MagickCore/opencl.c

index 4ce01e553e4aacfed0a86e5ca66c556dda190fd6..fdab1cf291fad4427e1381da1111c7791af43554 100644 (file)
@@ -2463,7 +2463,9 @@ static MagickBooleanType resizeHorizontalFilter(cl_mem inputImage
   /* get the local memory size supported by the device */
   deviceLocalMemorySize = GetOpenCLDeviceLocalMemorySize(clEnv);
 
+DisableMSCWarning(4127)
   while(1)
+RestoreMSCWarning
   {
     /* calculate the local memory size needed per workgroup */
     cacheRangeStart = (int) (((0 + 0.5)/xFactor+MagickEpsilon)-support+0.5);
@@ -2645,7 +2647,9 @@ static MagickBooleanType resizeVerticalFilter(cl_mem inputImage
   /* get the local memory size supported by the device */
   deviceLocalMemorySize = GetOpenCLDeviceLocalMemorySize(clEnv);
 
+DisableMSCWarning(4127)
   while(1)
+RestoreMSCWarning
   {
     /* calculate the local memory size needed per workgroup */
     cacheRangeStart = (int) (((0 + 0.5)/yFactor+MagickEpsilon)-support+0.5);
@@ -4834,7 +4838,9 @@ Image* AccelerateAddNoiseImage(const Image *image, const ChannelType channel,
   if (status == MagickFalse)
     return NULL;
 
+DisableMSCWarning(4127)
   if (sizeof(unsigned long) == 4)
+RestoreMSCWarning
     filteredImage = ComputeAddNoiseImageOptRandomNum(image,channel,noise_type,exception);
   else
     filteredImage = ComputeAddNoiseImage(image,channel,noise_type,exception);
index 10ac9a685c845c622307304f8c43516398c9eaec..65cfe465a45e322571254abb8bd8de1709622064 100644 (file)
@@ -1242,8 +1242,6 @@ MagickExport
 */
 
 
-#define DS_DEVICE_NAME_LENGTH 256
-
 typedef enum {
   DS_SUCCESS = 0
  ,DS_INVALID_PROFILE = 1000
@@ -1382,23 +1380,22 @@ static ds_status initDSProfile(ds_profile** p, const char* version) {
         }
         clGetDeviceIDs(platforms[i], deviceType, numDevices, devices, &num);
         for (j = 0; j < num; j++, next++) {
-          char buffer[DS_DEVICE_NAME_LENGTH];
           size_t length;
 
           profile->devices[next].type = DS_DEVICE_OPENCL_DEVICE;
           profile->devices[next].oclDeviceID = devices[j];
 
-          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DEVICE_NAME
-            , DS_DEVICE_NAME_LENGTH, &buffer, NULL);
-          length = strlen(buffer);
-          profile->devices[next].oclDeviceName = (char*)malloc(length+1);
-          memcpy(profile->devices[next].oclDeviceName, buffer, length+1);
-
-          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DRIVER_VERSION
-            , DS_DEVICE_NAME_LENGTH, &buffer, NULL);
-          length = strlen(buffer);
-          profile->devices[next].oclDriverVersion = (char*)malloc(length+1);
-          memcpy(profile->devices[next].oclDriverVersion, buffer, length+1);
+          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DEVICE_NAME\r
+            , 0, NULL, &length);\r
+          profile->devices[next].oclDeviceName = (char*)malloc(sizeof(char)*length);\r
+          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DEVICE_NAME\r
+            , length, profile->devices[next].oclDeviceName, NULL);\r
+\r
+          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DRIVER_VERSION\r
+            , 0, NULL, &length);\r
+          profile->devices[next].oclDriverVersion = (char*)malloc(sizeof(char)*length);\r
+          clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DRIVER_VERSION\r
+            , length, profile->devices[next].oclDriverVersion, NULL);
 
           clGetDeviceInfo(profile->devices[next].oclDeviceID, CL_DEVICE_MAX_CLOCK_FREQUENCY
             , sizeof(cl_uint), &profile->devices[next].oclMaxClockFrequency, NULL);