You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sa...@apache.org on 2006/12/06 10:35:16 UTC
svn commit: r482989 - in /webservices/axis2/trunk/c/tools/tcpmon:
include/tcpmon_session.h include/tcpmon_util.h src/Makefile.am
src/session.c src/tcpmon.c src/util.c
Author: samisa
Date: Wed Dec 6 01:35:15 2006
New Revision: 482989
URL: http://svn.apache.org/viewvc?view=rev&rev=482989
Log:
Added patch by milinda
Modified:
webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_session.h
webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_util.h
webservices/axis2/trunk/c/tools/tcpmon/src/Makefile.am
webservices/axis2/trunk/c/tools/tcpmon/src/session.c
webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c
webservices/axis2/trunk/c/tools/tcpmon/src/util.c
Modified: webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_session.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_session.h?view=diff&rev=482989&r1=482988&r2=482989
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_session.h (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_session.h Wed Dec 6 01:35:15 2006
@@ -74,7 +74,14 @@
axis2_status_t (AXIS2_CALL *
get_test_bit) (tcpmon_session_t *session,
axis2_env_t *env);
-
+ axis2_status_t (AXIS2_CALL *
+ set_format_bit) (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ int format_bit);
+
+ int (AXIS2_CALL *
+ get_format_bit) (tcpmon_session_t *session,
+ const axis2_env_t *env);
/**
* configure the listening port.
* @param session represet the type object.
@@ -204,6 +211,12 @@
#define TCPMON_SESSION_GET_TEST_BIT(session, env) \
((session)->ops->get_test_bit(session, env))
+
+#define TCPMON_SESSION_SET_FORMAT_BIT(session, env, format_bit) \
+ ((session)->ops->set_format_bit(session, env, format_bit))
+
+#define TCPMON_SESSION_GET_FORMAT_BIT(session, env) \
+ ((session)->ops->get_format_bit(session, env))
#define TCPMON_SESSION_SET_LISTEN_PORT(session, env, listen_port) \
((session)->ops->set_listen_port(session, env, listen_port))
Modified: webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_util.h
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_util.h?view=diff&rev=482989&r1=482988&r2=482989
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_util.h (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/include/tcpmon_util.h Wed Dec 6 01:35:15 2006
@@ -42,7 +42,7 @@
* @param data to be formatted
*/
axis2_char_t* AXIS2_CALL
-tcpmon_util_format_as_xml (const axis2_env_t *env, axis2_char_t *data);
+tcpmon_util_format_as_xml (const axis2_env_t *env, axis2_char_t *data, int format);
/** @} */
Modified: webservices/axis2/trunk/c/tools/tcpmon/src/Makefile.am
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/Makefile.am?view=diff&rev=482989&r1=482988&r2=482989
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/Makefile.am (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/Makefile.am Wed Dec 6 01:35:15 2006
@@ -33,5 +33,7 @@
INCLUDES = -I$(top_builddir)/include \
-I ../../../util/include \
+ -I ../../../axiom/include \
+ -I ../../../include \
$(NULL)
Modified: webservices/axis2/trunk/c/tools/tcpmon/src/session.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/session.c?view=diff&rev=482989&r1=482988&r2=482989
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/session.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/session.c Wed Dec 6 01:35:15 2006
@@ -34,7 +34,8 @@
tcpmon_session_t session;
int listen_port;
int target_port;
- int test_bit;
+ int test_bit;
+ int format_bit;
axis2_char_t *target_host;
TCPMON_SESSION_NEW_ENTRY_FUNCT on_new_entry_funct;
TCPMON_SESSION_TRANS_ERROR_FUNCT on_trans_fault_funct;
@@ -114,6 +115,15 @@
const axis2_env_t *env,
int test_bit);
+int AXIS2_CALL
+tcpmon_session_get_format_bit (tcpmon_session_t *session,
+ const axis2_env_t *env);
+
+int AXIS2_CALL
+tcpmon_session_set_format_bit(tcpmon_session_t *session,
+ const axis2_env_t *env,
+ int format_bit);
+
/** internal implementations */
void * AXIS2_THREAD_FUNC
@@ -140,6 +150,7 @@
session_impl -> listen_port = -1;
session_impl -> target_port = -1;
session_impl->test_bit = -1;
+ session_impl->format_bit = 0;
session_impl -> target_host = NULL;
session_impl -> on_new_entry_funct = NULL;
@@ -154,11 +165,13 @@
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
-
+
session_impl-> is_running = AXIS2_FALSE;
session_impl->session.ops->free = tcpmon_session_free;
- session_impl->session.ops->set_test_bit = tcpmon_session_set_test_bit;
- session_impl->session.ops->get_test_bit = tcpmon_session_get_test_bit;
+ session_impl->session.ops->set_test_bit = tcpmon_session_set_test_bit;
+ session_impl->session.ops->get_test_bit = tcpmon_session_get_test_bit;
+ session_impl->session.ops->get_format_bit = tcpmon_session_get_format_bit;
+ session_impl->session.ops->set_format_bit = tcpmon_session_get_format_bit;
session_impl->session.ops->set_listen_port = tcpmon_session_set_listen_port;
session_impl->session.ops->get_listen_port = tcpmon_session_get_listen_port;
session_impl->session.ops->set_target_port = tcpmon_session_set_target_port;
@@ -232,7 +245,7 @@
}
-axis2_status_t AXIS2_CALL
+int AXIS2_CALL
tcpmon_session_get_test_bit (tcpmon_session_t *session,
const axis2_env_t *env)
{
@@ -245,6 +258,34 @@
return session_impl->test_bit;
}
+axis2_status_t AXIS2_CALL
+tcpmon_session_set_format_bit (tcpmon_session_t *session,
+ const axis2_env_t *env,
+ int format_bit)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ session_impl->format_bit = format_bit;
+
+ return AXIS2_SUCCESS;
+}
+
+int AXIS2_CALL
+tcpmon_session_get_format_bit (tcpmon_session_t *session,
+ const axis2_env_t *env)
+{
+ tcpmon_session_impl_t *session_impl = NULL;
+
+ AXIS2_ENV_CHECK (env, AXIS2_FAILURE);
+
+ session_impl = AXIS2_INTF_TO_IMPL(session);
+
+ return session_impl->format_bit;
+}
axis2_status_t AXIS2_CALL
tcpmon_session_set_listen_port(tcpmon_session_t *session,
Modified: webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c?view=diff&rev=482989&r1=482988&r2=482989
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/tcpmon.c Wed Dec 6 01:35:15 2006
@@ -28,6 +28,7 @@
int listen_port = 0, target_port = 0;
char *target_host = NULL;
int test_bit = 0;
+ int format_bit = 0;
int ii = 1;
allocator = axis2_allocator_init(NULL);
@@ -81,6 +82,11 @@
ii++;
test_bit = 1;
}
+ else if (!strcmp ("--format",argv [ii]))
+ {
+ ii++;
+ format_bit = 1;
+ }
else
{
printf("INVALID value for tcpmon \n");
@@ -104,6 +110,7 @@
TCPMON_SESSION_ON_TRANS_FAULT(session, env, on_error_func);
TCPMON_SESSION_ON_NEW_ENTRY(session, env, on_new_entry);
TCPMON_SESSION_SET_TEST_BIT (session, env, test_bit);
+ TCPMON_SESSION_SET_FORMAT_BIT(session, env, format_bit);
TCPMON_SESSION_START(session, env);
do
@@ -126,13 +133,14 @@
{
char* plain_buffer = NULL;
char* formated_buffer = NULL;
+ int format = 1;
if (status == 0)
{
plain_buffer = TCPMON_ENTRY_SENT_DATA(entry, env);
if (plain_buffer) /* this can be possible as no xml present */
{
formated_buffer = tcpmon_util_format_as_xml
- (env, plain_buffer);
+ (env, plain_buffer, format);
}
else
{
@@ -151,7 +159,7 @@
if (plain_buffer) /* this can be possible as no xml present */
{
formated_buffer = tcpmon_util_format_as_xml
- (env, plain_buffer);
+ (env, plain_buffer, format);
}
else
{
Modified: webservices/axis2/trunk/c/tools/tcpmon/src/util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/tools/tcpmon/src/util.c?view=diff&rev=482989&r1=482988&r2=482989
==============================================================================
--- webservices/axis2/trunk/c/tools/tcpmon/src/util.c (original)
+++ webservices/axis2/trunk/c/tools/tcpmon/src/util.c Wed Dec 6 01:35:15 2006
@@ -1,92 +1,410 @@
#include <tcpmon_util.h>
#include <axis2_string.h>
+#include <axiom.h>
+#include <axis2_util.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+#define START_ELEMENT 1
+#define CHAR_VALUE 2
+#define END_ELEMENT 3
+#define EMPTY_ELEMENT 4
typedef struct tcpmon_util_allocator
{
- int allocated;
- int index;
- axis2_char_t* buffer;
+ int allocated;
+ int index;
+ axis2_char_t* buffer;
}
tcpmon_util_allocator_t;
+axis2_char_t* tcpmon_strcat(char *dest, char *source, int *cur_buf_s, const axis2_env_t *env);
static void add_string(const axis2_env_t* env,
- tcpmon_util_allocator_t* allocator,
- axis2_char_t* string);
+ tcpmon_util_allocator_t* allocator,
+ axis2_char_t* string);
static void add_axis2_char_t(const axis2_env_t* env,
- tcpmon_util_allocator_t* allocator,
- axis2_char_t c,
- int turns);
+ tcpmon_util_allocator_t* allocator,
+ axis2_char_t c,
+ int turns);
-axis2_char_t* AXIS2_CALL
-tcpmon_util_format_as_xml(const axis2_env_t* env, axis2_char_t* data)
+AXIS2_EXTERN axis2_char_t* AXIS2_CALL
+tcpmon_util_format_as_xml(const axis2_env_t* env, axis2_char_t* data, int format)
{
- return data;
+ if(format)
+ {
+ int c;
+ int tab_pos = 0;
+ int has_value = 0;
+ int has_space = 0;
+ int start_ele = 0;
+ int prev_case = 0;
+ int buffer_size = 0;
+
+ axis2_char_t *out;
+
+ axiom_xml_reader_t *xml_reader = NULL;
+
+ buffer_size = 2*strlen(data);
+ out = AXIS2_MALLOC(env->allocator, buffer_size*sizeof(axis2_char_t));
+
+ if (data)
+ {
+ int size = 0;
+ size = strlen (data);
+ xml_reader =
+ axiom_xml_reader_create_for_memory (env, data, size, "utf-8", AXIS2_XML_PARSER_TYPE_BUFFER);
+ if (!xml_reader)
+ return AXIS2_FAILURE;
+ }
+
+ axiom_xml_reader_init ();
+
+ while ((c = AXIOM_XML_READER_NEXT (xml_reader, env)) != -1)
+ {
+ switch (c)
+ {
+ case AXIOM_XML_READER_START_DOCUMENT:
+ {
+ int ix;
+
+ tcpmon_strcat(out, "<?xml ", &buffer_size, env);
+
+
+ ix = AXIOM_XML_READER_GET_ATTRIBUTE_COUNT (xml_reader, env);
+ for (; ix > 0; ix--)
+ {
+ axis2_char_t *attr_prefix;
+ axis2_char_t *attr_name;
+ axis2_char_t *attr_value;
+
+ attr_prefix = (axis2_char_t *)AXIOM_XML_READER_GET_ATTRIBUTE_PREFIX_BY_NUMBER (xml_reader, env, ix);
+ if (attr_prefix)
+ {
+ tcpmon_strcat(out, attr_prefix, &buffer_size, env);
+ tcpmon_strcat(out, ":", &buffer_size, env);
+ }
+
+ attr_name = (axis2_char_t *)AXIOM_XML_READER_GET_ATTRIBUTE_NAME_BY_NUMBER (xml_reader, env, ix);
+ if (attr_name)
+ {
+ tcpmon_strcat(out, attr_name, &buffer_size, env);
+ tcpmon_strcat(out, "=\"", &buffer_size, env);
+ }
+
+ attr_value = (axis2_char_t *)AXIOM_XML_READER_GET_ATTRIBUTE_VALUE_BY_NUMBER (xml_reader, env, ix);
+ if (attr_value)
+ {
+ tcpmon_strcat(out, attr_value, &buffer_size, env);
+ tcpmon_strcat(out, "\"", &buffer_size, env);
+ }
+ }
+
+ printf ("?>");
+ }
+ break;
+ case AXIOM_XML_READER_START_ELEMENT:
+ {
+ int i, ix, has_prefix = 0;
+
+ axis2_char_t *ele_name;
+ axis2_char_t *ele_prefix;
+
+ prev_case = START_ELEMENT;
+
+ has_value = 0;
+ has_space = 0;
+
+ if (start_ele != 0)
+ tcpmon_strcat(out, "\n", &buffer_size, env);
+
+ for (i = 0; i < tab_pos; i++)
+ tcpmon_strcat(out, "\t", &buffer_size, env);
+
+ tcpmon_strcat(out, "<", &buffer_size, env);
+
+ ele_prefix =(axis2_char_t *)AXIOM_XML_READER_GET_PREFIX (xml_reader, env);
+ if (ele_prefix)
+ {
+ tcpmon_strcat(out, ele_prefix, &buffer_size, env);
+ tcpmon_strcat(out, ":", &buffer_size, env);
+ }
+
+ ele_name = (axis2_char_t *) AXIOM_XML_READER_GET_NAME (xml_reader, env);
+ if (ele_name)
+ {
+ tcpmon_strcat(out, ele_name, &buffer_size, env);
+ }
+
+ ix = AXIOM_XML_READER_GET_ATTRIBUTE_COUNT (xml_reader, env);
+ for (; ix > 0; ix--)
+ {
+ axis2_char_t *attr_prefix;
+ axis2_char_t *attr_name;
+ axis2_char_t *attr_value;
+
+ attr_prefix = (axis2_char_t *)AXIOM_XML_READER_GET_ATTRIBUTE_PREFIX_BY_NUMBER (xml_reader, env, ix);
+ if (attr_prefix)
+ {
+ has_prefix = 1;
+ tcpmon_strcat(out, " ", &buffer_size, env);
+ tcpmon_strcat(out, attr_prefix, &buffer_size, env);
+ tcpmon_strcat(out, ":", &buffer_size, env);
+ }
+
+ attr_name = (axis2_char_t *)AXIOM_XML_READER_GET_ATTRIBUTE_NAME_BY_NUMBER (xml_reader, env, ix);
+ if (attr_name)
+ {
+ if(has_prefix)
+ {
+ tcpmon_strcat(out, attr_name, &buffer_size, env);
+ tcpmon_strcat(out, "=\"", &buffer_size, env);
+ }
+ else
+ {
+ tcpmon_strcat(out, " ", &buffer_size, env);
+ tcpmon_strcat(out, attr_name, &buffer_size, env);
+ tcpmon_strcat(out, "=\"", &buffer_size, env);
+ }
+
+ has_prefix = 0;
+ }
+
+ attr_value = (axis2_char_t *)AXIOM_XML_READER_GET_ATTRIBUTE_VALUE_BY_NUMBER (xml_reader, env, ix);
+ if (attr_value)
+ {
+ tcpmon_strcat(out, attr_value, &buffer_size, env);
+ tcpmon_strcat(out, "\"", &buffer_size, env);
+ }
+ }
+
+ tcpmon_strcat(out, ">", &buffer_size, env);
+
+ tab_pos++;
+ start_ele = 1;
+ }
+ break;
+ case AXIOM_XML_READER_CHARACTER:
+ {
+ axis2_char_t *ele_value;
+
+ prev_case = CHAR_VALUE;
+
+ ele_value = AXIOM_XML_READER_GET_VALUE (xml_reader, env);
+ if (ele_value)
+ tcpmon_strcat(out, ele_value, &buffer_size, env);
+
+ has_value = 1;
+
+ }
+ break;
+ case AXIOM_XML_READER_EMPTY_ELEMENT:
+ {
+ int i, ix, has_prefix = 0;
+
+ axis2_char_t *ele_name;
+ axis2_char_t *ele_prefix;
+
+ prev_case = EMPTY_ELEMENT;
+
+ has_value = 0;
+ has_space = 0;
+
+ if (start_ele != 0)
+ tcpmon_strcat(out, "\n", &buffer_size, env);
+
+ for (i = 0; i < tab_pos; i++)
+ tcpmon_strcat(out, "\t", &buffer_size, env);
+
+ tcpmon_strcat(out, "<", &buffer_size, env);
+
+ ele_prefix = (axis2_char_t *) AXIOM_XML_READER_GET_PREFIX (xml_reader, env);
+ if (ele_prefix)
+ {
+ tcpmon_strcat(out, ele_prefix, &buffer_size, env);
+ tcpmon_strcat(out, ":", &buffer_size, env);
+ }
+
+ ele_name = (axis2_char_t *) AXIOM_XML_READER_GET_NAME (xml_reader, env);
+ if (ele_name)
+ tcpmon_strcat(out, ele_name, &buffer_size, env);
+
+ ix = AXIOM_XML_READER_GET_ATTRIBUTE_COUNT (xml_reader, env);
+ for (; ix > 0; ix--)
+ {
+ axis2_char_t *attr_prefix;
+ axis2_char_t *attr_name;
+ axis2_char_t *attr_value;
+
+ attr_prefix = (axis2_char_t *)AXIOM_XML_READER_GET_ATTRIBUTE_PREFIX_BY_NUMBER (xml_reader, env, ix);
+ if (attr_prefix)
+ {
+ has_prefix = 1;
+ tcpmon_strcat(out, " ", &buffer_size, env);
+ tcpmon_strcat(out, attr_prefix, &buffer_size, env);
+ tcpmon_strcat(out, ":", &buffer_size, env);
+ }
+
+ attr_name = (axis2_char_t *)AXIOM_XML_READER_GET_ATTRIBUTE_NAME_BY_NUMBER (xml_reader, env, ix);
+ if (attr_name)
+ {
+ if(has_prefix)
+ {
+ tcpmon_strcat(out, attr_name, &buffer_size, env);
+ tcpmon_strcat(out, "=\"", &buffer_size, env);
+ }
+ else
+ {
+ tcpmon_strcat(out, " ", &buffer_size, env);
+ tcpmon_strcat(out, attr_name, &buffer_size, env);
+ tcpmon_strcat(out, "=\"", &buffer_size, env);
+ }
+ has_prefix = 0;
+ }
+
+ attr_value = (axis2_char_t *)AXIOM_XML_READER_GET_ATTRIBUTE_VALUE_BY_NUMBER (xml_reader, env, ix);
+ if (attr_value)
+ {
+ tcpmon_strcat(out, attr_value, &buffer_size, env);
+ tcpmon_strcat(out, "\"", &buffer_size, env);
+ }
+ }
+
+ tcpmon_strcat(out, "/>", &buffer_size, env);
+ start_ele = 1;
+ }
+ break;
+ case AXIOM_XML_READER_END_ELEMENT:
+ {
+ int i;
+
+ axis2_char_t *ele_prefix;
+ axis2_char_t *ele_name;
+
+ tab_pos--;
+
+ if (has_value == 0 && prev_case != START_ELEMENT)
+ {
+ tcpmon_strcat(out, "\n", &buffer_size, env);
+ for (i = 0; i < tab_pos; i++)
+ tcpmon_strcat(out, "\t", &buffer_size, env);
+ }
+
+ has_value = 0;
+
+ tcpmon_strcat(out, "</", &buffer_size, env);
+
+ ele_prefix = (axis2_char_t *) AXIOM_XML_READER_GET_PREFIX (xml_reader, env);
+ if (ele_prefix)
+ {
+ tcpmon_strcat(out, ele_prefix, &buffer_size, env);
+ tcpmon_strcat(out, ":", &buffer_size, env);
+ }
+
+ ele_name = (axis2_char_t *) AXIOM_XML_READER_GET_NAME (xml_reader, env);
+ if (ele_name)
+ {
+ tcpmon_strcat(out, ele_name, &buffer_size, env);
+ tcpmon_strcat(out, ">", &buffer_size, env);
+ }
+ prev_case = END_ELEMENT;
+
+ }
+ break;
+ }
+ }
+ return out;
+ }
+ return data;
}
void add_string(const axis2_env_t* env,
- tcpmon_util_allocator_t* allocator,
- axis2_char_t* string)
+ tcpmon_util_allocator_t* allocator,
+ axis2_char_t* string)
{
- int additional_len = 0;
- void* dest = NULL;
- void* src = NULL;
- int count = 0;
+ int additional_len = 0;
+ void* dest = NULL;
+ void* src = NULL;
+ int count = 0;
- additional_len = AXIS2_STRLEN(string) + 1;
- if (allocator-> index + additional_len >= allocator-> allocated)
+ additional_len = AXIS2_STRLEN(string) + 1;
+ if (allocator-> index + additional_len >= allocator-> allocated)
{
- if (allocator-> allocated == 0)
+ if (allocator-> allocated == 0)
{
- allocator-> buffer =
- AXIS2_MALLOC(env-> allocator, additional_len);
+ allocator-> buffer =
+ AXIS2_MALLOC(env-> allocator, additional_len);
}
- else
+ else
{
- allocator-> buffer =
- AXIS2_REALLOC(env-> allocator, allocator-> buffer,
- allocator-> allocated + additional_len);
+ allocator-> buffer =
+ AXIS2_REALLOC(env-> allocator, allocator-> buffer,
+ allocator-> allocated + additional_len);
}
- allocator-> allocated += additional_len;
+ allocator-> allocated += additional_len;
}
- /* copy memory */
- dest = allocator-> buffer + allocator-> index;
- src = string;
- count = additional_len; /* this is with the terminating zero */
- memcpy(dest, src, count);
+ /* copy memory */
+ dest = allocator-> buffer + allocator-> index;
+ src = string;
+ count = additional_len; /* this is with the terminating zero */
+ memcpy(dest, src, count);
- allocator-> index += count - 1;
+ allocator-> index += count - 1;
}
void add_axis2_char_t(const axis2_env_t* env,
- tcpmon_util_allocator_t* allocator,
- axis2_char_t c,
- int turns)
+ tcpmon_util_allocator_t* allocator,
+ axis2_char_t c,
+ int turns)
{
- int additional_len = 0;
+ int additional_len = 0;
- additional_len = turns + 1;
- if (allocator-> index + additional_len >= allocator-> allocated)
+ additional_len = turns + 1;
+ if (allocator-> index + additional_len >= allocator-> allocated)
{
- if (allocator-> allocated == 0)
+ if (allocator-> allocated == 0)
{
- allocator-> buffer =
- AXIS2_MALLOC(env-> allocator, additional_len);
+ allocator-> buffer =
+ AXIS2_MALLOC(env-> allocator, additional_len);
}
- else
+ else
{
- allocator-> buffer =
- AXIS2_REALLOC(env-> allocator, allocator-> buffer,
- allocator-> allocated + additional_len);
+ allocator-> buffer =
+ AXIS2_REALLOC(env-> allocator, allocator-> buffer,
+ allocator-> allocated + additional_len);
}
- allocator-> allocated += additional_len;
+ allocator-> allocated += additional_len;
}
- /* copy memory */
- memset(allocator-> buffer + allocator-> index, c, turns);
+ /* copy memory */
+ memset(allocator-> buffer + allocator-> index, c, turns);
+
+ allocator-> index += turns;
- allocator-> index += turns;
+}
+
+axis2_char_t* tcpmon_strcat(axis2_char_t *dest, axis2_char_t *source, int *buff_size, const axis2_env_t* env)
+{
+ int cur_len = 0;
+ int source_len = 0;
+
+ axis2_char_t *tmp;
+ cur_len = strlen(dest);
+ source_len = strlen(source);
+ if ((*buff_size-cur_len) < source_len)
+ {
+ *buff_size = *buff_size + (*buff_size*2);
+ tmp = (axis2_char_t*)AXIS2_REALLOC(env->allocator, dest, *buff_size*sizeof(axis2_char_t));
+ dest = tmp;
+ strcat((char*)dest, (char*)source);
+ }
+ else
+ {
+ strcat((char*)dest, (char*)source);
+ }
}
+
---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org