celix-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From abroekh...@apache.org
Subject svn commit: r1423360 - in /incubator/celix/trunk: ./ framework/private/src/ shell_tui/private/src/
Date Tue, 18 Dec 2012 09:12:44 GMT
Author: abroekhuis
Date: Tue Dec 18 09:12:41 2012
New Revision: 1423360

URL: http://svn.apache.org/viewvc?rev=1423360&view=rev
Log:
CELIX-42: Fixed several warnings found by the VS compiler

Modified:
    incubator/celix/trunk/CMakeLists.txt
    incubator/celix/trunk/framework/private/src/bundle_archive.c
    incubator/celix/trunk/framework/private/src/bundle_cache.c
    incubator/celix/trunk/framework/private/src/framework.c
    incubator/celix/trunk/framework/private/src/miniunz.c
    incubator/celix/trunk/framework/private/src/service_tracker.c
    incubator/celix/trunk/shell_tui/private/src/shell_tui.c

Modified: incubator/celix/trunk/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/CMakeLists.txt?rev=1423360&r1=1423359&r2=1423360&view=diff
==============================================================================
--- incubator/celix/trunk/CMakeLists.txt (original)
+++ incubator/celix/trunk/CMakeLists.txt Tue Dec 18 09:12:41 2012
@@ -25,7 +25,12 @@ cmake_policy(SET CMP0012 NEW)
 set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/modules/")
 
 SET(CMAKE_BUILD_TYPE "Debug")
-SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 ${CMAKE_C_FLAGS}")
+IF(UNIX)
+	SET(CMAKE_C_FLAGS "-D_GNU_SOURCE -std=gnu99 ${CMAKE_C_FLAGS}")
+ENDIF()
+IF(WIN32)
+	SET(CMAKE_C_FLAGS "-D_CRT_SECURE_NO_WARNINGS ${CMAKE_C_FLAGS}")
+ENDIF()
 
 include(cmake/Includes.cmake)
 

Modified: incubator/celix/trunk/framework/private/src/bundle_archive.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_archive.c?rev=1423360&r1=1423359&r2=1423360&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_archive.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_archive.c Tue Dec 18 09:12:41 2012
@@ -180,7 +180,7 @@ celix_status_t bundleArchive_recreate(ch
                 
                 if (apr_dir_open(&dir, archiveRoot, mp) == APR_SUCCESS) {
                     apr_finfo_t dp;
-                    long idx;
+                    long idx = 0;
 					char *location;
 
                     while ((apr_dir_read(&dp, APR_FINFO_DIRENT|APR_FINFO_TYPE, dir))
== APR_SUCCESS) {

Modified: incubator/celix/trunk/framework/private/src/bundle_cache.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/bundle_cache.c?rev=1423360&r1=1423359&r2=1423360&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/bundle_cache.c (original)
+++ incubator/celix/trunk/framework/private/src/bundle_cache.c Tue Dec 18 09:12:41 2012
@@ -140,8 +140,8 @@ celix_status_t bundleCache_getArchives(b
 }
 
 celix_status_t bundleCache_createArchive(bundle_cache_t cache, apr_pool_t *bundlePool, long
id, char * location, char *inputFile, bundle_archive_t *bundle_archive) {
-    celix_status_t status;
-	char *archiveRoot;
+	celix_status_t status = CELIX_SUCCESS;
+	char *archiveRoot = NULL;
 
 	if (cache && location && bundlePool) {
 		archiveRoot = apr_psprintf(bundlePool, "%s/bundle%ld",  cache->cacheDir, id);

Modified: incubator/celix/trunk/framework/private/src/framework.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/framework.c?rev=1423360&r1=1423359&r2=1423360&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/framework.c (original)
+++ incubator/celix/trunk/framework/private/src/framework.c Tue Dec 18 09:12:41 2012
@@ -265,8 +265,8 @@ celix_status_t framework_destroy(framewo
 	while (hashMapIterator_hasNext(iterator)) {
 		linked_list_t wires;
 	    hash_map_entry_t entry = hashMapIterator_nextEntry(iterator);
-		bundle_t bundle = hashMapEntry_getValue(entry);
-		char * location = hashMapEntry_getKey(entry);
+		bundle_t bundle = (bundle_t) hashMapEntry_getValue(entry);
+		char *location = (char *) hashMapEntry_getKey(entry);
 		bundle_archive_t archive = NULL;
 
 		// for each installed bundle, clean up memory
@@ -276,7 +276,7 @@ celix_status_t framework_destroy(framewo
 		if (wires != NULL) {
 			linked_list_iterator_t iter = linkedListIterator_create(wires, 0);
 			while (linkedListIterator_hasNext(iter)) {
-				wire_t wire = linkedListIterator_next(iter);
+				wire_t wire = (wire_t) linkedListIterator_next(iter);
 				linkedListIterator_remove(iter);
 			}
 			linkedListIterator_destroy(iter);
@@ -627,7 +627,7 @@ celix_status_t framework_getBundleEntry(
 celix_status_t fw_startBundle(framework_t framework, bundle_t bundle, int options) {
 	celix_status_t lock = framework_acquireBundleLock(framework, bundle, BUNDLE_INSTALLED|BUNDLE_RESOLVED|BUNDLE_STARTING|BUNDLE_ACTIVE);
 
-	hash_map_t wires;
+	hash_map_t wires = NULL;
 	void * handle;
 	bundle_context_t context = NULL;
 	bundle_state_e state;
@@ -688,7 +688,9 @@ celix_status_t fw_startBundle(framework_
                 }
                 framework_markResolvedModules(framework, wires);
 		    }
-			hashMap_destroy(wires, false, false);
+			if (wires != NULL) {
+				hashMap_destroy(wires, false, false);
+			}
 			/* no break */
 		case BUNDLE_RESOLVED:
 			if (bundleContext_create(framework, bundle, &context) != CELIX_SUCCESS) {
@@ -1000,7 +1002,7 @@ celix_status_t fw_refreshBundles(framewo
     } else {
 		hash_map_values_t values;
         bundle_t *newTargets;
-        int nrofvalues;
+        unsigned int nrofvalues;
 		bool restart = false;
         hash_map_t map = hashMap_create(NULL, NULL, NULL, NULL);
         int targetIdx = 0;
@@ -1010,7 +1012,7 @@ celix_status_t fw_refreshBundles(framewo
             fw_populateDependentGraph(framework, bundle, &map);
         }
         values = hashMapValues_create(map);
-        hashMapValues_toArray(values, (void *) &newTargets, &nrofvalues);
+        hashMapValues_toArray(values, (void ***) &newTargets, &nrofvalues);
         hashMapValues_destroy(values);
 
         hashMap_destroy(map, false, false);
@@ -1122,11 +1124,11 @@ celix_status_t fw_getDependentBundles(fr
 
         modules = bundle_getModules(exporter);
         for (modIdx = 0; modIdx < arrayList_size(modules); modIdx++) {
-            module_t module = arrayList_get(modules, modIdx);
+            module_t module = (module_t) arrayList_get(modules, modIdx);
             array_list_t dependents = module_getDependents(module);
             unsigned int depIdx = 0;
             for (depIdx = 0; (dependents != NULL) && (depIdx < arrayList_size(dependents));
depIdx++) {
-                module_t dependent = arrayList_get(dependents, depIdx);
+                module_t dependent = (module_t) arrayList_get(dependents, depIdx);
                 arrayList_add(*list, module_getBundle(dependent));
             }
             arrayList_destroy(dependents);
@@ -1148,7 +1150,7 @@ celix_status_t fw_populateDependentGraph
             for (depIdx = 0; (dependents != NULL) && (depIdx < arrayList_size(dependents));
depIdx++) {
                 if (!hashMap_containsKey(*map, arrayList_get(dependents, depIdx))) {
                     hashMap_put(*map, arrayList_get(dependents, depIdx), arrayList_get(dependents,
depIdx));
-                    fw_populateDependentGraph(framework, arrayList_get(dependents, depIdx),
map);
+                    fw_populateDependentGraph(framework, (bundle_t) arrayList_get(dependents,
depIdx), map);
                 }
             }
             arrayList_destroy(dependents);
@@ -1192,7 +1194,7 @@ celix_status_t fw_registerService(framew
 
 		arrayList_create(pool, &infos);
 		for (i = 0; i > arrayList_size(framework->serviceListeners); i++) {
-			fw_service_listener_t listener = arrayList_get(framework->serviceListeners, i);
+			fw_service_listener_t listener = (fw_service_listener_t) (framework->serviceListeners,
i);
 			apr_pool_t *pool;
 			bundle_context_t context;
 			listener_hook_info_t info;
@@ -1200,7 +1202,7 @@ celix_status_t fw_registerService(framew
 
 			bundle_getContext(bundle, &context);
 			bundleContext_getMemoryPool(context, &pool);
-			info = apr_palloc(pool, sizeof(*info));
+			info = (listener_hook_info_t) (pool, sizeof(*info));
 
 			bundle_getContext(listener->bundle, &lContext);
 			info->context = lContext;
@@ -1213,7 +1215,7 @@ celix_status_t fw_registerService(framew
 		apr_pool_create(&subpool, pool);
 
 		serviceRegistry_createServiceReference(framework->registry, subpool, *registration,
&ref);
-		hook = fw_getService(framework, framework->bundle, ref);
+		hook = (listener_hook_service_t) (framework, framework->bundle, ref);
 		hook->added(hook->handle, infos);
 		serviceRegistry_ungetService(framework->registry, framework->bundle, ref);
 
@@ -1329,7 +1331,7 @@ void fw_addServiceListener(framework_t f
 	apr_pool_create(&subpool, listener->pool);
 	serviceRegistry_getListenerHooks(framework->registry, subpool, &listenerHooks);
 
-	info = apr_palloc(subpool, sizeof(*info));
+	info = (listener_hook_info_t) apr_palloc(subpool, sizeof(*info));
 
 	bundle_getContext(bundle, &context);
 	info->context = context;
@@ -1338,8 +1340,8 @@ void fw_addServiceListener(framework_t f
 	info->filter = sfilter == NULL ? NULL : apr_pstrdup(subpool, sfilter);
 
 	for (i = 0; i < arrayList_size(listenerHooks); i++) {
-		service_reference_t ref = arrayList_get(listenerHooks, i);
-		listener_hook_service_t hook = fw_getService(framework, framework->bundle, ref);
+		service_reference_t ref = (service_reference_t) arrayList_get(listenerHooks, i);
+		listener_hook_service_t hook = (listener_hook_service_t) fw_getService(framework, framework->bundle,
ref);
 		array_list_t infos = NULL;
 		arrayList_create(subpool, &infos);
 		arrayList_add(infos, info);
@@ -1366,7 +1368,7 @@ void fw_removeServiceListener(framework_
 		if (element->listener == listener && element->bundle == bundle) {
 			bundle_context_t lContext = NULL;
 
-			info = apr_palloc(pool, sizeof(*info));
+			info = (listener_hook_info_t) apr_palloc(pool, sizeof(*info));
 
 			bundle_getContext(element->bundle, &context);
 			info->context = lContext;
@@ -1393,8 +1395,8 @@ void fw_removeServiceListener(framework_
 		serviceRegistry_getListenerHooks(framework->registry, pool, &listenerHooks);
 		
 		for (i = 0; i < arrayList_size(listenerHooks); i++) {
-			service_reference_t ref = arrayList_get(listenerHooks, i);
-			listener_hook_service_t hook = fw_getService(framework, framework->bundle, ref);
+			service_reference_t ref = (service_reference_t) arrayList_get(listenerHooks, i);
+			listener_hook_service_t hook = (listener_hook_service_t) fw_getService(framework, framework->bundle,
ref);
 			array_list_t infos = NULL;
 			apr_pool_t *pool = NULL;
 
@@ -1416,7 +1418,7 @@ celix_status_t fw_addBundleListener(fram
 	fw_bundle_listener_t bundleListener = NULL;
 
 	apr_pool_create(&pool, framework->mp);
-	bundleListener = apr_palloc(pool, sizeof(*bundleListener));
+	bundleListener = (fw_bundle_listener_t) apr_palloc(pool, sizeof(*bundleListener));
 	if (!bundleListener) {
 		status = CELIX_ENOMEM;
 	} else {
@@ -1591,7 +1593,7 @@ array_list_t framework_getBundles(framew
 	arrayList_create(framework->mp, &bundles);
 	iterator = hashMapIterator_create(framework->installedBundleMap);
 	while (hashMapIterator_hasNext(iterator)) {
-		bundle_t bundle = hashMapIterator_nextValue(iterator);
+		bundle_t bundle = (bundle_t) hashMapIterator_nextValue(iterator);
 		arrayList_add(bundles, bundle);
 	}
 	hashMapIterator_destroy(iterator);
@@ -1599,7 +1601,7 @@ array_list_t framework_getBundles(framew
 }
 
 bundle_t framework_getBundle(framework_t framework, char * location) {
-	bundle_t bundle = hashMap_get(framework->installedBundleMap, location);
+	bundle_t bundle = (bundle_t) hashMap_get(framework->installedBundleMap, location);
 	return bundle;
 }
 
@@ -1607,7 +1609,7 @@ bundle_t framework_getBundleById(framewo
 	hash_map_iterator_t iter = hashMapIterator_create(framework->installedBundleMap);
 	bundle_t bundle = NULL;
 	while (hashMapIterator_hasNext(iter)) {
-		bundle_t b = hashMapIterator_nextValue(iter);
+		bundle_t b = (bundle_t) hashMapIterator_nextValue(iter);
 		bundle_archive_t archive = NULL;
 		long bid;
 		bundle_getArchive(b, &archive);
@@ -1845,7 +1847,7 @@ static void *APR_THREAD_FUNC framework_s
 
 	iterator = hashMapIterator_create(fw->installedBundleMap);
 	while (hashMapIterator_hasNext(iterator)) {
-		bundle_t bundle = hashMapIterator_nextValue(iterator);
+		bundle_t bundle = (bundle_t) hashMapIterator_nextValue(iterator);
 		bundle_state_e state;
 		bundle_getState(bundle, &state);
 		if (state == BUNDLE_ACTIVE || state == BUNDLE_STARTING) {
@@ -1925,7 +1927,7 @@ celix_status_t fw_fireBundleEvent(framew
 	if ((eventType != BUNDLE_EVENT_STARTING)
 			&& (eventType != BUNDLE_EVENT_STOPPING)
 			&& (eventType != BUNDLE_EVENT_LAZY_ACTIVATION)) {
-		request_t request = malloc(sizeof(*request));
+		request_t request = (request_t) malloc(sizeof(*request));
 		if (!request) {
 			status = CELIX_ENOMEM;
 		} else {
@@ -1991,8 +1993,8 @@ static void *APR_THREAD_FUNC fw_eventDis
 			int size = arrayList_size(request->listeners);
 			for (i = 0; i < size; i++) {
 				if (request->type == BUNDLE_EVENT_TYPE) {
-					fw_bundle_listener_t listener = arrayList_get(request->listeners, i);
-					bundle_event_t event = apr_palloc(listener->listener->pool, sizeof(*event));
+					fw_bundle_listener_t listener = (fw_bundle_listener_t) (request->listeners, i);
+					bundle_event_t event = (bundle_event_t) apr_palloc(listener->listener->pool, sizeof(*event));
 					event->bundle = request->bundle;
 					event->type = request->type;
 

Modified: incubator/celix/trunk/framework/private/src/miniunz.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/miniunz.c?rev=1423360&r1=1423359&r2=1423360&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/miniunz.c (original)
+++ incubator/celix/trunk/framework/private/src/miniunz.c Tue Dec 18 09:12:41 2012
@@ -51,6 +51,7 @@
 #ifdef _WIN32
 #define USEWIN32IOAPI
 #include "iowin32.h"
+#include <direct.h>
 #endif
 /*
   mini unzip, demo of unzip package
@@ -67,10 +68,7 @@
     filename : the filename of the file where date/time must be modified
     dosdate : the new date at the MSDos format (4 bytes)
     tmu_date : the SAME new date at the tm_unz format */
-void change_file_date(filename,dosdate,tmu_date)
-    const char *filename;
-    uLong dosdate;
-    tm_unz tmu_date;
+void change_file_date(const char *filename, uLong dosdate, tm_unz tmu_date)
 {
 #ifdef _WIN32
   HANDLE hFile;
@@ -108,8 +106,7 @@ void change_file_date(filename,dosdate,t
 /* mymkdir and change_file_date are not 100 % portable
    As I don't know well Unix, I wait feedback for the unix portion */
 
-int mymkdir(dirname)
-    const char* dirname;
+int mymkdir(const char *dirname)
 {
     int ret=0;
 #ifdef _WIN32
@@ -122,8 +119,7 @@ int mymkdir(dirname)
     return ret;
 }
 
-int makedir (newdir)
-    char *newdir;
+int makedir (char *newdir)
 {
   char *buffer ;
   char *p;

Modified: incubator/celix/trunk/framework/private/src/service_tracker.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/private/src/service_tracker.c?rev=1423360&r1=1423359&r2=1423360&view=diff
==============================================================================
--- incubator/celix/trunk/framework/private/src/service_tracker.c (original)
+++ incubator/celix/trunk/framework/private/src/service_tracker.c Tue Dec 18 09:12:41 2012
@@ -102,7 +102,7 @@ celix_status_t serviceTracker_createWith
 }
 
 apr_status_t serviceTracker_destroy(void *trackerP) {
-	service_tracker_t tracker = trackerP;
+	service_tracker_t tracker = (service_tracker_t) trackerP;
 	bundleContext_removeServiceListener(tracker->context, tracker->listener);
 	arrayList_destroy(tracker->tracked);
 

Modified: incubator/celix/trunk/shell_tui/private/src/shell_tui.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/shell_tui/private/src/shell_tui.c?rev=1423360&r1=1423359&r2=1423360&view=diff
==============================================================================
--- incubator/celix/trunk/shell_tui/private/src/shell_tui.c (original)
+++ incubator/celix/trunk/shell_tui/private/src/shell_tui.c Tue Dec 18 09:12:41 2012
@@ -88,7 +88,7 @@ void shellTui_initializeService(SHELL_TU
 }
 
 void shellTui_serviceChanged(service_listener_t listener, service_event_t event) {
-	bool result = NULL;
+	bool result = false;
     SHELL_TUI_ACTIVATOR act = (SHELL_TUI_ACTIVATOR) listener->handle;
 
 	if ((event->type == SERVICE_EVENT_REGISTERED) && (act->reference == NULL))
{



Mime
View raw message