Skip to content

Commit

Permalink
Fix Wcast-qual warning.
Browse files Browse the repository at this point in the history
  • Loading branch information
haonanya1 committed Sep 24, 2024
1 parent 3d27d7c commit 78af7ae
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
12 changes: 5 additions & 7 deletions loader/icd.c
Original file line number Diff line number Diff line change
Expand Up @@ -324,14 +324,12 @@ void khrIcdLayerAdd(const char *libraryName)

cl_uint limit = layerDispatchNumEntries < loaderDispatchNumEntries ? layerDispatchNumEntries : loaderDispatchNumEntries;

for (cl_uint i = 0; i < limit; i++) {
for (cl_uint i = 0; i < limit; i++)
((void **)&(layer->dispatch))[i] =
((void **)layerDispatch)[i] ?
((void **)layerDispatch)[i] : ((void **)targetDispatch)[i];
}
for (cl_uint i = limit; i < loaderDispatchNumEntries; i++) {
((void **)&(layer->dispatch))[i] = ((void **)targetDispatch)[i];
}
((void *const*)layerDispatch)[i] ?
((void *const*)layerDispatch)[i] : ((void *const*)targetDispatch)[i];
for (cl_uint i = limit; i < loaderDispatchNumEntries; i++)
((void **)&(layer->dispatch))[i] = ((void *const*)targetDispatch)[i];

KHR_ICD_TRACE("successfully added layer %s\n", libraryName);
return;
Expand Down
4 changes: 2 additions & 2 deletions loader/icd_dispatch.c
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,12 @@ clGetICDLoaderInfoOCLICD(
static const char cl_icdl_NAME[] = OPENCL_ICD_LOADER_NAME_STRING;
static const char cl_icdl_VENDOR[] = OPENCL_ICD_LOADER_VENDOR_STRING;
size_t pvs;
void * pv;
const void * pv = NULL;

#define KHR_ICD_CASE_STRING_PARAM_NAME(name) \
case CL_ICDL_ ## name: \
pvs = strlen(cl_icdl_ ## name) + 1; \
pv = (void *)cl_icdl_ ## name; \
pv = (const void *)cl_icdl_ ## name; \
break

switch (param_name) {
Expand Down
2 changes: 1 addition & 1 deletion loader/linux/icd_linux.c
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ struct dirElem
static int compareDirElem(const void *a, const void *b)
{
// sort files the same way libc alpahnumerically sorts directory entries.
return strcoll(((struct dirElem *)a)->d_name, ((struct dirElem *)b)->d_name);
return strcoll(((const struct dirElem *)a)->d_name, ((const struct dirElem *)b)->d_name);
}

static inline void khrIcdOsDirEnumerate(const char *path, const char *env,
Expand Down

0 comments on commit 78af7ae

Please sign in to comment.