axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dami...@apache.org
Subject svn commit: r327970 - in /webservices/axis2/trunk/c: include/ modules/core/engine/src/ modules/util/src/
Date Mon, 24 Oct 2005 05:07:10 GMT
Author: damitha
Date: Sun Oct 23 22:06:48 2005
New Revision: 327970

URL: http://svn.apache.org/viewcvs?rev=327970&view=rev
Log:
Changes to stream.c and string.c to handle uninitialized situations

Modified:
    webservices/axis2/trunk/c/include/axis2_error.h
    webservices/axis2/trunk/c/include/axis2_stream.h
    webservices/axis2/trunk/c/modules/core/engine/src/axis2_engine_config.c
    webservices/axis2/trunk/c/modules/util/src/axis2_environment.c
    webservices/axis2/trunk/c/modules/util/src/axis2_file_diff.c
    webservices/axis2/trunk/c/modules/util/src/axis2_stream.c
    webservices/axis2/trunk/c/modules/util/src/axis2_string.c

Modified: webservices/axis2/trunk/c/include/axis2_error.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_error.h?rev=327970&r1=327969&r2=327970&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_error.h (original)
+++ webservices/axis2/trunk/c/include/axis2_error.h Sun Oct 23 22:06:48 2005
@@ -117,7 +117,9 @@
         /** Trying to release unallocated memory */
         AXIS2_ERROR_UNALLOCATED_MEMEORY_RELEASE_REQUESTED,
 		/** Struct is not properly initialized */
-		AXIS2_ERROR_STRUCT_NOT_INITIALIZED
+		AXIS2_ERROR_STRUCT_NOT_INITIALIZED,
+		/** Could not open the file */
+		AXIS2_ERROR_COULD_NOT_OPEN_FILE
     } axis2_error_codes_t;
 
 /** @} */

Modified: webservices/axis2/trunk/c/include/axis2_stream.h
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/include/axis2_stream.h?rev=327970&r1=327969&r2=327970&view=diff
==============================================================================
--- webservices/axis2/trunk/c/include/axis2_stream.h (original)
+++ webservices/axis2/trunk/c/include/axis2_stream.h Sun Oct 23 22:06:48 2005
@@ -63,7 +63,7 @@
 		 * @param options file options given.
 		 * @return status code
 		 */
-		AXIS2_DECLARE(axis2_status_t) (*axis2_stream_ops_file_open)
+		AXIS2_DECLARE(void *) (*axis2_stream_ops_file_open)
 				(const char *file_name, const char *options);
 		
 		/**
@@ -101,7 +101,6 @@
     {
         /** Stream related operations */
         struct axis2_stream_ops *ops;
-		void *file;
 		int axis2_eof;
     } axis2_stream_t;
 
@@ -112,7 +111,7 @@
     * @return pointer to the newly created log struct 
     */
     AXIS2_DECLARE(axis2_stream_t *) axis2_stream_create (axis2_allocator_t * allocator,
-                                         axis2_stream_ops_t * operations);
+                                         axis2_stream_t * stream);
 
 #define axis2_stream_read(stream, buffer, count) \
 		((stream)->ops->axis2_stream_ops_read(buffer, count))

Modified: webservices/axis2/trunk/c/modules/core/engine/src/axis2_engine_config.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/core/engine/src/axis2_engine_config.c?rev=327970&r1=327969&r2=327970&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/core/engine/src/axis2_engine_config.c (original)
+++ webservices/axis2/trunk/c/modules/core/engine/src/axis2_engine_config.c Sun Oct 23 22:06:48
2005
@@ -41,11 +41,17 @@
 		axis2_environment_t *env, axis2_engine_config_t *engine_config
 		, const axis2_char_t* servicegroup_name);
 
+axis2_status_t axis2_engine_config_ops_add_service(
+		axis2_environment_t *env, axis2_engine_config_t *engine_config
+		, const axis2_description_service_t* service_desc);
+
 axis2_description_service_t *axis2_engine_config_ops_get_service(
-		axis2_engine_config_t *engine_config, const axis2_char_t* service_name);
+		axis2_environment_t *env, axis2_engine_config_t *engine_config
+		, const axis2_char_t* service_name);
 
 axis2_status_t axis2_engine_config_ops_remove_service
-		(axis2_engine_config_t *engine_config, const axis2_char_t *name);
+		(axis2_environment_t *env, axis2_engine_config_t *engine_config
+		, const axis2_char_t *name);
 
 /************************** End of function prototypes ************************/
 
@@ -155,20 +161,25 @@
 		, AXIS2_HASH_KEY_STRING));
 }
 
-axis2_description_service_t *axis2_engine_config_ops_add_service(
-		axis2_engine_config_t *engine_config, const axis2_char_t* service_name)
+axis2_status_t axis2_engine_config_ops_add_service(
+		axis2_environment_t *env, axis2_engine_config_t *engine_config
+		, const axis2_description_service_t *service_desc)
 {
+	if(!engine_config || engine_config->servicegroup_desc) return AXIS2_ERROR_INVALID_NULL_PARAMETER;
+	
 		
 }
 
 axis2_description_service_t *axis2_engine_config_ops_get_service(
-		axis2_engine_config_t *engine_config, const axis2_char_t* service_name)
+		axis2_environment_t *env, axis2_engine_config_t *engine_config
+		, const axis2_char_t* service_name)
 {
 		
 }
 
 axis2_status_t axis2_engine_config_ops_remove_service
-		(axis2_engine_config_t *engine_config, const axis2_char_t *name)
+		(axis2_environment_t *env, axis2_engine_config_t *engine_config
+		, const axis2_char_t *name)
 {
 	
 }

Modified: webservices/axis2/trunk/c/modules/util/src/axis2_environment.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_environment.c?rev=327970&r1=327969&r2=327970&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_environment.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_environment.c Sun Oct 23 22:06:48 2005
@@ -39,17 +39,14 @@
     else
         environment->error = error;
 
-    environment->stream = axis2_stream_create (allocator, NULL);    
+    environment->stream = axis2_stream_create (allocator, stream);    
 
     if (!log)
         environment->log = axis2_log_create (allocator, NULL);
     else
         environment->log = log;
 
-    if (!string)
-        environment->string = axis2_string_create (allocator, NULL);
-    else
-        environment->string = string;
+    environment->string = axis2_string_create (allocator, string);
 
     return environment;
 }

Modified: webservices/axis2/trunk/c/modules/util/src/axis2_file_diff.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_file_diff.c?rev=327970&r1=327969&r2=327970&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_file_diff.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_file_diff.c Sun Oct 23 22:06:48 2005
@@ -19,7 +19,7 @@
 void *expected_file, *actual_file; /* File pointers */
 
 /* private function header */
-axis2_status_t axis2_file_diff_clean(axis2_environment_t *env, int);
+axis2_status_t axis2_file_diff_clean(axis2_environment_t *env);
 
 axis2_status_t axis2_file_diff(axis2_environment_t *env
 		, axis2_char_t* expected_file_name, axis2_char_t* actual_file_name)
@@ -31,9 +31,10 @@
 		, "rt");
 	
 	if( expected_file == NULL || actual_file == NULL ) {
-		printf("Unable to open one of datafile %s, %s\n", expected_file_name
-			, actual_file_name );
-		axis2_file_diff_clean(env, 1 );
+		/*printf("Unable to open one of datafile %s, %s\n", expected_file_name
+			, actual_file_name );*/
+		axis2_file_diff_clean(env);
+		return AXIS2_ERROR_COULD_NOT_OPEN_FILE;
 	}
 	
    	int ch1, ch2;
@@ -99,7 +100,7 @@
 				axis2_stream_write(env->stream, buffer2, k);
 				axis2_stream_write(env->stream, "\n", 1);
 
-                axis2_file_diff_clean(env, 1);
+                axis2_file_diff_clean(env);
             }
             j++;k++;
             buffer1[j] = ch1;
@@ -128,11 +129,11 @@
    	return AXIS2_SUCCESS;
 }
 
-axis2_status_t axis2_file_diff_clean (axis2_environment_t *env, int exitcode )
+axis2_status_t axis2_file_diff_clean (axis2_environment_t *env)
 {
 	if(expected_file != NULL )
     	axis2_stream_file_close(env->stream, expected_file);
    	if(actual_file != NULL )
     	axis2_stream_file_close(env->stream, actual_file);
-    exit(exitcode);
+	return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/modules/util/src/axis2_stream.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_stream.c?rev=327970&r1=327969&r2=327970&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_stream.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_stream.c Sun Oct 23 22:06:48 2005
@@ -33,22 +33,64 @@
 
 axis2_stream_t *
 axis2_stream_create (axis2_allocator_t * allocator,
-                     axis2_stream_ops_t * operations)
+                     axis2_stream_t * stream)
 {
-    axis2_stream_t *stream;
-    if (!allocator)
-        return NULL;
-    stream =
-        (axis2_stream_t *) axis2_malloc (allocator, sizeof (axis2_stream_t));
+	if(stream)
+	{
+		if(stream->ops)
+		{
+			if(!stream->ops->axis2_stream_ops_read)
+				stream->ops->axis2_stream_ops_read = axis2_stream_impl_read;
+			if(!stream->ops->axis2_stream_ops_write)
+				stream->ops->axis2_stream_ops_write = axis2_stream_impl_write;
+			if(!stream->ops->axis2_stream_ops_file_open)
+				stream->ops->axis2_stream_ops_file_open = axis2_stream_impl_file_open;
+			if(!stream->ops->axis2_stream_ops_file_close)
+				stream->ops->axis2_stream_ops_file_close = axis2_stream_impl_file_close;
+			if(!stream->ops->axis2_stream_ops_file_get_char)
+				stream->ops->axis2_stream_ops_file_get_char 
+				= axis2_stream_impl_file_get_char;
+			if(!stream->ops->axis2_stream_ops_file_unget_char)
+				stream->ops->axis2_stream_ops_file_unget_char 
+				= axis2_stream_impl_file_unget_char;
+		}
+		else if (allocator)
+		{
+			stream->ops =
+            (axis2_stream_ops_t *) axis2_malloc (allocator,
+                                                 sizeof (axis2_stream_ops_t));
 
-    if (!stream)
-        return NULL;
+			if (!stream->ops)
+			{
+				axis2_free (allocator, stream->ops);
+				return NULL;
+			}
 
-    if (operations)
-        stream->ops = operations;
-    else
-    {
-        stream->ops =
+			stream->ops->axis2_stream_ops_read = axis2_stream_impl_read;
+			stream->ops->axis2_stream_ops_write = axis2_stream_impl_write;
+			stream->ops->axis2_stream_ops_file_open = axis2_stream_impl_file_open;
+			stream->ops->axis2_stream_ops_file_close = axis2_stream_impl_file_close;
+			stream->ops->axis2_stream_ops_file_get_char 
+				= axis2_stream_impl_file_get_char;
+			stream->ops->axis2_stream_ops_file_unget_char 
+				= axis2_stream_impl_file_unget_char;
+		}
+		else 
+			return NULL;
+		
+		if(!stream->axis2_eof)
+			stream->axis2_eof = EOF;
+		
+		return stream;
+	}
+	else if(allocator)
+	{
+		stream =
+        (axis2_stream_t *) axis2_malloc (allocator, sizeof (axis2_stream_t));
+
+		if (!stream)
+			return NULL;
+		stream->ops =
             (axis2_stream_ops_t *) axis2_malloc (allocator,
                                                  sizeof (axis2_stream_ops_t));
 
@@ -57,19 +99,20 @@
             axis2_free (allocator, stream);
             return NULL;
         }
-
-        stream->ops->axis2_stream_ops_read = axis2_stream_impl_read;
+		stream->ops->axis2_stream_ops_read = axis2_stream_impl_read;
         stream->ops->axis2_stream_ops_write = axis2_stream_impl_write;
 		stream->ops->axis2_stream_ops_file_open = axis2_stream_impl_file_open;
 		stream->ops->axis2_stream_ops_file_close = axis2_stream_impl_file_close;
-		stream->ops->axis2_stream_ops_file_get_char = axis2_stream_impl_file_get_char;
-		stream->ops->axis2_stream_ops_file_unget_char = axis2_stream_impl_file_unget_char;
-		
-		stream->file = NULL;
+		stream->ops->axis2_stream_ops_file_get_char 
+			= axis2_stream_impl_file_get_char;
+		stream->ops->axis2_stream_ops_file_unget_char 
+			= axis2_stream_impl_file_unget_char;
 		stream->axis2_eof = EOF;
-    }
-
-    return stream;
+		
+		return stream;
+	}
+	
+    return NULL;
 }
 
 axis2_status_t

Modified: webservices/axis2/trunk/c/modules/util/src/axis2_string.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/util/src/axis2_string.c?rev=327970&r1=327969&r2=327970&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/util/src/axis2_string.c (original)
+++ webservices/axis2/trunk/c/modules/util/src/axis2_string.c Sun Oct 23 22:06:48 2005
@@ -18,8 +18,6 @@
 #include <stdlib.h>
 #include <string.h>
 
-axis2_status_t check_validity(axis2_string_t *string);
-
 void *
 axis2_string_ops_strdup (const void *ptr)
 {
@@ -45,15 +43,12 @@
 axis2_string_t *
 axis2_string_create (axis2_allocator_t * allocator, axis2_string_t * string)
 {
-    if (string && AXIS2_SUCCESS == check_validity(string))
-	{
-		return string;	
-	}
-	else if(string)
+	if(string)
 	{
-		string->axis2_string_strdup = axis2_string_ops_strdup;
-        string->axis2_string_strcmp = axis2_string_ops_strcmp;	
-		return string;
+		if(!string->axis2_string_strdup)
+			string->axis2_string_strdup = axis2_string_ops_strdup;
+		if(!string->axis2_string_strcmp)
+			string->axis2_string_strcmp = axis2_string_ops_strcmp;
 	}
 	else if (allocator)
 	{
@@ -68,21 +63,4 @@
         }
     }
     return NULL;
-}
-
-/** This will check whether the passed string is properly initialized
-  * @param string to be validated
-  * @return status code
-  */
-axis2_status_t check_validity(axis2_string_t *string)
-{
-	if(!string)
-	{
-		return AXIS2_ERROR_INVALID_NULL_PARAMETER;
-	}
-	if(!string->axis2_string_strdup) return AXIS2_ERROR_STRUCT_NOT_INITIALIZED;
-		
-	if(!string->axis2_string_strcmp) return AXIS2_ERROR_STRUCT_NOT_INITIALIZED;
-		
-	return AXIS2_SUCCESS;
 }



Mime
View raw message