Skip to content

Commit

Permalink
VS2010 build: Prepare ocl.c
Browse files Browse the repository at this point in the history
Cherry-picked by veox.
  • Loading branch information
Sanjin Trošelj authored and veox committed Jan 27, 2014
1 parent 7ac101f commit 5d57691
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions ocl.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ int opt_platform_id = -1;

char *file_contents(const char *filename, int *length)
{
char *fullpath = alloca(PATH_MAX);
char *fullpath = (char *)alloca(PATH_MAX);
void *buffer;
FILE *f;

Expand Down Expand Up @@ -150,7 +150,7 @@ int clDevicesNum(void) {

static int advance(char **area, unsigned *remaining, const char *marker)
{
char *find = memmem(*area, *remaining, marker, strlen(marker));
char *find = (char *)memmem(*area, *remaining, (void *)marker, strlen(marker));

if (!find) {
applog(LOG_DEBUG, "Marker \"%s\" not found", marker);
Expand Down Expand Up @@ -207,7 +207,7 @@ void patch_opcodes(char *w, unsigned remaining)

_clState *initCl(unsigned int gpu, char *name, size_t nameSize)
{
_clState *clState = calloc(1, sizeof(_clState));
_clState *clState = (_clState *)calloc(1, sizeof(_clState));
bool patchbfi = false, prog_built = false;
struct cgpu_info *cgpu = &gpus[gpu];
cl_platform_id platform = NULL;
Expand Down Expand Up @@ -325,7 +325,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)

/* Check for BFI INT support. Hopefully people don't mix devices with
* and without it! */
char * extensions = malloc(1024);
char * extensions = (char *)malloc(1024);
const char * camo = "cl_amd_media_ops";
char *find;

Expand All @@ -339,7 +339,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
clState->hasBitAlign = true;

/* Check for OpenCL >= 1.0 support, needed for global offset parameter usage. */
char * devoclver = malloc(1024);
char * devoclver = (char *)malloc(1024);
const char * ocl10 = "OpenCL 1.0";
const char * ocl11 = "OpenCL 1.1";

Expand Down Expand Up @@ -494,12 +494,12 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
if (!source)
return NULL;

binary_sizes = calloc(sizeof(size_t) * MAX_GPUDEVICES * 4, 1);
binary_sizes = (size_t *)calloc(sizeof(size_t) * MAX_GPUDEVICES * 4, 1);
if (unlikely(!binary_sizes)) {
applog(LOG_ERR, "Unable to calloc binary_sizes");
return NULL;
}
binaries = calloc(sizeof(char *) * MAX_GPUDEVICES * 4, 1);
binaries = (char **)calloc(sizeof(char *) * MAX_GPUDEVICES * 4, 1);
if (unlikely(!binaries)) {
applog(LOG_ERR, "Unable to calloc binaries");
return NULL;
Expand Down Expand Up @@ -573,7 +573,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
}

/* create a cl program executable for all the devices specified */
char *CompilerOptions = calloc(1, 256);
char *CompilerOptions = (char *)calloc(1, 256);

sprintf(CompilerOptions, "-D LOOKUP_GAP=%d -D CONCURRENT_THREADS=%d -D WORKSIZE=%d",
cgpu->lookup_gap, (unsigned int)cgpu->thread_concurrency, (int)clState->wsize);
Expand Down Expand Up @@ -624,7 +624,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
size_t logSize;
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, 0, NULL, &logSize);

char *log = malloc(logSize);
char *log = (char *)malloc(logSize);
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, logSize, log, NULL);
applog(LOG_ERR, "%s", log);
return NULL;
Expand Down Expand Up @@ -663,7 +663,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
applog(LOG_ERR, "OpenCL compiler generated a zero sized binary, FAIL!");
return NULL;
}
binaries[slot] = calloc(sizeof(char) * binary_sizes[slot], 1);
binaries[slot] = (char *)calloc(sizeof(char)* binary_sizes[slot], 1);
status = clGetProgramInfo(clState->program, CL_PROGRAM_BINARIES, sizeof(char *) * cpnd, binaries, NULL );
if (unlikely(status != CL_SUCCESS)) {
applog(LOG_ERR, "Error %d: Getting program info. CL_PROGRAM_BINARIES (clGetProgramInfo)", status);
Expand Down Expand Up @@ -751,7 +751,7 @@ _clState *initCl(unsigned int gpu, char *name, size_t nameSize)
size_t logSize;
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, 0, NULL, &logSize);

char *log = malloc(logSize);
char *log = (char *)malloc(logSize);
status = clGetProgramBuildInfo(clState->program, devices[gpu], CL_PROGRAM_BUILD_LOG, logSize, log, NULL);
applog(LOG_ERR, "%s", log);
return NULL;
Expand Down

0 comments on commit 5d57691

Please sign in to comment.