http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/src/framework.c ---------------------------------------------------------------------- diff --git a/framework/private/src/framework.c b/framework/private/src/framework.c index 93db610..26177eb 100644 --- a/framework/private/src/framework.c +++ b/framework/private/src/framework.c @@ -67,12 +67,12 @@ bool framework_releaseBundleLock(framework_pt framework, bundle_pt bundle); bool framework_acquireGlobalLock(framework_pt framework); celix_status_t framework_releaseGlobalLock(framework_pt framework); -celix_status_t framework_acquireInstallLock(framework_pt framework, char * location); -celix_status_t framework_releaseInstallLock(framework_pt framework, char * location); +celix_status_t framework_acquireInstallLock(framework_pt framework, const char* location); +celix_status_t framework_releaseInstallLock(framework_pt framework, const char* location); long framework_getNextBundleId(framework_pt framework); -celix_status_t fw_installBundle2(framework_pt framework, bundle_pt * bundle, long id, char * location, char *inputFile, bundle_archive_pt archive); +celix_status_t fw_installBundle2(framework_pt framework, bundle_pt * bundle, long id, const char * location, const char *inputFile, bundle_archive_pt archive); celix_status_t fw_refreshBundles(framework_pt framework, bundle_pt bundles[], int size); celix_status_t fw_refreshBundle(framework_pt framework, bundle_pt bundle); @@ -87,8 +87,8 @@ celix_status_t fw_invokeBundleListener(framework_pt framework, bundle_listener_p celix_status_t fw_invokeFrameworkListener(framework_pt framework, framework_listener_pt listener, framework_event_pt event, bundle_pt bundle); static celix_status_t framework_loadBundleLibraries(framework_pt framework, bundle_pt bundle); -static celix_status_t framework_loadLibraries(framework_pt framework, char *libraries, char *activator, bundle_archive_pt archive, void **activatorHandle); -static celix_status_t framework_loadLibrary(framework_pt framework, char *library, bundle_archive_pt archive, void **handle); +static celix_status_t framework_loadLibraries(framework_pt framework, const char* libraries, const char* activator, bundle_archive_pt archive, void **activatorHandle); +static celix_status_t framework_loadLibrary(framework_pt framework, const char* library, bundle_archive_pt archive, void **handle); static celix_status_t frameworkActivator_start(void * userData, bundle_context_pt context); static celix_status_t frameworkActivator_stop(void * userData, bundle_context_pt context); @@ -344,7 +344,7 @@ celix_status_t framework_destroy(framework_pt framework) { celix_status_t fw_init(framework_pt framework) { bundle_state_e state; - char *location = NULL; + const char *location = NULL; module_pt module = NULL; linked_list_pt wires = NULL; array_list_pt archives = NULL; @@ -418,7 +418,7 @@ celix_status_t fw_init(framework_pt framework) { bundleArchive_closeAndDelete(archive1); } else { bundle_pt bundle = NULL; - char *location1 = NULL; + const char *location1 = NULL; status = bundleArchive_getLocation(archive1, &location1); fw_installBundle2(framework, &bundle, id, location1, NULL, archive1); } @@ -535,11 +535,11 @@ celix_status_t fw_getProperty(framework_pt framework, const char *name, const ch return status; } -celix_status_t fw_installBundle(framework_pt framework, bundle_pt * bundle, char * location, char *inputFile) { +celix_status_t fw_installBundle(framework_pt framework, bundle_pt * bundle, const char * location, const char *inputFile) { return fw_installBundle2(framework, bundle, -1, location, inputFile, NULL); } -celix_status_t fw_installBundle2(framework_pt framework, bundle_pt * bundle, long id, char * location, char *inputFile, bundle_archive_pt archive) { +celix_status_t fw_installBundle2(framework_pt framework, bundle_pt * bundle, long id, const char * location, const char *inputFile, bundle_archive_pt archive) { celix_status_t status = CELIX_SUCCESS; // bundle_archive_pt bundle_archive = NULL; bundle_state_e state = OSGI_FRAMEWORK_BUNDLE_UNKNOWN; @@ -607,12 +607,12 @@ celix_status_t fw_installBundle2(framework_pt framework, bundle_pt * bundle, lon return status; } -celix_status_t framework_getBundleEntry(framework_pt framework, bundle_pt bundle, char *name, char **entry) { +celix_status_t framework_getBundleEntry(framework_pt framework, bundle_pt bundle, const char* name, const char** entry) { celix_status_t status = CELIX_SUCCESS; bundle_revision_pt revision; bundle_archive_pt archive = NULL; - char *root; + const char *root; status = CELIX_DO_IF(status, bundle_getArchive(bundle, &archive)); status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision)); @@ -647,7 +647,7 @@ celix_status_t fw_startBundle(framework_pt framework, bundle_pt bundle, int opti module_pt module = NULL; activator_pt activator = NULL; char *error = NULL; - char *name = NULL; + const char *name = NULL; status = CELIX_DO_IF(status, framework_acquireBundleLock(framework, bundle, OSGI_FRAMEWORK_BUNDLE_INSTALLED|OSGI_FRAMEWORK_BUNDLE_RESOLVED|OSGI_FRAMEWORK_BUNDLE_STARTING|OSGI_FRAMEWORK_BUNDLE_ACTIVE)); status = CELIX_DO_IF(status, bundle_getState(bundle, &state)); @@ -742,7 +742,7 @@ celix_status_t fw_startBundle(framework_pt framework, bundle_pt bundle, int opti if (status != CELIX_SUCCESS) { module_pt module = NULL; - char *symbolicName = NULL; + const char *symbolicName = NULL; long id = 0; bundle_getCurrentModule(bundle, &module); module_getSymbolicName(module, &symbolicName); @@ -760,10 +760,10 @@ celix_status_t fw_startBundle(framework_pt framework, bundle_pt bundle, int opti return status; } -celix_status_t framework_updateBundle(framework_pt framework, bundle_pt bundle, char *inputFile) { +celix_status_t framework_updateBundle(framework_pt framework, bundle_pt bundle, const char *inputFile) { celix_status_t status = CELIX_SUCCESS; bundle_state_e oldState; - char *location; + const char *location; bundle_archive_pt archive = NULL; char *error = NULL; @@ -819,7 +819,7 @@ celix_status_t framework_updateBundle(framework_pt framework, bundle_pt bundle, if (status != CELIX_SUCCESS) { module_pt module = NULL; - char *symbolicName = NULL; + const char *symbolicName = NULL; long id = 0; bundle_getCurrentModule(bundle, &module); module_getSymbolicName(module, &symbolicName); @@ -901,7 +901,7 @@ celix_status_t fw_stopBundle(framework_pt framework, bundle_pt bundle, bool reco status = CELIX_DO_IF(status, serviceRegistry_clearServiceRegistrations(framework->registry, bundle)); if (status == CELIX_SUCCESS) { module_pt module = NULL; - char *symbolicName = NULL; + const char *symbolicName = NULL; long id = 0; bundle_getCurrentModule(bundle, &module); module_getSymbolicName(module, &symbolicName); @@ -930,7 +930,7 @@ celix_status_t fw_stopBundle(framework_pt framework, bundle_pt bundle, bool reco if (status != CELIX_SUCCESS) { module_pt module = NULL; - char *symbolicName = NULL; + const char *symbolicName = NULL; long id = 0; bundle_getCurrentModule(bundle, &module); module_getSymbolicName(module, &symbolicName); @@ -951,7 +951,7 @@ celix_status_t fw_uninstallBundle(framework_pt framework, bundle_pt bundle) { celix_status_t status = CELIX_SUCCESS; bool locked; bundle_archive_pt archive = NULL; - char * location = NULL; + const char * location = NULL; bundle_pt target = NULL; char *error = NULL; @@ -1277,7 +1277,7 @@ celix_status_t fw_registerService(framework_pt framework, service_registration_p info->context = lContext; info->removed = false; } - subs = CELIX_DO_IF(subs, filter_getString(listener->filter, &info->filter)); + subs = CELIX_DO_IF(subs, filter_getString(listener->filter, (const char**)&info->filter)); if (subs == CELIX_SUCCESS) { arrayList_add(infos, info); @@ -1332,7 +1332,7 @@ celix_status_t fw_registerServiceFactory(framework_pt framework, service_registr return CELIX_SUCCESS; } -celix_status_t fw_getServiceReferences(framework_pt framework, array_list_pt *references, bundle_pt bundle, const char * serviceName, char * sfilter) { +celix_status_t fw_getServiceReferences(framework_pt framework, array_list_pt *references, bundle_pt bundle, const char * serviceName, const char * sfilter) { celix_status_t status = CELIX_SUCCESS; filter_pt filter = NULL; @@ -1466,7 +1466,7 @@ void fw_removeServiceListener(framework_pt framework, bundle_pt bundle, service_ info->context = lContext; // TODO Filter toString; - filter_getString(element->filter, &info->filter); + filter_getString(element->filter, (const char**)&info->filter); info->removed = true; arrayList_remove(framework->serviceListeners, i); @@ -1773,7 +1773,7 @@ celix_status_t framework_markResolvedModules(framework_pt framework, linked_list module_setResolved(module); resolver_moduleResolved(module); - char *mname = NULL; + const char *mname = NULL; module_getSymbolicName(module, &mname); framework_markBundleResolved(framework, module); linkedListIterator_remove(iterator); @@ -1811,7 +1811,7 @@ celix_status_t framework_markBundleResolved(framework_pt framework, module_pt mo if (status != CELIX_SUCCESS) { module_pt module = NULL; - char *symbolicName = NULL; + const char *symbolicName = NULL; long id = 0; module_getSymbolicName(module, &symbolicName); bundle_getBundleId(bundle, &id); @@ -1847,7 +1847,7 @@ array_list_pt framework_getBundles(framework_pt framework) { return bundles; } -bundle_pt framework_getBundle(framework_pt framework, char * location) { +bundle_pt framework_getBundle(framework_pt framework, const char* location) { celixThreadMutex_lock(&framework->installedBundleMapLock); bundle_pt bundle = (bundle_pt) hashMap_get(framework->installedBundleMap, location); celixThreadMutex_unlock(&framework->installedBundleMapLock); @@ -1875,20 +1875,20 @@ bundle_pt framework_getBundleById(framework_pt framework, long id) { return bundle; } -celix_status_t framework_acquireInstallLock(framework_pt framework, char * location) { +celix_status_t framework_acquireInstallLock(framework_pt framework, const char * location) { celixThreadMutex_lock(&framework->installRequestLock); while (hashMap_get(framework->installRequestMap, location) != NULL) { celixThreadCondition_wait(&framework->condition, &framework->installRequestLock); } - hashMap_put(framework->installRequestMap, location, location); + hashMap_put(framework->installRequestMap, (char*)location, (char*)location); celixThreadMutex_unlock(&framework->installRequestLock); return CELIX_SUCCESS; } -celix_status_t framework_releaseInstallLock(framework_pt framework, char * location) { +celix_status_t framework_releaseInstallLock(framework_pt framework, const char* location) { celixThreadMutex_lock(&framework->installRequestLock); hashMap_remove(framework->installRequestMap, location); @@ -2222,7 +2222,7 @@ celix_status_t fw_fireBundleEvent(framework_pt framework, bundle_event_type_e ev status = bundle_getCurrentModule(bundle, &module); if (status == CELIX_SUCCESS) { - char *symbolicName = NULL; + const char *symbolicName = NULL; status = module_getSymbolicName(module, &symbolicName); if (status == CELIX_SUCCESS) { request->bundleSymbolicName = strdup(symbolicName); @@ -2282,7 +2282,7 @@ celix_status_t fw_fireFrameworkEvent(framework_pt framework, framework_event_typ status = bundle_getCurrentModule(bundle, &module); if (status == CELIX_SUCCESS) { - char *symbolicName = NULL; + const char *symbolicName = NULL; status = module_getSymbolicName(module, &symbolicName); if (status == CELIX_SUCCESS) { request->bundleSymbolicName = strdup(symbolicName); @@ -2466,9 +2466,9 @@ static celix_status_t framework_loadBundleLibraries(framework_pt framework, bund status = CELIX_DO_IF(status, bundleArchive_getCurrentRevision(archive, &revision)); status = CELIX_DO_IF(status, bundleRevision_getManifest(revision, &manifest)); if (status == CELIX_SUCCESS) { - char *privateLibraries = NULL; - char *exportLibraries = NULL; - char *activator = NULL; + const char *privateLibraries = NULL; + const char *exportLibraries = NULL; + const char *activator = NULL; privateLibraries = manifest_getValue(manifest, OSGI_FRAMEWORK_PRIVATE_LIBRARY); exportLibraries = manifest_getValue(manifest, OSGI_FRAMEWORK_EXPORT_LIBRARY); @@ -2497,11 +2497,12 @@ static celix_status_t framework_loadBundleLibraries(framework_pt framework, bund } // TODO Store all handles for unloading! -static celix_status_t framework_loadLibraries(framework_pt framework, char *libraries, char *activator, bundle_archive_pt archive, void **activatorHandle) { +static celix_status_t framework_loadLibraries(framework_pt framework, const char *librariesIn, const char *activator, bundle_archive_pt archive, void **activatorHandle) { celix_status_t status = CELIX_SUCCESS; - char *last; - char *token = strtok_r(libraries, ",", &last); + char* last; + char* libraries = strndup(librariesIn, 1024*10); + char* token = strtok_r(libraries, ",", &last); while (token != NULL) { void *handle = NULL; char lib[128]; @@ -2545,10 +2546,11 @@ static celix_status_t framework_loadLibraries(framework_pt framework, char *libr framework_logIfError(framework->logger, status, NULL, "Could not load all libraries"); + free(libraries); return status; } -static celix_status_t framework_loadLibrary(framework_pt framework, char *library, bundle_archive_pt archive, void **handle) { +static celix_status_t framework_loadLibrary(framework_pt framework, const char *library, bundle_archive_pt archive, void **handle) { celix_status_t status = CELIX_SUCCESS; char *error = NULL; @@ -2565,7 +2567,7 @@ static celix_status_t framework_loadLibrary(framework_pt framework, char *librar char libraryPath[256]; long refreshCount = 0; - char *archiveRoot = NULL; + const char *archiveRoot = NULL; long revisionNumber = 0; status = CELIX_DO_IF(status, bundleArchive_getRefreshCount(archive, &refreshCount));
http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/src/manifest.c ---------------------------------------------------------------------- diff --git a/framework/private/src/manifest.c b/framework/private/src/manifest.c index 5ee13ad..7e24aec 100644 --- a/framework/private/src/manifest.c +++ b/framework/private/src/manifest.c @@ -63,7 +63,7 @@ celix_status_t manifest_destroy(manifest_pt manifest) { return CELIX_SUCCESS; } -celix_status_t manifest_createFromFile(char *filename, manifest_pt *manifest) { +celix_status_t manifest_createFromFile(const char *filename, manifest_pt *manifest) { celix_status_t status; status = manifest_create(manifest); @@ -90,7 +90,7 @@ celix_status_t manifest_getEntries(manifest_pt manifest, hash_map_pt *map) { return CELIX_SUCCESS; } -celix_status_t manifest_read(manifest_pt manifest, char *filename) { +celix_status_t manifest_read(manifest_pt manifest, const char *filename) { celix_status_t status = CELIX_SUCCESS; FILE *file = fopen ( filename, "r" ); @@ -182,14 +182,14 @@ celix_status_t manifest_read(manifest_pt manifest, char *filename) { return status; } -void manifest_write(manifest_pt manifest, char * filename) { +void manifest_write(manifest_pt manifest, const char * filename) { } -char * manifest_getValue(manifest_pt manifest, const char * name) { +const char* manifest_getValue(manifest_pt manifest, const char* name) { const char* val = properties_get(manifest->mainAttributes, name); bool isEmpty = utils_isStringEmptyOrNull(val); - return isEmpty ? NULL : (char*)val; + return isEmpty ? NULL : val; } int fpeek(FILE *stream) { http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/src/manifest_parser.c ---------------------------------------------------------------------- diff --git a/framework/private/src/manifest_parser.c b/framework/private/src/manifest_parser.c index 1c0735a..07b40a8 100644 --- a/framework/private/src/manifest_parser.c +++ b/framework/private/src/manifest_parser.c @@ -49,11 +49,11 @@ struct manifestParser { linked_list_pt requirements; }; -static linked_list_pt manifestParser_parseImportHeader(char * header); -static linked_list_pt manifestParser_parseExportHeader(module_pt module, char * header); -static linked_list_pt manifestParser_parseDelimitedString(char * value, char * delim); -static linked_list_pt manifestParser_parseStandardHeaderClause(char * clauseString); -static linked_list_pt manifestParser_parseStandardHeader(char * header); +static linked_list_pt manifestParser_parseImportHeader(const char* header); +static linked_list_pt manifestParser_parseExportHeader(module_pt module, const char* header); +static linked_list_pt manifestParser_parseDelimitedString(const char* value, const char* delim); +static linked_list_pt manifestParser_parseStandardHeaderClause(const char* clauseString); +static linked_list_pt manifestParser_parseStandardHeader(const char* header); celix_status_t manifestParser_create(module_pt owner, manifest_pt manifest, manifest_parser_pt *manifest_parser) { celix_status_t status; @@ -62,8 +62,8 @@ celix_status_t manifestParser_create(module_pt owner, manifest_pt manifest, mani status = CELIX_SUCCESS; parser = (manifest_parser_pt) malloc(sizeof(*parser)); if (parser) { - char * bundleVersion = NULL; - char * bundleSymbolicName = NULL; + const char * bundleVersion = NULL; + const char * bundleSymbolicName = NULL; parser->manifest = manifest; parser->owner = owner; @@ -77,7 +77,7 @@ celix_status_t manifestParser_create(module_pt owner, manifest_pt manifest, mani } bundleSymbolicName = manifest_getValue(manifest, OSGI_FRAMEWORK_BUNDLE_SYMBOLICNAME); if (bundleSymbolicName != NULL) { - parser->bundleSymbolicName = bundleSymbolicName; + parser->bundleSymbolicName = (char*)bundleSymbolicName; } parser->capabilities = manifestParser_parseExportHeader(owner, manifest_getValue(manifest, OSGI_FRAMEWORK_EXPORT_LIBRARY)); @@ -111,7 +111,7 @@ celix_status_t manifestParser_destroy(manifest_parser_pt mp) { return CELIX_SUCCESS; } -static linked_list_pt manifestParser_parseDelimitedString(char * value, char * delim) { +static linked_list_pt manifestParser_parseDelimitedString(const char * value, const char * delim) { linked_list_pt list; if (linkedList_create(&list) == CELIX_SUCCESS) { @@ -169,7 +169,7 @@ static linked_list_pt manifestParser_parseDelimitedString(char * value, char * d return list; } -static linked_list_pt manifestParser_parseStandardHeaderClause(char * clauseString) { +static linked_list_pt manifestParser_parseStandardHeaderClause(const char * clauseString) { linked_list_pt paths = NULL; linked_list_pt clause = NULL; linked_list_pt pieces = NULL; @@ -312,7 +312,7 @@ static linked_list_pt manifestParser_parseStandardHeaderClause(char * clauseStri return clause; } -static linked_list_pt manifestParser_parseStandardHeader(char * header) { +static linked_list_pt manifestParser_parseStandardHeader(const char * header) { linked_list_pt clauseStrings = NULL; linked_list_pt completeList = NULL; @@ -341,7 +341,7 @@ static linked_list_pt manifestParser_parseStandardHeader(char * header) { return completeList; } -static linked_list_pt manifestParser_parseImportHeader(char * header) { +static linked_list_pt manifestParser_parseImportHeader(const char * header) { linked_list_pt clauses = NULL; linked_list_pt requirements = NULL; bool failure = false; @@ -403,7 +403,7 @@ static linked_list_pt manifestParser_parseImportHeader(char * header) { return requirements; } -static linked_list_pt manifestParser_parseExportHeader(module_pt module, char * header) { +static linked_list_pt manifestParser_parseExportHeader(module_pt module, const char * header) { linked_list_pt clauses = NULL; linked_list_pt capabilities = NULL; int clauseIdx; @@ -464,8 +464,8 @@ static linked_list_pt manifestParser_parseExportHeader(module_pt module, char * return capabilities; } -celix_status_t manifestParser_getSymbolicName(manifest_parser_pt parser, char **symbolicName) { - *symbolicName = strdup(parser->bundleSymbolicName); +celix_status_t manifestParser_getAndDuplicateSymbolicName(manifest_parser_pt parser, char **symbolicName) { + *symbolicName = strndup(parser->bundleSymbolicName, 1024*10); return CELIX_SUCCESS; } http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/src/miniunz.c ---------------------------------------------------------------------- diff --git a/framework/private/src/miniunz.c b/framework/private/src/miniunz.c index a308e47..c3a9bd1 100644 --- a/framework/private/src/miniunz.c +++ b/framework/private/src/miniunz.c @@ -333,7 +333,7 @@ int do_extract(unzFile uf, char * revisionRoot) { return 0; } -celix_status_t extractBundle(char * bundleName, char * revisionRoot) { +celix_status_t extractBundle(const char* bundleName, const char* revisionRoot) { celix_status_t status = CELIX_SUCCESS; char filename_try[MAXFILENAME+16] = ""; unzFile uf=NULL; @@ -371,7 +371,7 @@ celix_status_t extractBundle(char * bundleName, char * revisionRoot) { printf("Cannot open %s or %s.zip\n",bundleName,bundleName); status = CELIX_FILE_IO_EXCEPTION; } else { - if (do_extract(uf, revisionRoot) != 0) { + if (do_extract(uf, (char*)revisionRoot) != 0) { status = CELIX_FILE_IO_EXCEPTION; } http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/src/module.c ---------------------------------------------------------------------- diff --git a/framework/private/src/module.c b/framework/private/src/module.c index 17fea5c..6d64f9f 100644 --- a/framework/private/src/module.c +++ b/framework/private/src/module.c @@ -48,7 +48,7 @@ struct module { struct bundle * bundle; }; -module_pt module_create(manifest_pt headerMap, char * moduleId, bundle_pt bundle) { +module_pt module_create(manifest_pt headerMap, const char * moduleId, bundle_pt bundle) { module_pt module = NULL; manifest_parser_pt mp; @@ -64,7 +64,7 @@ module_pt module_create(manifest_pt headerMap, char * moduleId, bundle_pt bundle if (manifestParser_create(module, headerMap, &mp) == CELIX_SUCCESS) { module->symbolicName = NULL; - manifestParser_getSymbolicName(mp, &module->symbolicName); + manifestParser_getAndDuplicateSymbolicName(mp, &module->symbolicName); module->version = NULL; manifestParser_getBundleVersion(mp, &module->version); @@ -151,12 +151,12 @@ void module_destroy(module_pt module) { free(module); } -wire_pt module_getWire(module_pt module, char * serviceName) { +wire_pt module_getWire(module_pt module, const char * serviceName) { wire_pt wire = NULL; if (module->wires != NULL) { linked_list_iterator_pt iterator = linkedListIterator_create(module->wires, 0); while (linkedListIterator_hasNext(iterator)) { - char *name; + const char* name; wire_pt next = linkedListIterator_next(iterator); capability_pt cap = NULL; wire_getCapability(next, &cap); @@ -174,7 +174,7 @@ version_pt module_getVersion(module_pt module) { return module->version; } -celix_status_t module_getSymbolicName(module_pt module, char **symbolicName) { +celix_status_t module_getSymbolicName(module_pt module, const char **symbolicName) { celix_status_t status = CELIX_SUCCESS; if (module == NULL || *symbolicName != NULL) { http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/src/requirement.c ---------------------------------------------------------------------- diff --git a/framework/private/src/requirement.c b/framework/private/src/requirement.c index 375ede2..7ce585c 100644 --- a/framework/private/src/requirement.c +++ b/framework/private/src/requirement.c @@ -90,7 +90,7 @@ celix_status_t requirement_getVersionRange(requirement_pt requirement, version_r return CELIX_SUCCESS; } -celix_status_t requirement_getTargetName(requirement_pt requirement, char **targetName) { +celix_status_t requirement_getTargetName(requirement_pt requirement, const char **targetName) { *targetName = requirement->targetName; return CELIX_SUCCESS; } http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/src/resolver.c ---------------------------------------------------------------------- diff --git a/framework/private/src/resolver.c b/framework/private/src/resolver.c index f9c1227..256eff5 100644 --- a/framework/private/src/resolver.c +++ b/framework/private/src/resolver.c @@ -55,7 +55,7 @@ linked_list_pt m_unresolvedServices = NULL; linked_list_pt m_resolvedServices = NULL; int resolver_populateCandidatesMap(hash_map_pt candidatesMap, module_pt targetModule); -capability_list_pt resolver_getCapabilityList(linked_list_pt list, char * name); +capability_list_pt resolver_getCapabilityList(linked_list_pt list, const char* name); void resolver_removeInvalidCandidate(module_pt module, hash_map_pt candidates, linked_list_pt invalid); linked_list_pt resolver_populateWireMap(hash_map_pt candidates, module_pt importer, linked_list_pt wireMap); @@ -134,7 +134,7 @@ int resolver_populateCandidatesMap(hash_map_pt candidatesMap, module_pt targetMo for (i = 0; i < linkedList_size(module_getRequirements(targetModule)); i++) { capability_list_pt capList; requirement_pt req; - char *targetName = NULL; + const char *targetName = NULL; req = (requirement_pt) linkedList_get(module_getRequirements(targetModule), i); requirement_getTargetName(req, &targetName); capList = resolver_getCapabilityList(m_resolvedServices, targetName); @@ -176,7 +176,7 @@ int resolver_populateCandidatesMap(hash_map_pt candidatesMap, module_pt targetMo if (linkedList_size(candidates) == 0) { if (linkedList_create(&invalid) == CELIX_SUCCESS) { - char *name = NULL; + const char *name = NULL; resolver_removeInvalidCandidate(targetModule, candidatesMap, invalid); module_getSymbolicName(targetModule, &name); @@ -258,7 +258,7 @@ void resolver_addModule(module_pt module) { linkedList_addElement(m_modules, module); for (i = 0; i < linkedList_size(module_getCapabilities(module)); i++) { - char *serviceName = NULL; + const char *serviceName = NULL; capability_list_pt list = NULL; capability_pt cap; @@ -294,7 +294,7 @@ void resolver_removeModule(module_pt module) { int i = 0; for (i = 0; i < linkedList_size(caps); i++) { capability_pt cap = (capability_pt) linkedList_get(caps, i); - char *serviceName = NULL; + const char *serviceName = NULL; capability_list_pt list; capability_getServiceName(cap, &serviceName); list = resolver_getCapabilityList(m_unresolvedServices, serviceName); @@ -351,7 +351,7 @@ void resolver_moduleResolved(module_pt module) { for (capIdx = 0; (module_getCapabilities(module) != NULL) && (capIdx < linkedList_size(module_getCapabilities(module))); capIdx++) { capability_pt cap = (capability_pt) linkedList_get(module_getCapabilities(module), capIdx); - char *serviceName = NULL; + const char *serviceName = NULL; capability_list_pt list; capability_getServiceName(cap, &serviceName); list = resolver_getCapabilityList(m_unresolvedServices, serviceName); @@ -384,7 +384,7 @@ void resolver_moduleResolved(module_pt module) { capability_pt cap = linkedList_get(capsCopy, capIdx); if (cap != NULL) { - char *serviceName = NULL; + const char *serviceName = NULL; capability_list_pt list = NULL; capability_getServiceName(cap, &serviceName); @@ -414,7 +414,7 @@ void resolver_moduleResolved(module_pt module) { } } -capability_list_pt resolver_getCapabilityList(linked_list_pt list, char * name) { +capability_list_pt resolver_getCapabilityList(linked_list_pt list, const char * name) { capability_list_pt capabilityList = NULL; linked_list_iterator_pt iterator = linkedListIterator_create(list, 0); while (linkedListIterator_hasNext(iterator)) { @@ -461,7 +461,7 @@ linked_list_pt resolver_populateWireMap(hash_map_pt candidates, module_pt import // hashMap_put(wireMap, importer, emptyWires); - char *mname = NULL; + const char *mname = NULL; module_getSymbolicName(importer, &mname); importer_wires_pt importerWires = malloc(sizeof(*importerWires)); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/src/service_reference.c ---------------------------------------------------------------------- diff --git a/framework/private/src/service_reference.c b/framework/private/src/service_reference.c index 2f75973..e51fa7b 100644 --- a/framework/private/src/service_reference.c +++ b/framework/private/src/service_reference.c @@ -279,9 +279,9 @@ celix_status_t serviceReference_equals(service_reference_pt reference, service_r return status; } -int serviceReference_equals2(void *reference1, void *reference2) { +int serviceReference_equals2(const void* reference1, const void* reference2) { bool equal; - serviceReference_equals(reference1, reference2, &equal); + serviceReference_equals((service_reference_pt)reference1, (service_reference_pt)reference2, &equal); return equal; } @@ -312,8 +312,8 @@ celix_status_t serviceReference_compareTo(service_reference_pt reference, servic return status; } -unsigned int serviceReference_hashCode(void *referenceP) { - service_reference_pt ref = referenceP; +unsigned int serviceReference_hashCode(const void *referenceP) { + service_reference_pt ref = (service_reference_pt)referenceP; bundle_pt bundle = NULL; service_registration_pt reg = NULL; http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/src/service_registration.c ---------------------------------------------------------------------- diff --git a/framework/private/src/service_registration.c b/framework/private/src/service_registration.c index 63d2c91..22e4b9a 100644 --- a/framework/private/src/service_registration.c +++ b/framework/private/src/service_registration.c @@ -264,7 +264,7 @@ celix_status_t serviceRegistration_getBundle(service_registration_pt registratio return status; } -celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, char **serviceName) { +celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, const char **serviceName) { celix_status_t status = CELIX_SUCCESS; if (registration != NULL && *serviceName == NULL) { http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/src/service_registry.c ---------------------------------------------------------------------- diff --git a/framework/private/src/service_registry.c b/framework/private/src/service_registry.c index db00934..c3a73ab 100644 --- a/framework/private/src/service_registry.c +++ b/framework/private/src/service_registry.c @@ -271,7 +271,7 @@ celix_status_t serviceRegistry_clearServiceRegistrations(service_registry_pt reg } static void serviceRegistry_logWarningServiceRegistration(service_registry_pt registry __attribute__((unused)), service_registration_pt reg) { - char *servName = NULL; + const char *servName = NULL; serviceRegistration_getServiceName(reg, &servName); fw_log(logger, OSGI_FRAMEWORK_LOG_WARNING, "Dangling service registration for service %s. Look for missing serviceRegistration_unregister calls.", servName); } @@ -356,7 +356,7 @@ celix_status_t serviceRegistry_getServiceReferences(service_registry_pt registry if ((serviceName == NULL) && ((filter == NULL) || matchResult)) { matched = true; } else if (serviceName != NULL) { - char *className = NULL; + const char *className = NULL; matchResult = false; serviceRegistration_getServiceName(registration, &className); if (filter != NULL) { http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/src/service_tracker.c ---------------------------------------------------------------------- diff --git a/framework/private/src/service_tracker.c b/framework/private/src/service_tracker.c index 06a6ab1..a926d71 100644 --- a/framework/private/src/service_tracker.c +++ b/framework/private/src/service_tracker.c @@ -46,7 +46,7 @@ static celix_status_t serviceTracker_invokeModifiedService(service_tracker_pt tr static celix_status_t serviceTracker_invokeRemovingService(service_tracker_pt tracker, service_reference_pt ref, void *service); -celix_status_t serviceTracker_create(bundle_context_pt context, char * service, service_tracker_customizer_pt customizer, service_tracker_pt *tracker) { +celix_status_t serviceTracker_create(bundle_context_pt context, const char * service, service_tracker_customizer_pt customizer, service_tracker_pt *tracker) { celix_status_t status = CELIX_SUCCESS; if (service == NULL || *tracker != NULL) { @@ -64,7 +64,7 @@ celix_status_t serviceTracker_create(bundle_context_pt context, char * service, return status; } -celix_status_t serviceTracker_createWithFilter(bundle_context_pt context, char * filter, service_tracker_customizer_pt customizer, service_tracker_pt *tracker) { +celix_status_t serviceTracker_createWithFilter(bundle_context_pt context, const char * filter, service_tracker_customizer_pt customizer, service_tracker_pt *tracker) { celix_status_t status = CELIX_SUCCESS; *tracker = (service_tracker_pt) malloc(sizeof(**tracker)); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/src/utils.c ---------------------------------------------------------------------- diff --git a/framework/private/src/utils.c b/framework/private/src/utils.c index 5998531..1386046 100644 --- a/framework/private/src/utils.c +++ b/framework/private/src/utils.c @@ -28,8 +28,8 @@ #include "utils.h" -unsigned int utils_stringHash(void * strPtr) { - char * string = strPtr; +unsigned int utils_stringHash(const void* strPtr) { + const char* string = strPtr; unsigned int hash = 5381; unsigned int i = 0; unsigned int len = strlen(string); @@ -40,8 +40,8 @@ unsigned int utils_stringHash(void * strPtr) { return hash; } -int utils_stringEquals(void * string, void * toCompare) { - return strcmp((char *)string, (char *) toCompare) == 0; +int utils_stringEquals(const void* string, const void* toCompare) { + return strcmp((const char*)string, (const char*)toCompare) == 0; } char * string_ndup(const char *s, size_t n) { @@ -113,7 +113,7 @@ celix_status_t thread_equalsSelf(celix_thread_t thread, bool *equals) { return status; } -celix_status_t utils_isNumeric(char *number, bool *ret) { +celix_status_t utils_isNumeric(const char *number, bool *ret) { celix_status_t status = CELIX_SUCCESS; *ret = true; while(*number) { http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/test/bundle_revision_test.cpp ---------------------------------------------------------------------- diff --git a/framework/private/test/bundle_revision_test.cpp b/framework/private/test/bundle_revision_test.cpp index c9fb567..5e9320d 100644 --- a/framework/private/test/bundle_revision_test.cpp +++ b/framework/private/test/bundle_revision_test.cpp @@ -121,8 +121,8 @@ TEST(bundle_revision, getters) { revision->manifest = expectedManifest; revision->libraryHandles = handles; - char *actualRoot = NULL; - char *actualLocation = NULL; + const char *actualRoot = NULL; + const char *actualLocation = NULL; long actualRevisionNr = 0l; manifest_pt actualManifest = NULL; array_list_pt actualHandles = NULL; http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/test/bundle_test.cpp ---------------------------------------------------------------------- diff --git a/framework/private/test/bundle_test.cpp b/framework/private/test/bundle_test.cpp index 5dfb2be..af406b1 100644 --- a/framework/private/test/bundle_test.cpp +++ b/framework/private/test/bundle_test.cpp @@ -316,7 +316,7 @@ TEST(bundle, getEntry) { .withOutputParameterReturning("entry", &expected, sizeof(expected)) .andReturnValue(CELIX_SUCCESS); - char *actual = NULL; + const char *actual = NULL; celix_status_t status = bundle_getEntry(bundle, name, &actual); LONGS_EQUAL(CELIX_SUCCESS, status); POINTERS_EQUAL(expected, actual); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/test/capability_test.cpp ---------------------------------------------------------------------- diff --git a/framework/private/test/capability_test.cpp b/framework/private/test/capability_test.cpp index b3bd61f..f948ac3 100644 --- a/framework/private/test/capability_test.cpp +++ b/framework/private/test/capability_test.cpp @@ -130,7 +130,7 @@ TEST(capability, getServiceName) { char serviceName[] = "service"; capability->serviceName = serviceName; - char *actual = NULL; + const char *actual = NULL; capability_getServiceName(capability, &actual); STRCMP_EQUAL(serviceName, actual); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/test/filter_test.cpp ---------------------------------------------------------------------- diff --git a/framework/private/test/filter_test.cpp b/framework/private/test/filter_test.cpp index bf07fc6..c9b1ca5 100644 --- a/framework/private/test/filter_test.cpp +++ b/framework/private/test/filter_test.cpp @@ -544,7 +544,7 @@ TEST(filter, getString){ char * filter_str = my_strdup("(&(test_attr1=attr1)(|(test_attr2=attr2)(test_attr3=attr3)))"); filter_pt filter = filter_create(filter_str); - char * get_str; + const char * get_str; filter_getString(filter, &get_str); //cleanup http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/test/manifest_parser_test.cpp ---------------------------------------------------------------------- diff --git a/framework/private/test/manifest_parser_test.cpp b/framework/private/test/manifest_parser_test.cpp index 598b95a..d3fdbbf 100644 --- a/framework/private/test/manifest_parser_test.cpp +++ b/framework/private/test/manifest_parser_test.cpp @@ -151,7 +151,7 @@ TEST(manifest_parser, create){ version_pt get_version; linked_list_pt get_caps; linked_list_pt get_reqs; - char * get_bundle_name; + char* get_bundle_name; celix_status_t status; mock().expectOneCall("version_clone") @@ -199,7 +199,7 @@ TEST(manifest_parser, create){ } - status = manifestParser_getSymbolicName(parser, &get_bundle_name); + status = manifestParser_getAndDuplicateSymbolicName(parser, &get_bundle_name); LONGS_EQUAL(CELIX_SUCCESS, status); STRCMP_EQUAL(bundle_name, get_bundle_name); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/test/manifest_test.cpp ---------------------------------------------------------------------- diff --git a/framework/private/test/manifest_test.cpp b/framework/private/test/manifest_test.cpp index 7753c76..5138fa5 100644 --- a/framework/private/test/manifest_test.cpp +++ b/framework/private/test/manifest_test.cpp @@ -192,7 +192,7 @@ TEST(manifest, createFromFileWithSections) { properties_pt main = manifest_getMainAttributes(manifest); POINTERS_EQUAL(properties, main); - char *name = manifest_getValue(manifest, "Bundle-SymbolicName"); + const char *name = manifest_getValue(manifest, "Bundle-SymbolicName"); STRCMP_EQUAL("bsn", name); hash_map_pt map = NULL; http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/test/requirement_test.cpp ---------------------------------------------------------------------- diff --git a/framework/private/test/requirement_test.cpp b/framework/private/test/requirement_test.cpp index ce25dca..d04bf2f 100644 --- a/framework/private/test/requirement_test.cpp +++ b/framework/private/test/requirement_test.cpp @@ -146,7 +146,7 @@ TEST(requirement, getTargetName) { char targetName[] = "target"; requirement->targetName = targetName; - char *actual = NULL; + const char *actual = NULL; requirement_getTargetName(requirement, &actual); STRCMP_EQUAL(targetName, actual); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/private/test/service_registration_test.cpp ---------------------------------------------------------------------- diff --git a/framework/private/test/service_registration_test.cpp b/framework/private/test/service_registration_test.cpp index f1482a7..219f1cf 100644 --- a/framework/private/test/service_registration_test.cpp +++ b/framework/private/test/service_registration_test.cpp @@ -400,7 +400,7 @@ TEST(service_registration, getServiceName) { char * name = my_strdup("sevice_name"); service_registration_pt registration = serviceRegistration_create(callback, NULL, name, 0, NULL, NULL); - char *actual = NULL; + const char *actual = NULL; celix_status_t status = serviceRegistration_getServiceName(registration, &actual); LONGS_EQUAL(CELIX_SUCCESS, status); STRCMP_EQUAL(name, actual); @@ -413,7 +413,7 @@ TEST(service_registration, getServiceNameIllegalArgument) { registry_callback_t callback; char * name = my_strdup("sevice_name"); service_registration_pt registration = serviceRegistration_create(callback, NULL, name, 0, NULL, NULL); - char *actual = (char *) 0x01; + const char *actual = (char *) 0x01; mock().expectOneCall("framework_logCode") .withParameter("code", CELIX_ILLEGAL_ARGUMENT); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/archive.h ---------------------------------------------------------------------- diff --git a/framework/public/include/archive.h b/framework/public/include/archive.h index fd418f3..ce9a395 100644 --- a/framework/public/include/archive.h +++ b/framework/public/include/archive.h @@ -41,7 +41,7 @@ * - CELIX_SUCCESS when no errors are encountered. * - CELIX_FILE_IO_EXCEPTION If the zip file cannot be extracted. */ -celix_status_t extractBundle(char * bundleName, char * revisionRoot); +celix_status_t extractBundle(const char* bundleName, const char* revisionRoot); #endif /* ARCHIVE_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/bundle.h ---------------------------------------------------------------------- diff --git a/framework/public/include/bundle.h b/framework/public/include/bundle.h index 588e4cc..ab7bb5a 100644 --- a/framework/public/include/bundle.h +++ b/framework/public/include/bundle.h @@ -54,11 +54,11 @@ FRAMEWORK_EXPORT activator_pt bundle_getActivator(bundle_pt bundle); FRAMEWORK_EXPORT celix_status_t bundle_setActivator(bundle_pt bundle, activator_pt activator); FRAMEWORK_EXPORT celix_status_t bundle_getContext(bundle_pt bundle, bundle_context_pt *context); FRAMEWORK_EXPORT celix_status_t bundle_setContext(bundle_pt bundle, bundle_context_pt context); -FRAMEWORK_EXPORT celix_status_t bundle_getEntry(bundle_pt bundle, char * name, char **entry); +FRAMEWORK_EXPORT celix_status_t bundle_getEntry(bundle_pt bundle, const char* name, const char** entry); FRAMEWORK_EXPORT celix_status_t bundle_start(bundle_pt bundle); FRAMEWORK_EXPORT celix_status_t bundle_startWithOptions(bundle_pt bundle, int options); -FRAMEWORK_EXPORT celix_status_t bundle_update(bundle_pt bundle, char *inputFile); +FRAMEWORK_EXPORT celix_status_t bundle_update(bundle_pt bundle, const char* inputFile); FRAMEWORK_EXPORT celix_status_t bundle_stop(bundle_pt bundle); FRAMEWORK_EXPORT celix_status_t bundle_stopWithOptions(bundle_pt bundle, int options); FRAMEWORK_EXPORT celix_status_t bundle_uninstall(bundle_pt bundle); @@ -69,7 +69,7 @@ FRAMEWORK_EXPORT celix_status_t bundle_setPersistentStateUninstalled(bundle_pt b FRAMEWORK_EXPORT void uninstallBundle(bundle_pt bundle); -FRAMEWORK_EXPORT celix_status_t bundle_revise(bundle_pt bundle, char * location, char *inputFile); +FRAMEWORK_EXPORT celix_status_t bundle_revise(bundle_pt bundle, const char* location, const char* inputFile); FRAMEWORK_EXPORT celix_status_t bundle_addModule(bundle_pt bundle, module_pt module); FRAMEWORK_EXPORT celix_status_t bundle_closeModules(bundle_pt bundle); @@ -96,7 +96,7 @@ FRAMEWORK_EXPORT celix_status_t bundle_getServicesInUse(bundle_pt bundle, array_ FRAMEWORK_EXPORT celix_status_t bundle_setFramework(bundle_pt bundle, framework_pt framework); FRAMEWORK_EXPORT celix_status_t bundle_getFramework(bundle_pt bundle, framework_pt *framework); -FRAMEWORK_EXPORT celix_status_t bundle_getBundleLocation(bundle_pt bundle, char **location); +FRAMEWORK_EXPORT celix_status_t bundle_getBundleLocation(bundle_pt bundle, const char** location); #endif /* BUNDLE_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/bundle_archive.h ---------------------------------------------------------------------- diff --git a/framework/public/include/bundle_archive.h b/framework/public/include/bundle_archive.h index e5f22b3..bee4eb3 100644 --- a/framework/public/include/bundle_archive.h +++ b/framework/public/include/bundle_archive.h @@ -38,17 +38,17 @@ typedef struct bundleArchive * bundle_archive_pt; -celix_status_t bundleArchive_create(char * archiveRoot, long id, char * location, char *inputFile, bundle_archive_pt *bundle_archive); +celix_status_t bundleArchive_create(const char* archiveRoot, long id, const char* location, const char* inputFile, bundle_archive_pt *bundle_archive); celix_status_t bundleArchive_createSystemBundleArchive(bundle_archive_pt *bundle_archive); -celix_status_t bundleArchive_recreate(char * archiveRoot, bundle_archive_pt *bundle_archive); +celix_status_t bundleArchive_recreate(const char* archiveRoot, bundle_archive_pt *bundle_archive); celix_status_t bundleArchive_destroy(bundle_archive_pt archive); FRAMEWORK_EXPORT celix_status_t bundleArchive_getId(bundle_archive_pt archive, long *id); -FRAMEWORK_EXPORT celix_status_t bundleArchive_getLocation(bundle_archive_pt archive, char **location); -FRAMEWORK_EXPORT celix_status_t bundleArchive_getArchiveRoot(bundle_archive_pt archive, char **archiveRoot); +FRAMEWORK_EXPORT celix_status_t bundleArchive_getLocation(bundle_archive_pt archive, const char **location); +FRAMEWORK_EXPORT celix_status_t bundleArchive_getArchiveRoot(bundle_archive_pt archive, const char **archiveRoot); -FRAMEWORK_EXPORT celix_status_t bundleArchive_revise(bundle_archive_pt archive, char * location, char *inputFile); +FRAMEWORK_EXPORT celix_status_t bundleArchive_revise(bundle_archive_pt archive, const char* location, const char* inputFile); FRAMEWORK_EXPORT celix_status_t bundleArchive_rollbackRevise(bundle_archive_pt archive, bool *rolledback); FRAMEWORK_EXPORT celix_status_t bundleArchive_getRevision(bundle_archive_pt archive, long revNr, bundle_revision_pt *revision); FRAMEWORK_EXPORT celix_status_t bundleArchive_getCurrentRevision(bundle_archive_pt archive, bundle_revision_pt *revision); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/bundle_context.h ---------------------------------------------------------------------- diff --git a/framework/public/include/bundle_context.h b/framework/public/include/bundle_context.h index fc29db5..42a8a5c 100644 --- a/framework/public/include/bundle_context.h +++ b/framework/public/include/bundle_context.h @@ -47,12 +47,12 @@ celix_status_t bundleContext_destroy(bundle_context_pt context); FRAMEWORK_EXPORT celix_status_t bundleContext_getBundle(bundle_context_pt context, bundle_pt *bundle); FRAMEWORK_EXPORT celix_status_t bundleContext_getFramework(bundle_context_pt context, framework_pt *framework); -FRAMEWORK_EXPORT celix_status_t bundleContext_installBundle(bundle_context_pt context, char * location, bundle_pt *bundle); -FRAMEWORK_EXPORT celix_status_t bundleContext_installBundle2(bundle_context_pt context, char * location, char *inputFile, bundle_pt *bundle); +FRAMEWORK_EXPORT celix_status_t bundleContext_installBundle(bundle_context_pt context, const char* location, bundle_pt *bundle); +FRAMEWORK_EXPORT celix_status_t bundleContext_installBundle2(bundle_context_pt context, const char* location, const char* inputFile, bundle_pt *bundle); -FRAMEWORK_EXPORT celix_status_t bundleContext_registerService(bundle_context_pt context, const char * serviceName, void * svcObj, +FRAMEWORK_EXPORT celix_status_t bundleContext_registerService(bundle_context_pt context, const char* serviceName, void * svcObj, properties_pt properties, service_registration_pt *service_registration); -FRAMEWORK_EXPORT celix_status_t bundleContext_registerServiceFactory(bundle_context_pt context, const char * serviceName, service_factory_pt factory, +FRAMEWORK_EXPORT celix_status_t bundleContext_registerServiceFactory(bundle_context_pt context, const char* serviceName, service_factory_pt factory, properties_pt properties, service_registration_pt *service_registration); /** @@ -75,7 +75,7 @@ FRAMEWORK_EXPORT celix_status_t bundleContext_getServiceReference(bundle_context * @param service_references _output_ a array list, can be size 0. * @return CELIX_SUCCESS on success */ -FRAMEWORK_EXPORT celix_status_t bundleContext_getServiceReferences(bundle_context_pt context, const char * serviceName, char * filter, array_list_pt *service_references); +FRAMEWORK_EXPORT celix_status_t bundleContext_getServiceReferences(bundle_context_pt context, const char * serviceName, const char * filter, array_list_pt *service_references); /** * Retains (increases the ref count) the provided service reference. Can be used to retain a service reference. http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/bundle_revision.h ---------------------------------------------------------------------- diff --git a/framework/public/include/bundle_revision.h b/framework/public/include/bundle_revision.h index 6537f64..7a1181a 100644 --- a/framework/public/include/bundle_revision.h +++ b/framework/public/include/bundle_revision.h @@ -62,7 +62,7 @@ typedef struct bundleRevision * bundle_revision_pt; * - CELIX_SUCCESS when no errors are encountered. * - CELIX_ENOMEM If allocating memory for <code>bundle_revision</code> failed. */ -celix_status_t bundleRevision_create(char *root, char *location, long revisionNr, char *inputFile, bundle_revision_pt *bundle_revision); +celix_status_t bundleRevision_create(const char* root, const char* location, long revisionNr, const char* inputFile, bundle_revision_pt *bundle_revision); celix_status_t bundleRevision_destroy(bundle_revision_pt revision); @@ -88,7 +88,7 @@ celix_status_t bundleRevision_getNumber(bundle_revision_pt revision, long *revis * - CELIX_SUCCESS when no errors are encountered. * - CELIX_ILLEGAL_ARGUMENT If <code>revision</code> is illegal. */ -celix_status_t bundleRevision_getLocation(bundle_revision_pt revision, char **location); +celix_status_t bundleRevision_getLocation(bundle_revision_pt revision, const char** location); /** * Retrieves the root of the given revision. @@ -100,7 +100,7 @@ celix_status_t bundleRevision_getLocation(bundle_revision_pt revision, char **lo * - CELIX_SUCCESS when no errors are encountered. * - CELIX_ILLEGAL_ARGUMENT If <code>revision</code> is illegal. */ -celix_status_t bundleRevision_getRoot(bundle_revision_pt revision, char **root); +celix_status_t bundleRevision_getRoot(bundle_revision_pt revision, const char** root); /** * Retrieves the manifest of the given revision. http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/capability.h ---------------------------------------------------------------------- diff --git a/framework/public/include/capability.h b/framework/public/include/capability.h index e2dc33c..a041828 100644 --- a/framework/public/include/capability.h +++ b/framework/public/include/capability.h @@ -34,7 +34,7 @@ typedef struct capability *capability_pt; celix_status_t capability_create(module_pt module, hash_map_pt directives, hash_map_pt attributes, capability_pt *capability); celix_status_t capability_destroy(capability_pt capability); -celix_status_t capability_getServiceName(capability_pt capability, char **serviceName); +celix_status_t capability_getServiceName(capability_pt capability, const char** serviceName); celix_status_t capability_getVersion(capability_pt capability, version_pt *version); celix_status_t capability_getModule(capability_pt capability, module_pt *module); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/celix_log.h ---------------------------------------------------------------------- diff --git a/framework/public/include/celix_log.h b/framework/public/include/celix_log.h index 50c2cc4..71f549a 100644 --- a/framework/public/include/celix_log.h +++ b/framework/public/include/celix_log.h @@ -46,7 +46,7 @@ typedef struct framework_logger *framework_logger_pt; extern framework_logger_pt logger; -typedef celix_status_t (*framework_log_function_pt)(framework_log_level_t level, const char *func, const char *file, int line, char *msg); +typedef celix_status_t (*framework_log_function_pt)(framework_log_level_t level, const char* func, const char* file, int line, const char* msg); struct framework_logger { framework_log_function_pt logFunction; @@ -63,8 +63,8 @@ struct framework_logger { } \ } -FRAMEWORK_EXPORT celix_status_t frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, char *fmsg); -FRAMEWORK_EXPORT void framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, char *fmsg, ...); -FRAMEWORK_EXPORT void framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, celix_status_t code, char *fmsg, ...); +FRAMEWORK_EXPORT celix_status_t frameworkLogger_log(framework_log_level_t level, const char *func, const char *file, int line, const char* fmsg); +FRAMEWORK_EXPORT void framework_log(framework_logger_pt logger, framework_log_level_t level, const char *func, const char *file, int line, const char* fmsg, ...); +FRAMEWORK_EXPORT void framework_logCode(framework_logger_pt logger, framework_log_level_t level, const char* func, const char* file, int line, celix_status_t code, const char* fmsg, ...); #endif /* CELIX_LOG_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/filter.h ---------------------------------------------------------------------- diff --git a/framework/public/include/filter.h b/framework/public/include/filter.h index 2bcefd8..27706a5 100644 --- a/framework/public/include/filter.h +++ b/framework/public/include/filter.h @@ -40,6 +40,6 @@ FRAMEWORK_EXPORT void filter_destroy(filter_pt filter); FRAMEWORK_EXPORT celix_status_t filter_match(filter_pt filter, properties_pt properties, bool *result); FRAMEWORK_EXPORT celix_status_t filter_match_filter(filter_pt src, filter_pt dest, bool *result); -FRAMEWORK_EXPORT celix_status_t filter_getString(filter_pt filter, char **filterStr); +FRAMEWORK_EXPORT celix_status_t filter_getString(filter_pt filter, const char** filterStr); #endif /* FILTER_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/manifest.h ---------------------------------------------------------------------- diff --git a/framework/public/include/manifest.h b/framework/public/include/manifest.h index 634d675..398adfe 100644 --- a/framework/public/include/manifest.h +++ b/framework/public/include/manifest.h @@ -39,16 +39,16 @@ struct manifest { typedef struct manifest * manifest_pt; FRAMEWORK_EXPORT celix_status_t manifest_create(manifest_pt *manifest); -FRAMEWORK_EXPORT celix_status_t manifest_createFromFile(char *filename, manifest_pt *manifest); +FRAMEWORK_EXPORT celix_status_t manifest_createFromFile(const char* filename, manifest_pt *manifest); FRAMEWORK_EXPORT celix_status_t manifest_destroy(manifest_pt manifest); FRAMEWORK_EXPORT void manifest_clear(manifest_pt manifest); FRAMEWORK_EXPORT properties_pt manifest_getMainAttributes(manifest_pt manifest); FRAMEWORK_EXPORT celix_status_t manifest_getEntries(manifest_pt manifest, hash_map_pt *map); -FRAMEWORK_EXPORT celix_status_t manifest_read(manifest_pt manifest, char *filename); -FRAMEWORK_EXPORT void manifest_write(manifest_pt manifest, char * filename); +FRAMEWORK_EXPORT celix_status_t manifest_read(manifest_pt manifest, const char* filename); +FRAMEWORK_EXPORT void manifest_write(manifest_pt manifest, const char* filename); -FRAMEWORK_EXPORT char * manifest_getValue(manifest_pt manifest, const char * name); +FRAMEWORK_EXPORT const char* manifest_getValue(manifest_pt manifest, const char* name); #endif /* MANIFEST_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/module.h ---------------------------------------------------------------------- diff --git a/framework/public/include/module.h b/framework/public/include/module.h index c6b7926..6d49a56 100644 --- a/framework/public/include/module.h +++ b/framework/public/include/module.h @@ -37,17 +37,17 @@ typedef struct module *module_pt; #include "bundle.h" #include "framework_exports.h" -module_pt module_create(manifest_pt headerMap, char * moduleId, bundle_pt bundle); +module_pt module_create(manifest_pt headerMap, const char* moduleId, bundle_pt bundle); module_pt module_createFrameworkModule(bundle_pt bundle); void module_destroy(module_pt module); FRAMEWORK_EXPORT unsigned int module_hash(void * module); FRAMEWORK_EXPORT int module_equals(void * module, void * compare); -FRAMEWORK_EXPORT wire_pt module_getWire(module_pt module, char * serviceName); +FRAMEWORK_EXPORT wire_pt module_getWire(module_pt module, const char* serviceName); FRAMEWORK_EXPORT version_pt module_getVersion(module_pt module); -FRAMEWORK_EXPORT celix_status_t module_getSymbolicName(module_pt module, char **symbolicName); +FRAMEWORK_EXPORT celix_status_t module_getSymbolicName(module_pt module, const char** symbolicName); FRAMEWORK_EXPORT char * module_getId(module_pt module); FRAMEWORK_EXPORT linked_list_pt module_getWires(module_pt module); FRAMEWORK_EXPORT void module_setWires(module_pt module, linked_list_pt wires); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/requirement.h ---------------------------------------------------------------------- diff --git a/framework/public/include/requirement.h b/framework/public/include/requirement.h index 1b7c494..84d3a41 100644 --- a/framework/public/include/requirement.h +++ b/framework/public/include/requirement.h @@ -36,7 +36,7 @@ typedef struct requirement *requirement_pt; celix_status_t requirement_create(hash_map_pt directives, hash_map_pt attributes, requirement_pt *requirement); celix_status_t requirement_destroy(requirement_pt requirement); celix_status_t requirement_getVersionRange(requirement_pt requirement, version_range_pt *range); -celix_status_t requirement_getTargetName(requirement_pt requirement, char **targetName); +celix_status_t requirement_getTargetName(requirement_pt requirement, const char** targetName); celix_status_t requirement_isSatisfied(requirement_pt requirement, capability_pt capability, bool *inRange); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/service_reference.h ---------------------------------------------------------------------- diff --git a/framework/public/include/service_reference.h b/framework/public/include/service_reference.h index 6e1605a..cb67f24 100644 --- a/framework/public/include/service_reference.h +++ b/framework/public/include/service_reference.h @@ -45,8 +45,8 @@ FRAMEWORK_EXPORT celix_status_t serviceReference_getPropertyKeys(service_referen FRAMEWORK_EXPORT celix_status_t serviceReference_getServiceRegistration(service_reference_pt reference, service_registration_pt *registration); FRAMEWORK_EXPORT celix_status_t serviceReference_equals(service_reference_pt reference, service_reference_pt compareTo, bool *equal); -FRAMEWORK_EXPORT unsigned int serviceReference_hashCode(void *referenceP); -FRAMEWORK_EXPORT int serviceReference_equals2(void *reference1, void *reference2); +FRAMEWORK_EXPORT unsigned int serviceReference_hashCode(const void* referenceP); +FRAMEWORK_EXPORT int serviceReference_equals2(const void* reference1, const void* reference2); FRAMEWORK_EXPORT celix_status_t serviceReference_compareTo(service_reference_pt reference, service_reference_pt compareTo, int *compare); FRAMEWORK_EXPORT celix_status_t serviceReference_getUsingBundles(service_reference_pt ref, array_list_pt *out); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/service_registration.h ---------------------------------------------------------------------- diff --git a/framework/public/include/service_registration.h b/framework/public/include/service_registration.h index 7f0e17a..b981e48 100644 --- a/framework/public/include/service_registration.h +++ b/framework/public/include/service_registration.h @@ -40,6 +40,6 @@ typedef struct serviceRegistration * service_registration_pt; FRAMEWORK_EXPORT celix_status_t serviceRegistration_unregister(service_registration_pt registration); FRAMEWORK_EXPORT celix_status_t serviceRegistration_getProperties(service_registration_pt registration, properties_pt *properties); FRAMEWORK_EXPORT celix_status_t serviceRegistration_setProperties(service_registration_pt registration, properties_pt properties); -FRAMEWORK_EXPORT celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, char **serviceName); +FRAMEWORK_EXPORT celix_status_t serviceRegistration_getServiceName(service_registration_pt registration, const char **serviceName); #endif /* SERVICE_REGISTRATION_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/service_tracker.h ---------------------------------------------------------------------- diff --git a/framework/public/include/service_tracker.h b/framework/public/include/service_tracker.h index 4ac8abb..415e96f 100644 --- a/framework/public/include/service_tracker.h +++ b/framework/public/include/service_tracker.h @@ -35,8 +35,8 @@ typedef struct serviceTracker * service_tracker_pt; -FRAMEWORK_EXPORT celix_status_t serviceTracker_create(bundle_context_pt context, char * service, service_tracker_customizer_pt customizer, service_tracker_pt *tracker); -FRAMEWORK_EXPORT celix_status_t serviceTracker_createWithFilter(bundle_context_pt context, char * filter, service_tracker_customizer_pt customizer, service_tracker_pt *tracker); +FRAMEWORK_EXPORT celix_status_t serviceTracker_create(bundle_context_pt context, const char* service, service_tracker_customizer_pt customizer, service_tracker_pt *tracker); +FRAMEWORK_EXPORT celix_status_t serviceTracker_createWithFilter(bundle_context_pt context, const char* filter, service_tracker_customizer_pt customizer, service_tracker_pt *tracker); FRAMEWORK_EXPORT celix_status_t serviceTracker_open(service_tracker_pt tracker); FRAMEWORK_EXPORT celix_status_t serviceTracker_close(service_tracker_pt tracker); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/framework/public/include/utils.h ---------------------------------------------------------------------- diff --git a/framework/public/include/utils.h b/framework/public/include/utils.h index 1ac2438..bd04067 100644 --- a/framework/public/include/utils.h +++ b/framework/public/include/utils.h @@ -34,8 +34,8 @@ #include "framework_exports.h" #include "celix_threads.h" -FRAMEWORK_EXPORT unsigned int utils_stringHash(void * string); -FRAMEWORK_EXPORT int utils_stringEquals(void * string, void * toCompare); +FRAMEWORK_EXPORT unsigned int utils_stringHash(const void* string); +FRAMEWORK_EXPORT int utils_stringEquals(const void* string, const void* toCompare); FRAMEWORK_EXPORT char * string_ndup(const char *s, size_t n); FRAMEWORK_EXPORT char * utils_stringTrim(char * string); FRAMEWORK_EXPORT bool utils_isStringEmptyOrNull(const char * const str); @@ -44,6 +44,6 @@ FRAMEWORK_EXPORT int utils_compareServiceIdsAndRanking(long servId, long servRan FRAMEWORK_EXPORT celix_status_t thread_equalsSelf(celix_thread_t thread, bool *equals); -FRAMEWORK_EXPORT celix_status_t utils_isNumeric(char *number, bool *ret); +FRAMEWORK_EXPORT celix_status_t utils_isNumeric(const char *number, bool *ret); #endif /* UTILS_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/log_service/private/src/log_entry.c ---------------------------------------------------------------------- diff --git a/log_service/private/src/log_entry.c b/log_service/private/src/log_entry.c index 8870c3b..3a8603a 100644 --- a/log_service/private/src/log_entry.c +++ b/log_service/private/src/log_entry.c @@ -32,7 +32,7 @@ #include "log_service.h" #include "log_entry.h" -celix_status_t logEntry_create(long bundleId, char* bundleSymbolicName , service_reference_pt reference, +celix_status_t logEntry_create(long bundleId, const char* bundleSymbolicName , service_reference_pt reference, log_level_t level, char *message, int errorCode, log_entry_pt *entry) { celix_status_t status = CELIX_SUCCESS; @@ -63,7 +63,7 @@ celix_status_t logEntry_destroy(log_entry_pt *entry) { return CELIX_SUCCESS; } -celix_status_t logEntry_getBundleSymbolicName(log_entry_pt entry, char **bundleSymbolicName) { +celix_status_t logEntry_getBundleSymbolicName(log_entry_pt entry, const char** bundleSymbolicName) { *bundleSymbolicName = entry->bundleSymbolicName; return CELIX_SUCCESS; } @@ -83,7 +83,7 @@ celix_status_t logEntry_getLevel(log_entry_pt entry, log_level_t *level) { return CELIX_SUCCESS; } -celix_status_t logEntry_getMessage(log_entry_pt entry, char **message) { +celix_status_t logEntry_getMessage(log_entry_pt entry, const char **message) { *message = entry->message; return CELIX_SUCCESS; } http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/log_service/private/src/log_service_impl.c ---------------------------------------------------------------------- diff --git a/log_service/private/src/log_service_impl.c b/log_service/private/src/log_service_impl.c index c7fa850..a77e9ad 100644 --- a/log_service/private/src/log_service_impl.c +++ b/log_service/private/src/log_service_impl.c @@ -66,7 +66,7 @@ celix_status_t logService_logSr(log_service_data_pt logger, service_reference_pt bundle_pt bundle = logger->bundle; bundle_archive_pt archive = NULL; module_pt module = NULL; - char *symbolicName = NULL; + const char *symbolicName = NULL; long bundleId = -1; if (reference != NULL) { http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/log_service/public/include/log_entry.h ---------------------------------------------------------------------- diff --git a/log_service/public/include/log_entry.h b/log_service/public/include/log_entry.h index b5b9c7e..e588774 100644 --- a/log_service/public/include/log_entry.h +++ b/log_service/public/include/log_entry.h @@ -41,15 +41,15 @@ struct log_entry { typedef struct log_entry * log_entry_pt; -celix_status_t logEntry_create(long bundleId, char* bundleSymbolicName , service_reference_pt reference, +celix_status_t logEntry_create(long bundleId, const char* bundleSymbolicName , service_reference_pt reference, log_level_t level, char *message, int errorCode, log_entry_pt *entry); celix_status_t logEntry_destroy(log_entry_pt *entry); -celix_status_t logEntry_getBundleSymbolicName(log_entry_pt entry, char **bundleSymbolicName); +celix_status_t logEntry_getBundleSymbolicName(log_entry_pt entry, const char** bundleSymbolicName); celix_status_t logEntry_getBundleId(log_entry_pt entry, long *bundleId); celix_status_t logEntry_getErrorCode(log_entry_pt entry, int *errorCode); celix_status_t logEntry_getLevel(log_entry_pt entry, log_level_t *level); -celix_status_t logEntry_getMessage(log_entry_pt entry, char **message); +celix_status_t logEntry_getMessage(log_entry_pt entry, const char** message); celix_status_t logEntry_getTime(log_entry_pt entry, time_t *time); #endif /* LOG_ENTRY_H_ */ http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/remote_services/remote_service_admin_dfi/rsa/private/src/dfi_utils.c ---------------------------------------------------------------------- diff --git a/remote_services/remote_service_admin_dfi/rsa/private/src/dfi_utils.c b/remote_services/remote_service_admin_dfi/rsa/private/src/dfi_utils.c index c77e7f4..020dfcd 100644 --- a/remote_services/remote_service_admin_dfi/rsa/private/src/dfi_utils.c +++ b/remote_services/remote_service_admin_dfi/rsa/private/src/dfi_utils.c @@ -51,7 +51,7 @@ static celix_status_t dfi_findFileForFramework(bundle_context_pt context, const static celix_status_t dfi_findFileForBundle(bundle_pt bundle, const char *fileName, FILE **out) { celix_status_t status; - char *path = NULL; + const char *path = NULL; char metaInfFileName[128]; snprintf(metaInfFileName, sizeof(metaInfFileName), "META-INF/descriptors/%s", fileName); @@ -69,7 +69,6 @@ static celix_status_t dfi_findFileForBundle(bundle_pt bundle, const char *fileNa *out = df; } - free(path); } return status; } http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/remote_services/remote_service_admin_http/private/test/rsa_client_server_tests.cpp ---------------------------------------------------------------------- diff --git a/remote_services/remote_service_admin_http/private/test/rsa_client_server_tests.cpp b/remote_services/remote_service_admin_http/private/test/rsa_client_server_tests.cpp index f26bdf3..19cf103 100644 --- a/remote_services/remote_service_admin_http/private/test/rsa_client_server_tests.cpp +++ b/remote_services/remote_service_admin_http/private/test/rsa_client_server_tests.cpp @@ -168,7 +168,7 @@ extern "C" { for (i = 0; i < size; i++) { module_pt module = NULL; - char *name = NULL; + const char *name = NULL; bundle_pt bundle = (bundle_pt) arrayList_get(bundles, i); @@ -229,7 +229,7 @@ extern "C" { if (status == CELIX_SUCCESS) { module_pt module = NULL; - char *name = NULL; + const char *name = NULL; status = bundle_getCurrentModule(bundle, &module); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp ---------------------------------------------------------------------- diff --git a/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp b/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp index 2e80521..13c6941 100644 --- a/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp +++ b/remote_services/remote_service_admin_shm/private/test/rsa_client_server_tests.cpp @@ -168,7 +168,7 @@ extern "C" { for (i = 0; i < size; i++) { module_pt module = NULL; - char *name = NULL; + const char *name = NULL; bundle_pt bundle = (bundle_pt) arrayList_get(bundles, i); @@ -226,7 +226,7 @@ extern "C" { if (status == CELIX_SUCCESS) { module_pt module = NULL; - char *name = NULL; + const char *name = NULL; status = bundle_getCurrentModule(bundle, &module); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/shell/private/src/inspect_command.c ---------------------------------------------------------------------- diff --git a/shell/private/src/inspect_command.c b/shell/private/src/inspect_command.c index 206319b..f53a163 100644 --- a/shell/private/src/inspect_command.c +++ b/shell/private/src/inspect_command.c @@ -123,7 +123,7 @@ celix_status_t inspectCommand_printExportedServices(bundle_context_pt context, a if (bundle_getRegisteredServices(bundle, &refs) == CELIX_SUCCESS) { module_pt module = NULL; - char * name = NULL; + const char * name = NULL; status = bundle_getCurrentModule(bundle, &module); if (status == CELIX_SUCCESS) { status = module_getSymbolicName(module, &name); @@ -207,7 +207,7 @@ celix_status_t inspectCommand_printImportedServices(bundle_context_pt context, a if (bundle_getServicesInUse(bundle, &refs) == CELIX_SUCCESS) { module_pt module = NULL; - char * name = NULL; + const char * name = NULL; status = bundle_getCurrentModule(bundle, &module); if (status == CELIX_SUCCESS) { status = module_getSymbolicName(module, &name); @@ -223,7 +223,7 @@ celix_status_t inspectCommand_printImportedServices(bundle_context_pt context, a service_reference_pt ref = (service_reference_pt) arrayList_get(refs, j); bundle_pt usedBundle = NULL; module_pt usedModule = NULL; - char *usedSymbolicName = NULL; + const char *usedSymbolicName = NULL; long usedBundleId; serviceReference_getBundle(ref, &usedBundle); http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/shell/private/src/lb_command.c ---------------------------------------------------------------------- diff --git a/shell/private/src/lb_command.c b/shell/private/src/lb_command.c index 9a1eb3f..82812d5 100644 --- a/shell/private/src/lb_command.c +++ b/shell/private/src/lb_command.c @@ -115,9 +115,9 @@ celix_status_t psCommand_execute(void *_ptr, char *command_line_str, FILE *out_p bundle_archive_pt archive_ptr = NULL; long id = 0; bundle_state_e state = OSGI_FRAMEWORK_BUNDLE_UNKNOWN; - char *state_str = NULL; + const char *state_str = NULL; module_pt module_ptr = NULL; - char *name_str = NULL; + const char *name_str = NULL; sub_status = bundle_getArchive(bundle_ptr, &archive_ptr); if (sub_status == CELIX_SUCCESS) { http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/utils/private/include/hash_map_private.h ---------------------------------------------------------------------- diff --git a/utils/private/include/hash_map_private.h b/utils/private/include/hash_map_private.h index fe2a065..4950b63 100644 --- a/utils/private/include/hash_map_private.h +++ b/utils/private/include/hash_map_private.h @@ -30,17 +30,17 @@ #include "exports.h" #include "hash_map.h" -UTILS_EXPORT unsigned int hashMap_hashCode(void * toHash); -UTILS_EXPORT int hashMap_equals(void * toCompare, void * compare); +UTILS_EXPORT unsigned int hashMap_hashCode(const void* toHash); +UTILS_EXPORT int hashMap_equals(const void* toCompare, const void* compare); void hashMap_resize(hash_map_pt map, int newCapacity); -void * hashMap_removeEntryForKey(hash_map_pt map, void * key); +void * hashMap_removeEntryForKey(hash_map_pt map, const void* key); UTILS_EXPORT hash_map_entry_pt hashMap_removeMapping(hash_map_pt map, hash_map_entry_pt entry); -void hashMap_addEntry(hash_map_pt map, int hash, void * key, void * value, int bucketIndex); +void hashMap_addEntry(hash_map_pt map, int hash, void* key, void* value, int bucketIndex); struct hashMapEntry { - void * key; - void * value; + void* key; + void* value; hash_map_entry_pt next; unsigned int hash; }; @@ -52,10 +52,10 @@ struct hashMap { unsigned int modificationCount; unsigned int tablelength; - unsigned int (*hashKey)(void * key); - unsigned int (*hashValue)(void * value); - int (*equalsKey)(void * key1, void * key2); - int (*equalsValue)(void * value1, void * value2); + unsigned int (*hashKey)(const void* key); + unsigned int (*hashValue)(const void* value); + int (*equalsKey)(const void* key1, const void* key2); + int (*equalsValue)(const void* value1, const void* value2); }; struct hashMapIterator { http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/utils/private/src/hash_map.c ---------------------------------------------------------------------- diff --git a/utils/private/src/hash_map.c b/utils/private/src/hash_map.c index 1f78251..aa320d4 100644 --- a/utils/private/src/hash_map.c +++ b/utils/private/src/hash_map.c @@ -36,12 +36,12 @@ static unsigned int DEFAULT_INITIAL_CAPACITY = 16; static float DEFAULT_LOAD_FACTOR = 0.75f; static unsigned int MAXIMUM_CAPACITY = 1 << 30; -unsigned int hashMap_hashCode(void * toHash) { +unsigned int hashMap_hashCode(const void * toHash) { intptr_t address = (intptr_t) toHash; return address; } -int hashMap_equals(void * toCompare, void * compare) { +int hashMap_equals(const void * toCompare, const void * compare) { return toCompare == compare; } @@ -66,8 +66,8 @@ static unsigned int hashMap_indexFor(unsigned int h, unsigned int length) { return h & (length - 1); } -hash_map_pt hashMap_create(unsigned int (*keyHash)(void *), unsigned int (*valueHash)(void *), - int (*keyEquals)(void *, void *), int (*valueEquals)(void *, void *)) { +hash_map_pt hashMap_create(unsigned int (*keyHash)(const void *), unsigned int (*valueHash)(const void *), + int (*keyEquals)(const void *, const void *), int (*valueEquals)(const void *, const void *)) { hash_map_pt map = (hash_map_pt) malloc(sizeof(*map)); map->treshold = (unsigned int) (DEFAULT_INITIAL_CAPACITY * DEFAULT_LOAD_FACTOR); map->table = (hash_map_entry_pt *) calloc(DEFAULT_INITIAL_CAPACITY, sizeof(hash_map_entry_pt)); @@ -109,7 +109,7 @@ bool hashMap_isEmpty(hash_map_pt map) { return hashMap_size(map) == 0; } -void * hashMap_get(hash_map_pt map, void * key) { +void * hashMap_get(hash_map_pt map, const void* key) { unsigned int hash; if (key == NULL) { hash_map_entry_pt entry; @@ -131,11 +131,11 @@ void * hashMap_get(hash_map_pt map, void * key) { return NULL; } -bool hashMap_containsKey(hash_map_pt map, void * key) { +bool hashMap_containsKey(hash_map_pt map, const void* key) { return hashMap_getEntry(map, key) != NULL; } -hash_map_entry_pt hashMap_getEntry(hash_map_pt map, void * key) { +hash_map_entry_pt hashMap_getEntry(hash_map_pt map, const void* key) { unsigned int hash = (key == NULL) ? 0 : hashMap_hash(map->hashKey(key)); hash_map_entry_pt entry; int index = hashMap_indexFor(hash, map->tablelength); @@ -207,7 +207,7 @@ void hashMap_resize(hash_map_pt map, int newCapacity) { map->treshold = (unsigned int) ceil(newCapacity * DEFAULT_LOAD_FACTOR); } -void * hashMap_remove(hash_map_pt map, void * key) { +void * hashMap_remove(hash_map_pt map, const void* key) { hash_map_entry_pt entry = hashMap_removeEntryForKey(map, key); void * value = (entry == NULL ? NULL : entry->value); if (entry != NULL) { @@ -218,7 +218,7 @@ void * hashMap_remove(hash_map_pt map, void * key) { return value; } -void * hashMap_removeEntryForKey(hash_map_pt map, void * key) { +void * hashMap_removeEntryForKey(hash_map_pt map, const void* key) { unsigned int hash = (key == NULL) ? 0 : hashMap_hash(map->hashKey(key)); int i = hashMap_indexFor(hash, map->tablelength); hash_map_entry_pt prev = map->table[i]; @@ -297,7 +297,7 @@ void hashMap_clear(hash_map_pt map, bool freeKey, bool freeValue) { map->size = 0; } -bool hashMap_containsValue(hash_map_pt map, void * value) { +bool hashMap_containsValue(hash_map_pt map, const void* value) { unsigned int i; if (value == NULL) { for (i = 0; i < map->tablelength; i++) { @@ -321,7 +321,7 @@ bool hashMap_containsValue(hash_map_pt map, void * value) { return false; } -void hashMap_addEntry(hash_map_pt map, int hash, void * key, void * value, int bucketIndex) { +void hashMap_addEntry(hash_map_pt map, int hash, void* key, void* value, int bucketIndex) { hash_map_entry_pt entry = map->table[bucketIndex]; hash_map_entry_pt new = (hash_map_entry_pt) malloc(sizeof(*new)); new->hash = hash; @@ -444,11 +444,11 @@ int hashMapKeySet_size(hash_map_key_set_pt keySet) { return keySet->map->size; } -bool hashMapKeySet_contains(hash_map_key_set_pt keySet, void * key) { +bool hashMapKeySet_contains(hash_map_key_set_pt keySet, const void* key) { return hashMap_containsKey(keySet->map, key); } -bool hashMapKeySet_remove(hash_map_key_set_pt keySet, void * key) { +bool hashMapKeySet_remove(hash_map_key_set_pt keySet, const void* key) { hash_map_entry_pt entry = hashMap_removeEntryForKey(keySet->map, key); bool removed = entry != NULL; free(entry); @@ -483,7 +483,7 @@ int hashMapValues_size(hash_map_values_pt values) { return values->map->size; } -bool hashMapValues_contains(hash_map_values_pt values, void * value) { +bool hashMapValues_contains(hash_map_values_pt values, const void* value) { return hashMap_containsValue(values->map, value); } @@ -500,7 +500,7 @@ void hashMapValues_toArray(hash_map_values_pt values, void* *array[], unsigned i hashMapIterator_destroy(it); } -bool hashMapValues_remove(hash_map_values_pt values, void * value) { +bool hashMapValues_remove(hash_map_values_pt values, const void* value) { hash_map_iterator_pt iterator = hashMapValues_iterator(values); if (value == NULL) { while (hashMapIterator_hasNext(iterator)) { http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/utils/private/src/version.c ---------------------------------------------------------------------- diff --git a/utils/private/src/version.c b/utils/private/src/version.c index 73ade95..cb2703d 100644 --- a/utils/private/src/version.c +++ b/utils/private/src/version.c @@ -97,7 +97,7 @@ celix_status_t version_destroy(version_pt version) { return CELIX_SUCCESS; } -celix_status_t version_createVersionFromString(char * versionStr, version_pt *version) { +celix_status_t version_createVersionFromString(const char * versionStr, version_pt *version) { celix_status_t status = CELIX_SUCCESS; int major = 0; @@ -194,7 +194,7 @@ celix_status_t version_getMicro(version_pt version, int *micro) { return status; } -celix_status_t version_getQualifier(version_pt version, char **qualifier) { +celix_status_t version_getQualifier(version_pt version, const char **qualifier) { celix_status_t status = CELIX_SUCCESS; *qualifier = version->qualifier; return status; http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/utils/private/test/hash_map_test.cpp ---------------------------------------------------------------------- diff --git a/utils/private/test/hash_map_test.cpp b/utils/private/test/hash_map_test.cpp index eac9ea0..a50b377 100644 --- a/utils/private/test/hash_map_test.cpp +++ b/utils/private/test/hash_map_test.cpp @@ -61,7 +61,7 @@ static char* my_strdup(const char* s){ } //Callback functions -unsigned int test_hashKeyChar(void * k) { +unsigned int test_hashKeyChar(const void * k) { char * str = (char *) k; unsigned int hash = 1315423911; @@ -76,16 +76,16 @@ unsigned int test_hashKeyChar(void * k) { return hash; } -unsigned int test_hashValueChar(void * v) { +unsigned int test_hashValueChar(const void * v) { (void)(v); return 0; } -int test_equalsKeyChar(void * k, void * o) { +int test_equalsKeyChar(const void * k, const void * o) { return strcmp((char *)k, (char *) o) == 0; } -int test_equalsValueChar(void * v, void * o) { +int test_equalsValueChar(const void * v, const void * o) { return strcmp((char *)v, (char *) o) == 0; } http://git-wip-us.apache.org/repos/asf/celix/blob/6f85bf3c/utils/public/include/hash_map.h ---------------------------------------------------------------------- diff --git a/utils/public/include/hash_map.h b/utils/public/include/hash_map.h index f4f0acd..cc5a7e2 100644 --- a/utils/public/include/hash_map.h +++ b/utils/public/include/hash_map.h @@ -39,18 +39,18 @@ typedef struct hashMapKeySet * hash_map_key_set_pt; typedef struct hashMapValues * hash_map_values_pt; typedef struct hashMapEntrySet * hash_map_entry_set_pt; -UTILS_EXPORT hash_map_pt hashMap_create(unsigned int (*keyHash)(void *), unsigned int (*valueHash)(void *), - int (*keyEquals)(void *, void *), int (*valueEquals)(void *, void *)); +UTILS_EXPORT hash_map_pt hashMap_create(unsigned int (*keyHash)(const void*), unsigned int (*valueHash)(const void*), + int (*keyEquals)(const void*, const void*), int (*valueEquals)(const void*, const void*)); UTILS_EXPORT void hashMap_destroy(hash_map_pt map, bool freeKeys, bool freeValues); UTILS_EXPORT int hashMap_size(hash_map_pt map); UTILS_EXPORT bool hashMap_isEmpty(hash_map_pt map); -UTILS_EXPORT void * hashMap_get(hash_map_pt map, void * key); -UTILS_EXPORT bool hashMap_containsKey(hash_map_pt map, void * key); -UTILS_EXPORT hash_map_entry_pt hashMap_getEntry(hash_map_pt map, void * key); -UTILS_EXPORT void * hashMap_put(hash_map_pt map, void * key, void * value); -UTILS_EXPORT void * hashMap_remove(hash_map_pt map, void * key); +UTILS_EXPORT void * hashMap_get(hash_map_pt map, const void* key); +UTILS_EXPORT bool hashMap_containsKey(hash_map_pt map, const void* key); +UTILS_EXPORT hash_map_entry_pt hashMap_getEntry(hash_map_pt map, const void* key); +UTILS_EXPORT void * hashMap_put(hash_map_pt map, void* key, void* value); +UTILS_EXPORT void * hashMap_remove(hash_map_pt map, const void* key); UTILS_EXPORT void hashMap_clear(hash_map_pt map, bool freeKey, bool freeValue); -UTILS_EXPORT bool hashMap_containsValue(hash_map_pt map, void * value); +UTILS_EXPORT bool hashMap_containsValue(hash_map_pt map, const void* value); UTILS_EXPORT hash_map_iterator_pt hashMapIterator_create(hash_map_pt map); UTILS_EXPORT void hashMapIterator_destroy(hash_map_iterator_pt iterator); @@ -63,8 +63,8 @@ UTILS_EXPORT hash_map_entry_pt hashMapIterator_nextEntry(hash_map_iterator_pt it UTILS_EXPORT hash_map_key_set_pt hashMapKeySet_create(hash_map_pt map); UTILS_EXPORT void hashMapKeySet_destroy(hash_map_key_set_pt keySet); UTILS_EXPORT int hashMapKeySet_size(hash_map_key_set_pt keySet); -UTILS_EXPORT bool hashMapKeySet_contains(hash_map_key_set_pt keySet, void * key); -UTILS_EXPORT bool hashMapKeySet_remove(hash_map_key_set_pt keySet, void * key); +UTILS_EXPORT bool hashMapKeySet_contains(hash_map_key_set_pt keySet, const void* key); +UTILS_EXPORT bool hashMapKeySet_remove(hash_map_key_set_pt keySet, const void* key); UTILS_EXPORT void hashMapKeySet_clear(hash_map_key_set_pt keySet); UTILS_EXPORT bool hashMapKeySet_isEmpty(hash_map_key_set_pt keySet); @@ -72,9 +72,9 @@ UTILS_EXPORT hash_map_values_pt hashMapValues_create(hash_map_pt map); UTILS_EXPORT void hashMapValues_destroy(hash_map_values_pt values); UTILS_EXPORT hash_map_iterator_pt hashMapValues_iterator(hash_map_values_pt values); UTILS_EXPORT int hashMapValues_size(hash_map_values_pt values); -UTILS_EXPORT bool hashMapValues_contains(hash_map_values_pt values, void * o); +UTILS_EXPORT bool hashMapValues_contains(hash_map_values_pt values, const void* o); UTILS_EXPORT void hashMapValues_toArray(hash_map_values_pt values, void* *array[], unsigned int *size); -UTILS_EXPORT bool hashMapValues_remove(hash_map_values_pt values, void * o); +UTILS_EXPORT bool hashMapValues_remove(hash_map_values_pt values, const void* o); UTILS_EXPORT void hashMapValues_clear(hash_map_values_pt values); UTILS_EXPORT bool hashMapValues_isEmpty(hash_map_values_pt values);
