diff --git a/loader/icd.c b/loader/icd.c index bbd6ec3a..8128ca7d 100644 --- a/loader/icd.c +++ b/loader/icd.c @@ -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; diff --git a/loader/icd_dispatch.c b/loader/icd_dispatch.c index 3eb18d27..51ec52d6 100644 --- a/loader/icd_dispatch.c +++ b/loader/icd_dispatch.c @@ -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) { diff --git a/loader/linux/icd_linux.c b/loader/linux/icd_linux.c index 44915fe1..265215eb 100644 --- a/loader/linux/icd_linux.c +++ b/loader/linux/icd_linux.c @@ -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,