You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by sh...@apache.org on 2009/08/18 13:08:44 UTC
svn commit: r805360 [1/13] - in /webservices/axis2/trunk/c/axiom/src:
attachments/ om/ parser/ parser/guththila/ parser/libxml2/ soap/ util/ xpath/
Author: shankar
Date: Tue Aug 18 11:08:42 2009
New Revision: 805360
URL: http://svn.apache.org/viewvc?rev=805360&view=rev
Log:
formatting the code
Modified:
webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c
webservices/axis2/trunk/c/axiom/src/attachments/mime_body_part.c
webservices/axis2/trunk/c/axiom/src/attachments/mime_parser.c
webservices/axis2/trunk/c/axiom/src/attachments/mime_part.c
webservices/axis2/trunk/c/axiom/src/om/om_attribute.c
webservices/axis2/trunk/c/axiom/src/om/om_child_element_iterator.c
webservices/axis2/trunk/c/axiom/src/om/om_children_iterator.c
webservices/axis2/trunk/c/axiom/src/om/om_children_qname_iterator.c
webservices/axis2/trunk/c/axiom/src/om/om_children_with_specific_attribute_iterator.c
webservices/axis2/trunk/c/axiom/src/om/om_comment.c
webservices/axis2/trunk/c/axiom/src/om/om_data_source.c
webservices/axis2/trunk/c/axiom/src/om/om_doctype.c
webservices/axis2/trunk/c/axiom/src/om/om_document.c
webservices/axis2/trunk/c/axiom/src/om/om_element.c
webservices/axis2/trunk/c/axiom/src/om/om_namespace.c
webservices/axis2/trunk/c/axiom/src/om/om_navigator.c
webservices/axis2/trunk/c/axiom/src/om/om_node.c
webservices/axis2/trunk/c/axiom/src/om/om_output.c
webservices/axis2/trunk/c/axiom/src/om/om_processing_instruction.c
webservices/axis2/trunk/c/axiom/src/om/om_stax_builder.c
webservices/axis2/trunk/c/axiom/src/om/om_text.c
webservices/axis2/trunk/c/axiom/src/parser/guththila/guththila_xml_reader_wrapper.c
webservices/axis2/trunk/c/axiom/src/parser/guththila/guththila_xml_writer_wrapper.c
webservices/axis2/trunk/c/axiom/src/parser/libxml2/libxml2_reader_wrapper.c
webservices/axis2/trunk/c/axiom/src/parser/libxml2/libxml2_writer_wrapper.c
webservices/axis2/trunk/c/axiom/src/parser/xml_reader.c
webservices/axis2/trunk/c/axiom/src/parser/xml_writer.c
webservices/axis2/trunk/c/axiom/src/soap/soap11_builder_helper.c
webservices/axis2/trunk/c/axiom/src/soap/soap12_builder_helper.c
webservices/axis2/trunk/c/axiom/src/soap/soap_body.c
webservices/axis2/trunk/c/axiom/src/soap/soap_builder.c
webservices/axis2/trunk/c/axiom/src/soap/soap_envelope.c
webservices/axis2/trunk/c/axiom/src/soap/soap_fault.c
webservices/axis2/trunk/c/axiom/src/soap/soap_fault_code.c
webservices/axis2/trunk/c/axiom/src/soap/soap_fault_detail.c
webservices/axis2/trunk/c/axiom/src/soap/soap_fault_node.c
webservices/axis2/trunk/c/axiom/src/soap/soap_fault_reason.c
webservices/axis2/trunk/c/axiom/src/soap/soap_fault_role.c
webservices/axis2/trunk/c/axiom/src/soap/soap_fault_sub_code.c
webservices/axis2/trunk/c/axiom/src/soap/soap_fault_text.c
webservices/axis2/trunk/c/axiom/src/soap/soap_fault_value.c
webservices/axis2/trunk/c/axiom/src/soap/soap_header.c
webservices/axis2/trunk/c/axiom/src/soap/soap_header_block.c
webservices/axis2/trunk/c/axiom/src/util/om_util.c
webservices/axis2/trunk/c/axiom/src/xpath/xpath.c
webservices/axis2/trunk/c/axiom/src/xpath/xpath_functions.c
webservices/axis2/trunk/c/axiom/src/xpath/xpath_internals.c
webservices/axis2/trunk/c/axiom/src/xpath/xpath_internals_engine.c
webservices/axis2/trunk/c/axiom/src/xpath/xpath_internals_iterators.c
webservices/axis2/trunk/c/axiom/src/xpath/xpath_internals_parser.c
webservices/axis2/trunk/c/axiom/src/xpath/xpath_streaming.c
Modified: webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c?rev=805360&r1=805359&r2=805360&view=diff
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c (original)
+++ webservices/axis2/trunk/c/axiom/src/attachments/data_handler.c Tue Aug 18 11:08:42 2009
@@ -24,7 +24,7 @@
{
/* The content type */
axis2_char_t *mime_type;
-
+
/* If in a file then the file name*/
axis2_char_t *file_name;
@@ -44,11 +44,10 @@
axis2_char_t *mime_id;
/* In the case of sending callback this is required */
- void *user_param;
+ void *user_param;
};
-
/* Creates the data_handler. The file name is not mandatory */
AXIS2_EXTERN axiom_data_handler_t *AXIS2_CALL
@@ -60,14 +59,13 @@
axiom_data_handler_t *data_handler = NULL;
AXIS2_ENV_CHECK(env, NULL);
- data_handler = (axiom_data_handler_t *) AXIS2_MALLOC(env->allocator,
+ data_handler = (axiom_data_handler_t *)AXIS2_MALLOC(env->allocator,
sizeof(axiom_data_handler_t));
- if (!data_handler)
+ if(!data_handler)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "No memory. Cannot create data handler");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create data handler");
return NULL;
}
@@ -81,19 +79,19 @@
data_handler->mime_id = NULL;
data_handler->user_param = NULL;
- if (mime_type)
+ if(mime_type)
{
data_handler->mime_type = axutil_strdup(env, mime_type);
- if (!(data_handler->mime_type))
+ if(!(data_handler->mime_type))
{
axiom_data_handler_free(data_handler, env);
return NULL;
}
}
- if (file_name)
+ if(file_name)
{
data_handler->file_name = axutil_strdup(env, file_name);
- if (!(data_handler->file_name))
+ if(!(data_handler->file_name))
{
axiom_data_handler_free(data_handler, env);
return NULL;
@@ -109,17 +107,17 @@
axiom_data_handler_t *data_handler,
const axutil_env_t *env)
{
- if (data_handler->file_name)
+ if(data_handler->file_name)
{
AXIS2_FREE(env->allocator, data_handler->file_name);
}
- if (data_handler->mime_type)
+ if(data_handler->mime_type)
{
AXIS2_FREE(env->allocator, data_handler->mime_type);
}
- if (data_handler->buffer)
+ if(data_handler->buffer)
{
AXIS2_FREE(env->allocator, data_handler->buffer);
}
@@ -129,7 +127,7 @@
AXIS2_FREE(env->allocator, data_handler->mime_id);
}
- if (data_handler)
+ if(data_handler)
{
AXIS2_FREE(env->allocator, data_handler);
}
@@ -149,17 +147,16 @@
axiom_data_handler_set_content_type(
axiom_data_handler_t *data_handler,
const axutil_env_t *env,
- const axis2_char_t *mime_type)
+ const axis2_char_t *mime_type)
{
- if(data_handler->mime_type)
- {
- AXIS2_FREE(env->allocator, data_handler->mime_type);
- }
- data_handler->mime_type = axutil_strdup(env, mime_type);
+ if(data_handler->mime_type)
+ {
+ AXIS2_FREE(env->allocator, data_handler->mime_type);
+ }
+ data_handler->mime_type = axutil_strdup(env, mime_type);
return AXIS2_SUCCESS;
}
-
AXIS2_EXTERN axis2_bool_t AXIS2_CALL
axiom_data_handler_get_cached(
axiom_data_handler_t *data_handler,
@@ -172,12 +169,11 @@
axiom_data_handler_set_cached(
axiom_data_handler_t *data_handler,
const axutil_env_t *env,
- axis2_bool_t cached)
+ axis2_bool_t cached)
{
data_handler->cached = cached;
}
-
AXIS2_EXTERN axis2_byte_t *AXIS2_CALL
axiom_data_handler_get_input_stream(
axiom_data_handler_t *data_handler,
@@ -194,7 +190,6 @@
return data_handler->buffer_len;
}
-
/* With MTOM caching support this function is no longer used
* Because this will load whole file in to buffer. So for large
* attachment this is not wise */
@@ -206,13 +201,13 @@
axis2_byte_t **output_stream,
int *output_stream_size)
{
- if (data_handler->data_handler_type == AXIOM_DATA_HANDLER_TYPE_BUFFER)
+ if(data_handler->data_handler_type == AXIOM_DATA_HANDLER_TYPE_BUFFER)
{
*output_stream = data_handler->buffer;
*output_stream_size = data_handler->buffer_len;
}
- else if (data_handler->data_handler_type == AXIOM_DATA_HANDLER_TYPE_FILE
- && data_handler->file_name)
+ else if(data_handler->data_handler_type == AXIOM_DATA_HANDLER_TYPE_FILE
+ && data_handler->file_name)
{
FILE *f = NULL;
axis2_byte_t *byte_stream = NULL;
@@ -225,20 +220,19 @@
struct stat stat_p;
f = fopen(data_handler->file_name, "rb");
- if (!f)
+ if(!f)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Error opening file %s for reading",
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error opening file %s for reading",
data_handler->file_name);
return AXIS2_FAILURE;
}
- if (stat(data_handler->file_name, &stat_p) == -1)
+ if(stat(data_handler->file_name, &stat_p) == -1)
{
- fclose(f);
+ fclose(f);
return AXIS2_FAILURE;
}
- else if (stat_p.st_size == 0)
+ else if(stat_p.st_size == 0)
{
fclose(f);
*output_stream = NULL;
@@ -249,15 +243,12 @@
do
{
read_stream_size = stat_p.st_size;
- read_stream = AXIS2_MALLOC(env->allocator,
- (read_stream_size) * sizeof(axis2_byte_t));
- if (!read_stream)
+ read_stream = AXIS2_MALLOC(env->allocator, (read_stream_size) * sizeof(axis2_byte_t));
+ if(!read_stream)
{
- AXIS2_ERROR_SET(env->error,
- AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "No memory. Cannot create binary stream");
- if (byte_stream)
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create binary stream");
+ if(byte_stream)
{
AXIS2_FREE(env->allocator, byte_stream);
}
@@ -266,15 +257,15 @@
}
count = (int)fread(read_stream, 1, read_stream_size, f);
/* The count lies within the int range */
- if (ferror(f))
+ if(ferror(f))
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Error in reading file %s", data_handler->file_name);
- if (byte_stream)
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error in reading file %s",
+ data_handler->file_name);
+ if(byte_stream)
{
AXIS2_FREE(env->allocator, byte_stream);
}
- if (read_stream)
+ if(read_stream)
{
AXIS2_FREE(env->allocator, read_stream);
}
@@ -283,26 +274,25 @@
}
/* copy the read bytes */
- if (count > 0)
+ if(count > 0)
{
- if (byte_stream)
+ if(byte_stream)
{
temp_byte_stream = byte_stream;
temp_byte_stream_size = byte_stream_size;
byte_stream_size = temp_byte_stream_size + count;
- byte_stream = AXIS2_MALLOC(env->allocator,
- (byte_stream_size) * sizeof(axis2_byte_t));
- if (!byte_stream)
+ byte_stream = AXIS2_MALLOC(env->allocator, (byte_stream_size)
+ * sizeof(axis2_byte_t));
+ if(!byte_stream)
{
- AXIS2_ERROR_SET(env->error,
- AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
"No memory. Cannot create binary stream");
- if (read_stream)
+ if(read_stream)
{
AXIS2_FREE(env->allocator, read_stream);
}
- if (temp_byte_stream)
+ if(temp_byte_stream)
{
AXIS2_FREE(env->allocator, temp_byte_stream);
}
@@ -310,17 +300,15 @@
return AXIS2_FAILURE;
}
- memcpy(byte_stream,
- temp_byte_stream, temp_byte_stream_size);
- memcpy(byte_stream + temp_byte_stream_size,
- read_stream, count);
+ memcpy(byte_stream, temp_byte_stream, temp_byte_stream_size);
+ memcpy(byte_stream + temp_byte_stream_size, read_stream, count);
- if (read_stream)
+ if(read_stream)
{
AXIS2_FREE(env->allocator, read_stream);
read_stream_size = 0;
}
- if (temp_byte_stream)
+ if(temp_byte_stream)
{
AXIS2_FREE(env->allocator, temp_byte_stream);
temp_byte_stream = NULL;
@@ -335,12 +323,12 @@
read_stream_size = 0;
}
}
- else if (read_stream)
+ else if(read_stream)
{
AXIS2_FREE(env->allocator, read_stream);
}
}
- while (!feof(f));
+ while(!feof(f));
fclose(f);
data_handler->buffer = byte_stream;
@@ -374,30 +362,28 @@
* not be called , because the parser it self cache
* the attachment while parsing */
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axiom_data_handler_write_to(
axiom_data_handler_t *data_handler,
const axutil_env_t *env)
{
- if (data_handler->file_name)
+ if(data_handler->file_name)
{
FILE *f = NULL;
int count = 0;
f = fopen(data_handler->file_name, "wb");
- if (!f)
+ if(!f)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "Error opening file %s for writing", data_handler->file_name);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Error opening file %s for writing",
+ data_handler->file_name);
return AXIS2_FAILURE;
}
- count = (int)fwrite(data_handler->buffer, 1,
- data_handler->buffer_len, f);
+ count = (int)fwrite(data_handler->buffer, 1, data_handler->buffer_len, f);
/* The count lies within the int range */
- if (ferror(f))
+ if(ferror(f))
{
fclose(f);
return AXIS2_FAILURE;
@@ -415,16 +401,16 @@
const axutil_env_t *env,
axis2_char_t *file_name)
{
- if (data_handler->file_name)
+ if(data_handler->file_name)
{
AXIS2_FREE(env->allocator, data_handler->file_name);
data_handler->file_name = NULL;
}
- if (file_name)
+ if(file_name)
{
data_handler->file_name = axutil_strdup(env, file_name);
- if (!(data_handler->file_name))
+ if(!(data_handler->file_name))
{
return AXIS2_FAILURE;
}
@@ -438,7 +424,7 @@
axiom_data_handler_t *data_handler,
const axutil_env_t *env)
{
- if (data_handler->file_name)
+ if(data_handler->file_name)
{
return data_handler->file_name;
}
@@ -448,7 +434,6 @@
}
}
-
/* This method will add the data_handler binary data to the array_list.
* If it is a buffer the part type is buffer. otherwise it is a file. In the
* case of file the array_list have just the file name and the size. The content
@@ -460,21 +445,21 @@
axiom_data_handler_t *data_handler,
const axutil_env_t *env,
axutil_array_list_t *list)
-
+
{
axiom_mime_part_t *binary_part = NULL;
-
+
binary_part = axiom_mime_part_create(env);
-
+
if(!binary_part)
{
return AXIS2_FAILURE;
- }
-
- if (data_handler->data_handler_type == AXIOM_DATA_HANDLER_TYPE_BUFFER)
+ }
+
+ if(data_handler->data_handler_type == AXIOM_DATA_HANDLER_TYPE_BUFFER)
{
- binary_part->part = (axis2_byte_t *)AXIS2_MALLOC(env->allocator,
- (data_handler->buffer_len) * sizeof(axis2_byte_t));
+ binary_part->part = (axis2_byte_t *)AXIS2_MALLOC(env->allocator, (data_handler->buffer_len)
+ * sizeof(axis2_byte_t));
memcpy(binary_part->part, data_handler->buffer, data_handler->buffer_len);
binary_part->part_size = data_handler->buffer_len;
@@ -483,17 +468,17 @@
/* In the case of file we first calculate the file size
* and then add the file name */
-
- else if (data_handler->data_handler_type == AXIOM_DATA_HANDLER_TYPE_FILE
- && data_handler->file_name)
+
+ else if(data_handler->data_handler_type == AXIOM_DATA_HANDLER_TYPE_FILE
+ && data_handler->file_name)
{
struct stat stat_p;
- if (stat(data_handler->file_name, &stat_p) == -1)
+ if(stat(data_handler->file_name, &stat_p) == -1)
{
- return AXIS2_FAILURE;
+ return AXIS2_FAILURE;
}
- else if (stat_p.st_size == 0)
+ else if(stat_p.st_size == 0)
{
return AXIS2_SUCCESS;
}
@@ -502,7 +487,7 @@
binary_part->file_name = (axis2_char_t *)axutil_strdup(env, data_handler->file_name);
binary_part->part_size = stat_p.st_size;
binary_part->type = AXIOM_MIME_PART_FILE;
- }
+ }
}
/* In the case of Callback the user should specify the callback name in the
* configuration file. We just set the correct type. Inside the transport
@@ -520,14 +505,13 @@
return AXIS2_FAILURE;
}
- /* Finaly we add the binary details to the list */
+ /* Finaly we add the binary details to the list */
axutil_array_list_add(list, env, binary_part);
return AXIS2_SUCCESS;
}
-
AXIS2_EXTERN axis2_char_t *AXIS2_CALL
axiom_data_handler_get_mime_id(
axiom_data_handler_t *data_handler,
@@ -540,13 +524,13 @@
axiom_data_handler_set_mime_id(
axiom_data_handler_t *data_handler,
const axutil_env_t *env,
- const axis2_char_t *mime_id)
+ const axis2_char_t *mime_id)
{
- if(data_handler->mime_id)
- {
- AXIS2_FREE(env->allocator, data_handler->mime_id);
- }
- data_handler->mime_id = axutil_strdup(env, mime_id);
+ if(data_handler->mime_id)
+ {
+ AXIS2_FREE(env->allocator, data_handler->mime_id);
+ }
+ data_handler->mime_id = axutil_strdup(env, mime_id);
return AXIS2_SUCCESS;
}
@@ -562,9 +546,9 @@
axiom_data_handler_set_data_handler_type(
axiom_data_handler_t *data_handler,
const axutil_env_t *env,
- axiom_data_handler_type_t data_handler_type)
+ axiom_data_handler_type_t data_handler_type)
{
- data_handler->data_handler_type = data_handler_type;
+ data_handler->data_handler_type = data_handler_type;
return;
}
@@ -580,9 +564,9 @@
axiom_data_handler_set_user_param(
axiom_data_handler_t *data_handler,
const axutil_env_t *env,
- void *user_param)
+ void *user_param)
{
- data_handler->user_param = user_param;
+ data_handler->user_param = user_param;
return;
}
Modified: webservices/axis2/trunk/c/axiom/src/attachments/mime_body_part.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/axiom/src/attachments/mime_body_part.c?rev=805360&r1=805359&r2=805360&view=diff
==============================================================================
--- webservices/axis2/trunk/c/axiom/src/attachments/mime_body_part.c (original)
+++ webservices/axis2/trunk/c/axiom/src/attachments/mime_body_part.c Tue Aug 18 11:08:42 2009
@@ -31,7 +31,6 @@
* fill the header map.
*/
-
AXIS2_EXTERN axiom_mime_body_part_t *AXIS2_CALL
axiom_mime_body_part_create(
const axutil_env_t *env)
@@ -39,14 +38,13 @@
axiom_mime_body_part_t *mime_body_part = NULL;
AXIS2_ENV_CHECK(env, NULL);
- mime_body_part = (axiom_mime_body_part_t *) AXIS2_MALLOC(env->allocator,
+ mime_body_part = (axiom_mime_body_part_t *)AXIS2_MALLOC(env->allocator,
sizeof(axiom_mime_body_part_t));
- if (!mime_body_part)
+ if(!mime_body_part)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "No memory. Cannot create MIME body part");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "No memory. Cannot create MIME body part");
return NULL;
}
@@ -54,7 +52,7 @@
mime_body_part->data_handler = NULL;
mime_body_part->header_map = axutil_hash_make(env);
- if (!(mime_body_part->header_map))
+ if(!(mime_body_part->header_map))
{
axiom_mime_body_part_free(mime_body_part, env);
return NULL;
@@ -67,11 +65,11 @@
* default information. Default information are for binary attachments.
* Attachment information is taken from the information in data_handler in passed
* om_text.
- */
+ */
-AXIS2_EXTERN axiom_mime_body_part_t *AXIS2_CALL
+AXIS2_EXTERN axiom_mime_body_part_t *AXIS2_CALL
axiom_mime_body_part_create_from_om_text(
- const axutil_env_t *env,
+ const axutil_env_t *env,
axiom_text_t *text)
{
axiom_data_handler_t *data_handler = NULL;
@@ -81,63 +79,59 @@
const axis2_char_t *content_type = AXIOM_MIME_TYPE_OCTET_STREAM;
mime_body_part = axiom_mime_body_part_create(env);
- if (!mime_body_part)
+ if(!mime_body_part)
{
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI,
- "MIME body part creation failed");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "MIME body part creation failed");
return NULL;
}
-
+
/* Take the data_handler which is set by the sending applocation. */
-
+
data_handler = axiom_text_get_data_handler(text, env);
- if (data_handler)
+ if(data_handler)
{
content_type = axiom_data_handler_get_content_type(data_handler, env);
}
AXIOM_MIME_BODY_PART_SET_DATA_HANDLER(mime_body_part, env, data_handler);
- content_id = (axis2_char_t *) "<";
- content_id = axutil_stracat(env, content_id,
- axiom_text_get_content_id(text, env));
+ content_id = (axis2_char_t *)"<";
+ content_id = axutil_stracat(env, content_id, axiom_text_get_content_id(text, env));
temp_content_id = axutil_stracat(env, content_id, ">");
AXIS2_FREE(env->allocator, content_id);
content_id = temp_content_id;
/* Adding the content-id */
- AXIOM_MIME_BODY_PART_ADD_HEADER(mime_body_part, env,
- AXIOM_MIME_HEADER_CONTENT_ID, content_id);
-
+ AXIOM_MIME_BODY_PART_ADD_HEADER(mime_body_part, env, AXIOM_MIME_HEADER_CONTENT_ID, content_id);
+
/* Adding the content-type */
- AXIOM_MIME_BODY_PART_ADD_HEADER(mime_body_part, env,
- AXIOM_MIME_HEADER_CONTENT_TYPE, axutil_strdup(env, content_type));
-
+ AXIOM_MIME_BODY_PART_ADD_HEADER(mime_body_part, env, AXIOM_MIME_HEADER_CONTENT_TYPE,
+ axutil_strdup(env, content_type));
+
/* Adding the content-transfer encoding */
AXIOM_MIME_BODY_PART_ADD_HEADER(mime_body_part, env,
- AXIOM_MIME_HEADER_CONTENT_TRANSFER_ENCODING,
- axutil_strdup(env, AXIOM_MIME_CONTENT_TRANSFER_ENCODING_BINARY));
+ AXIOM_MIME_HEADER_CONTENT_TRANSFER_ENCODING, axutil_strdup(env,
+ AXIOM_MIME_CONTENT_TRANSFER_ENCODING_BINARY));
return mime_body_part;
}
-
AXIS2_EXTERN void AXIS2_CALL
axiom_mime_body_part_free(
axiom_mime_body_part_t *mime_body_part,
const axutil_env_t *env)
{
- if (mime_body_part->header_map)
+ if(mime_body_part->header_map)
{
axutil_hash_index_t *hash_index = NULL;
const void *key = NULL;
void *value = NULL;
- for (hash_index = axutil_hash_first(mime_body_part->header_map, env);
- hash_index; hash_index = axutil_hash_next(env, hash_index))
+ for(hash_index = axutil_hash_first(mime_body_part->header_map, env); hash_index; hash_index
+ = axutil_hash_next(env, hash_index))
{
axutil_hash_this(hash_index, &key, NULL, &value);
- if (value)
+ if(value)
{
AXIS2_FREE(env->allocator, value);
}
@@ -147,7 +141,7 @@
mime_body_part->header_map = NULL;
}
- if (mime_body_part)
+ if(mime_body_part)
{
AXIS2_FREE(env->allocator, mime_body_part);
}
@@ -157,7 +151,6 @@
/* This method will add a mime_header to the hash */
-
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axiom_mime_body_part_add_header(
axiom_mime_body_part_t *mime_body_part,
@@ -167,12 +160,11 @@
{
AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
- if (!mime_body_part->header_map)
+ if(!mime_body_part->header_map)
{
return AXIS2_FAILURE;
}
- axutil_hash_set(mime_body_part->header_map, name,
- AXIS2_HASH_KEY_STRING, value);
+ axutil_hash_set(mime_body_part->header_map, name, AXIS2_HASH_KEY_STRING, value);
return AXIS2_SUCCESS;
}
@@ -186,7 +178,6 @@
return AXIS2_SUCCESS;
}
-
/* This method will fill the array_list with binary and binary_beader information.
* If the binary is in a file this will not load the file to the memory. Because
* that will cause performance degradation when the file size is large. Instead
@@ -209,21 +200,19 @@
axis2_status_t status = AXIS2_FAILURE;
axiom_mime_part_t *mime_header_part = NULL;
+ /* We have the mime headers in the hash with thier keys
+ * So first concatenate them to a one string */
- /* We have the mime headers in the hash with thier keys
- * So first concatenate them to a one string */
-
- for (hash_index = axutil_hash_first(mime_body_part->header_map, env);
- hash_index; hash_index = axutil_hash_next(env, hash_index))
+ for(hash_index = axutil_hash_first(mime_body_part->header_map, env); hash_index; hash_index
+ = axutil_hash_next(env, hash_index))
{
axutil_hash_this(hash_index, &key, NULL, &value);
- if (key && value)
+ if(key && value)
{
/* First conactenate to the already conacatenated stuff */
-
- temp_header_str =
- axutil_stracat(env, header_str, (axis2_char_t *) key);
- if (header_str)
+
+ temp_header_str = axutil_stracat(env, header_str, (axis2_char_t *)key);
+ if(header_str)
{
AXIS2_FREE(env->allocator, header_str);
}
@@ -231,15 +220,14 @@
temp_header_str = axutil_stracat(env, header_str, ": ");
AXIS2_FREE(env->allocator, header_str);
header_str = temp_header_str;
-
+
/* Add the new stuff */
- temp_header_str =
- axutil_stracat(env, header_str, (axis2_char_t *) value);
+ temp_header_str = axutil_stracat(env, header_str, (axis2_char_t *)value);
AXIS2_FREE(env->allocator, header_str);
header_str = temp_header_str;
-
+
/* Next header will be in a new line. So lets add it */
-
+
temp_header_str = axutil_stracat(env, header_str, AXIS2_CRLF);
AXIS2_FREE(env->allocator, header_str);
header_str = temp_header_str;
@@ -248,46 +236,46 @@
/* If there is a data handler that's mean there is an attachment. Attachment
* will always start after an additional new line . So let's add it .*/
-
- if (mime_body_part->data_handler)
+
+ if(mime_body_part->data_handler)
{
temp_header_str = axutil_stracat(env, header_str, AXIS2_CRLF);
AXIS2_FREE(env->allocator, header_str);
header_str = temp_header_str;
}
- if (header_str)
+ if(header_str)
{
header_str_size = axutil_strlen(header_str);
}
-
+
/* Now we have the complete mime_headers string for a particular mime part.
* First wrap it as a mime_part_t .Then add it to the array list so
* later through the transport this can be written to the wire. */
-
+
mime_header_part = axiom_mime_part_create(env);
-
+
if(mime_header_part)
{
mime_header_part->part = (axis2_byte_t *)header_str;
mime_header_part->part_size = header_str_size;
mime_header_part->type = AXIOM_MIME_PART_BUFFER;
- }
+ }
else
{
return AXIS2_FAILURE;
- }
-
+ }
+
axutil_array_list_add(list, env, mime_header_part);
/* Then if the data_handler is there let's add the binary data, may be
* buffer , may be file name and information.
*/
-
- if (mime_body_part->data_handler)
+
+ if(mime_body_part->data_handler)
{
status = axiom_data_handler_add_binary_data(mime_body_part->data_handler, env, list);
- if (status != AXIS2_SUCCESS)
+ if(status != AXIS2_SUCCESS)
{
return status;
}