axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sam...@apache.org
Subject svn commit: r580200 [3/4] - /webservices/axis2/trunk/c/util/src/
Date Fri, 28 Sep 2007 03:13:00 GMT
Modified: webservices/axis2/trunk/c/util/src/network_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/network_handler.c?rev=580200&r1=580199&r2=580200&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/network_handler.c (original)
+++ webservices/axis2/trunk/c/util/src/network_handler.c Thu Sep 27 20:12:58 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -21,14 +22,17 @@
 #include <axutil_network_handler.h>
 #include <fcntl.h>
 
-
 #if defined(WIN32)
 static int is_init_socket = 0;
-axis2_bool_t axis2_init_socket();
+axis2_bool_t axis2_init_socket(
+    );
 #endif
 
-AXIS2_EXTERN axis2_socket_t  AXIS2_CALL
-axutil_network_handler_open_socket(const axutil_env_t *env, char *server, int port)
+AXIS2_EXTERN axis2_socket_t AXIS2_CALL
+axutil_network_handler_open_socket(
+    const axutil_env_t * env,
+    char *server,
+    int port)
 {
     axis2_socket_t sock = AXIS2_INVALID_SOCKET;
     struct sockaddr_in sock_addr;
@@ -47,7 +51,7 @@
     AXIS2_PARAM_CHECK(env->error, server, AXIS2_CRITICAL_FAILURE);
 
     if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
-        /*nnn AF_INET is not defined in sys/socket.h but PF_INET*/
+        /*nnn AF_INET is not defined in sys/socket.h but PF_INET */
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOCKET_ERROR, AXIS2_FAILURE);
         return AXIS2_INVALID_SOCKET;
@@ -55,47 +59,48 @@
 
     memset(&sock_addr, 0, sizeof(sock_addr));
     sock_addr.sin_family = AF_INET;
-    sock_addr.sin_addr.s_addr = inet_addr(server);/*nnn arpa/inet.d */
+    sock_addr.sin_addr.s_addr = inet_addr(server);  /*nnn arpa/inet.d */
 
     if (sock_addr.sin_addr.s_addr == AXIS2_INADDR_NONE) /*nnn netinet/in.h */
     {
+
         /**
          * server may be a host name
          */
-        struct hostent* lphost = NULL;
-        lphost = gethostbyname(server); 
+        struct hostent *lphost = NULL;
+        lphost = gethostbyname(server);
 
         if (lphost)
         {
-            sock_addr.sin_addr.s_addr =
-                ((struct in_addr*)lphost->h_addr)->s_addr;
+            sock_addr.sin_addr.s_addr = ((struct in_addr *) lphost->h_addr)->s_addr;
         }
         else
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_ADDRESS,
-                    AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_ADDRESS, AXIS2_FAILURE);
             return AXIS2_INVALID_SOCKET;
         }
     }
 
-    sock_addr.sin_port = htons((axis2_unsigned_short_t)port);
+    sock_addr.sin_port = htons((axis2_unsigned_short_t) port);
+
     /** Connect to server */
-    if (connect(sock, (struct sockaddr*)&sock_addr, sizeof(sock_addr)) < 0)
+    if (connect(sock, (struct sockaddr *) &sock_addr, sizeof(sock_addr)) < 0)
     {
         AXIS2_CLOSE_SOCKET(sock);
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOCKET_ERROR, AXIS2_FAILURE);
         return AXIS2_INVALID_SOCKET;
     }
-    setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (const char *)&nodelay,
-            sizeof(nodelay));
+    setsockopt(sock, IPPROTO_TCP, TCP_NODELAY, (const char *) &nodelay, sizeof(nodelay));
     ll.l_onoff = 1;
     ll.l_linger = 5;
-    setsockopt(sock, SOL_SOCKET, SO_LINGER , (const char *)&ll, sizeof(struct linger));
+    setsockopt(sock, SOL_SOCKET, SO_LINGER, (const char *) &ll, sizeof(struct linger));
     return sock;
 }
 
-AXIS2_EXTERN  axis2_socket_t  AXIS2_CALL
-axutil_network_handler_create_server_socket(const axutil_env_t *env, int port)
+AXIS2_EXTERN axis2_socket_t AXIS2_CALL
+axutil_network_handler_create_server_socket(
+    const axutil_env_t * env,
+    int port)
 {
     axis2_socket_t sock = AXIS2_INVALID_SOCKET;
     axis2_socket_t i = 0;
@@ -115,45 +120,43 @@
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOCKET_ERROR, AXIS2_FAILURE);
         return AXIS2_INVALID_SOCKET;
     }
+
     /** Address re-use */
     i = 1;
-    setsockopt(sock, SOL_SOCKET, SO_REUSEADDR , (char*) &i,
-            sizeof(axis2_socket_t));/*nnn casted 4th param to char* */
-    /** Exec behaviour */
-    AXIS2_CLOSE_SOCKET_ON_EXIT(sock)
+    setsockopt(sock, SOL_SOCKET, SO_REUSEADDR, (char *) &i, sizeof(axis2_socket_t));    /*nnn casted 4th param to char* */
 
-    memset(&sock_addr, 0, sizeof(sock_addr));
+    /** Exec behaviour */
+    AXIS2_CLOSE_SOCKET_ON_EXIT(sock) memset(&sock_addr, 0, sizeof(sock_addr));
 
     sock_addr.sin_family = AF_INET;
     sock_addr.sin_addr.s_addr = htonl(INADDR_ANY);
-    sock_addr.sin_port = htons((axis2_unsigned_short_t)port);
+    sock_addr.sin_port = htons((axis2_unsigned_short_t) port);
 
     /* Bind the socket to our port number */
-    if (bind(sock, (struct sockaddr*)&sock_addr, sizeof(sock_addr)) < 0)
+    if (bind(sock, (struct sockaddr *) &sock_addr, sizeof(sock_addr)) < 0)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOCKET_BIND_FAILED,
-                AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOCKET_BIND_FAILED, AXIS2_FAILURE);
         return AXIS2_INVALID_SOCKET;
     }
     if (listen(sock, 50) < 0)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOCKET_LISTEN_FAILED,
-                AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_SOCKET_LISTEN_FAILED, AXIS2_FAILURE);
         return AXIS2_INVALID_SOCKET;
     }
     return sock;
 }
 
-AXIS2_EXTERN axis2_status_t  AXIS2_CALL
-axutil_network_handler_close_socket(const axutil_env_t *env,  axis2_socket_t socket)
+AXIS2_EXTERN axis2_status_t AXIS2_CALL
+axutil_network_handler_close_socket(
+    const axutil_env_t * env,
+    axis2_socket_t socket)
 {
     int i = 0;
     char buf[32];
     AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
     if (socket < 0)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET,
-                AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET, AXIS2_FAILURE);
         return AXIS2_FAILURE;
     }
     shutdown(socket, AXIS2_SHUT_WR);
@@ -164,29 +167,33 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_network_handler_set_sock_option(const axutil_env_t *env, axis2_socket_t socket,
-        int option, int value)
+axutil_network_handler_set_sock_option(
+    const axutil_env_t * env,
+    axis2_socket_t socket,
+    int option,
+    int value)
 {
     if (option == SO_RCVTIMEO || option == SO_SNDTIMEO)
     {
-        #if defined(WIN32)
-            DWORD tv = value; //windows expects milliseconds in a DWORD
-        #else 
-            struct timeval tv;
-            /* we deal with milliseconds */
-            tv.tv_sec = value / 1000;
-            tv.tv_usec = (value % 1000) * 1000;
-        #endif    
-        
-        setsockopt(socket, SOL_SOCKET, option, (char*) &tv, sizeof(tv));
+#if defined(WIN32)
+        DWORD tv = value;       //windows expects milliseconds in a DWORD
+#else
+        struct timeval tv;
+        /* we deal with milliseconds */
+        tv.tv_sec = value / 1000;
+        tv.tv_usec = (value % 1000) * 1000;
+#endif
+
+        setsockopt(socket, SOL_SOCKET, option, (char *) &tv, sizeof(tv));
         return AXIS2_SUCCESS;
     }
     return AXIS2_FAILURE;
 }
 
 AXIS2_EXTERN axis2_socket_t AXIS2_CALL
-axutil_network_handler_svr_socket_accept(const axutil_env_t *env,
-        axis2_socket_t svr_socket)
+axutil_network_handler_svr_socket_accept(
+    const axutil_env_t * env,
+    axis2_socket_t svr_socket)
 {
     struct sockaddr cli_addr;
 
@@ -197,21 +204,22 @@
     AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
 
     cli_len = sizeof(cli_addr);
-    cli_socket = accept(svr_socket, (struct sockaddr *) & cli_addr, &cli_len);
+    cli_socket = accept(svr_socket, (struct sockaddr *) &cli_addr, &cli_len);
     if (cli_socket < 0)
         AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "[Axis2][network_handler] Socket accept \
                 failed");
 
-    setsockopt(svr_socket, IPPROTO_TCP, TCP_NODELAY, &nodelay,
-            sizeof(nodelay));
+    setsockopt(svr_socket, IPPROTO_TCP, TCP_NODELAY, &nodelay, sizeof(nodelay));
     ll.l_onoff = 1;
     ll.l_linger = 5;
-    setsockopt(cli_socket, SOL_SOCKET, SO_LINGER , &ll, sizeof(struct linger));
+    setsockopt(cli_socket, SOL_SOCKET, SO_LINGER, &ll, sizeof(struct linger));
     return cli_socket;
 }
 
 #if defined (WIN32)
-axis2_bool_t axis2_init_socket()
+axis2_bool_t
+axis2_init_socket(
+    )
 {
     WORD wVersionRequested;
     WSADATA wsaData;
@@ -223,8 +231,7 @@
     err = WSAStartup(wVersionRequested, &wsaData);
 
     if (err != 0)
-        return 0; //WinSock 2.2 not found
-
+        return 0;               //WinSock 2.2 not found
 
     /*   Confirm that the WinSock DLL supports 2.2. */
     /*   Note that if the DLL supports versions greater */
@@ -232,33 +239,33 @@
     /*   2.2 in wVersion since that is the version we */
     /*   requested. */
 
-    if (LOBYTE(wsaData.wVersion) != 2 ||
-            HIBYTE(wsaData.wVersion) != 2)
+    if (LOBYTE(wsaData.wVersion) != 2 || HIBYTE(wsaData.wVersion) != 2)
     {
         WSACleanup();
-        return 0; //WinSock 2.2 not supported
+        return 0;               //WinSock 2.2 not supported
     }
+
     /**
      *   Enable the use of sockets as filehandles
      */
     /*  
      * setsockopt(INVALID_SOCKET, SOL_SOCKET, SO_OPENTYPE, (char *)&sock_opt,
-            sizeof(sock_opt));*/
+     sizeof(sock_opt));*/
     return 1;
 }
 #endif
 
-
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axutil_network_handler_get_svr_ip(const axutil_env_t *env,
-        axis2_socket_t socket)
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+axutil_network_handler_get_svr_ip(
+    const axutil_env_t * env,
+    axis2_socket_t socket)
 {
     struct sockaddr_in addr;
 
     axis2_socket_len_t len = sizeof(addr);
     char *ret = NULL;
     memset(&addr, 0, sizeof(addr));
-    if (getsockname(socket, (struct sockaddr *)&addr, &len) < 0)
+    if (getsockname(socket, (struct sockaddr *) &addr, &len) < 0)
     {
         return NULL;
     }
@@ -266,16 +273,17 @@
     return ret;
 }
 
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axutil_network_handler_get_peer_ip(const axutil_env_t *env,
-        axis2_socket_t socket)
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+axutil_network_handler_get_peer_ip(
+    const axutil_env_t * env,
+    axis2_socket_t socket)
 {
     struct sockaddr_in addr;
 
     axis2_socket_len_t len = sizeof(addr);
     char *ret = NULL;
     memset(&addr, 0, sizeof(addr));
-    if (getpeername(socket, (struct sockaddr *)&addr, &len) < 0)
+    if (getpeername(socket, (struct sockaddr *) &addr, &len) < 0)
     {
         return NULL;
     }

Modified: webservices/axis2/trunk/c/util/src/param.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/param.c?rev=580200&r1=580199&r2=580200&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/param.c (original)
+++ webservices/axis2/trunk/c/util/src/param.c Thu Sep 27 20:12:58 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -22,24 +23,30 @@
 
 struct axutil_param
 {
+
     /** Parameter name */
     axis2_char_t *name;
+
     /** Parameter value */
-    void* value;
+    void *value;
+
     /** Parameter locked? */
     axis2_bool_t locked;
+
     /** Parameter type */
-    int type; /*default is AXIS2_TEXT_PARAM */
+    int type;                   /*default is AXIS2_TEXT_PARAM */
     axutil_hash_t *attrs;
     axutil_array_list_t *value_list;
-    axis2_status_t (AXIS2_CALL *
-    value_free) (void *param_value,
-        const axutil_env_t *env);
+     axis2_status_t(
+    AXIS2_CALL * value_free) (
+    void *param_value,
+    const axutil_env_t * env);
 };
 
-AXIS2_EXTERN axutil_param_t* AXIS2_CALL
-axutil_param_create(const axutil_env_t *env,
-    axis2_char_t *name, 
+AXIS2_EXTERN axutil_param_t *AXIS2_CALL
+axutil_param_create(
+    const axutil_env_t * env,
+    axis2_char_t * name,
     void *value)
 {
     axutil_param_t *param = NULL;
@@ -55,7 +62,7 @@
     }
 
     param->name = axutil_strdup(env, name);
-    param->value = value; /* shallow copy.*/
+    param->value = value;       /* shallow copy. */
     param->locked = AXIS2_FALSE;
     param->type = AXIS2_TEXT_PARAM;
     param->attrs = NULL;
@@ -65,24 +72,27 @@
     return param;
 }
 
-axis2_char_t* AXIS2_CALL
-axutil_param_get_name(axutil_param_t *param,
-    const axutil_env_t *env)
+axis2_char_t *AXIS2_CALL
+axutil_param_get_name(
+    axutil_param_t * param,
+    const axutil_env_t * env)
 {
     return param->name;
 }
 
-void* AXIS2_CALL
-axutil_param_get_value(axutil_param_t *param,
-    const axutil_env_t *env)
+void *AXIS2_CALL
+axutil_param_get_value(
+    axutil_param_t * param,
+    const axutil_env_t * env)
 {
     return param->value;
 }
 
 axis2_status_t AXIS2_CALL
-axutil_param_set_name(axutil_param_t *param,
-    const axutil_env_t *env,
-    const axis2_char_t *name)
+axutil_param_set_name(
+    axutil_param_t * param,
+    const axutil_env_t * env,
+    const axis2_char_t * name)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
@@ -91,8 +101,9 @@
 }
 
 axis2_status_t AXIS2_CALL
-axutil_param_set_value(axutil_param_t *param,
-    const axutil_env_t *env,
+axutil_param_set_value(
+    axutil_param_t * param,
+    const axutil_env_t * env,
     const void *value)
 {
     void *param_value = NULL;
@@ -105,26 +116,28 @@
         {
             param->value_free(param_value, env);
         }
-        else /* we assume that param value is axis2_char_t* */
+        else                    /* we assume that param value is axis2_char_t* */
         {
             AXIS2_FREE(env->allocator, param_value);
         }
     }
-    param->value = (void *)value;
+    param->value = (void *) value;
     return AXIS2_SUCCESS;
 }
 
 axis2_bool_t AXIS2_CALL
-axutil_param_is_locked(axutil_param_t *param,
-    const axutil_env_t *env)
+axutil_param_is_locked(
+    axutil_param_t * param,
+    const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     return param->locked;
 }
 
 axis2_status_t AXIS2_CALL
-axutil_param_set_locked(axutil_param_t *param,
-    const axutil_env_t *env,
+axutil_param_set_locked(
+    axutil_param_t * param,
+    const axutil_env_t * env,
     axis2_bool_t value)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -134,15 +147,17 @@
 }
 
 int AXIS2_CALL
-axutil_param_get_param_type(axutil_param_t *param,
-    const axutil_env_t *env)
+axutil_param_get_param_type(
+    axutil_param_t * param,
+    const axutil_env_t * env)
 {
     return param->type;
 }
 
 axis2_status_t AXIS2_CALL
-axutil_param_set_param_type(axutil_param_t *param,
-    const axutil_env_t *env,
+axutil_param_set_param_type(
+    axutil_param_t * param,
+    const axutil_env_t * env,
     int type)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -152,9 +167,10 @@
 }
 
 axis2_status_t AXIS2_CALL
-axutil_param_set_attributes(axutil_param_t *param,
-    const axutil_env_t *env,
-    axutil_hash_t *attrs)
+axutil_param_set_attributes(
+    axutil_param_t * param,
+    const axutil_env_t * env,
+    axutil_hash_t * attrs)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, attrs, AXIS2_FAILURE);
@@ -164,8 +180,7 @@
         axutil_hash_index_t *i = NULL;
         void *v = NULL;
 
-        for (i = axutil_hash_first(param->attrs, env); i;
-            i = axutil_hash_next(env, i))
+        for (i = axutil_hash_first(param->attrs, env); i; i = axutil_hash_next(env, i))
         {
             axutil_hash_this(i, NULL, NULL, &v);
             axutil_generic_obj_free(v, env);
@@ -177,32 +192,34 @@
     return AXIS2_SUCCESS;
 }
 
-axutil_hash_t* AXIS2_CALL
-axutil_param_get_attributes(axutil_param_t *param,
-    const axutil_env_t *env)
+axutil_hash_t *AXIS2_CALL
+axutil_param_get_attributes(
+    axutil_param_t * param,
+    const axutil_env_t * env)
 {
     return param->attrs;
 }
 
 axis2_status_t AXIS2_CALL
-axutil_param_set_value_list(axutil_param_t *param,
-    const axutil_env_t *env,
-    axutil_array_list_t *value_list)
+axutil_param_set_value_list(
+    axutil_param_t * param,
+    const axutil_env_t * env,
+    axutil_array_list_t * value_list)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, value_list, AXIS2_FAILURE);
 
     if (param->value_list)
     {
-        int i = 0, size = 0;
+        int i = 0,
+            size = 0;
 
         size = axutil_array_list_size(param->value_list, env);
         for (i = 0; i < size; i++)
         {
             axutil_param_t *param = NULL;
 
-            param = (axutil_param_t *) axutil_array_list_get(
-                param->value_list, env, i);
+            param = (axutil_param_t *) axutil_array_list_get(param->value_list, env, i);
             axutil_param_free(param, env);
         }
         axutil_array_list_free(param->value_list, env);
@@ -212,16 +229,18 @@
     return AXIS2_SUCCESS;
 }
 
-axutil_array_list_t* AXIS2_CALL
-axutil_param_get_value_list(axutil_param_t *param,
-    const axutil_env_t *env)
+axutil_array_list_t *AXIS2_CALL
+axutil_param_get_value_list(
+    axutil_param_t * param,
+    const axutil_env_t * env)
 {
     return param->value_list;
 }
 
 void AXIS2_CALL
-axutil_param_free(axutil_param_t *param,
-    const axutil_env_t *env)
+axutil_param_free(
+    axutil_param_t * param,
+    const axutil_env_t * env)
 {
     void *param_value = NULL;
     axis2_char_t *param_name = NULL;
@@ -235,7 +254,7 @@
         {
             param->value_free(param_value, env);
         }
-        else /* we assume that param value is axis2_char_t* */
+        else                    /* we assume that param value is axis2_char_t* */
         {
             AXIS2_FREE(env->allocator, param_value);
         }
@@ -246,8 +265,7 @@
         axutil_hash_index_t *i = NULL;
         void *v = NULL;
 
-        for (i = axutil_hash_first(param->attrs, env); i;
-            i = axutil_hash_next(env, i))
+        for (i = axutil_hash_first(param->attrs, env); i; i = axutil_hash_next(env, i))
         {
             axutil_hash_this(i, NULL, NULL, &v);
             axutil_generic_obj_free(v, env);
@@ -257,15 +275,15 @@
 
     if (param->value_list)
     {
-        int i = 0, size = 0;
+        int i = 0,
+            size = 0;
 
         size = axutil_array_list_size(param->value_list, env);
         for (i = 0; i < size; i++)
         {
             axutil_param_t *param_l = NULL;
 
-            param_l = (axutil_param_t *) axutil_array_list_get(
-                param->value_list, env, i);
+            param_l = (axutil_param_t *) axutil_array_list_get(param->value_list, env, i);
             if (param_l)
             {
                 axutil_param_free(param_l, env);
@@ -280,8 +298,9 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_param_set_value_free(axutil_param_t *param,
-    const axutil_env_t *env,
+axutil_param_set_value_free(
+    axutil_param_t * param,
+    const axutil_env_t * env,
     void *free_fn)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -295,8 +314,9 @@
  * to avoid double free
  */
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_param_dummy_free_fn(void *param,
-    const axutil_env_t *env)
+axutil_param_dummy_free_fn(
+    void *param,
+    const axutil_env_t * env)
 {
     return AXIS2_SUCCESS;
 }

Modified: webservices/axis2/trunk/c/util/src/param_container.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/param_container.c?rev=580200&r1=580199&r2=580200&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/param_container.c (original)
+++ webservices/axis2/trunk/c/util/src/param_container.c Thu Sep 27 20:12:58 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -23,15 +24,16 @@
     axutil_array_list_t *params_list;
 };
 
-AXIS2_EXTERN axutil_param_container_t * AXIS2_CALL
-axutil_param_container_create(const axutil_env_t *env)
+AXIS2_EXTERN axutil_param_container_t *AXIS2_CALL
+axutil_param_container_create(
+    const axutil_env_t * env)
 {
     axutil_param_container_t *param_container = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
 
-    param_container = (axutil_param_container_t *) AXIS2_MALLOC(env->
-        allocator, sizeof(axutil_param_container_t));
+    param_container =
+        (axutil_param_container_t *) AXIS2_MALLOC(env->allocator, sizeof(axutil_param_container_t));
 
     if (!param_container)
     {
@@ -55,8 +57,9 @@
 }
 
 AXIS2_EXTERN void AXIS2_CALL
-axutil_param_container_free(axutil_param_container_t *param_container,
-    const axutil_env_t *env)
+axutil_param_container_free(
+    axutil_param_container_t * param_container,
+    const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
@@ -65,7 +68,7 @@
         axutil_hash_index_t *hi = NULL;
         void *val = NULL;
         for (hi = axutil_hash_first(param_container->params, env); hi;
-            hi = axutil_hash_next(env, hi))
+             hi = axutil_hash_next(env, hi))
         {
             axutil_param_t *param = NULL;
             axutil_hash_this(hi, NULL, NULL, &val);
@@ -94,8 +97,9 @@
 }
 
 AXIS2_EXTERN void AXIS2_CALL
-axutil_param_container_free_void_arg(void *param_container,
-    const axutil_env_t *env)
+axutil_param_container_free_void_arg(
+    void *param_container,
+    const axutil_env_t * env)
 {
     axutil_param_container_t *param_container_l = NULL;
 
@@ -106,9 +110,10 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_param_container_add_param(axutil_param_container_t *param_container,
-    const axutil_env_t *env,
-    axutil_param_t *param)
+axutil_param_container_add_param(
+    axutil_param_container_t * param_container,
+    const axutil_env_t * env,
+    axutil_param_t * param)
 {
     axis2_char_t *param_name = NULL;
 
@@ -126,28 +131,28 @@
     param_name = axutil_param_get_name(param, env);
     if (!param_name)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_PARAM,
-            AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_PARAM, AXIS2_FAILURE);
         return AXIS2_FAILURE;
     }
-    axutil_hash_set(param_container->params, param_name, 
-        AXIS2_HASH_KEY_STRING, param);
+    axutil_hash_set(param_container->params, param_name, AXIS2_HASH_KEY_STRING, param);
 
     return AXIS2_SUCCESS;
 }
 
-AXIS2_EXTERN axutil_param_t * AXIS2_CALL
-axutil_param_container_get_param(axutil_param_container_t *param_container,
-    const axutil_env_t *env,
-    const axis2_char_t *name)
-{
-    return (axutil_param_t *)(axutil_hash_get(param_container->params, 
-        name, AXIS2_HASH_KEY_STRING));
+AXIS2_EXTERN axutil_param_t *AXIS2_CALL
+axutil_param_container_get_param(
+    axutil_param_container_t * param_container,
+    const axutil_env_t * env,
+    const axis2_char_t * name)
+{
+    return (axutil_param_t
+            *) (axutil_hash_get(param_container->params, name, AXIS2_HASH_KEY_STRING));
 }
 
-AXIS2_EXTERN axutil_array_list_t * AXIS2_CALL
-axutil_param_container_get_params(axutil_param_container_t *param_container,
-    const axutil_env_t *env)
+AXIS2_EXTERN axutil_array_list_t *AXIS2_CALL
+axutil_param_container_get_params(
+    axutil_param_container_t * param_container,
+    const axutil_env_t * env)
 {
     axutil_hash_index_t *index_i = 0;
     axis2_status_t status = AXIS2_FAILURE;
@@ -158,21 +163,19 @@
         param_container->params_list = axutil_array_list_create(env, 0);
         if (!param_container->params_list)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
-                AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
             return NULL;
         }
     }
 
-    for (index_i = axutil_hash_first(param_container->params, env);
-        index_i; index_i = axutil_hash_next(env, index_i))
+    for (index_i = axutil_hash_first(param_container->params, env); index_i;
+         index_i = axutil_hash_next(env, index_i))
     {
         axutil_hash_this(index_i, NULL, NULL, &value);
-        status = axutil_array_list_add(param_container->params_list, env,
-            value);
+        status = axutil_array_list_add(param_container->params_list, env, value);
         if (AXIS2_SUCCESS != status)
         {
-            axutil_array_list_free(param_container->params_list , env);
+            axutil_array_list_free(param_container->params_list, env);
             return NULL;
         }
     }
@@ -181,16 +184,18 @@
 }
 
 AXIS2_EXTERN axis2_bool_t AXIS2_CALL
-axutil_param_container_is_param_locked(axutil_param_container_t *param_container,
-    const axutil_env_t *env,
-    const axis2_char_t *param_name)
+axutil_param_container_is_param_locked(
+    axutil_param_container_t * param_container,
+    const axutil_env_t * env,
+    const axis2_char_t * param_name)
 {
     axutil_param_t *param = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
-    param = (axutil_param_t *)(axutil_hash_get(param_container->params, 
-        param_name, AXIS2_HASH_KEY_STRING));
+    param =
+        (axutil_param_t
+         *) (axutil_hash_get(param_container->params, param_name, AXIS2_HASH_KEY_STRING));
     if (!param)
     {
         /* In this case we consider param is not locked */
@@ -198,4 +203,3 @@
     }
     return axutil_param_is_locked(param, env);
 }
-

Modified: webservices/axis2/trunk/c/util/src/properties.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/properties.c?rev=580200&r1=580199&r2=580200&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/properties.c (original)
+++ webservices/axis2/trunk/c/util/src/properties.c Thu Sep 27 20:12:58 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -19,21 +20,20 @@
 #include <axutil_string.h>
 #include <axutil_utils.h>
 
-
 #define MAX_SIZE 1024
 #define MAX_ALLOC (MAX_SIZE * 64)
 
-axis2_char_t*
-axutil_properties_read(FILE* input,
-    const axutil_env_t* env);
-
-axis2_char_t*
-axutil_properties_read_next(axis2_char_t* cur);
-
-axis2_char_t*
-axutil_properties_trunk_and_dup(axis2_char_t* start, 
-    axis2_char_t* end,
-    const axutil_env_t* env);
+axis2_char_t *axutil_properties_read(
+    FILE * input,
+    const axutil_env_t * env);
+
+axis2_char_t *axutil_properties_read_next(
+    axis2_char_t * cur);
+
+axis2_char_t *axutil_properties_trunk_and_dup(
+    axis2_char_t * start,
+    axis2_char_t * end,
+    const axutil_env_t * env);
 
 struct axutil_properties
 {
@@ -41,14 +41,14 @@
 };
 
 AXIS2_EXTERN axutil_properties_t *AXIS2_CALL
-axutil_properties_create(const axutil_env_t *env)
+axutil_properties_create(
+    const axutil_env_t * env)
 {
     axutil_properties_t *properties = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
 
-    properties= (axutil_properties_t *) AXIS2_MALLOC(env->allocator,
-        sizeof(axutil_properties_t));
+    properties = (axutil_properties_t *) AXIS2_MALLOC(env->allocator, sizeof(axutil_properties_t));
 
     if (!properties)
     {
@@ -61,8 +61,9 @@
 }
 
 AXIS2_EXTERN void AXIS2_CALL
-axutil_properties_free(axutil_properties_t *properties,
-    const axutil_env_t *env)
+axutil_properties_free(
+    axutil_properties_t * properties,
+    const axutil_env_t * env)
 {
     axis2_char_t *key = NULL;
     axis2_char_t *value = NULL;
@@ -72,18 +73,17 @@
 
     if (properties->prop_hash)
     {
-        for (hi = axutil_hash_first(properties->prop_hash, env);
-            hi; hi = axutil_hash_next(env, hi))
+        for (hi = axutil_hash_first(properties->prop_hash, env); hi; hi = axutil_hash_next(env, hi))
         {
-            axutil_hash_this(hi, (void*)&key, NULL, (void*)&value);
+            axutil_hash_this(hi, (void *) &key, NULL, (void *) &value);
             if (key)
-	    {
-                AXIS2_FREE(env-> allocator, key);
-	    }
+            {
+                AXIS2_FREE(env->allocator, key);
+            }
             if (value)
-	    {
-                AXIS2_FREE(env-> allocator, value);
-	    }
+            {
+                AXIS2_FREE(env->allocator, value);
+            }
         }
         axutil_hash_free(properties->prop_hash, env);
     }
@@ -95,56 +95,57 @@
     return;
 }
 
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axutil_properties_get_property(axutil_properties_t *properties,
-    const axutil_env_t *env,
-    axis2_char_t *key)
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+axutil_properties_get_property(
+    axutil_properties_t * properties,
+    const axutil_env_t * env,
+    axis2_char_t * key)
 {
-    AXIS2_PARAM_CHECK(env-> error, key, NULL);
+    AXIS2_PARAM_CHECK(env->error, key, NULL);
 
-    return axutil_hash_get(properties-> prop_hash,
-        key, AXIS2_HASH_KEY_STRING);
+    return axutil_hash_get(properties->prop_hash, key, AXIS2_HASH_KEY_STRING);
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_properties_set_property(axutil_properties_t *properties,
-    const axutil_env_t *env,
-    axis2_char_t *key,
-    axis2_char_t *value)
+axutil_properties_set_property(
+    axutil_properties_t * properties,
+    const axutil_env_t * env,
+    axis2_char_t * key,
+    axis2_char_t * value)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK(env-> error, key, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, key, AXIS2_FAILURE);
 
-    axutil_hash_set(properties-> prop_hash, key,
-        AXIS2_HASH_KEY_STRING, value);
+    axutil_hash_set(properties->prop_hash, key, AXIS2_HASH_KEY_STRING, value);
     return AXIS2_SUCCESS;
 }
 
-AXIS2_EXTERN axutil_hash_t* AXIS2_CALL
-axutil_properties_get_all(axutil_properties_t *properties,
-    const axutil_env_t *env)
+AXIS2_EXTERN axutil_hash_t *AXIS2_CALL
+axutil_properties_get_all(
+    axutil_properties_t * properties,
+    const axutil_env_t * env)
 {
-    return properties-> prop_hash;
+    return properties->prop_hash;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_properties_store(axutil_properties_t *properties,
-    const axutil_env_t *env,
-    FILE *output)
+axutil_properties_store(
+    axutil_properties_t * properties,
+    const axutil_env_t * env,
+    FILE * output)
 {
     axutil_hash_index_t *hi = NULL;
     axis2_char_t *key = NULL;
     axis2_char_t *value = NULL;
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK(env-> error, output, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, output, AXIS2_FAILURE);
 
     if (properties->prop_hash)
     {
-        for (hi = axutil_hash_first(properties->prop_hash, env);
-            hi; hi = axutil_hash_next(env, hi))
+        for (hi = axutil_hash_first(properties->prop_hash, env); hi; hi = axutil_hash_next(env, hi))
         {
-            axutil_hash_this(hi, (void*)&key, NULL, (void*)&value);
+            axutil_hash_this(hi, (void *) &key, NULL, (void *) &value);
             if (key)
             {
                 if (!value)
@@ -159,9 +160,10 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_properties_load(axutil_properties_t *properties,
-    const axutil_env_t *env,
-    axis2_char_t *input_filename)
+axutil_properties_load(
+    axutil_properties_t * properties,
+    const axutil_env_t * env,
+    axis2_char_t * input_filename)
 {
     FILE *input = NULL;
     axis2_char_t *cur = NULL;
@@ -178,12 +180,12 @@
     axis2_char_t loginfo[1024];
 
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
-    AXIS2_PARAM_CHECK(env-> error, input_filename, AXIS2_FAILURE);
+    AXIS2_PARAM_CHECK(env->error, input_filename, AXIS2_FAILURE);
 
-    prop_hash = properties-> prop_hash;
+    prop_hash = properties->prop_hash;
 
     input = fopen(input_filename, "r+");
-    if(!input)
+    if (!input)
     {
         return AXIS2_FAILURE;
     }
@@ -192,16 +194,12 @@
     if (!buffer)
     {
         sprintf(loginfo, "error in reading file\n");
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            loginfo);
-        AXIS2_FREE(env-> allocator, buffer);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, loginfo);
+        AXIS2_FREE(env->allocator, buffer);
         return AXIS2_FAILURE;
     }
 
-
-
-    for (cur = axutil_properties_read_next(buffer); *cur ;
-        cur = axutil_properties_read_next(++cur))
+    for (cur = axutil_properties_read_next(buffer); *cur; cur = axutil_properties_read_next(++cur))
     {
         if (*cur == '\r')
         {
@@ -213,19 +211,18 @@
             status = LINE_MIDWAY;
         }
         /* equal found just create a property */
-        else if (*cur == '=' &&  status == LINE_MIDWAY)
+        else if (*cur == '=' && status == LINE_MIDWAY)
         {
             *cur = '\0';
             if (status != LINE_MIDWAY)
             {
                 sprintf(loginfo, "equal apear in wrong place around %s\n", tag);
-                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-                    loginfo);
-                AXIS2_FREE(env-> allocator, buffer);
+                AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, loginfo);
+                AXIS2_FREE(env->allocator, buffer);
                 return AXIS2_FAILURE;
             }
             status = EQUAL_FOUND;
-            key =  axutil_properties_trunk_and_dup(tag, cur, env);
+            key = axutil_properties_trunk_and_dup(tag, cur, env);
         }
         /* right next to the equal found */
         else if (status == EQUAL_FOUND)
@@ -239,9 +236,8 @@
             *cur = '\0';
             if (status == LINE_HALFWAY)
             {
-                tag =  axutil_properties_trunk_and_dup(tag, cur, env);
-                axutil_hash_set(prop_hash,
-                    key, AXIS2_HASH_KEY_STRING, tag);
+                tag = axutil_properties_trunk_and_dup(tag, cur, env);
+                axutil_hash_set(prop_hash, key, AXIS2_HASH_KEY_STRING, tag);
             }
             status = LINE_STARTED;
         }
@@ -249,35 +245,33 @@
     if (status == LINE_HALFWAY)
     {
         *cur = '\0';
-        tag =  axutil_properties_trunk_and_dup(tag, cur, env);
-        axutil_hash_set(prop_hash,
-            key, AXIS2_HASH_KEY_STRING, tag);
+        tag = axutil_properties_trunk_and_dup(tag, cur, env);
+        axutil_hash_set(prop_hash, key, AXIS2_HASH_KEY_STRING, tag);
         status = LINE_STARTED;
     }
     if (status != LINE_STARTED)
     {
         sprintf(loginfo, "error parsing properties\n");
-        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
-            loginfo);
-        AXIS2_FREE(env-> allocator, buffer);
+        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, loginfo);
+        AXIS2_FREE(env->allocator, buffer);
         return AXIS2_FAILURE;
     }
-	if(input)
-	{
-	    fclose(input);			
-	}
-    AXIS2_FREE(env-> allocator, buffer);
+    if (input)
+    {
+        fclose(input);
+    }
+    AXIS2_FREE(env->allocator, buffer);
     return AXIS2_SUCCESS;
 }
 
-
-axis2_char_t*
-axutil_properties_read_next(axis2_char_t* cur)
+axis2_char_t *
+axutil_properties_read_next(
+    axis2_char_t * cur)
 {
     /* ignore comment */
     if (*cur == '#')
     {
-        for (;*cur != '\n' && *cur != '\0'; cur ++);
+        for (; *cur != '\n' && *cur != '\0'; cur++);
     }
     /* check '\\''\n' case */
     if (*cur == '\\' && *(cur + 1) == '\n')
@@ -289,30 +283,31 @@
     return cur;
 }
 
-axis2_char_t*
-axutil_properties_trunk_and_dup(axis2_char_t* start, 
-    axis2_char_t* end,
-    const axutil_env_t* env)
+axis2_char_t *
+axutil_properties_trunk_and_dup(
+    axis2_char_t * start,
+    axis2_char_t * end,
+    const axutil_env_t * env)
 {
-    for (; *start == ' '; start ++); /* remove front spaces */
-    for (end --; *end == ' '; end --); /* remove rear spaces */
+    for (; *start == ' '; start++); /* remove front spaces */
+    for (end--; *end == ' '; end--);    /* remove rear spaces */
     *(++end) = '\0';
-    start = (axis2_char_t*)axutil_strdup(env, start);
+    start = (axis2_char_t *) axutil_strdup(env, start);
     return start;
 }
 
-axis2_char_t*
-axutil_properties_read(FILE* input,
-    const axutil_env_t* env)
+axis2_char_t *
+axutil_properties_read(
+    FILE * input,
+    const axutil_env_t * env)
 {
     size_t nread = 0;
-    axis2_char_t* out_stream = NULL;
+    axis2_char_t *out_stream = NULL;
     size_t ncount = 0;
     size_t curr_alloc = MAX_SIZE * 2;
     size_t total_alloc = curr_alloc;
 
-    out_stream = (axis2_char_t*) AXIS2_MALLOC(env-> allocator,
-        sizeof(axis2_char_t) * curr_alloc);
+    out_stream = (axis2_char_t *) AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * curr_alloc);
     if (!out_stream)
     {
         return NULL;
@@ -320,8 +315,7 @@
 
     do
     {
-        nread = fread(out_stream + ncount, sizeof(axis2_char_t), MAX_SIZE,
-            input);
+        nread = fread(out_stream + ncount, sizeof(axis2_char_t), MAX_SIZE, input);
         ncount += nread;
 
         if (ncount + MAX_SIZE > total_alloc)
@@ -333,8 +327,7 @@
             }
 
             total_alloc += curr_alloc;
-            new_stream = AXIS2_MALLOC(env->allocator,
-                sizeof(axis2_char_t) * total_alloc);
+            new_stream = AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * total_alloc);
             if (!new_stream)
             {
                 return NULL;

Modified: webservices/axis2/trunk/c/util/src/property.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/property.c?rev=580200&r1=580199&r2=580200&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/property.c (original)
+++ webservices/axis2/trunk/c/util/src/property.c Thu Sep 27 20:12:58 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -27,14 +28,14 @@
 };
 
 axutil_property_t *AXIS2_CALL
-axutil_property_create(const axutil_env_t *env)
+axutil_property_create(
+    const axutil_env_t * env)
 {
     axutil_property_t *property = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
 
-    property = (axutil_property_t *) AXIS2_MALLOC(env->allocator,
-        sizeof(axutil_property_t));
+    property = (axutil_property_t *) AXIS2_MALLOC(env->allocator, sizeof(axutil_property_t));
 
     if (!property)
     {
@@ -48,13 +49,15 @@
 
     return property;
 }
+
 /*****************************************************************************/
 axutil_property_t *AXIS2_CALL
-axutil_property_create_with_args(const axutil_env_t *env,
+axutil_property_create_with_args(
+    const axutil_env_t * env,
     axis2_scope_t scope,
     axis2_bool_t own_value,
     AXIS2_FREE_VOID_ARG free_func,
-    void *value) 
+    void *value)
 {
     axutil_property_t *property = NULL;
 
@@ -76,8 +79,9 @@
 }
 
 void AXIS2_CALL
-axutil_property_free(axutil_property_t *property,
-    const axutil_env_t *env)
+axutil_property_free(
+    axutil_property_t * property,
+    const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
@@ -89,7 +93,7 @@
             {
                 property->free_func(property->value, env);
             }
-            else if(property->own_value)
+            else if (property->own_value)
             {
                 AXIS2_FREE(env->allocator, property->value);
             }
@@ -104,8 +108,9 @@
 }
 
 axis2_status_t AXIS2_CALL
-axutil_property_set_scope(axutil_property_t *property,
-    const axutil_env_t *env,
+axutil_property_set_scope(
+    axutil_property_t * property,
+    const axutil_env_t * env,
     axis2_scope_t scope)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -115,8 +120,9 @@
 }
 
 axis2_status_t AXIS2_CALL
-axutil_property_set_free_func(axutil_property_t *property,
-    const axutil_env_t *env,
+axutil_property_set_free_func(
+    axutil_property_t * property,
+    const axutil_env_t * env,
     AXIS2_FREE_VOID_ARG free_func)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -126,8 +132,9 @@
 }
 
 axis2_status_t AXIS2_CALL
-axutil_property_set_value(axutil_property_t *property,
-    const axutil_env_t *env,
+axutil_property_set_value(
+    axutil_property_t * property,
+    const axutil_env_t * env,
     void *value)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -140,7 +147,7 @@
             {
                 property->free_func(property->value, env);
             }
-            else if(property->own_value)
+            else if (property->own_value)
             {
                 AXIS2_FREE(env->allocator, property->value);
             }
@@ -152,15 +159,17 @@
 }
 
 void *AXIS2_CALL
-axutil_property_get_value(axutil_property_t *property,
-    const axutil_env_t *env)
+axutil_property_get_value(
+    axutil_property_t * property,
+    const axutil_env_t * env)
 {
     return property->value;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_property_set_own_value(axutil_property_t *property,
-    const axutil_env_t *env,
+axutil_property_set_own_value(
+    axutil_property_t * property,
+    const axutil_env_t * env,
     axis2_bool_t own_value)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
@@ -169,10 +178,10 @@
     return AXIS2_SUCCESS;
 }
 
-
-axutil_property_t* AXIS2_CALL
-axutil_property_clone(axutil_property_t *property,
-    const axutil_env_t *env)
+axutil_property_t *AXIS2_CALL
+axutil_property_clone(
+    axutil_property_t * property,
+    const axutil_env_t * env)
 {
     axutil_property_t *new_property = NULL;
     AXIS2_ENV_CHECK(env, NULL);
@@ -181,6 +190,5 @@
     axutil_property_set_scope(new_property, env, property->scope);
     axutil_property_set_own_value(new_property, env, property->own_value);
     axutil_property_set_value(new_property, env, property->value);
-    return new_property; 
+    return new_property;
 }
-

Modified: webservices/axis2/trunk/c/util/src/qname.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/qname.c?rev=580200&r1=580199&r2=580200&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/qname.c (original)
+++ webservices/axis2/trunk/c/util/src/qname.c Thu Sep 27 20:12:58 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -24,22 +25,27 @@
 
 struct axutil_qname
 {
+
     /** localpart of qname is mandatory */
     axis2_char_t *localpart;
+
     /** namespace uri is optional */
     axis2_char_t *namespace_uri;
+
     /**  prefix mandatory */
     axis2_char_t *prefix;
+
     /** qname represented as a string, used as keys in hash tables, etc. */
     axis2_char_t *qname_string;
     unsigned int ref;
 };
 
-AXIS2_EXTERN axutil_qname_t * AXIS2_CALL
-axutil_qname_create(const axutil_env_t *env,
-    const axis2_char_t *localpart,
-    const axis2_char_t *namespace_uri,
-    const axis2_char_t *prefix)
+AXIS2_EXTERN axutil_qname_t *AXIS2_CALL
+axutil_qname_create(
+    const axutil_env_t * env,
+    const axis2_char_t * localpart,
+    const axis2_char_t * namespace_uri,
+    const axis2_char_t * prefix)
 {
 
     axutil_qname_t *qname = NULL;
@@ -48,13 +54,11 @@
     /* localpart can't be null */
     if (!localpart)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, 
-            AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_NULL_PARAM, AXIS2_FAILURE);
         return NULL;
     }
 
-    qname = (axutil_qname_t *) AXIS2_MALLOC(env->allocator,
-            sizeof(axutil_qname_t));
+    qname = (axutil_qname_t *) AXIS2_MALLOC(env->allocator, sizeof(axutil_qname_t));
     if (!qname)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -67,8 +71,7 @@
     qname->namespace_uri = NULL;
     qname->ref = 1;
 
-
-    qname->localpart = (axis2_char_t *)axutil_strdup(env, localpart);
+    qname->localpart = (axis2_char_t *) axutil_strdup(env, localpart);
     if (!(qname->localpart))
     {
         AXIS2_ERROR_SET_ERROR_NUMBER(env->error, AXIS2_ERROR_NO_MEMORY);
@@ -76,12 +79,12 @@
         axutil_qname_free(qname, env);
         return NULL;
     }
-    
+
     if (prefix)
     {
-        qname->prefix = (axis2_char_t*)axutil_strdup(env, prefix);
+        qname->prefix = (axis2_char_t *) axutil_strdup(env, prefix);
     }
-    
+
     if (prefix && !(qname->prefix))
     {
         AXIS2_ERROR_SET_ERROR_NUMBER(env->error, AXIS2_ERROR_NO_MEMORY);
@@ -89,10 +92,10 @@
         axutil_qname_free(qname, env);
         return NULL;
     }
-    
+
     if (namespace_uri)
     {
-        qname->namespace_uri = (axis2_char_t*)axutil_strdup(env, namespace_uri);
+        qname->namespace_uri = (axis2_char_t *) axutil_strdup(env, namespace_uri);
     }
 
     if (namespace_uri && !(qname->namespace_uri))
@@ -106,10 +109,10 @@
     return qname;
 }
 
-
 AXIS2_EXTERN void AXIS2_CALL
-axutil_qname_free(axutil_qname_t * qname,
-    const axutil_env_t *env)
+axutil_qname_free(
+    axutil_qname_t * qname,
+    const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
@@ -142,11 +145,11 @@
     return;
 }
 
-
 AXIS2_EXTERN axis2_bool_t AXIS2_CALL
-axutil_qname_equals(const axutil_qname_t *qname,
-    const axutil_env_t *env,
-    const axutil_qname_t *qname2)
+axutil_qname_equals(
+    const axutil_qname_t * qname,
+    const axutil_env_t * env,
+    const axutil_qname_t * qname2)
 {
     int uris_differ = 0;
     int localparts_differ = 0;
@@ -162,75 +165,74 @@
 
     if (qname->localpart && qname2->localpart)
     {
-        localparts_differ =
-            axutil_strcmp(qname->localpart,
-                qname2->localpart);
+        localparts_differ = axutil_strcmp(qname->localpart, qname2->localpart);
     }
     else
     {
         localparts_differ = ((qname->localpart) || (qname2->localpart));
     }
-    
+
     if (qname->namespace_uri && qname2->namespace_uri)
     {
-        uris_differ =
-            axutil_strcmp(qname->namespace_uri,
-                qname2->namespace_uri);
+        uris_differ = axutil_strcmp(qname->namespace_uri, qname2->namespace_uri);
     }
     else
     {
         uris_differ = ((qname->namespace_uri) || (qname2->namespace_uri));
     }
-    
+
     return (!uris_differ && !localparts_differ) ? AXIS2_TRUE : AXIS2_FALSE;
 }
 
-
-AXIS2_EXTERN axutil_qname_t* AXIS2_CALL
-axutil_qname_clone(axutil_qname_t *qname,
-    const axutil_env_t *env)
+AXIS2_EXTERN axutil_qname_t *AXIS2_CALL
+axutil_qname_clone(
+    axutil_qname_t * qname,
+    const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, NULL);
-    
+
     if (!qname)
     {
         return NULL;
     }
 
     qname->ref++;
-    
+
     return qname;
 }
 
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axutil_qname_get_uri(const axutil_qname_t *qname,
-    const axutil_env_t *env)
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+axutil_qname_get_uri(
+    const axutil_qname_t * qname,
+    const axutil_env_t * env)
 {
     AXIS2_PARAM_CHECK(env->error, qname, NULL);
     return qname->namespace_uri;
 }
 
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axutil_qname_get_prefix(const axutil_qname_t *qname,
-    const axutil_env_t *env)
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+axutil_qname_get_prefix(
+    const axutil_qname_t * qname,
+    const axutil_env_t * env)
 {
 
     AXIS2_PARAM_CHECK(env->error, qname, NULL);
     return qname->prefix;
 }
 
-
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axutil_qname_get_localpart(const axutil_qname_t *qname,
-    const axutil_env_t *env)
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+axutil_qname_get_localpart(
+    const axutil_qname_t * qname,
+    const axutil_env_t * env)
 {
     AXIS2_PARAM_CHECK(env->error, qname, NULL);
     return qname->localpart;
 }
 
-AXIS2_EXTERN axis2_char_t* AXIS2_CALL
-axutil_qname_to_string(axutil_qname_t *qname,
-    const axutil_env_t *env)
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+axutil_qname_to_string(
+    axutil_qname_t * qname,
+    const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, NULL);
     if (qname->qname_string)
@@ -280,9 +282,10 @@
     return qname->qname_string;
 }
 
-AXIS2_EXTERN axutil_qname_t* AXIS2_CALL
-axutil_qname_create_from_string(const axutil_env_t *env,
-    const axis2_char_t *qstring)
+AXIS2_EXTERN axutil_qname_t *AXIS2_CALL
+axutil_qname_create_from_string(
+    const axutil_env_t * env,
+    const axis2_char_t * qstring)
 {
     axis2_char_t *localpart = NULL;
     axis2_char_t *namespace_uri = NULL;
@@ -316,12 +319,14 @@
         }
         else
         {
+
             /** only uri and localpart is available */
             qname = axutil_qname_create(env, localpart, next, NULL);
         }
     }
     else
     {
+
         /** only localpart is there in this qname */
         qname = axutil_qname_create(env, temp_string, NULL, NULL);
     }
@@ -331,4 +336,3 @@
     }
     return qname;
 }
-

Modified: webservices/axis2/trunk/c/util/src/rand.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/rand.c?rev=580200&r1=580199&r2=580200&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/rand.c (original)
+++ webservices/axis2/trunk/c/util/src/rand.c Thu Sep 27 20:12:58 2007
@@ -1,3 +1,4 @@
+
 /*
  * Copyright 2004,2005 The Apache Software Foundation.
  *
@@ -22,39 +23,44 @@
 #define AXIS2_RAND_MAX 32768
 
 AXIS2_EXTERN int AXIS2_CALL
-axutil_rand(unsigned int *seedp)
+axutil_rand(
+    unsigned int *seedp)
 {
     *seedp = *seedp * 1103515245 + 12345;
-    return((unsigned)(*seedp/(2 * AXIS2_RAND_MAX)) % AXIS2_RAND_MAX);
+    return ((unsigned) (*seedp / (2 * AXIS2_RAND_MAX)) % AXIS2_RAND_MAX);
 }
 
 AXIS2_EXTERN int AXIS2_CALL
-axutil_rand_with_range(unsigned int *seedp,
+axutil_rand_with_range(
+    unsigned int *seedp,
     int start,
     int end)
 {
     int rand = -1;
     float range = 0.0;
-    if(start < 0 || end <= 0) return -1;
-    if(start >= AXIS2_RAND_MAX || end > AXIS2_RAND_MAX) return -1;
-    if(end <= start) return -1;
-  
+    if (start < 0 || end <= 0)
+        return -1;
+    if (start >= AXIS2_RAND_MAX || end > AXIS2_RAND_MAX)
+        return -1;
+    if (end <= start)
+        return -1;
+
     range = end - start;
     rand = axutil_rand(seedp);
-    rand = 1+(int) (range * rand / (AXIS2_RAND_MAX + 1.0));
+    rand = 1 + (int) (range * rand / (AXIS2_RAND_MAX + 1.0));
     return rand;
 }
 
 AXIS2_EXTERN unsigned int AXIS2_CALL
-axutil_rand_get_seed_value_based_on_time(const axutil_env_t *env)
+axutil_rand_get_seed_value_based_on_time(
+    const axutil_env_t * env)
 {
     axutil_date_time_t *date = axutil_date_time_create(env);
-    unsigned int rand_var =  axutil_date_time_get_year(date, env);
-    rand_var +=  axutil_date_time_get_month(date, env);
-    rand_var +=  axutil_date_time_get_date(date, env);
-    rand_var +=   axutil_date_time_get_hour(date, env);
-    rand_var +=  axutil_date_time_get_minute(date, env);
-    rand_var +=  axutil_date_time_get_second(date, env);
+    unsigned int rand_var = axutil_date_time_get_year(date, env);
+    rand_var += axutil_date_time_get_month(date, env);
+    rand_var += axutil_date_time_get_date(date, env);
+    rand_var += axutil_date_time_get_hour(date, env);
+    rand_var += axutil_date_time_get_minute(date, env);
+    rand_var += axutil_date_time_get_second(date, env);
     return rand_var;
 }
-

Modified: webservices/axis2/trunk/c/util/src/stack.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/stack.c?rev=580200&r1=580199&r2=580200&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/stack.c (original)
+++ webservices/axis2/trunk/c/util/src/stack.c Thu Sep 27 20:12:58 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -26,22 +27,24 @@
 struct axutil_stack
 {
     void **data;
+
     /** current number of elements */
     int size;
+
     /** total capacity */
     int capacity;
     axis2_bool_t is_empty_stack;
 };
 
-AXIS2_EXTERN axutil_stack_t * AXIS2_CALL
-axutil_stack_create(const axutil_env_t *env)
+AXIS2_EXTERN axutil_stack_t *AXIS2_CALL
+axutil_stack_create(
+    const axutil_env_t * env)
 {
     axutil_stack_t *stack = NULL;
 
     AXIS2_ENV_CHECK(env, NULL);
 
-    stack = (axutil_stack_t*)AXIS2_MALLOC(env->allocator,
-        sizeof(axutil_stack_t));
+    stack = (axutil_stack_t *) AXIS2_MALLOC(env->allocator, sizeof(axutil_stack_t));
 
     if (!stack)
     {
@@ -54,12 +57,11 @@
     stack->capacity = AXIS2_STACK_DEFAULT_CAPACITY;
     stack->is_empty_stack = AXIS2_TRUE;
 
-    stack->data = AXIS2_MALLOC(env->allocator, sizeof(void*) *
-        AXIS2_STACK_DEFAULT_CAPACITY);
+    stack->data = AXIS2_MALLOC(env->allocator, sizeof(void *) * AXIS2_STACK_DEFAULT_CAPACITY);
     if (!stack->data)
     {
         AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
-        axutil_stack_free(stack , env);
+        axutil_stack_free(stack, env);
         return NULL;
     }
 
@@ -67,8 +69,9 @@
 }
 
 void AXIS2_CALL
-axutil_stack_free(axutil_stack_t *stack,
-    const axutil_env_t *env)
+axutil_stack_free(
+    axutil_stack_t * stack,
+    const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
@@ -80,22 +83,22 @@
     return;
 }
 
-void* AXIS2_CALL
-axutil_stack_pop(axutil_stack_t *stack,
-    const axutil_env_t *env)
+void *AXIS2_CALL
+axutil_stack_pop(
+    axutil_stack_t * stack,
+    const axutil_env_t * env)
 {
     void *value = NULL;
     AXIS2_ENV_CHECK(env, NULL);
 
-    if (stack->is_empty_stack == AXIS2_TRUE ||
-        stack->size == 0)
+    if (stack->is_empty_stack == AXIS2_TRUE || stack->size == 0)
     {
         return NULL;
     }
     if (stack->size > 0)
     {
-        value = stack->data[stack->size -1 ];
-        stack->data[stack->size-1] = NULL;
+        value = stack->data[stack->size - 1];
+        stack->data[stack->size - 1] = NULL;
         stack->size--;
         if (stack->size == 0)
         {
@@ -106,14 +109,15 @@
 }
 
 axis2_status_t AXIS2_CALL
-axutil_stack_push(axutil_stack_t *stack,
-    const axutil_env_t *env,
-    void* value)
+axutil_stack_push(
+    axutil_stack_t * stack,
+    const axutil_env_t * env,
+    void *value)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     AXIS2_PARAM_CHECK(env->error, value, AXIS2_FAILURE);
 
-    if ((stack->size  < stack->capacity) && (stack->capacity > 0))
+    if ((stack->size < stack->capacity) && (stack->capacity > 0))
     {
         stack->data[stack->size++] = value;
     }
@@ -123,14 +127,14 @@
 
         int new_capacity = stack->capacity + AXIS2_STACK_DEFAULT_CAPACITY;
 
-        new_data = AXIS2_MALLOC(env->allocator, sizeof(void*) * new_capacity);
+        new_data = AXIS2_MALLOC(env->allocator, sizeof(void *) * new_capacity);
         if (!new_data)
         {
             AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
             return AXIS2_FAILURE;
         }
-        memset(new_data, 0, sizeof(void*)*new_capacity);
-        memcpy(new_data, stack->data, sizeof(void*) *(stack->capacity));
+        memset(new_data, 0, sizeof(void *) * new_capacity);
+        memcpy(new_data, stack->data, sizeof(void *) * (stack->capacity));
         stack->capacity = new_capacity;
 
         AXIS2_FREE(env->allocator, stack->data);
@@ -143,27 +147,30 @@
 }
 
 int AXIS2_CALL
-axutil_stack_size(axutil_stack_t *stack,
-    const axutil_env_t *env)
+axutil_stack_size(
+    axutil_stack_t * stack,
+    const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     return stack->size;
 }
 
-void * AXIS2_CALL
-axutil_stack_get(axutil_stack_t *stack,
-    const axutil_env_t *env)
+void *AXIS2_CALL
+axutil_stack_get(
+    axutil_stack_t * stack,
+    const axutil_env_t * env)
 {
     if (stack->size > 0)
     {
-        return stack->data[stack->size-1];
+        return stack->data[stack->size - 1];
     }
     return NULL;
 }
 
-void* AXIS2_CALL
-axutil_stack_get_at(axutil_stack_t *stack,
-    const axutil_env_t *env,
+void *AXIS2_CALL
+axutil_stack_get_at(
+    axutil_stack_t * stack,
+    const axutil_env_t * env,
     int i)
 {
     if ((stack->size == 0) || (i < 0) || (i >= stack->size))

Modified: webservices/axis2/trunk/c/util/src/stream.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/stream.c?rev=580200&r1=580199&r2=580200&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/stream.c (original)
+++ webservices/axis2/trunk/c/util/src/stream.c Thu Sep 27 20:12:58 2007
@@ -1,3 +1,4 @@
+
 /*
  * Licensed to the Apache Software Foundation (ASF) under one or more
  * contributor license agreements.  See the NOTICE file distributed with
@@ -20,63 +21,68 @@
 #include <axutil_stream.h>
 #include <platforms/axutil_platform_auto_sense.h>
 
-
 /** basic stream operatons **/
-int AXIS2_CALL
-axutil_stream_write_basic(axutil_stream_t *stream, 
-    const axutil_env_t *env,
-    const void *buffer, size_t count);
+int AXIS2_CALL axutil_stream_write_basic(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    const void *buffer,
+    size_t count);
 
-int AXIS2_CALL
-axutil_stream_read_basic(axutil_stream_t *stream, 
-    const axutil_env_t *env,
-    void *buffer, size_t count);
+int AXIS2_CALL axutil_stream_read_basic(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    void *buffer,
+    size_t count);
 
-int AXIS2_CALL
-axutil_stream_skip_basic(axutil_stream_t *stream, 
-    const axutil_env_t *env, 
+int AXIS2_CALL axutil_stream_skip_basic(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
     int count);
 
 /** file stream operations **/
-int AXIS2_CALL
-axutil_stream_write_file(axutil_stream_t *stream, 
-    const axutil_env_t *env,
-    const void *buffer, size_t count);
+int AXIS2_CALL axutil_stream_write_file(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    const void *buffer,
+    size_t count);
 
-int AXIS2_CALL
-axutil_stream_read_file(axutil_stream_t *stream, 
-    const axutil_env_t *env,
-    void *buffer, size_t count);
+int AXIS2_CALL axutil_stream_read_file(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    void *buffer,
+    size_t count);
 
-int AXIS2_CALL
-axutil_stream_skip_file(axutil_stream_t *stream, 
-    const axutil_env_t *env, 
+int AXIS2_CALL axutil_stream_skip_file(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
     int count);
 
 /** socket stream operations **/
-int AXIS2_CALL
-axutil_stream_write_socket(axutil_stream_t *stream, 
-    const axutil_env_t *env,
-    const void *buffer, size_t count);
+int AXIS2_CALL axutil_stream_write_socket(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    const void *buffer,
+    size_t count);
 
-int AXIS2_CALL
-axutil_stream_read_socket(axutil_stream_t *stream, 
-    const axutil_env_t *env,
-    void *buffer, size_t count);
+int AXIS2_CALL axutil_stream_read_socket(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    void *buffer,
+    size_t count);
 
-int AXIS2_CALL
-axutil_stream_skip_socket(axutil_stream_t *stream, 
-    const axutil_env_t *env,
+int AXIS2_CALL axutil_stream_skip_socket(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
     int count);
 
-AXIS2_EXTERN axutil_stream_t * AXIS2_CALL
-axutil_stream_create_internal(const axutil_env_t *env)
+AXIS2_EXTERN axutil_stream_t *AXIS2_CALL
+axutil_stream_create_internal(
+    const axutil_env_t * env)
 {
     axutil_stream_t *stream = NULL;
     AXIS2_ENV_CHECK(env, NULL);
 
-    stream = (axutil_stream_t *)AXIS2_MALLOC(
-        env->allocator, sizeof(axutil_stream_t));
+    stream = (axutil_stream_t *) AXIS2_MALLOC(env->allocator, sizeof(axutil_stream_t));
 
     if (!stream)
     {
@@ -94,16 +100,16 @@
     return stream;
 }
 
-
 void AXIS2_CALL
-axutil_stream_free(axutil_stream_t *stream, 
-    const axutil_env_t *env)
+axutil_stream_free(
+    axutil_stream_t * stream,
+    const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     switch (stream->stream_type)
     {
-        case AXIS2_STREAM_BASIC:
+    case AXIS2_STREAM_BASIC:
         {
             if (stream->buffer_head)
             {
@@ -113,13 +119,13 @@
             stream->len = -1;
             break;
         }
-        case AXIS2_STREAM_FILE:
+    case AXIS2_STREAM_FILE:
         {
             stream->fp = NULL;
             stream->len = -1;
             break;
         }
-        case AXIS2_STREAM_SOCKET:
+    case AXIS2_STREAM_SOCKET:
         {
             if (stream->fp)
             {
@@ -129,8 +135,8 @@
             stream->len = -1;
             break;
         }
-        default:
-            break;
+    default:
+        break;
     }
 
     AXIS2_FREE(env->allocator, stream);
@@ -139,8 +145,9 @@
 }
 
 void AXIS2_CALL
-axutil_stream_free_void_arg(void *stream,
-    const axutil_env_t *env)
+axutil_stream_free_void_arg(
+    void *stream,
+    const axutil_env_t * env)
 {
     axutil_stream_t *stream_l = NULL;
 
@@ -151,8 +158,9 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_stream_flush(axutil_stream_t *stream,
-    const axutil_env_t *env)
+axutil_stream_flush(
+    axutil_stream_t * stream,
+    const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
@@ -167,14 +175,15 @@
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_stream_close(axutil_stream_t *stream,
-    const axutil_env_t *env)
+axutil_stream_close(
+    axutil_stream_t * stream,
+    const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
 
     switch (stream->stream_type)
     {
-        case AXIS2_STREAM_BASIC:
+    case AXIS2_STREAM_BASIC:
         {
             if (stream->buffer_head)
             {
@@ -184,7 +193,7 @@
             stream->len = -1;
             break;
         }
-        case AXIS2_STREAM_FILE:
+    case AXIS2_STREAM_FILE:
         {
             if (stream->fp)
             {
@@ -197,7 +206,7 @@
             stream->len = -1;
             break;
         }
-        case AXIS2_STREAM_SOCKET:
+    case AXIS2_STREAM_SOCKET:
         {
             if (stream->fp)
             {
@@ -210,16 +219,17 @@
             stream->len = -1;
             break;
         }
-        default:
-            break;
+    default:
+        break;
     }
 
     return AXIS2_SUCCESS;
 }
 
 /************************ Basic Stream Operations *****************************/
-AXIS2_EXTERN axutil_stream_t * AXIS2_CALL
-axutil_stream_create_basic(const axutil_env_t *env)
+AXIS2_EXTERN axutil_stream_t *AXIS2_CALL
+axutil_stream_create_basic(
+    const axutil_env_t * env)
 {
     axutil_stream_t *stream = NULL;
 
@@ -237,11 +247,12 @@
     stream->read = axutil_stream_read_basic;
     stream->write = axutil_stream_write_basic;
     stream->skip = axutil_stream_skip_basic;
-    stream->buffer = (axis2_char_t*)AXIS2_MALLOC(env->allocator,
-        AXIS2_STREAM_DEFAULT_BUF_SIZE * sizeof(axis2_char_t));
+    stream->buffer =
+        (axis2_char_t *) AXIS2_MALLOC(env->allocator,
+                                      AXIS2_STREAM_DEFAULT_BUF_SIZE * sizeof(axis2_char_t));
     stream->buffer_head = stream->buffer;
     stream->len = 0;
-    stream->max_len =    AXIS2_STREAM_DEFAULT_BUF_SIZE;
+    stream->max_len = AXIS2_STREAM_DEFAULT_BUF_SIZE;
 
     if (!stream->buffer)
     {
@@ -251,10 +262,12 @@
     return stream;
 }
 
-
 int AXIS2_CALL
-axutil_stream_read_basic(axutil_stream_t *stream, const axutil_env_t *env,
-    void *buffer, size_t count)
+axutil_stream_read_basic(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    void *buffer,
+    size_t count)
 {
     int len = 0;
     char *buf = NULL;
@@ -280,9 +293,9 @@
     }
     memcpy(buffer, buf, len);
     /*
-    * Finally we need to remove the read bytes from the stream
-    * adjust the length of the stream.
-    */
+     * Finally we need to remove the read bytes from the stream
+     * adjust the length of the stream.
+     */
     stream->len -= len;
     stream->buffer = buf + len;
     ((axis2_char_t *) buffer)[len] = '\0';
@@ -290,9 +303,11 @@
 }
 
 int AXIS2_CALL
-axutil_stream_write_basic(axutil_stream_t *stream, 
-    const axutil_env_t *env,
-    const void *buffer, size_t count)
+axutil_stream_write_basic(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    const void *buffer,
+    size_t count)
 {
     int new_len = 0;
 
@@ -303,13 +318,12 @@
     new_len = stream->len + count;
     if (new_len > stream->max_len)
     {
-        axis2_char_t *tmp = (axis2_char_t *)AXIS2_MALLOC(env->allocator,
-            sizeof(axis2_char_t) * (new_len +
-        AXIS2_STREAM_DEFAULT_BUF_SIZE));
+        axis2_char_t *tmp = (axis2_char_t *) AXIS2_MALLOC(env->allocator,
+                                                          sizeof(axis2_char_t) * (new_len +
+                                                                                  AXIS2_STREAM_DEFAULT_BUF_SIZE));
         if (!tmp)
         {
-            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY,
-                AXIS2_FAILURE);
+            AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
             return -1;
         }
         /*
@@ -317,28 +331,28 @@
          * allocated 
          */
         stream->max_len = new_len + AXIS2_STREAM_DEFAULT_BUF_SIZE;
-        memcpy(tmp, stream->buffer, sizeof(axis2_char_t)*stream->len);
+        memcpy(tmp, stream->buffer, sizeof(axis2_char_t) * stream->len);
         AXIS2_FREE(env->allocator, stream->buffer_head);
         stream->buffer = tmp;
         stream->buffer_head = tmp;
     }
-    memcpy(stream->buffer + (stream->len * sizeof(axis2_char_t)),
-        buffer, count);
+    memcpy(stream->buffer + (stream->len * sizeof(axis2_char_t)), buffer, count);
     stream->len += count;
     return count;
 }
 
-
 int AXIS2_CALL
-axutil_stream_get_len(axutil_stream_t *stream, 
-    const axutil_env_t *env)
+axutil_stream_get_len(
+    axutil_stream_t * stream,
+    const axutil_env_t * env)
 {
     return stream->len;
 }
 
 int AXIS2_CALL
-axutil_stream_skip_basic(axutil_stream_t *stream, 
-    const axutil_env_t *env, 
+axutil_stream_skip_basic(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
     int count)
 {
     int del_len = 0;
@@ -361,28 +375,31 @@
     return -1;
 }
 
-AXIS2_EXTERN axis2_char_t * AXIS2_CALL
-axutil_stream_get_buffer (const axutil_stream_t *stream, 
-                         const axutil_env_t *env)
+AXIS2_EXTERN axis2_char_t *AXIS2_CALL
+axutil_stream_get_buffer(
+    const axutil_stream_t * stream,
+    const axutil_env_t * env)
 {
     return stream->buffer;
 }
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
-axutil_stream_flush_buffer (axutil_stream_t *stream, 
-    const axutil_env_t *env)
+axutil_stream_flush_buffer(
+    axutil_stream_t * stream,
+    const axutil_env_t * env)
 {
     AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
     stream->len = 0;
     return AXIS2_SUCCESS;
 }
 
-
 /********************* End of Basic Stream Operations *************************/
 
 /************************** File Stream Operations ****************************/
-AXIS2_EXTERN axutil_stream_t * AXIS2_CALL
-axutil_stream_create_file(const axutil_env_t *env, FILE *fp)
+AXIS2_EXTERN axutil_stream_t *AXIS2_CALL
+axutil_stream_create_file(
+    const axutil_env_t * env,
+    FILE * fp)
 {
     axutil_stream_t *stream = NULL;
 
@@ -406,11 +423,12 @@
     return stream;
 }
 
-
 int AXIS2_CALL
-axutil_stream_read_file(axutil_stream_t *stream, 
-    const axutil_env_t *env,
-    void *buffer, size_t count)
+axutil_stream_read_file(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    void *buffer,
+    size_t count)
 {
     FILE *fp = NULL;
     AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
@@ -429,9 +447,11 @@
 }
 
 int AXIS2_CALL
-axutil_stream_write_file(axutil_stream_t *stream, 
-    const axutil_env_t *env,
-    const void *buffer, size_t count)
+axutil_stream_write_file(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    const void *buffer,
+    size_t count)
 {
     int len = 0;
     FILE *fp = NULL;
@@ -450,8 +470,9 @@
 }
 
 int AXIS2_CALL
-axutil_stream_skip_file(axutil_stream_t *stream, 
-    const axutil_env_t *env, 
+axutil_stream_skip_file(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
     int count)
 {
     int c = -1;
@@ -472,8 +493,9 @@
 /********************** End of File Stream Operations *************************/
 
 /************************** Socket Stream Operations **************************/
-AXIS2_EXTERN axutil_stream_t * AXIS2_CALL
-axutil_stream_create_socket(const axutil_env_t *env, 
+AXIS2_EXTERN axutil_stream_t *AXIS2_CALL
+axutil_stream_create_socket(
+    const axutil_env_t * env,
     int socket)
 {
     axutil_stream_t *stream = NULL;
@@ -500,11 +522,12 @@
     return stream;
 }
 
-
 int AXIS2_CALL
-axutil_stream_read_socket(axutil_stream_t *stream, 
-    const axutil_env_t *env,
-    void *buffer, size_t count)
+axutil_stream_read_socket(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    void *buffer,
+    size_t count)
 {
     int len = 0;
 #ifdef AXIS2_TCPMON
@@ -515,8 +538,7 @@
 
     if (-1 == stream->socket)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET,
-            AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET, AXIS2_FAILURE);
         return -1;
     }
     if (!buffer)
@@ -528,8 +550,7 @@
 #ifdef AXIS2_TCPMON
     if (len > 1)
     {
-        temp = (axis2_char_t *)AXIS2_MALLOC(env->allocator,
-            (len + 1) * sizeof(axis2_char_t));
+        temp = (axis2_char_t *) AXIS2_MALLOC(env->allocator, (len + 1) * sizeof(axis2_char_t));
         if (temp)
         {
             memcpy(temp, buffer, len * sizeof(axis2_char_t));
@@ -543,9 +564,11 @@
 }
 
 int AXIS2_CALL
-axutil_stream_write_socket(axutil_stream_t *stream, 
-    const axutil_env_t *env,
-    const void *buffer, size_t count)
+axutil_stream_write_socket(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    const void *buffer,
+    size_t count)
 {
     int len = 0;
 #ifdef AXIS2_TCPMON
@@ -556,8 +579,7 @@
 
     if (-1 == stream->socket)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET,
-            AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET, AXIS2_FAILURE);
         return -1;
     }
     if (!buffer)
@@ -566,8 +588,7 @@
 #ifdef AXIS2_TCPMON
     if (len > 0)
     {
-        temp = (axis2_char_t *)AXIS2_MALLOC(env->allocator,
-            (len + 1) * sizeof(axis2_char_t));
+        temp = (axis2_char_t *) AXIS2_MALLOC(env->allocator, (len + 1) * sizeof(axis2_char_t));
         if (temp)
         {
             memcpy(temp, buffer, len * sizeof(axis2_char_t));
@@ -582,19 +603,18 @@
 }
 
 int AXIS2_CALL
-axutil_stream_skip_socket(axutil_stream_t *stream, 
-    const axutil_env_t *env, 
+axutil_stream_skip_socket(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
     int count)
 {
     int len = 0;
     char buffer[2];
     AXIS2_ENV_CHECK(env, AXIS2_CRITICAL_FAILURE);
 
-
     if (-1 == stream->socket)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET,
-                AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET, AXIS2_FAILURE);
         return -1;
     }
     while (len < count)
@@ -605,9 +625,11 @@
 }
 
 AXIS2_EXTERN int AXIS2_CALL
-axutil_stream_peek_socket(axutil_stream_t *stream, 
-    const axutil_env_t *env,
-    void *buffer, size_t count)
+axutil_stream_peek_socket(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
+    void *buffer,
+    size_t count)
 {
     int len = 0;
 
@@ -615,8 +637,7 @@
 
     if (-1 == stream->socket)
     {
-        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET,
-            AXIS2_FAILURE);
+        AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_SOCKET, AXIS2_FAILURE);
         return -1;
     }
     if (!buffer)
@@ -628,12 +649,13 @@
 
     return len;
 }
+
 /********************** End of Socket Stream Operations ***********************/
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axutil_stream_set_read(
-    axutil_stream_t *stream,
-    const axutil_env_t *env, 
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
     void *func)
 {
     stream->read = func;
@@ -642,8 +664,8 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axutil_stream_set_write(
-    axutil_stream_t *stream,
-    const axutil_env_t *env, 
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
     void *func)
 {
     stream->write = func;
@@ -652,8 +674,8 @@
 
 AXIS2_EXTERN axis2_status_t AXIS2_CALL
 axutil_stream_set_skip(
-    axutil_stream_t *stream,
-    const axutil_env_t *env, 
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
     void *func)
 {
     stream->skip = func;
@@ -661,8 +683,9 @@
 }
 
 AXIS2_EXTERN int AXIS2_CALL
-axutil_stream_read(axutil_stream_t *stream,
-    const axutil_env_t *env,
+axutil_stream_read(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
     void *buffer,
     size_t count)
 {
@@ -670,8 +693,9 @@
 }
 
 AXIS2_EXTERN int AXIS2_CALL
-axutil_stream_write(axutil_stream_t *stream,
-    const axutil_env_t *env,
+axutil_stream_write(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
     const void *buffer,
     size_t count)
 {
@@ -679,10 +703,10 @@
 }
 
 AXIS2_EXTERN int AXIS2_CALL
-axutil_stream_skip(axutil_stream_t *stream,
-    const axutil_env_t *env,
+axutil_stream_skip(
+    axutil_stream_t * stream,
+    const axutil_env_t * env,
     int count)
 {
     return stream->skip(stream, env, count);
 }
-



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org


Mime
View raw message