You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@celix.apache.org by ab...@apache.org on 2012/12/18 09:36:33 UTC

svn commit: r1423320 - in /incubator/celix/trunk: framework/public/include/ remote_shell/ remote_shell/private/include/ remote_shell/private/src/

Author: abroekhuis
Date: Tue Dec 18 08:36:31 2012
New Revision: 1423320

URL: http://svn.apache.org/viewvc?rev=1423320&view=rev
Log:
CELIX-44: Fixed several small compilation error on WIN32

Modified:
    incubator/celix/trunk/framework/public/include/bundle_activator.h
    incubator/celix/trunk/framework/public/include/framework_exports.h
    incubator/celix/trunk/remote_shell/CMakeLists.txt
    incubator/celix/trunk/remote_shell/private/include/connection_listener.h
    incubator/celix/trunk/remote_shell/private/include/remote_shell.h
    incubator/celix/trunk/remote_shell/private/src/activator.c
    incubator/celix/trunk/remote_shell/private/src/connection_listener.c
    incubator/celix/trunk/remote_shell/private/src/remote_shell.c
    incubator/celix/trunk/remote_shell/private/src/shell_mediator.c

Modified: incubator/celix/trunk/framework/public/include/bundle_activator.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/bundle_activator.h?rev=1423320&r1=1423319&r2=1423320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/bundle_activator.h (original)
+++ incubator/celix/trunk/framework/public/include/bundle_activator.h Tue Dec 18 08:36:31 2012
@@ -54,7 +54,7 @@
  * 		- Any other status code will mark the bundle as stopped and the framework will remove this
  * 		  bundle's listeners, unregister all services, and release all services used by this bundle.
  */
-FRAMEWORK_EXPORT celix_status_t bundleActivator_create(bundle_context_t context, void **userData);
+ACTIVATOR_EXPORT celix_status_t bundleActivator_create(bundle_context_t context, void **userData);
 
 /**
  * Called when this bundle is started so the Framework can perform the bundle-specific activities necessary
@@ -72,7 +72,7 @@ FRAMEWORK_EXPORT celix_status_t bundleAc
  * 		- Any other status code will mark the bundle as stopped and the framework will remove this
  * 		  bundle's listeners, unregister all services, and release all services used by this bundle.
  */
-FRAMEWORK_EXPORT celix_status_t bundleActivator_start(void * userData, bundle_context_t context);
+ACTIVATOR_EXPORT celix_status_t bundleActivator_start(void * userData, bundle_context_t context);
 
 /**
  * Called when this bundle is stopped so the Framework can perform the bundle-specific activities necessary
@@ -91,7 +91,7 @@ FRAMEWORK_EXPORT celix_status_t bundleAc
  * 		- Any other status code will mark the bundle as stopped and the framework will remove this
  * 		  bundle's listeners, unregister all services, and release all services used by this bundle.
  */
-FRAMEWORK_EXPORT celix_status_t bundleActivator_stop(void * userData, bundle_context_t context);
+ACTIVATOR_EXPORT celix_status_t bundleActivator_stop(void * userData, bundle_context_t context);
 
 /**
  * Called when this bundle is stopped so the bundle can destroy the instance of its activator. In general, this
@@ -108,7 +108,7 @@ FRAMEWORK_EXPORT celix_status_t bundleAc
  * 		- Any other status code will mark the bundle as stopped and the framework will remove this
  * 		  bundle's listeners, unregister all services, and release all services used by this bundle.
  */
-FRAMEWORK_EXPORT celix_status_t bundleActivator_destroy(void * userData, bundle_context_t context);
+ACTIVATOR_EXPORT celix_status_t bundleActivator_destroy(void * userData, bundle_context_t context);
 
 #endif /* BUNDLE_ACTIVATOR_H_ */
 

Modified: incubator/celix/trunk/framework/public/include/framework_exports.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/framework/public/include/framework_exports.h?rev=1423320&r1=1423319&r2=1423320&view=diff
==============================================================================
--- incubator/celix/trunk/framework/public/include/framework_exports.h (original)
+++ incubator/celix/trunk/framework/public/include/framework_exports.h Tue Dec 18 08:36:31 2012
@@ -32,6 +32,7 @@ building a DLL on windows.
 // We are using the Visual Studio Compiler and building Shared libraries
 
 #if defined (_WIN32)
+	#define  ACTIVATOR_EXPORT __declspec(dllexport)
   #if defined(celix_framework_EXPORTS)
     #define  FRAMEWORK_EXPORT __declspec(dllexport)
   #else

Modified: incubator/celix/trunk/remote_shell/CMakeLists.txt
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_shell/CMakeLists.txt?rev=1423320&r1=1423319&r2=1423320&view=diff
==============================================================================
--- incubator/celix/trunk/remote_shell/CMakeLists.txt (original)
+++ incubator/celix/trunk/remote_shell/CMakeLists.txt Tue Dec 18 08:36:31 2012
@@ -25,6 +25,9 @@ if (REMOTE_SHELL)
     	private/src/connection_listener 
     	private/src/shell_mediator 
     	private/src/remote_shell
+
+		private/include/remote_shell.h
+		private/include/connection_listener.h
 	)
  
     include_directories("private/include")

Modified: incubator/celix/trunk/remote_shell/private/include/connection_listener.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_shell/private/include/connection_listener.h?rev=1423320&r1=1423319&r2=1423320&view=diff
==============================================================================
--- incubator/celix/trunk/remote_shell/private/include/connection_listener.h (original)
+++ incubator/celix/trunk/remote_shell/private/include/connection_listener.h Tue Dec 18 08:36:31 2012
@@ -36,7 +36,7 @@
 
 typedef struct connection_listener *connection_listener_t;
 
-celix_status_t connectionListener_create(apr_pool_t *pool, remote_shell_t remoteShell, apr_int64_t port, connection_listener_t *instance);
+celix_status_t connectionListener_create(apr_pool_t *pool, remote_shell_t remoteShell, apr_size_t port, connection_listener_t *instance);
 
 celix_status_t connectionListener_start(connection_listener_t instance);
 celix_status_t connectionListener_stop(connection_listener_t instance);

Modified: incubator/celix/trunk/remote_shell/private/include/remote_shell.h
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_shell/private/include/remote_shell.h?rev=1423320&r1=1423319&r2=1423320&view=diff
==============================================================================
--- incubator/celix/trunk/remote_shell/private/include/remote_shell.h (original)
+++ incubator/celix/trunk/remote_shell/private/include/remote_shell.h Tue Dec 18 08:36:31 2012
@@ -36,7 +36,7 @@
 
 typedef struct remote_shell *remote_shell_t;
 
-celix_status_t remoteShell_create(apr_pool_t *pool, shell_mediator_t mediator, apr_int64_t maximumConnections, remote_shell_t *instance);
+celix_status_t remoteShell_create(apr_pool_t *pool, shell_mediator_t mediator, apr_size_t maximumConnections, remote_shell_t *instance);
 
 celix_status_t remoteShell_addConnection(remote_shell_t instance, apr_socket_t *socket);
 

Modified: incubator/celix/trunk/remote_shell/private/src/activator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_shell/private/src/activator.c?rev=1423320&r1=1423319&r2=1423320&view=diff
==============================================================================
--- incubator/celix/trunk/remote_shell/private/src/activator.c (original)
+++ incubator/celix/trunk/remote_shell/private/src/activator.c Tue Dec 18 08:36:31 2012
@@ -51,9 +51,9 @@ struct bundle_instance {
 
 typedef struct bundle_instance *bundle_instance_t;
 
-static apr_int64_t bundleActivator_getPort(bundle_context_t context);
-static apr_int64_t bundleActivator_getMaximumConnections(bundle_context_t context);
-static apr_int64_t bundleActivator_getProperty(bundle_context_t context, char * propertyName, apr_int64_t defaultValue);
+static apr_size_t bundleActivator_getPort(bundle_context_t context);
+static apr_size_t bundleActivator_getMaximumConnections(bundle_context_t context);
+static apr_size_t bundleActivator_getProperty(bundle_context_t context, char * propertyName, apr_size_t defaultValue);
 
 celix_status_t bundleActivator_create(bundle_context_t context, void **userData) {
 	celix_status_t status = CELIX_SUCCESS;
@@ -62,7 +62,7 @@ celix_status_t bundleActivator_create(bu
     status = bundleContext_getMemoryPool(context, &ctxpool);
     apr_pool_create(&pool, ctxpool);
     if (status == CELIX_SUCCESS) {
-    	bundle_instance_t bi = apr_palloc(pool, sizeof(struct bundle_instance));
+    	bundle_instance_t bi = (bundle_instance_t) apr_palloc(pool, sizeof(struct bundle_instance));
         if (userData != NULL) {
         	bi->pool = pool;
         	bi->shellMediator = NULL;
@@ -80,8 +80,8 @@ celix_status_t bundleActivator_start(voi
     celix_status_t status = CELIX_SUCCESS;
     bundle_instance_t bi = (bundle_instance_t)userData;
 
-    apr_int64_t port = bundleActivator_getPort(context);
-    apr_int64_t maxConn = bundleActivator_getMaximumConnections(context);
+    apr_size_t port = bundleActivator_getPort(context);
+    apr_size_t maxConn = bundleActivator_getMaximumConnections(context);
 
     status = shellMediator_create(bi->pool, context, &bi->shellMediator);
 	status = CELIX_DO_IF(status, remoteShell_create(bi->pool, bi->shellMediator,  maxConn, &bi->remoteShell));
@@ -105,21 +105,21 @@ celix_status_t bundleActivator_destroy(v
     return CELIX_SUCCESS;
 }
 
-static apr_int64_t bundleActivator_getPort(bundle_context_t context) {
+static apr_size_t bundleActivator_getPort(bundle_context_t context) {
 	return bundleActivator_getProperty(context, REMOTE_SHELL_TELNET_PORT_PROPERTY_NAME, DEFAULT_REMOTE_SHELL_TELNET_PORT);
 }
 
-static apr_int64_t bundleActivator_getMaximumConnections(bundle_context_t context) {
+static apr_size_t bundleActivator_getMaximumConnections(bundle_context_t context) {
 	return bundleActivator_getProperty(context, REMOTE_SHELL_TELNET_MAXCONN_PROPERTY_NAME, DEFAULT_REMOTE_SHELL_TELNET_MAXCONN);
 }
 
-static apr_int64_t bundleActivator_getProperty(bundle_context_t context, char * propertyName, apr_int64_t defaultValue) {
-	apr_int64_t value;
+static apr_size_t bundleActivator_getProperty(bundle_context_t context, char * propertyName, apr_size_t defaultValue) {
+	apr_size_t value;
 	char *strValue = NULL;
 
 	bundleContext_getProperty(context, propertyName, &strValue);
 	if (strValue != NULL) {
-		value = apr_strtoi64(strValue, (char **)NULL, 10);
+		value = atoi(strValue);
 		if (errno != 0) {
 			printf("incorrect format for %s\n", propertyName);
 			value = defaultValue;

Modified: incubator/celix/trunk/remote_shell/private/src/connection_listener.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_shell/private/src/connection_listener.c?rev=1423320&r1=1423319&r2=1423320&view=diff
==============================================================================
--- incubator/celix/trunk/remote_shell/private/src/connection_listener.c (original)
+++ incubator/celix/trunk/remote_shell/private/src/connection_listener.c Tue Dec 18 08:36:31 2012
@@ -43,7 +43,7 @@
 struct connection_listener {
 	//constant
     apr_pool_t *pool;
-    apr_int64_t port;
+    apr_size_t port;
     remote_shell_t remoteShell;
 	apr_thread_mutex_t *mutex;
 
@@ -55,7 +55,7 @@ struct connection_listener {
 static void* APR_THREAD_FUNC connection_listener_thread(apr_thread_t *thread, void *data);
 static apr_status_t connectionListener_cleanup(connection_listener_t instance);
 
-celix_status_t connectionListener_create(apr_pool_t *pool, remote_shell_t remoteShell, apr_int64_t port, connection_listener_t *instance) {
+celix_status_t connectionListener_create(apr_pool_t *pool, remote_shell_t remoteShell, apr_size_t port, connection_listener_t *instance) {
 	celix_status_t status = CELIX_SUCCESS;
     (*instance) = apr_palloc(pool, sizeof(**instance));
     if ((*instance) != NULL) {
@@ -105,10 +105,12 @@ celix_status_t connectionListener_stop(c
 
 	if (thread != NULL && pollset != NULL) {
 		apr_status_t threadStatus = APR_SUCCESS;
+		apr_status_t stat = APR_SUCCESS;
+		char error[512];
 
 		printf("Stopping thread by waking poll on listen socket\n");
-		apr_status_t stat = apr_pollset_wakeup(pollset);
-		char error[512];
+		stat = apr_pollset_wakeup(pollset);
+		
 		apr_strerror(stat, error, 512);
 		printf("Got error %s\n", error);
 

Modified: incubator/celix/trunk/remote_shell/private/src/remote_shell.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_shell/private/src/remote_shell.c?rev=1423320&r1=1423319&r2=1423320&view=diff
==============================================================================
--- incubator/celix/trunk/remote_shell/private/src/remote_shell.c (original)
+++ incubator/celix/trunk/remote_shell/private/src/remote_shell.c Tue Dec 18 08:36:31 2012
@@ -69,9 +69,9 @@ static apr_status_t remoteShell_cleanup(
 
 static celix_status_t remoteShell_connection_print(connection_t connection, char * text);
 static celix_status_t remoteShell_connection_execute(connection_t connection, char *command);
-static void* remoteShell_connection_run(apr_thread_t *thread, void *data);
+static void* APR_THREAD_FUNC remoteShell_connection_run(apr_thread_t *thread, void *data);
 
-celix_status_t remoteShell_create(apr_pool_t *pool, shell_mediator_t mediator, apr_int64_t maximumConnections, remote_shell_t *instance) {
+celix_status_t remoteShell_create(apr_pool_t *pool, shell_mediator_t mediator, apr_size_t maximumConnections, remote_shell_t *instance) {
 	celix_status_t status = CELIX_SUCCESS;
 	(*instance) = apr_palloc(pool, sizeof(**instance));
 	if ((*instance) != NULL) {
@@ -138,10 +138,12 @@ celix_status_t remoteShell_stopConnectio
 	celix_status_t status = CELIX_SUCCESS;
 	apr_status_t wakeupStatus = APR_SUCCESS;
 	char error[64];
+	int length = 0;
+	int i = 0;
 
 	apr_thread_mutex_lock(instance->mutex);
-	int length = arrayList_size(instance->connections);
-	for (int i = 0; i < length; i += 1) {
+	length = arrayList_size(instance->connections);
+	for (i = 0; i < length; i += 1) {
 		connection_t connection = arrayList_get(instance->connections, i);
 		wakeupStatus = apr_pollset_wakeup(connection->pollset);
 		if (wakeupStatus != APR_SUCCESS) {
@@ -155,7 +157,7 @@ celix_status_t remoteShell_stopConnectio
 	return status;
 }
 
-void * remoteShell_connection_run(apr_thread_t *thread, void *data) {
+void *APR_THREAD_FUNC remoteShell_connection_run(apr_thread_t *thread, void *data) {
 	celix_status_t status = CELIX_SUCCESS;
 	connection_t connection = data;
 

Modified: incubator/celix/trunk/remote_shell/private/src/shell_mediator.c
URL: http://svn.apache.org/viewvc/incubator/celix/trunk/remote_shell/private/src/shell_mediator.c?rev=1423320&r1=1423319&r2=1423320&view=diff
==============================================================================
--- incubator/celix/trunk/remote_shell/private/src/shell_mediator.c (original)
+++ incubator/celix/trunk/remote_shell/private/src/shell_mediator.c Tue Dec 18 08:36:31 2012
@@ -50,7 +50,7 @@ struct shell_mediator {
 // 		a non ADT - shared between instances - variable.
 static apr_socket_t *currentOutputSocket = NULL;
 
-static apr_status_t shellMediator_cleanup(shell_mediator_t instance); //gets called from apr pool cleanup
+static apr_status_t shellMediator_cleanup(void *handle); //gets called from apr pool cleanup
 static void shellMediator_writeOnCurrentSocket(char *buff);
 
 static celix_status_t shellMediator_addingService(void *handler, service_reference_t reference, void **service);
@@ -62,9 +62,9 @@ celix_status_t shellMediator_create(apr_
 	celix_status_t status = CELIX_SUCCESS;
 	service_tracker_customizer_t customizer = NULL;
 
-    (*instance) = apr_palloc(pool, sizeof(**instance));
+	(*instance) = (shell_mediator_t) (pool, sizeof(**instance));
     if ((*instance) != NULL) {
-		apr_pool_pre_cleanup_register(pool, *instance, (void *)shellMediator_cleanup);
+		apr_pool_pre_cleanup_register(pool, *instance, shellMediator_cleanup);
 
     	(*instance)->pool = pool;
 		(*instance)->context = context;
@@ -89,14 +89,15 @@ celix_status_t shellMediator_create(apr_
 	return status;
 }
 
-static apr_status_t shellMediator_cleanup(shell_mediator_t instance) {
-        apr_thread_mutex_lock(instance->mutex);
+static apr_status_t shellMediator_cleanup(void *handle) {
+	shell_mediator_t instance = (shell_mediator_t) handle;
+    apr_thread_mutex_lock(instance->mutex);
 
-        instance->shellService=NULL;
-        serviceTracker_close(instance->tracker);
+    instance->shellService=NULL;
+    serviceTracker_close(instance->tracker);
 
-        apr_thread_mutex_unlock(instance->mutex);
-        return APR_SUCCESS;
+    apr_thread_mutex_unlock(instance->mutex);
+    return APR_SUCCESS;
 }
 
 static void shellMediator_writeOnCurrentSocket(char *buff) {
@@ -120,16 +121,16 @@ celix_status_t shellMediator_executeComm
 
 static celix_status_t shellMediator_addingService(void *handler, service_reference_t reference, void **service) {
 	celix_status_t status = CELIX_SUCCESS;
-	shell_mediator_t instance = handler;
+	shell_mediator_t instance = (shell_mediator_t) handler;
 	bundleContext_getService(instance->context, reference, service);
 	return status;
 }
 
 static celix_status_t shellMediator_addedService(void *handler, service_reference_t reference, void * service) {
 	celix_status_t status = CELIX_SUCCESS;
-	shell_mediator_t instance = handler;
+	shell_mediator_t instance = (shell_mediator_t) handler;
 	apr_thread_mutex_lock(instance->mutex);
-	instance->shellService = service;
+	instance->shellService = (SHELL_SERVICE) service;
 	apr_thread_mutex_unlock(instance->mutex);
 	return status;
 }
@@ -142,7 +143,7 @@ static celix_status_t shellMediator_modi
 
 static celix_status_t shellMediator_removedService(void *handler, service_reference_t reference, void * service) {
 	celix_status_t status = CELIX_SUCCESS;
-	shell_mediator_t instance = handler;
+	shell_mediator_t instance = (shell_mediator_t) handler;
 	apr_thread_mutex_lock(instance->mutex);
 	instance->shellService = NULL;
 	apr_thread_mutex_unlock(instance->mutex);