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:24:02 UTC
svn commit: r805365 [1/5] - in /webservices/axis2/trunk/c/util/src: ./
platforms/unix/ platforms/windows/
Author: shankar
Date: Tue Aug 18 11:24:00 2009
New Revision: 805365
URL: http://svn.apache.org/viewvc?rev=805365&view=rev
Log:
formatting the code
Modified:
webservices/axis2/trunk/c/util/src/allocator.c
webservices/axis2/trunk/c/util/src/array_list.c
webservices/axis2/trunk/c/util/src/base64.c
webservices/axis2/trunk/c/util/src/base64_binary.c
webservices/axis2/trunk/c/util/src/class_loader.c
webservices/axis2/trunk/c/util/src/date_time.c
webservices/axis2/trunk/c/util/src/date_time_util.c
webservices/axis2/trunk/c/util/src/digest_calc.c
webservices/axis2/trunk/c/util/src/dir_handler.c
webservices/axis2/trunk/c/util/src/dll_desc.c
webservices/axis2/trunk/c/util/src/duration.c
webservices/axis2/trunk/c/util/src/env.c
webservices/axis2/trunk/c/util/src/error.c
webservices/axis2/trunk/c/util/src/file.c
webservices/axis2/trunk/c/util/src/file_handler.c
webservices/axis2/trunk/c/util/src/generic_obj.c
webservices/axis2/trunk/c/util/src/hash.c
webservices/axis2/trunk/c/util/src/http_chunked_stream.c
webservices/axis2/trunk/c/util/src/linked_list.c
webservices/axis2/trunk/c/util/src/log.c
webservices/axis2/trunk/c/util/src/md5.c
webservices/axis2/trunk/c/util/src/network_handler.c
webservices/axis2/trunk/c/util/src/param.c
webservices/axis2/trunk/c/util/src/param_container.c
webservices/axis2/trunk/c/util/src/platforms/unix/date_time_util_unix.c
webservices/axis2/trunk/c/util/src/platforms/unix/thread_unix.c
webservices/axis2/trunk/c/util/src/platforms/unix/uuid_gen_unix.c
webservices/axis2/trunk/c/util/src/platforms/windows/axutil_windows.c
webservices/axis2/trunk/c/util/src/platforms/windows/date_time_util_windows.c
webservices/axis2/trunk/c/util/src/platforms/windows/dir_windows.c
webservices/axis2/trunk/c/util/src/platforms/windows/getopt_windows.c
webservices/axis2/trunk/c/util/src/platforms/windows/thread_mutex_windows.c
webservices/axis2/trunk/c/util/src/platforms/windows/thread_windows.c
webservices/axis2/trunk/c/util/src/platforms/windows/uuid_gen_windows.c
webservices/axis2/trunk/c/util/src/properties.c
webservices/axis2/trunk/c/util/src/property.c
webservices/axis2/trunk/c/util/src/qname.c
webservices/axis2/trunk/c/util/src/rand.c
webservices/axis2/trunk/c/util/src/stack.c
webservices/axis2/trunk/c/util/src/stream.c
webservices/axis2/trunk/c/util/src/string.c
webservices/axis2/trunk/c/util/src/string_util.c
webservices/axis2/trunk/c/util/src/thread_pool.c
webservices/axis2/trunk/c/util/src/types.c
webservices/axis2/trunk/c/util/src/uri.c
webservices/axis2/trunk/c/util/src/url.c
webservices/axis2/trunk/c/util/src/utils.c
webservices/axis2/trunk/c/util/src/uuid_gen.c
webservices/axis2/trunk/c/util/src/version.c
Modified: webservices/axis2/trunk/c/util/src/allocator.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/allocator.c?rev=805365&r1=805364&r2=805365&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/allocator.c (original)
+++ webservices/axis2/trunk/c/util/src/allocator.c Tue Aug 18 11:24:00 2009
@@ -37,14 +37,14 @@
axutil_allocator_init(
axutil_allocator_t * allocator)
{
- if (allocator)
+ if(allocator)
return allocator;
else
{
- allocator = (axutil_allocator_t *) malloc(sizeof(axutil_allocator_t));
- memset(allocator, 0, sizeof(axutil_allocator_t));
- if (allocator)
+ allocator = (axutil_allocator_t *)malloc(sizeof(axutil_allocator_t));
+ memset(allocator, 0, sizeof(axutil_allocator_t));
+ if(allocator)
{
allocator->malloc_fn = axutil_allocator_malloc_impl;
allocator->realloc = axutil_allocator_realloc_impl;
@@ -61,25 +61,25 @@
axutil_allocator_clone(
axutil_allocator_t * allocator)
{
- if (!allocator)
+ if(!allocator)
return NULL;
else
{
axutil_allocator_t* clone = NULL;
- clone = (axutil_allocator_t *) malloc(sizeof(axutil_allocator_t));
- memset(clone , 0, sizeof(axutil_allocator_t));
- if (clone )
+ clone = (axutil_allocator_t *)malloc(sizeof(axutil_allocator_t));
+ memset(clone, 0, sizeof(axutil_allocator_t));
+ if(clone)
{
clone->malloc_fn = allocator->malloc_fn;
clone->realloc = allocator->realloc;
clone->free_fn = allocator->free_fn;
clone->current_pool = allocator->current_pool;
- clone->global_pool = allocator->global_pool;
- clone->local_pool = allocator->local_pool;
+ clone->global_pool = allocator->global_pool;
+ clone->local_pool = allocator->local_pool;
clone->global_pool_ref = 0;
- return clone ;
+ return clone;
}
}
return NULL;
@@ -88,7 +88,7 @@
axutil_allocator_free(
axutil_allocator_t * allocator)
{
- if (allocator)
+ if(allocator)
{
allocator->free_fn(allocator, allocator);
}
@@ -124,7 +124,7 @@
axutil_allocator_switch_to_global_pool(
axutil_allocator_t * allocator)
{
- if (!allocator)
+ if(!allocator)
return;
allocator->global_pool_ref++;
allocator->current_pool = allocator->global_pool;
@@ -135,7 +135,7 @@
axutil_allocator_switch_to_local_pool(
axutil_allocator_t * allocator)
{
- if (!allocator)
+ if(!allocator)
return;
if(allocator->global_pool_ref > 0)
{
Modified: webservices/axis2/trunk/c/util/src/array_list.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/array_list.c?rev=805365&r1=805364&r2=805365&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/array_list.c (original)
+++ webservices/axis2/trunk/c/util/src/array_list.c Tue Aug 18 11:24:00 2009
@@ -40,10 +40,10 @@
axutil_array_list_t *array_list = NULL;
array_list = AXIS2_MALLOC(env->allocator, sizeof(axutil_array_list_t));
- if (!array_list)
+ if(!array_list)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
return NULL;
}
@@ -52,14 +52,14 @@
array_list->data = NULL;
/* Check capacity, and set the default if error */
- if (capacity <= 0)
+ if(capacity <= 0)
capacity = AXIS2_ARRAY_LIST_DEFAULT_CAPACITY;
array_list->data = AXIS2_MALLOC(env->allocator, sizeof(void *) * capacity);
- if (!array_list->data)
+ if(!array_list->data)
{
axutil_array_list_free(array_list, env);
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
return NULL;
}
array_list->capacity = capacity;
@@ -73,17 +73,16 @@
const axutil_env_t * env,
int min_capacity)
{
- AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
- if (min_capacity > array_list->capacity)
+ AXIS2_PARAM_CHECK(env->error, array_list, AXIS2_FAILURE);
+ if(min_capacity > array_list->capacity)
{
- int new_capacity = (array_list->capacity * 2 >
- min_capacity) ? (array_list->capacity * 2) : min_capacity;
- void **data = (void **) AXIS2_MALLOC(env->allocator,
- sizeof(void *) * new_capacity);
- if (!data)
+ int new_capacity = (array_list->capacity * 2 > min_capacity) ? (array_list->capacity * 2)
+ : min_capacity;
+ void **data = (void **)AXIS2_MALLOC(env->allocator, sizeof(void *) * new_capacity);
+ if(!data)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
return AXIS2_FAILURE;
}
memcpy(data, array_list->data, sizeof(void *) * array_list->capacity);
@@ -102,9 +101,9 @@
const axutil_env_t * env)
{
/* Don't use AXIS2_PARAM_CHECK to verify array_list, as it clobbers
- env->error->status_code on no error destroying the information
- therein that an error has already occurred. */
- if (!array_list)
+ env->error->status_code on no error destroying the information
+ therein that an error has already occurred. */
+ if(!array_list)
return 0;
return array_list->size;
}
@@ -114,7 +113,7 @@
struct axutil_array_list * array_list,
const axutil_env_t * env)
{
- AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, array_list, AXIS2_FAILURE);
return array_list->size == 0;
}
@@ -124,7 +123,7 @@
const axutil_env_t * env,
void *e)
{
- AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, array_list, AXIS2_FAILURE);
return axutil_array_list_index_of(array_list, env, e) != -1;
}
@@ -136,9 +135,9 @@
{
int i = 0;
- AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
- for (i = 0; i < array_list->size; i++)
- if (e == array_list->data[i])
+ AXIS2_PARAM_CHECK(env->error, array_list, AXIS2_FAILURE);
+ for(i = 0; i < array_list->size; i++)
+ if(e == array_list->data[i])
return i;
return -1;
}
@@ -150,9 +149,9 @@
int index)
{
/* Don't use AXIS2_PARAM_CHECK to verify array_list, as it clobbers
- env->error->status_code on no error destroying the information
- therein that an error has already occurred. */
- if (axutil_array_list_check_bound_exclusive(array_list, env, index))
+ env->error->status_code on no error destroying the information
+ therein that an error has already occurred. */
+ if(axutil_array_list_check_bound_exclusive(array_list, env, index))
return array_list->data[index];
else
return NULL;
@@ -167,8 +166,8 @@
{
void *result = NULL;
- AXIS2_PARAM_CHECK (env->error, array_list, NULL);
- if (axutil_array_list_check_bound_exclusive(array_list, env, index))
+ AXIS2_PARAM_CHECK(env->error, array_list, NULL);
+ if(axutil_array_list_check_bound_exclusive(array_list, env, index))
{
result = array_list->data[index];
array_list->data[index] = e;
@@ -182,12 +181,12 @@
const axutil_env_t * env,
const void *e)
{
- AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
- if (array_list->size == array_list->capacity)
- if (axutil_array_list_ensure_capacity
- (array_list, env, array_list->size + 1) != AXIS2_SUCCESS)
+ AXIS2_PARAM_CHECK(env->error, array_list, AXIS2_FAILURE);
+ if(array_list->size == array_list->capacity)
+ if(axutil_array_list_ensure_capacity(array_list, env, array_list->size + 1)
+ != AXIS2_SUCCESS)
return AXIS2_FAILURE;
- array_list->data[array_list->size++] = (void *) e;
+ array_list->data[array_list->size++] = (void *)e;
return AXIS2_SUCCESS;
}
@@ -199,22 +198,22 @@
const void *e)
{
int i = 0;
- AXIS2_PARAM_CHECK (env->error, array_list, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK(env->error, array_list, AXIS2_FAILURE);
- if (!axutil_array_list_check_bound_inclusive(array_list, env, index))
+ if(!axutil_array_list_check_bound_inclusive(array_list, env, index))
return AXIS2_FAILURE;
- if (array_list->size == array_list->capacity)
+ if(array_list->size == array_list->capacity)
{
- if (axutil_array_list_ensure_capacity
- (array_list, env, array_list->size + 1) != AXIS2_SUCCESS)
+ if(axutil_array_list_ensure_capacity(array_list, env, array_list->size + 1)
+ != AXIS2_SUCCESS)
return AXIS2_FAILURE;
}
- if (index != array_list->size)
+ if(index != array_list->size)
{
- for (i = array_list->size; i > index; i--)
+ for(i = array_list->size; i > index; i--)
array_list->data[i] = array_list->data[i - 1];
}
- array_list->data[index] = (void *) e;
+ array_list->data[index] = (void *)e;
array_list->size++;
return AXIS2_SUCCESS;
}
@@ -227,12 +226,12 @@
{
void *result = NULL;
int i = 0;
- AXIS2_PARAM_CHECK (env->error, array_list, NULL);
+ AXIS2_PARAM_CHECK(env->error, array_list, NULL);
- if (axutil_array_list_check_bound_exclusive(array_list, env, index))
+ if(axutil_array_list_check_bound_exclusive(array_list, env, index))
{
result = array_list->data[index];
- for (i = index; i < array_list->size - 1; i++)
+ for(i = index; i < array_list->size - 1; i++)
array_list->data[i] = array_list->data[i + 1];
array_list->size--;
}
@@ -247,12 +246,11 @@
int index)
{
/* Don't use AXIS2_PARAM_CHECK to verify array_list, as it clobbers
- env->error->status_code on no error destroying the information
- therein that an error has already occurred. */
- if (!array_list || index < 0 || index > array_list->size)
+ env->error->status_code on no error destroying the information
+ therein that an error has already occurred. */
+ if(!array_list || index < 0 || index > array_list->size)
{
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INDEX_OUT_OF_BOUNDS,
- AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INDEX_OUT_OF_BOUNDS, AXIS2_FAILURE);
return AXIS2_FALSE;
}
return AXIS2_TRUE;
@@ -265,12 +263,11 @@
int index)
{
/* Don't use AXIS2_PARAM_CHECK to verify array_list, as it clobbers
- env->error->status_code on no error destroying the information
- therein that an error has already occurred. */
- if (!array_list || index < 0 || index >= array_list->size)
+ env->error->status_code on no error destroying the information
+ therein that an error has already occurred. */
+ if(!array_list || index < 0 || index >= array_list->size)
{
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INDEX_OUT_OF_BOUNDS,
- AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INDEX_OUT_OF_BOUNDS, AXIS2_FAILURE);
return AXIS2_FALSE;
}
return AXIS2_TRUE;
@@ -281,9 +278,9 @@
struct axutil_array_list *array_list,
const axutil_env_t * env)
{
- AXIS2_PARAM_CHECK_VOID (env->error, array_list);
+ AXIS2_PARAM_CHECK_VOID(env->error, array_list);
- if (array_list->data)
+ if(array_list->data)
{
AXIS2_FREE(env->allocator, array_list->data);
}
@@ -298,16 +295,10 @@
{
axutil_array_list_t *array_list_l = NULL;
- AXIS2_PARAM_CHECK_VOID (env->error, array_list);
+ AXIS2_PARAM_CHECK_VOID(env->error, array_list);
- array_list_l = (axutil_array_list_t *) array_list;
+ array_list_l = (axutil_array_list_t *)array_list;
axutil_array_list_free(array_list_l, env);
return;
}
-
-
-
-
-
-
Modified: webservices/axis2/trunk/c/util/src/base64.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/base64.c?rev=805365&r1=805364&r2=805365&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/base64.c (original)
+++ webservices/axis2/trunk/c/util/src/base64.c Tue Aug 18 11:24:00 2009
@@ -98,20 +98,22 @@
register const unsigned char *bufin;
register int nprbytes;
- if (!bufcoded)
+ if(!bufcoded)
{
return -1;
}
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
+ bufin = (const unsigned char *)bufcoded;
+ while(pr2six[*(bufin++)] <= 63)
+ ;
- nprbytes = (int)(bufin - (const unsigned char *) bufcoded) - 1;
+ nprbytes = (int)(bufin - (const unsigned char *)bufcoded) - 1;
/* We are sure that the difference lies within the int range */
nbytesdecoded = ((nprbytes >> 2) * 3);
- if (nprbytes & 0x03) nbytesdecoded += (nprbytes & 0x03) - 1;
+ if(nprbytes & 0x03)
+ nbytesdecoded += (nprbytes & 0x03) - 1;
return nbytesdecoded;
@@ -123,7 +125,7 @@
const char *bufcoded)
{
int len;
- len = axutil_base64_decode_binary((unsigned char *) bufplain, bufcoded);
+ len = axutil_base64_decode_binary((unsigned char *)bufplain, bufcoded);
bufplain[len] = '\0';
return len;
}
@@ -142,55 +144,49 @@
register unsigned char *bufout;
register int nprbytes;
- if (!bufcoded)
+ if(!bufcoded)
{
return -1;
}
- bufin = (const unsigned char *) bufcoded;
- while (pr2six[*(bufin++)] <= 63);
- nprbytes = (int)(bufin - (const unsigned char *) bufcoded) - 1;
+ bufin = (const unsigned char *)bufcoded;
+ while(pr2six[*(bufin++)] <= 63)
+ ;
+ nprbytes = (int)(bufin - (const unsigned char *)bufcoded) - 1;
/* We are sure that the difference lies within the int range */
nbytesdecoded = ((nprbytes + 3) / 4) * 3;
- bufout = (unsigned char *) bufplain;
- bufin = (const unsigned char *) bufcoded;
+ bufout = (unsigned char *)bufplain;
+ bufin = (const unsigned char *)bufcoded;
- while (nprbytes > 4)
+ while(nprbytes > 4)
{
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
+ *(bufout++) = (unsigned char)(pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
+ *(bufout++) = (unsigned char)(pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
+ *(bufout++) = (unsigned char)(pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
bufin += 4;
nprbytes -= 4;
}
/* Note: (nprbytes == 1) would be an error, so just ingore that case */
- if (nprbytes > 1)
+ if(nprbytes > 1)
{
- *(bufout++) =
- (unsigned char) (pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
+ *(bufout++) = (unsigned char)(pr2six[*bufin] << 2 | pr2six[bufin[1]] >> 4);
}
- if (nprbytes > 2)
+ if(nprbytes > 2)
{
- *(bufout++) =
- (unsigned char) (pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
+ *(bufout++) = (unsigned char)(pr2six[bufin[1]] << 4 | pr2six[bufin[2]] >> 2);
}
- if (nprbytes > 3)
+ if(nprbytes > 3)
{
- *(bufout++) =
- (unsigned char) (pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
+ *(bufout++) = (unsigned char)(pr2six[bufin[2]] << 6 | pr2six[bufin[3]]);
}
nbytesdecoded -= (4 - nprbytes) & 3;
return nbytesdecoded;
}
-static const char basis_64[] =
- "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
+static const char basis_64[] = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
AXIS2_EXTERN int AXIS2_CALL
axutil_base64_encode_len(
@@ -206,8 +202,7 @@
int len)
{
#ifndef __OS400__
- return axutil_base64_encode_binary(encoded, (const unsigned char *) string,
- len);
+ return axutil_base64_encode_binary(encoded, (const unsigned char *)string, len);
#else /* __OS400__ */
int i;
char *p;
@@ -217,11 +212,11 @@
{
*p++ = basis_64[(os_toascii[string[i]] >> 2) & 0x3F];
*p++ =
- basis_64[((os_toascii[string[i]] & 0x3) << 4) |
- ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
+ basis_64[((os_toascii[string[i]] & 0x3) << 4) |
+ ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
*p++ =
- basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) |
- ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)];
+ basis_64[((os_toascii[string[i + 1]] & 0xF) << 2) |
+ ((int) (os_toascii[string[i + 2]] & 0xC0) >> 6)];
*p++ = basis_64[os_toascii[string[i + 2]] & 0x3F];
}
if (i < len)
@@ -235,8 +230,8 @@
else
{
*p++ =
- basis_64[((os_toascii[string[i]] & 0x3) << 4) |
- ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
+ basis_64[((os_toascii[string[i]] & 0x3) << 4) |
+ ((int) (os_toascii[string[i + 1]] & 0xF0) >> 4)];
*p++ = basis_64[((os_toascii[string[i + 1]] & 0xF) << 2)];
}
*p++ = '=';
@@ -260,30 +255,24 @@
char *p;
p = encoded;
- for (i = 0; i < len - 2; i += 3)
+ for(i = 0; i < len - 2; i += 3)
{
*p++ = basis_64[(string[i] >> 2) & 0x3F];
- *p++ =
- basis_64[((string[i] & 0x3) << 4) |
- ((int) (string[i + 1] & 0xF0) >> 4)];
- *p++ =
- basis_64[((string[i + 1] & 0xF) << 2) |
- ((int) (string[i + 2] & 0xC0) >> 6)];
+ *p++ = basis_64[((string[i] & 0x3) << 4) | ((int)(string[i + 1] & 0xF0) >> 4)];
+ *p++ = basis_64[((string[i + 1] & 0xF) << 2) | ((int)(string[i + 2] & 0xC0) >> 6)];
*p++ = basis_64[string[i + 2] & 0x3F];
}
- if (i < len)
+ if(i < len)
{
*p++ = basis_64[(string[i] >> 2) & 0x3F];
- if (i == (len - 1))
+ if(i == (len - 1))
{
*p++ = basis_64[((string[i] & 0x3) << 4)];
*p++ = '=';
}
else
{
- *p++ =
- basis_64[((string[i] & 0x3) << 4) |
- ((int) (string[i + 1] & 0xF0) >> 4)];
+ *p++ = basis_64[((string[i] & 0x3) << 4) | ((int)(string[i + 1] & 0xF0) >> 4)];
*p++ = basis_64[((string[i + 1] & 0xF) << 2)];
}
*p++ = '=';
Modified: webservices/axis2/trunk/c/util/src/base64_binary.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/base64_binary.c?rev=805365&r1=805364&r2=805365&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/base64_binary.c (original)
+++ webservices/axis2/trunk/c/util/src/base64_binary.c Tue Aug 18 11:24:00 2009
@@ -25,7 +25,6 @@
int plain_binary_len;
};
-
AXIS2_EXTERN axutil_base64_binary_t *AXIS2_CALL
axutil_base64_binary_create(
const axutil_env_t * env)
@@ -33,10 +32,10 @@
axutil_base64_binary_t *base64_binary = NULL;
AXIS2_ENV_CHECK(env, NULL);
- base64_binary = (axutil_base64_binary_t *) AXIS2_MALLOC(env->allocator,
+ base64_binary = (axutil_base64_binary_t *)AXIS2_MALLOC(env->allocator,
sizeof(axutil_base64_binary_t));
- if (!base64_binary)
+ if(!base64_binary)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
@@ -58,18 +57,18 @@
AXIS2_ENV_CHECK(env, NULL);
AXIS2_PARAM_CHECK(env->error, plain_binary, NULL);
- base64_binary = (axutil_base64_binary_t *) axutil_base64_binary_create(env);
- if (!base64_binary)
+ base64_binary = (axutil_base64_binary_t *)axutil_base64_binary_create(env);
+ if(!base64_binary)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
return NULL;
}
- base64_binary->plain_binary =
- AXIS2_MALLOC(env->allocator, sizeof(unsigned char) * plain_binary_len);
+ base64_binary->plain_binary = AXIS2_MALLOC(env->allocator, sizeof(unsigned char)
+ * plain_binary_len);
- if (!base64_binary->plain_binary)
+ if(!base64_binary->plain_binary)
{
axutil_base64_binary_free(base64_binary, env);
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -93,8 +92,8 @@
AXIS2_ENV_CHECK(env, NULL);
AXIS2_PARAM_CHECK(env->error, encoded_binary, NULL);
- base64_binary = (axutil_base64_binary_t *) axutil_base64_binary_create(env);
- if (!base64_binary)
+ base64_binary = (axutil_base64_binary_t *)axutil_base64_binary_create(env);
+ if(!base64_binary)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
@@ -102,10 +101,10 @@
}
plain_binary_len = axutil_base64_decode_len(encoded_binary);
- base64_binary->plain_binary =
- AXIS2_MALLOC(env->allocator, sizeof(unsigned char) * plain_binary_len);
+ base64_binary->plain_binary = AXIS2_MALLOC(env->allocator, sizeof(unsigned char)
+ * plain_binary_len);
- if (!base64_binary->plain_binary)
+ if(!base64_binary->plain_binary)
{
axutil_base64_binary_free(base64_binary, env);
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -125,17 +124,17 @@
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (!base64_binary)
+ if(!base64_binary)
{
return;
}
- if (base64_binary->plain_binary)
+ if(base64_binary->plain_binary)
{
AXIS2_FREE(env->allocator, base64_binary->plain_binary);
}
- if (base64_binary)
+ if(base64_binary)
{
AXIS2_FREE(env->allocator, base64_binary);
}
@@ -153,17 +152,16 @@
AXIS2_PARAM_CHECK(env->error, plain_binary, AXIS2_FAILURE);
- base64_binary->plain_binary =
- AXIS2_MALLOC(env->allocator, sizeof(unsigned char) * plain_binary_len);
- if (!base64_binary->plain_binary)
+ base64_binary->plain_binary = AXIS2_MALLOC(env->allocator, sizeof(unsigned char)
+ * plain_binary_len);
+ if(!base64_binary->plain_binary)
{
axutil_base64_binary_free(base64_binary, env);
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
return AXIS2_FAILURE;
}
- memcpy(base64_binary->plain_binary, plain_binary,
- plain_binary_len);
+ memcpy(base64_binary->plain_binary, plain_binary, plain_binary_len);
base64_binary->plain_binary_len = plain_binary_len;
return AXIS2_SUCCESS;
@@ -192,10 +190,10 @@
AXIS2_PARAM_CHECK(env->error, encoded_binary, AXIS2_FAILURE);
plain_binary_len = axutil_base64_decode_len(encoded_binary);
- base64_binary->plain_binary =
- AXIS2_MALLOC(env->allocator, sizeof(unsigned char) * plain_binary_len);
+ base64_binary->plain_binary = AXIS2_MALLOC(env->allocator, sizeof(unsigned char)
+ * plain_binary_len);
- if (!base64_binary->plain_binary)
+ if(!base64_binary->plain_binary)
{
axutil_base64_binary_free(base64_binary, env);
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -217,12 +215,10 @@
int encoded_binary_len = 0;
AXIS2_PARAM_CHECK(env->error, base64_binary, NULL);
- encoded_binary_len =
- axutil_base64_encode_len(base64_binary->plain_binary_len);
- encoded_binary =
- AXIS2_MALLOC(env->allocator, sizeof(char) * encoded_binary_len);
+ encoded_binary_len = axutil_base64_encode_len(base64_binary->plain_binary_len);
+ encoded_binary = AXIS2_MALLOC(env->allocator, sizeof(char) * encoded_binary_len);
- if (!encoded_binary)
+ if(!encoded_binary)
{
axutil_base64_binary_free(base64_binary, env);
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -230,7 +226,7 @@
return NULL;
}
axutil_base64_encode_binary(encoded_binary, base64_binary->plain_binary,
- base64_binary->plain_binary_len);
+ base64_binary->plain_binary_len);
return encoded_binary;
}
@@ -240,13 +236,12 @@
const axutil_env_t *env)
{
int encoded_binary_len = 0;
- if (!base64_binary)
+ if(!base64_binary)
{
return 0;
}
- encoded_binary_len =
- axutil_base64_encode_len(base64_binary->plain_binary_len);
+ encoded_binary_len = axutil_base64_encode_len(base64_binary->plain_binary_len);
return encoded_binary_len;
}
@@ -255,7 +250,7 @@
axutil_base64_binary_t *base64_binary,
const axutil_env_t *env)
{
- if (!base64_binary)
+ if(!base64_binary)
{
return 0;
}
Modified: webservices/axis2/trunk/c/util/src/class_loader.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/class_loader.c?rev=805365&r1=805364&r2=805365&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/class_loader.c (original)
+++ webservices/axis2/trunk/c/util/src/class_loader.c Tue Aug 18 11:24:00 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -18,11 +17,13 @@
#include <axutil_class_loader.h>
-axis2_status_t axutil_class_loader_load_lib(
+axis2_status_t
+axutil_class_loader_load_lib(
const axutil_env_t *env,
axutil_dll_desc_t *dll_desc);
-axis2_status_t axutil_class_loader_unload_lib(
+axis2_status_t
+axutil_class_loader_unload_lib(
const axutil_env_t *env,
axutil_dll_desc_t *dll_desc);
@@ -39,10 +40,9 @@
const axutil_env_t *env,
axutil_dll_desc_t *dll_desc)
{
- if (!dll_desc)
+ if(!dll_desc)
{
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DLL_CREATE_FAILED,
- AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DLL_CREATE_FAILED, AXIS2_FAILURE);
return AXIS2_FAILURE;
}
axutil_class_loader_unload_lib(env, dll_desc);
@@ -64,84 +64,74 @@
axutil_error_codes_t error_code = AXIS2_ERROR_NONE;
dll_desc = axutil_param_get_value(impl_info_param, env);
- if (!dll_desc)
+ if(!dll_desc)
{
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DLL_CREATE_FAILED,
- AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DLL_CREATE_FAILED, AXIS2_FAILURE);
return NULL;
}
dl_handler = axutil_dll_desc_get_dl_handler(dll_desc, env);
- if (!dl_handler)
+ if(!dl_handler)
{
status = axutil_class_loader_load_lib(env, dll_desc);
- if (AXIS2_SUCCESS != status)
+ if(AXIS2_SUCCESS != status)
{
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DLL_CREATE_FAILED,
- AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DLL_CREATE_FAILED, AXIS2_FAILURE);
return NULL;
}
dl_handler = axutil_dll_desc_get_dl_handler(dll_desc, env);
- if (!dl_handler)
+ if(!dl_handler)
{
return NULL;
}
- create_funct =
- (CREATE_FUNCT) AXIS2_PLATFORM_GETPROCADDR(dl_handler,
- AXIS2_CREATE_FUNCTION);
- if (!create_funct)
+ create_funct = (CREATE_FUNCT)AXIS2_PLATFORM_GETPROCADDR(dl_handler, AXIS2_CREATE_FUNCTION);
+ if(!create_funct)
{
return NULL;
}
status = axutil_dll_desc_set_create_funct(dll_desc, env, create_funct);
- if (AXIS2_FAILURE == status)
+ if(AXIS2_FAILURE == status)
{
axutil_class_loader_unload_lib(env, dll_desc);
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DLL_CREATE_FAILED,
- AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DLL_CREATE_FAILED, AXIS2_FAILURE);
return NULL;
}
- delete_funct =
- (DELETE_FUNCT) AXIS2_PLATFORM_GETPROCADDR(dl_handler,
- AXIS2_DELETE_FUNCTION);
- if (!delete_funct)
+ delete_funct = (DELETE_FUNCT)AXIS2_PLATFORM_GETPROCADDR(dl_handler, AXIS2_DELETE_FUNCTION);
+ if(!delete_funct)
{
return NULL;
}
status = axutil_dll_desc_set_delete_funct(dll_desc, env, delete_funct);
- if (AXIS2_FAILURE == status)
+ if(AXIS2_FAILURE == status)
{
axutil_class_loader_unload_lib(env, dll_desc);
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DLL_CREATE_FAILED,
- AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DLL_CREATE_FAILED, AXIS2_FAILURE);
return NULL;
}
}
create_funct = axutil_dll_desc_get_create_funct(dll_desc, env);
- if (!create_funct)
+ if(!create_funct)
{
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_DLL_DESC,
- AXIS2_FAILURE);
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_INVALID_STATE_DLL_DESC, AXIS2_FAILURE);
return NULL;
}
error_code = axutil_dll_desc_get_error_code(dll_desc, env);
create_funct(&obj, env);
- if (!obj)
+ if(!obj)
{
axutil_class_loader_unload_lib(env, dll_desc);
AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "Object create function returned NULL");
AXIS2_ERROR_SET(env->error, error_code, AXIS2_FAILURE);
return NULL;
}
- else
- {
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "%s shared lib loaded successfully",
- axutil_dll_desc_get_name(dll_desc, env));
- }
+ else
+ {
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "%s shared lib loaded successfully",
+ axutil_dll_desc_get_name(dll_desc, env));
+ }
-
return obj;
}
@@ -156,25 +146,24 @@
dll_name = axutil_dll_desc_get_name(dll_desc, env);
dl_handler = AXIS2_PLATFORM_LOADLIB(dll_name);
- if (!dl_handler)
- {
+ if(!dl_handler)
+ {
#ifndef WIN32
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Loading shared library %s Failed. DLERROR IS %s",
- dll_name, AXIS2_PLATFORM_LOADLIB_ERROR);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Loading shared library %s Failed. DLERROR IS %s",
+ dll_name, AXIS2_PLATFORM_LOADLIB_ERROR);
#else
- axis2_char_t buff[AXUTIL_WIN32_ERROR_BUFSIZE];
- axutil_win32_get_last_error(buff, AXUTIL_WIN32_ERROR_BUFSIZE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Loading shared library %s Failed. DLERROR IS %s",
- dll_name, buff);
+ axis2_char_t buff[AXUTIL_WIN32_ERROR_BUFSIZE];
+ axutil_win32_get_last_error(buff, AXUTIL_WIN32_ERROR_BUFSIZE);
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Loading shared library %s Failed. DLERROR IS %s",
+ dll_name, buff);
#endif
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DLL_LOADING_FAILED,
- AXIS2_FAILURE);
-
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_DLL_LOADING_FAILED, AXIS2_FAILURE);
+
return AXIS2_FAILURE;
}
status = axutil_dll_desc_set_dl_handler(dll_desc, env, dl_handler);
- if (AXIS2_SUCCESS != status)
+ if(AXIS2_SUCCESS != status)
{
AXIS2_PLATFORM_UNLOADLIB(dl_handler);
dl_handler = NULL;
@@ -191,7 +180,7 @@
axutil_dll_desc_t * dll_desc)
{
AXIS2_DLHANDLER dl_handler = axutil_dll_desc_get_dl_handler(dll_desc, env);
- if (dl_handler)
+ if(dl_handler)
{
AXIS2_PLATFORM_UNLOADLIB(dl_handler);
}
Modified: webservices/axis2/trunk/c/util/src/date_time.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/date_time.c?rev=805365&r1=805364&r2=805365&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/date_time.c (original)
+++ webservices/axis2/trunk/c/util/src/date_time.c Tue Aug 18 11:24:00 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -47,10 +46,9 @@
struct tm *utc_time = NULL;
AXIS2_ENV_CHECK(env, NULL);
- date_time = (axutil_date_time_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axutil_date_time_t));
+ date_time = (axutil_date_time_t *)AXIS2_MALLOC(env->allocator, sizeof(axutil_date_time_t));
- if (!date_time)
+ if(!date_time)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
@@ -89,7 +87,7 @@
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (date_time)
+ if(date_time)
{
AXIS2_FREE(env->allocator, date_time);
}
@@ -108,15 +106,15 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
sscanf(time_str, "%d:%d:%fZ", &hour, &min, &sec);
- if (hour < 0 || hour > 23)
+ if(hour < 0 || hour > 23)
{
return AXIS2_FAILURE;
}
- if (min < 0 || min > 59)
+ if(min < 0 || min > 59)
{
return AXIS2_FAILURE;
}
- if (sec < 0 || sec >= 60)
+ if(sec < 0 || sec >= 60)
{
return AXIS2_FAILURE;
}
@@ -139,49 +137,47 @@
int tz_min;
axis2_bool_t tz_pos = AXIS2_TRUE;
-
+
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (strchr(time_str, 'Z'))
+ if(strchr(time_str, 'Z'))
{
return AXIS2_FAILURE;
}
- else if (!strchr(time_str, '+'))
+ else if(!strchr(time_str, '+'))
{
tz_pos = AXIS2_FALSE;
}
- if (tz_pos)
+ if(tz_pos)
{
- sscanf(time_str, "%d:%d:%f+%d:%d", &hour, &min,
- &sec, &tz_hour, &tz_min);
+ sscanf(time_str, "%d:%d:%f+%d:%d", &hour, &min, &sec, &tz_hour, &tz_min);
}
else
{
- sscanf(time_str, "%d:%d:%f-%d:%d", &hour, &min,
- &sec, &tz_hour, &tz_min);
+ sscanf(time_str, "%d:%d:%f-%d:%d", &hour, &min, &sec, &tz_hour, &tz_min);
}
- if (hour < 0 || hour > 23)
+ if(hour < 0 || hour > 23)
{
return AXIS2_FAILURE;
}
- if (min < 0 || min > 59)
+ if(min < 0 || min > 59)
{
return AXIS2_FAILURE;
}
- if (sec < 0 || sec >= 60)
+ if(sec < 0 || sec >= 60)
{
return AXIS2_FAILURE;
}
- if (tz_hour < 0 || tz_hour > 14)
+ if(tz_hour < 0 || tz_hour > 14)
{
return AXIS2_FAILURE;
}
- if (tz_min < 0 || tz_min > 59)
+ if(tz_min < 0 || tz_min > 59)
{
return AXIS2_FAILURE;
}
- if (tz_hour == 14 && tz_min != 0)
+ if(tz_hour == 14 && tz_min != 0)
{
return AXIS2_FAILURE;
}
@@ -206,40 +202,38 @@
int is_year_neg = 0;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (!date_str || *date_str == '+')
+ if(!date_str || *date_str == '+')
{
return AXIS2_FAILURE;
}
- if (*date_str == '-')
+ if(*date_str == '-')
{
is_year_neg++;
}
- sscanf(date_str + is_year_neg, "%d-%d-%d", &year, &mon,
- &day);
- if (is_year_neg)
+ sscanf(date_str + is_year_neg, "%d-%d-%d", &year, &mon, &day);
+ if(is_year_neg)
{
year *= -1;
}
- if (mon < 1 || mon > 12)
+ if(mon < 1 || mon > 12)
{
return AXIS2_FAILURE;
}
- if (day < 1 || day > 31)
+ if(day < 1 || day > 31)
{
return AXIS2_FAILURE;
}
- if (day == 31 && (mon == 2 || mon == 4 ||
- mon == 6 || mon == 9 || mon == 11))
+ if(day == 31 && (mon == 2 || mon == 4 || mon == 6 || mon == 9 || mon == 11))
{
return AXIS2_FAILURE;
}
- if (day == 30 && mon == 2)
+ if(day == 30 && mon == 2)
{
return AXIS2_FAILURE;
}
- if (day == 29 && mon == 2)
+ if(day == 29 && mon == 2)
{
- if (year % 4 != 0 || year % 400 == 0)
+ if(year % 4 != 0 || year % 400 == 0)
{
return AXIS2_FAILURE;
}
@@ -265,54 +259,52 @@
int is_year_neg = 0;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (!date_time_str || *date_time_str == '+')
+ if(!date_time_str || *date_time_str == '+')
{
return AXIS2_FAILURE;
}
- if (*date_time_str == '-')
+ if(*date_time_str == '-')
{
is_year_neg++;
}
- sscanf(date_time_str + is_year_neg, "%d-%d-%dT%d:%d:%fZ", &year,
- &mon, &day, &hour, &min, &sec);
+ sscanf(date_time_str + is_year_neg, "%d-%d-%dT%d:%d:%fZ", &year, &mon, &day, &hour, &min, &sec);
- if (is_year_neg)
+ if(is_year_neg)
{
year *= -1;
}
- if (mon < 1 || mon > 12)
+ if(mon < 1 || mon > 12)
{
return AXIS2_FAILURE;
}
- if (day < 1 || day > 31)
+ if(day < 1 || day > 31)
{
return AXIS2_FAILURE;
}
- if (day == 31 && (mon == 2 || mon == 4 ||
- mon == 6 || mon == 9 || mon == 11))
+ if(day == 31 && (mon == 2 || mon == 4 || mon == 6 || mon == 9 || mon == 11))
{
return AXIS2_FAILURE;
}
- if (day == 30 && mon == 2)
+ if(day == 30 && mon == 2)
{
return AXIS2_FAILURE;
}
- if (day == 29 && mon == 2)
+ if(day == 29 && mon == 2)
{
- if (year % 4 != 0 || year % 400 == 0)
+ if(year % 4 != 0 || year % 400 == 0)
{
return AXIS2_FAILURE;
}
}
- if (hour < 0 || hour > 23)
+ if(hour < 0 || hour > 23)
{
return AXIS2_FAILURE;
}
- if (min < 0 || min > 59)
+ if(min < 0 || min > 59)
{
return AXIS2_FAILURE;
}
- if (sec < 0 || sec >= 60)
+ if(sec < 0 || sec >= 60)
{
return AXIS2_FAILURE;
}
@@ -341,87 +333,86 @@
int tz_min;
int is_year_neg = 0;
axis2_bool_t tz_pos = AXIS2_FALSE;
-
+
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (!date_time_str || *date_time_str == '+')
+ if(!date_time_str || *date_time_str == '+')
{
return AXIS2_FAILURE;
}
- if (*date_time_str == '-')
+ if(*date_time_str == '-')
{
is_year_neg++;
}
- if (strchr(date_time_str, 'Z'))
+ if(strchr(date_time_str, 'Z'))
{
return AXIS2_FAILURE;
}
- else if (strchr(date_time_str, '+'))
+ else if(strchr(date_time_str, '+'))
{
tz_pos = AXIS2_TRUE;
}
- if (tz_pos)
+ if(tz_pos)
{
- sscanf(date_time_str + is_year_neg, "%d-%d-%dT%d:%d:%f+%d:%d", &year,
- &mon, &day, &hour, &min, &sec, &tz_hour, &tz_min);
+ sscanf(date_time_str + is_year_neg, "%d-%d-%dT%d:%d:%f+%d:%d", &year, &mon, &day, &hour,
+ &min, &sec, &tz_hour, &tz_min);
}
else
{
- sscanf(date_time_str + is_year_neg, "%d-%d-%dT%d:%d:%f-%d:%d", &year,
- &mon, &day, &hour, &min, &sec, &tz_hour, &tz_min);
+ sscanf(date_time_str + is_year_neg, "%d-%d-%dT%d:%d:%f-%d:%d", &year, &mon, &day, &hour,
+ &min, &sec, &tz_hour, &tz_min);
}
- if (is_year_neg)
+ if(is_year_neg)
{
year *= -1;
}
- if (mon < 1 || mon > 12)
+ if(mon < 1 || mon > 12)
{
return AXIS2_FAILURE;
}
- if (day < 1 || day > 31)
+ if(day < 1 || day > 31)
{
return AXIS2_FAILURE;
}
- if (day == 31 && (mon == 2 || mon == 4 ||
- mon == 6 || mon == 9 || mon == 11))
+ if(day == 31 && (mon == 2 || mon == 4 || mon == 6 || mon == 9 || mon == 11))
{
return AXIS2_FAILURE;
}
- if (day == 30 && mon == 2)
+ if(day == 30 && mon == 2)
{
return AXIS2_FAILURE;
}
- if (day == 29 && mon == 2)
+ if(day == 29 && mon == 2)
{
- if (year % 4 != 0 || year % 400 == 0)
+ if(year % 4 != 0 || year % 400 == 0)
{
return AXIS2_FAILURE;
}
}
- if (hour < 0 || hour > 23)
+ if(hour < 0 || hour > 23)
{
return AXIS2_FAILURE;
}
- if (min < 0 || min > 59)
+ if(min < 0 || min > 59)
{
return AXIS2_FAILURE;
}
- if (sec < 0 || sec >= 60)
+ if(sec < 0 || sec >= 60)
{
return AXIS2_FAILURE;
}
- if (tz_hour < 0 || tz_hour > 14)
+ if(tz_hour < 0 || tz_hour > 14)
{
return AXIS2_FAILURE;
}
- if (tz_min < 0 || tz_min > 59)
+ if(tz_min < 0 || tz_min > 59)
{
return AXIS2_FAILURE;
}
- if (tz_hour == 14 && tz_min != 0)
+ if(tz_hour == 14 && tz_min != 0)
{
return AXIS2_FAILURE;
}
@@ -450,29 +441,29 @@
int ref_hour;
AXIS2_ENV_CHECK(env, AXIS2_DATE_TIME_COMP_RES_FAILURE);
- if (date_time->year < ref->year)
+ if(date_time->year < ref->year)
{
return AXIS2_DATE_TIME_COMP_RES_NOT_EXPIRED;
}
- else if (date_time->year > ref->year)
+ else if(date_time->year > ref->year)
{
return AXIS2_DATE_TIME_COMP_RES_EXPIRED;
}
- if (date_time->mon < ref->mon)
+ if(date_time->mon < ref->mon)
{
return AXIS2_DATE_TIME_COMP_RES_NOT_EXPIRED;
}
- else if (date_time->mon > ref->mon)
+ else if(date_time->mon > ref->mon)
{
return AXIS2_DATE_TIME_COMP_RES_EXPIRED;
}
- if (date_time->day < ref->day)
+ if(date_time->day < ref->day)
{
return AXIS2_DATE_TIME_COMP_RES_NOT_EXPIRED;
}
- else if (date_time->day > ref->day)
+ else if(date_time->day > ref->day)
{
return AXIS2_DATE_TIME_COMP_RES_EXPIRED;
}
@@ -481,12 +472,12 @@
dt_hour = date_time->tz_hour;
ref_min = ref->tz_min;
ref_hour = ref->tz_hour;
- if (date_time->tz_pos)
+ if(date_time->tz_pos)
{
dt_min *= -1;
dt_hour *= -1;
}
- if (ref->tz_pos)
+ if(ref->tz_pos)
{
ref_min *= -1;
ref_hour *= -1;
@@ -497,29 +488,29 @@
ref_min += ref->min;
ref_hour += ref->hour;
- if (dt_hour < ref_hour)
+ if(dt_hour < ref_hour)
{
return AXIS2_DATE_TIME_COMP_RES_NOT_EXPIRED;
}
- else if (dt_hour > ref_hour)
+ else if(dt_hour > ref_hour)
{
return AXIS2_DATE_TIME_COMP_RES_EXPIRED;
}
- if (dt_min < ref_min)
+ if(dt_min < ref_min)
{
return AXIS2_DATE_TIME_COMP_RES_NOT_EXPIRED;
}
- else if (dt_min > ref_min)
+ else if(dt_min > ref_min)
{
return AXIS2_DATE_TIME_COMP_RES_EXPIRED;
}
- if (date_time->sec < ref->sec)
+ if(date_time->sec < ref->sec)
{
return AXIS2_DATE_TIME_COMP_RES_NOT_EXPIRED;
}
- else if (date_time->sec > ref->sec)
+ else if(date_time->sec > ref->sec)
{
return AXIS2_DATE_TIME_COMP_RES_EXPIRED;
}
@@ -536,15 +527,15 @@
int min)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (hour < 0 || hour > 14)
+ if(hour < 0 || hour > 14)
{
return AXIS2_FAILURE;
}
- if (min < 0 || min > 59)
+ if(min < 0 || min > 59)
{
return AXIS2_FAILURE;
}
- if (hour == 14 && min != 0)
+ if(hour == 14 && min != 0)
{
return AXIS2_FAILURE;
}
@@ -568,43 +559,42 @@
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (mon < 1 || mon > 12)
+ if(mon < 1 || mon > 12)
{
return AXIS2_FAILURE;
}
- if (day < 1 || day > 31)
+ if(day < 1 || day > 31)
{
return AXIS2_FAILURE;
}
- if (day == 31 && (mon == 2 || mon == 4 ||
- mon == 6 || mon == 9 || mon == 11))
+ if(day == 31 && (mon == 2 || mon == 4 || mon == 6 || mon == 9 || mon == 11))
{
return AXIS2_FAILURE;
}
- if (day == 30 && mon == 2)
+ if(day == 30 && mon == 2)
{
return AXIS2_FAILURE;
}
- if (day == 29 && mon == 2)
+ if(day == 29 && mon == 2)
{
- if (year % 4 != 0 || year % 400 == 0)
+ if(year % 4 != 0 || year % 400 == 0)
{
return AXIS2_FAILURE;
}
}
- if (hour < 0 || hour > 23)
+ if(hour < 0 || hour > 23)
{
return AXIS2_FAILURE;
}
- if (min < 0 || min > 59)
+ if(min < 0 || min > 59)
{
return AXIS2_FAILURE;
}
- if (sec < 0 || sec > 59)
+ if(sec < 0 || sec > 59)
{
return AXIS2_FAILURE;
}
- if (msec < 0 || msec > 999)
+ if(msec < 0 || msec > 999)
{
return AXIS2_FAILURE;
}
@@ -629,10 +619,8 @@
AXIS2_ENV_CHECK(env, NULL);
- time_str = (axis2_char_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axis2_char_t) * 32);
- sprintf(time_str, "%02d:%02d:%06.3fZ", date_time->hour, date_time->min,
- date_time->sec);
+ time_str = (axis2_char_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * 32);
+ sprintf(time_str, "%02d:%02d:%06.3fZ", date_time->hour, date_time->min, date_time->sec);
return time_str;
}
@@ -645,16 +633,14 @@
AXIS2_ENV_CHECK(env, NULL);
- if (!date_time->tz_hour && !date_time->tz_min)
+ if(!date_time->tz_hour && !date_time->tz_min)
{
return axutil_date_time_serialize_time(date_time, env);
}
- time_str =
- (axis2_char_t *) AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * 37);
+ time_str = (axis2_char_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * 37);
sprintf(time_str, "%02d:%02d:%06.3f%c%02d:%02d", date_time->hour, date_time->min,
- date_time->sec, date_time->tz_pos ? '+': '-',
- date_time->tz_hour, date_time->tz_min);
+ date_time->sec, date_time->tz_pos ? '+' : '-', date_time->tz_hour, date_time->tz_min);
return time_str;
}
@@ -667,11 +653,9 @@
AXIS2_ENV_CHECK(env, NULL);
- date_str = (axis2_char_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axis2_char_t) * 32);
+ date_str = (axis2_char_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * 32);
- sprintf(date_str, "%d-%02d-%02d", date_time->year + 1900, date_time->mon + 1,
- date_time->day);
+ sprintf(date_str, "%d-%02d-%02d", date_time->year + 1900, date_time->mon + 1, date_time->day);
return date_str;
}
@@ -685,9 +669,8 @@
AXIS2_ENV_CHECK(env, NULL);
date_time_str = AXIS2_MALLOC(env->allocator, sizeof(char) * 32);
- sprintf(date_time_str, "%d-%02d-%02dT%02d:%02d:%06.3fZ",
- date_time->year + 1900, date_time->mon + 1, date_time->day,
- date_time->hour, date_time->min, date_time->sec);
+ sprintf(date_time_str, "%d-%02d-%02dT%02d:%02d:%06.3fZ", date_time->year + 1900, date_time->mon
+ + 1, date_time->day, date_time->hour, date_time->min, date_time->sec);
return date_time_str;
}
@@ -701,9 +684,8 @@
AXIS2_ENV_CHECK(env, NULL);
date_time_str = AXIS2_MALLOC(env->allocator, sizeof(char) * 32);
- sprintf(date_time_str, "%d-%02d-%02dT%02d:%02d:%02.0fZ",
- date_time->year + 1900, date_time->mon + 1, date_time->day,
- date_time->hour, date_time->min, date_time->sec);
+ sprintf(date_time_str, "%d-%02d-%02dT%02d:%02d:%02.0fZ", date_time->year + 1900, date_time->mon
+ + 1, date_time->day, date_time->hour, date_time->min, date_time->sec);
return date_time_str;
}
@@ -716,16 +698,15 @@
AXIS2_ENV_CHECK(env, NULL);
- if (!date_time->tz_hour && !date_time->tz_min)
+ if(!date_time->tz_hour && !date_time->tz_min)
{
return axutil_date_time_serialize_date_time(date_time, env);
}
date_time_str = AXIS2_MALLOC(env->allocator, sizeof(char) * 37);
- sprintf(date_time_str, "%d-%02d-%02dT%02d:%02d:%06.3f%c%02d:%02d",
- date_time->year + 1900, date_time->mon + 1, date_time->day,
- date_time->hour, date_time->min, date_time->sec,
- date_time->tz_pos ? '+': '-', date_time->tz_hour, date_time->tz_min);
+ sprintf(date_time_str, "%d-%02d-%02dT%02d:%02d:%06.3f%c%02d:%02d", date_time->year + 1900,
+ date_time->mon + 1, date_time->day, date_time->hour, date_time->min, date_time->sec,
+ date_time->tz_pos ? '+' : '-', date_time->tz_hour, date_time->tz_min);
return date_time_str;
}
@@ -818,7 +799,7 @@
const axutil_env_t *env)
{
axis2_bool_t is_utc = AXIS2_TRUE;
- if (date_time->tz_hour || date_time->tz_min)
+ if(date_time->tz_hour || date_time->tz_min)
{
is_utc = AXIS2_FALSE;
}
@@ -839,7 +820,7 @@
int tz_hour;
int tz_min;
axis2_bool_t tz_pos = AXIS2_FALSE;
-
+
axutil_date_time_t *ret = NULL;
year = date_time->year;
@@ -852,7 +833,7 @@
tz_hour = date_time->tz_hour;
tz_min = date_time->tz_min;
- if (tz_pos)
+ if(tz_pos)
{
tz_hour *= -1;
tz_min *= -1;
@@ -860,35 +841,35 @@
hour += tz_hour;
min += tz_min;
- if (min > 59)
+ if(min > 59)
{
hour += min / 60;
min %= 60;
}
- while (min < 0)
+ while(min < 0)
{
hour--;
min += 60;
}
- if (hour > 23)
+ if(hour > 23)
{
day += hour / 24;
hour %= 24;
}
- while (hour < 0)
+ while(hour < 0)
{
day--;
hour += 24;
}
mon--;
- while (mon < 0)
+ while(mon < 0)
{
mon += 12;
year--;
}
- while (mon > 11)
+ while(mon > 11)
{
mon -= 12;
year++;
@@ -896,16 +877,16 @@
mon++;
day--;
- while (day > 27)
+ while(day > 27)
{
- if (mon == 2)
+ if(mon == 2)
{
- if (year % 4 != 0 || year % 400 == 0)
+ if(year % 4 != 0 || year % 400 == 0)
{
day -= 28;
mon++;
}
- else if (day > 28)
+ else if(day > 28)
{
day -= 29;
mon++;
@@ -915,14 +896,13 @@
break;
}
}
- else if (day > 29)
+ else if(day > 29)
{
- if (mon == 4 || mon == 6 ||
- mon == 9 || mon == 11)
+ if(mon == 4 || mon == 6 || mon == 9 || mon == 11)
{
day -= 30;
}
- else if (day > 30)
+ else if(day > 30)
{
day -= 31;
}
@@ -936,24 +916,23 @@
{
break;
}
- if (mon > 12)
+ if(mon > 12)
{
mon = 1;
year++;
}
}
- while (day < 0)
+ while(day < 0)
{
- if (mon == 3)
+ if(mon == 3)
{
day += 28;
- if (year % 4 == 0 || year % 400 != 0)
+ if(year % 4 == 0 || year % 400 != 0)
{
day++;
}
}
- if (mon == 5 || mon == 7 ||
- mon == 10 || mon == 12)
+ if(mon == 5 || mon == 7 || mon == 10 || mon == 12)
{
day += 30;
}
@@ -962,7 +941,7 @@
day += 31;
}
mon--;
- if (mon < 1)
+ if(mon < 1)
{
mon = 12;
year--;
@@ -970,39 +949,38 @@
}
day++;
- if (mon < 1 || mon > 12)
+ if(mon < 1 || mon > 12)
{
return NULL;
}
- if (day < 1 || day > 31)
+ if(day < 1 || day > 31)
{
return NULL;
}
- if (day == 31 && (mon == 2 || mon == 4 ||
- mon == 6 || mon == 9 || mon == 11))
+ if(day == 31 && (mon == 2 || mon == 4 || mon == 6 || mon == 9 || mon == 11))
{
return NULL;
}
- if (day == 30 && mon == 2)
+ if(day == 30 && mon == 2)
{
return NULL;
}
- if (day == 29 && mon == 2)
+ if(day == 29 && mon == 2)
{
- if (year % 4 != 0 || year % 400 == 0)
+ if(year % 4 != 0 || year % 400 == 0)
{
return NULL;
}
}
- if (hour < 0 || hour > 23)
+ if(hour < 0 || hour > 23)
{
return NULL;
}
- if (min < 0 || min > 59)
+ if(min < 0 || min > 59)
{
return NULL;
}
- if (sec < 0 || sec >= 60)
+ if(sec < 0 || sec >= 60)
{
return NULL;
}
@@ -1027,7 +1005,7 @@
{
axutil_date_time_t *date_time = NULL;
axutil_date_time_t *ret = NULL;
- if (date_time_in->tz_hour && date_time_in->tz_min)
+ if(date_time_in->tz_hour && date_time_in->tz_min)
{
return NULL;
}
@@ -1039,12 +1017,12 @@
date_time->sec = date_time_in->sec;
date_time->tz_hour = hour;
date_time->tz_min = min;
-
+
date_time->tz_pos = is_positive ? AXIS2_FALSE : AXIS2_TRUE;
ret = axutil_date_time_local_to_utc(date_time, env);
ret->tz_hour = hour;
ret->tz_min = min;
-
+
ret->tz_pos = is_positive;
axutil_date_time_free(date_time, env);
Modified: webservices/axis2/trunk/c/util/src/date_time_util.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/date_time_util.c?rev=805365&r1=805364&r2=805365&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/date_time_util.c (original)
+++ webservices/axis2/trunk/c/util/src/date_time_util.c Tue Aug 18 11:24:00 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
Modified: webservices/axis2/trunk/c/util/src/digest_calc.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/digest_calc.c?rev=805365&r1=805364&r2=805365&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/digest_calc.c (original)
+++ webservices/axis2/trunk/c/util/src/digest_calc.c Tue Aug 18 11:24:00 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -27,19 +26,19 @@
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axutil_digest_calc_get_h_a1(
const axutil_env_t *env,
- char *algorithm,
- char *user_name,
- char *realm,
- char *password,
- char *nonce,
- char *cnonce,
+ char *algorithm,
+ char *user_name,
+ char *realm,
+ char *password,
+ char *nonce,
+ char *cnonce,
axutil_digest_hash_hex_t session_key)
{
axutil_md5_ctx_t *ctx;
axutil_digest_hash_t ha1;
ctx = axutil_md5_ctx_create(env);
- if (!ctx)
+ if(!ctx)
return AXIS2_FAILURE;
axutil_md5_update(ctx, env, user_name, strlen(user_name));
axutil_md5_update(ctx, env, ":", 1);
@@ -48,10 +47,10 @@
axutil_md5_update(ctx, env, password, strlen(password));
axutil_md5_final(ctx, env, ha1);
axutil_md5_ctx_free(ctx, env);
- if (!axutil_strcasecmp(algorithm, "md5-sess"))
+ if(!axutil_strcasecmp(algorithm, "md5-sess"))
{
ctx = axutil_md5_ctx_create(env);
- if (!ctx)
+ if(!ctx)
return AXIS2_FAILURE;
axutil_md5_update(ctx, env, ha1, AXIS2_DIGEST_HASH_LEN);
axutil_md5_update(ctx, env, ":", 1);
@@ -63,19 +62,19 @@
}
convert_to_hex(ha1, session_key);
return AXIS2_SUCCESS;
-}
+}
AXIS2_EXTERN axis2_status_t AXIS2_CALL
axutil_digest_calc_get_response(
const axutil_env_t *env,
- axutil_digest_hash_hex_t h_a1,
- char *nonce,
- char *nonce_count,
- char *cnonce,
- char *qop,
- char *method,
- char *digest_uri,
- axutil_digest_hash_hex_t h_entity,
+ axutil_digest_hash_hex_t h_a1,
+ char *nonce,
+ char *nonce_count,
+ char *cnonce,
+ char *qop,
+ char *method,
+ char *digest_uri,
+ axutil_digest_hash_hex_t h_entity,
axutil_digest_hash_hex_t response)
{
axutil_md5_ctx_t *ctx;
@@ -84,12 +83,12 @@
axutil_digest_hash_hex_t ha2_hex;
ctx = axutil_md5_ctx_create(env);
- if (!ctx)
+ if(!ctx)
return AXIS2_FAILURE;
axutil_md5_update(ctx, env, method, strlen(method));
axutil_md5_update(ctx, env, ":", 1);
axutil_md5_update(ctx, env, digest_uri, strlen(digest_uri));
- if (!axutil_strcasecmp(qop, "auth-int"))
+ if(!axutil_strcasecmp(qop, "auth-int"))
{
axutil_md5_update(ctx, env, ":", 1);
axutil_md5_update(ctx, env, h_entity, AXIS2_DIGEST_HASH_HEX_LEN);
@@ -99,13 +98,13 @@
convert_to_hex(ha2, ha2_hex);
ctx = axutil_md5_ctx_create(env);
- if (!ctx)
+ if(!ctx)
return AXIS2_FAILURE;
axutil_md5_update(ctx, env, h_a1, AXIS2_DIGEST_HASH_HEX_LEN);
axutil_md5_update(ctx, env, ":", 1);
axutil_md5_update(ctx, env, nonce, strlen(nonce));
axutil_md5_update(ctx, env, ":", 1);
- if (*qop)
+ if(*qop)
{
axutil_md5_update(ctx, env, nonce_count, strlen(nonce_count));
axutil_md5_update(ctx, env, ":", 1);
@@ -132,14 +131,14 @@
{
j = (bin[i] >> 4) & 0xf;
if (j <= 9)
- hex[i*2] = (j + '0');
- else
- hex[i*2] = (j + 'a' - 10);
+ hex[i*2] = (j + '0');
+ else
+ hex[i*2] = (j + 'a' - 10);
j = bin[i] & 0xf;
if (j <= 9)
- hex[i*2+1] = (j + '0');
- else
- hex[i*2+1] = (j + 'a' - 10);
+ hex[i*2+1] = (j + '0');
+ else
+ hex[i*2+1] = (j + 'a' - 10);
}
hex[AXIS2_DIGEST_HASH_HEX_LEN] = '\0';
}
Modified: webservices/axis2/trunk/c/util/src/dir_handler.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/dir_handler.c?rev=805365&r1=805364&r2=805365&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/dir_handler.c (original)
+++ webservices/axis2/trunk/c/util/src/dir_handler.c Tue Aug 18 11:24:00 2009
@@ -1,4 +1,3 @@
-
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
@@ -40,7 +39,7 @@
int dir_select(
const struct dirent *entry);
int file_select(
- const struct dirent *entry);
+ const struct dirent *entry);
#endif
/**
@@ -59,7 +58,7 @@
int i = 0;
struct dirent **files = NULL;
/*int file_select(
- );*/
+ );*/
/* Removed un-wanted redefinition leading to warnings on
* Windows. If this is the desired behaviour, please look
* into the file_select function definition below and comment
@@ -71,15 +70,14 @@
file_list = axutil_array_list_create(env, 100);
count = AXIS2_SCANDIR(pathname, &files, file_select, AXIS2_ALPHASORT);
/* If no files found, make a non-selectable menu item */
- if (count <= 0)
+ if(count <= 0)
{
axutil_array_list_free(file_list, env);
- AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "No files in the path %s.",
- pathname);
+ AXIS2_LOG_DEBUG(env->log, AXIS2_LOG_SI, "No files in the path %s.", pathname);
return NULL;
}
- for (i = 1; i < (count + 1); ++i)
+ for(i = 1; i < (count + 1); ++i)
{
axis2_char_t *fname = NULL;
axutil_file_t *arch_file = NULL;
@@ -87,15 +85,15 @@
axis2_char_t *temp_path = NULL;
fname = files[i - 1]->d_name;
- arch_file = (axutil_file_t *) axutil_file_create(env);
- if (!arch_file)
+ arch_file = (axutil_file_t *)axutil_file_create(env);
+ if(!arch_file)
{
int size = 0;
int j = 0;
axutil_file_t *del_file = NULL;
size = axutil_array_list_size(file_list, env);
- for (j = 0; j < size; j++)
+ for(j = 0; j < size; j++)
{
del_file = axutil_array_list_get(file_list, env, j);
axutil_file_free(del_file, env);
@@ -108,7 +106,7 @@
temp_path = axutil_stracat(env, pathname, AXIS2_PATH_SEP_STR);
path = axutil_stracat(env, temp_path, fname);
AXIS2_FREE(env->allocator, temp_path);
- if (!path)
+ if(!path)
{
int size = 0;
int j = 0;
@@ -116,7 +114,7 @@
axutil_file_free(arch_file, env);
size = axutil_array_list_size(file_list, env);
- for (j = 0; j < size; j++)
+ for(j = 0; j < size; j++)
{
del_file = axutil_array_list_get(file_list, env, j);
axutil_file_free(del_file, env);
@@ -127,7 +125,7 @@
}
axutil_file_set_path(arch_file, env, path);
buf = AXIS2_MALLOC(env->allocator, sizeof(struct stat));
- if (!buf)
+ if(!buf)
{
int size = 0;
int j = 0;
@@ -136,7 +134,7 @@
AXIS2_FREE(env->allocator, path);
axutil_file_free(arch_file, env);
size = axutil_array_list_size(file_list, env);
- for (j = 0; j < size; j++)
+ for(j = 0; j < size; j++)
{
del_file = axutil_array_list_get(file_list, env, j);
axutil_file_free(del_file, env);
@@ -146,9 +144,9 @@
return NULL;
}
stat(path, buf);
- axutil_file_set_timestamp(arch_file, env, (time_t) buf->st_ctime);
+ axutil_file_set_timestamp(arch_file, env, (time_t)buf->st_ctime);
status = axutil_array_list_add(file_list, env, arch_file);
- if (AXIS2_SUCCESS != status)
+ if(AXIS2_SUCCESS != status)
{
int size = 0;
int j = 0;
@@ -158,7 +156,7 @@
AXIS2_FREE(env->allocator, path);
AXIS2_FREE(env->allocator, buf);
size = axutil_array_list_size(file_list, env);
- for (j = 0; j < size; j++)
+ for(j = 0; j < size; j++)
{
del_file = axutil_array_list_get(file_list, env, j);
axutil_file_free(del_file, env);
@@ -201,11 +199,11 @@
axis2_status_t status = AXIS2_FAILURE;
AXIS2_ENV_CHECK(env, NULL);
file_list = axutil_array_list_create(env, 0);
- if (!AXIS2_GETCWD(cwd, 500))
+ if(!AXIS2_GETCWD(cwd, 500))
exit(1);
/* pathname is path of services directory or modules directory. */
- chdir_result = AXIS2_CHDIR(pathname);
+ chdir_result = AXIS2_CHDIR(pathname);
#ifdef AXIS2_ARCHIVE_ENABLED
axis2_archive_extract();
#endif
@@ -214,14 +212,14 @@
chdir_result = AXIS2_CHDIR(cwd);
/* If no files found, make a non-selectable menu item */
- if (count <= 0)
+ if(count <= 0)
{
axutil_array_list_free(file_list, env);
AXIS2_LOG_INFO(env->log, "No files in the path %s.", pathname);
return NULL;
}
- for (i = 1; i < (count + 1); ++i)
+ for(i = 1; i < (count + 1); ++i)
{
axis2_char_t *fname = NULL;
axutil_file_t *arch_file = NULL;
@@ -229,15 +227,15 @@
axis2_char_t *temp_path = NULL;
fname = files[i - 1]->d_name;
- arch_file = (axutil_file_t *) axutil_file_create(env);
- if (!arch_file)
+ arch_file = (axutil_file_t *)axutil_file_create(env);
+ if(!arch_file)
{
int size = 0;
int j = 0;
axutil_file_t *del_file = NULL;
size = axutil_array_list_size(file_list, env);
- for (j = 0; j < size; j++)
+ for(j = 0; j < size; j++)
{
del_file = axutil_array_list_get(file_list, env, j);
axutil_file_free(del_file, env);
@@ -249,7 +247,7 @@
axutil_file_set_name(arch_file, env, fname);
temp_path = axutil_stracat(env, pathname, AXIS2_PATH_SEP_STR);
path = axutil_stracat(env, temp_path, fname);
- if (!path)
+ if(!path)
{
int size = 0;
int j = 0;
@@ -257,7 +255,7 @@
axutil_file_free(arch_file, env);
size = axutil_array_list_size(file_list, env);
- for (j = 0; j < size; j++)
+ for(j = 0; j < size; j++)
{
del_file = axutil_array_list_get(file_list, env, j);
axutil_file_free(del_file, env);
@@ -269,7 +267,7 @@
axutil_file_set_path(arch_file, env, path);
AXIS2_FREE(env->allocator, temp_path);
buf = AXIS2_MALLOC(env->allocator, sizeof(struct stat));
- if (!buf)
+ if(!buf)
{
int size = 0;
int j = 0;
@@ -278,7 +276,7 @@
axutil_file_free(arch_file, env);
AXIS2_FREE(env->allocator, path);
size = axutil_array_list_size(file_list, env);
- for (j = 0; j < size; j++)
+ for(j = 0; j < size; j++)
{
del_file = axutil_array_list_get(file_list, env, j);
axutil_file_free(del_file, env);
@@ -288,9 +286,9 @@
return NULL;
}
stat(path, buf);
- axutil_file_set_timestamp(arch_file, env, (time_t) buf->st_ctime);
+ axutil_file_set_timestamp(arch_file, env, (time_t)buf->st_ctime);
status = axutil_array_list_add(file_list, env, arch_file);
- if (AXIS2_SUCCESS != status)
+ if(AXIS2_SUCCESS != status)
{
int size = 0;
int j = 0;
@@ -300,7 +298,7 @@
AXIS2_FREE(env->allocator, path);
AXIS2_FREE(env->allocator, buf);
size = axutil_array_list_size(file_list, env);
- for (j = 0; j < size; j++)
+ for(j = 0; j < size; j++)
{
del_file = axutil_array_list_get(file_list, env, j);
axutil_file_free(del_file, env);
@@ -312,7 +310,7 @@
AXIS2_FREE(env->allocator, buf);
}
- for (i = 0; i < count; i++)
+ for(i = 0; i < count; i++)
{
free(files[i]);
}
@@ -320,32 +318,33 @@
return file_list;
}
-
int
file_select(
const struct dirent *entry)
{
- #ifdef IS_MACOSX
- int file_select(struct dirent *entry);
- #else
- int file_select(const struct dirent *entry);
- #endif
+#ifdef IS_MACOSX
+ int file_select(struct dirent *entry);
+#else
+ int
+ file_select(
+ const struct dirent *entry);
+#endif
/** FIXME:
- * This block of code has been sitting here doing nothing.
- * I have made the existing logic use this code portion.
- * Have no idea about the side-effects of this modification.
- * If this code block is not required, we might as well remove
- * it.
- */
+ * This block of code has been sitting here doing nothing.
+ * I have made the existing logic use this code portion.
+ * Have no idea about the side-effects of this modification.
+ * If this code block is not required, we might as well remove
+ * it.
+ */
axis2_char_t *ptr;
- if ((strcmp(entry->d_name, ".") == 0) || (strcmp(entry->d_name, "..") == 0))
+ if((strcmp(entry->d_name, ".") == 0) || (strcmp(entry->d_name, "..") == 0))
return (AXIS2_FALSE);
/* Check for filename extensions */
ptr = axutil_rindex(entry->d_name, '.');
- if ((ptr) && ((strcmp(ptr, AXIS2_LIB_SUFFIX) == 0)))
+ if((ptr) && ((strcmp(ptr, AXIS2_LIB_SUFFIX) == 0)))
{
return (AXIS2_TRUE);
}
@@ -365,10 +364,10 @@
{
struct stat stat_p;
- if (-1 == stat(entry->d_name, &stat_p))
+ if(-1 == stat(entry->d_name, &stat_p))
return (AXIS2_FALSE);
- if ((entry->d_name[0] == '.') || (!S_ISDIR(stat_p.st_mode)))
+ if((entry->d_name[0] == '.') || (!S_ISDIR(stat_p.st_mode)))
{
return (AXIS2_FALSE);
}
Modified: webservices/axis2/trunk/c/util/src/dll_desc.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/dll_desc.c?rev=805365&r1=805364&r2=805365&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/dll_desc.c (original)
+++ webservices/axis2/trunk/c/util/src/dll_desc.c Tue Aug 18 11:24:00 2009
@@ -40,13 +40,12 @@
AXIS2_ENV_CHECK(env, NULL);
- dll_desc = (axutil_dll_desc_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axutil_dll_desc_t));
+ dll_desc = (axutil_dll_desc_t *)AXIS2_MALLOC(env->allocator, sizeof(axutil_dll_desc_t));
- if (!dll_desc)
+ if(!dll_desc)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
return NULL;
}
@@ -70,24 +69,24 @@
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (dll_desc->dl_handler)
+ if(dll_desc->dl_handler)
{
axutil_class_loader_delete_dll(env, dll_desc);
}
- if (dll_desc->dll_name)
+ if(dll_desc->dll_name)
{
AXIS2_FREE(env->allocator, dll_desc->dll_name);
dll_desc->dll_name = NULL;
}
- if (dll_desc->path_qualified_dll_name)
+ if(dll_desc->path_qualified_dll_name)
{
AXIS2_FREE(env->allocator, dll_desc->path_qualified_dll_name);
dll_desc->path_qualified_dll_name = NULL;
}
- if (dll_desc)
+ if(dll_desc)
{
AXIS2_FREE(env->allocator, dll_desc);
}
@@ -102,7 +101,7 @@
axutil_dll_desc_t *dll_desc_l = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- dll_desc_l = (axutil_dll_desc_t *) dll_desc;
+ dll_desc_l = (axutil_dll_desc_t *)dll_desc;
axutil_dll_desc_free(dll_desc_l, env);
return;
}
@@ -116,14 +115,14 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, name, AXIS2_FAILURE);
- if (dll_desc->path_qualified_dll_name)
+ if(dll_desc->path_qualified_dll_name)
{
AXIS2_FREE(env->allocator, dll_desc->path_qualified_dll_name);
dll_desc->path_qualified_dll_name = NULL;
}
dll_desc->path_qualified_dll_name = axutil_strdup(env, name);
- if (!dll_desc->path_qualified_dll_name)
+ if(!dll_desc->path_qualified_dll_name)
{
return AXIS2_FAILURE;
}
@@ -187,7 +186,7 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK(env->error, dl_handler, AXIS2_FAILURE);
- if (dll_desc->dl_handler)
+ if(dll_desc->dl_handler)
{
AXIS2_FREE(env->allocator, dll_desc->dl_handler);
}
Modified: webservices/axis2/trunk/c/util/src/duration.c
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/c/util/src/duration.c?rev=805365&r1=805364&r2=805365&view=diff
==============================================================================
--- webservices/axis2/trunk/c/util/src/duration.c (original)
+++ webservices/axis2/trunk/c/util/src/duration.c Tue Aug 18 11:24:00 2009
@@ -54,17 +54,16 @@
AXIS2_ENV_CHECK(env, NULL);
- duration = (axutil_duration_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axutil_duration_t));
- if (!duration)
+ duration = (axutil_duration_t *)AXIS2_MALLOC(env->allocator, sizeof(axutil_duration_t));
+ if(!duration)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
return NULL;
}
duration->is_negative = negative;
- if (years > -1)
+ if(years > -1)
{
duration->years = years;
}
@@ -72,7 +71,7 @@
{
duration->years = 0;
}
- if (months > -1)
+ if(months > -1)
{
duration->months = months;
}
@@ -80,7 +79,7 @@
{
duration->months = 0;
}
- if (days > -1)
+ if(days > -1)
{
duration->days = days;
}
@@ -88,7 +87,7 @@
{
duration->days = 0;
}
- if (hours > -1)
+ if(hours > -1)
{
duration->hours = hours;
}
@@ -96,7 +95,7 @@
{
duration->hours = 0;
}
- if (minutes > -1)
+ if(minutes > -1)
{
duration->mins = minutes;
}
@@ -104,7 +103,7 @@
{
duration->mins = 0;
}
- if (seconds >= 0)
+ if(seconds >= 0)
{
duration->secs = seconds;
}
@@ -122,12 +121,11 @@
{
axutil_duration_t *duration = NULL;
- duration = (axutil_duration_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axutil_duration_t));
- if (!duration)
+ duration = (axutil_duration_t *)AXIS2_MALLOC(env->allocator, sizeof(axutil_duration_t));
+ if(!duration)
{
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
+ AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Out of memory");
return NULL;
}
@@ -144,7 +142,7 @@
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (duration)
+ if(duration)
{
AXIS2_FREE(env->allocator, duration);
duration = NULL;
@@ -171,30 +169,29 @@
duration->years = duration->months = duration->days = duration->hours = duration->mins = 0;
duration->secs = 0;
- if (!duration_str)
+ if(!duration_str)
{
- 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 AXIS2_FAILURE;
}
- if (*cur == '-')
+ if(*cur == '-')
{
duration->is_negative = 1;
cur++;
}
- if (*cur++ != 'P')
+ if(*cur++ != 'P')
{
duration->is_negative = AXIS2_FALSE;
duration->years = duration->months = duration->days = duration->hours = duration->mins = 0;
duration->secs = 0;
-
+
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NONE, AXIS2_FAILURE);
return AXIS2_FAILURE;
}
- if (!*cur)
+ if(!*cur)
{
duration->is_negative = AXIS2_FALSE;
duration->years = duration->months = duration->days = duration->hours = duration->mins = 0;
@@ -204,21 +201,22 @@
return AXIS2_FAILURE;
}
- while (*cur)
+ while(*cur)
{
- if (seq >= sizeof(desig))
+ if(seq >= sizeof(desig))
{
duration->is_negative = AXIS2_FALSE;
- duration->years = duration->months = duration->days = duration->hours = duration->mins = 0;
+ duration->years = duration->months = duration->days = duration->hours = duration->mins
+ = 0;
duration->secs = 0;
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NONE, AXIS2_FAILURE);
return AXIS2_FAILURE;
}
- if (*cur == 'T')
+ if(*cur == 'T')
{
- if (!(seq > 3))
+ if(!(seq > 3))
{
seq = 3;
cur++;
@@ -226,7 +224,8 @@
else
{
duration->is_negative = AXIS2_FALSE;
- duration->years = duration->months = duration->days = duration->hours = duration->mins = 0;
+ duration->years = duration->months = duration->days = duration->hours
+ = duration->mins = 0;
duration->secs = 0;
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NONE, AXIS2_FAILURE);
@@ -235,27 +234,27 @@
}
num = 0;
- if ((*cur < '0') || (*cur > '9'))
+ if((*cur < '0') || (*cur > '9'))
num_type = -1;
else
{
num_type = 0;
- while ((*cur >= '0') && (*cur <= '9'))
+ while((*cur >= '0') && (*cur <= '9'))
{
num = num * 10 + (*cur - '0');
cur++;
}
}
- if (!num_type && (*cur == '.'))
+ if(!num_type && (*cur == '.'))
{
double mult = 1;
cur++;
- if ((*cur < '0') || (*cur > '9'))
+ if((*cur < '0') || (*cur > '9'))
num_type = -1;
else
num_type = 1;
- while ((*cur >= '0') && (*cur <= '9'))
+ while((*cur >= '0') && (*cur <= '9'))
{
mult /= 10;
num += (*cur - '0') * mult;
@@ -263,62 +262,63 @@
}
}
- if ((num_type == -1) || (*cur == 0))
+ if((num_type == -1) || (*cur == 0))
{
duration->is_negative = AXIS2_FALSE;
- duration->years = duration->months = duration->days = duration->hours = duration->mins = 0;
+ duration->years = duration->months = duration->days = duration->hours = duration->mins
+ = 0;
duration->secs = 0;
AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NONE, AXIS2_FAILURE);
return AXIS2_FAILURE;
}
- while (seq < sizeof(desig))
+ while(seq < sizeof(desig))
{
- if (*cur == desig[seq])
+ if(*cur == desig[seq])
{
num_type = 0;
/*if (seq < (sizeof(desig) - 1))
- {
- duration->is_negative = AXIS2_FALSE;
- duration->years = duration->months = duration->days = duration->hours = duration->mins = 0;
- duration->secs = 0;
-
- AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NONE,
- AXIS2_FAILURE);
- return AXIS2_FAILURE;
- }*/
+ {
+ duration->is_negative = AXIS2_FALSE;
+ duration->years = duration->months = duration->days = duration->hours = duration->mins = 0;
+ duration->secs = 0;
+
+ AXIS2_ERROR_SET(env->error, AXIS2_ERROR_NONE,
+ AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }*/
- switch (seq)
+ switch(seq)
{
- case 0:
- duration->years = (int) num;
- seq++;
- break;
- case 1:
- duration->months = (int) num;
- seq++;
- break;
- case 2:
- duration->days = (int) num;
- seq++;
- break;
- case 3:
- duration->hours = (int) num;
- seq++;
- break;
- case 4:
- duration->mins = (int) num;
- seq++;
- break;
- case 5:
- duration->secs = num;
- seq++;
- break;
+ case 0:
+ duration->years = (int)num;
+ seq++;
+ break;
+ case 1:
+ duration->months = (int)num;
+ seq++;
+ break;
+ case 2:
+ duration->days = (int)num;
+ seq++;
+ break;
+ case 3:
+ duration->hours = (int)num;
+ seq++;
+ break;
+ case 4:
+ duration->mins = (int)num;
+ seq++;
+ break;
+ case 5:
+ duration->secs = num;
+ seq++;
+ break;
}
break;
}
- if ((++seq == 3) || (seq == 6))
+ if((++seq == 3) || (seq == 6))
return AXIS2_SUCCESS;
}
cur++;
@@ -336,17 +336,14 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- duration_str = (axis2_char_t *) AXIS2_MALLOC(env->allocator,
- sizeof(axis2_char_t) * 64);
+ duration_str = (axis2_char_t *)AXIS2_MALLOC(env->allocator, sizeof(axis2_char_t) * 64);
- if (duration->is_negative == 0)
- sprintf(duration_str, "P%dY%dM%dDT%dH%dM%fS", duration->years,
- duration->months, duration->days, duration->hours,
- duration->mins, duration->secs);
+ if(duration->is_negative == 0)
+ sprintf(duration_str, "P%dY%dM%dDT%dH%dM%fS", duration->years, duration->months,
+ duration->days, duration->hours, duration->mins, duration->secs);
else
- sprintf(duration_str, "-P%dY%dM%dDT%dH%dM%fS", duration->years,
- duration->months, duration->days, duration->hours,
- duration->mins, duration->secs);
+ sprintf(duration_str, "-P%dY%dM%dDT%dH%dM%fS", duration->years, duration->months,
+ duration->days, duration->hours, duration->mins, duration->secs);
return duration_str;
}
@@ -365,17 +362,17 @@
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (years > -1)
+ if(years > -1)
duration->years = years;
- if (months > -1)
+ if(months > -1)
duration->months = months;
- if (days > -1)
+ if(days > -1)
duration->days = days;
- if (hours > -1)
+ if(hours > -1)
duration->hours = hours;
- if (mins > -1)
+ if(mins > -1)
duration->mins = mins;
- if (seconds >= 0)
+ if(seconds >= 0)
duration->secs = seconds;
return AXIS2_SUCCESS;
@@ -397,7 +394,7 @@
int years)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (years > -1)
+ if(years > -1)
{
duration->years = years;
}
@@ -421,7 +418,7 @@
int months)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (months > -1)
+ if(months > -1)
{
duration->months = months;
}
@@ -445,7 +442,7 @@
int days)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (days > -1)
+ if(days > -1)
{
duration->days = days;
}
@@ -469,7 +466,7 @@
int hours)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (hours > -1)
+ if(hours > -1)
{
duration->hours = hours;
}
@@ -493,7 +490,7 @@
int mins)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (mins > -1)
+ if(mins > -1)
{
duration->mins = mins;
}
@@ -517,7 +514,7 @@
double seconds)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- if (seconds >= 0)
+ if(seconds >= 0)
{
duration->secs = seconds;
}
@@ -554,26 +551,25 @@
{
AXIS2_ENV_CHECK(env, AXIS2_FALSE);
- if (!duration_one || !duration_two)
+ if(!duration_one || !duration_two)
{
- 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 AXIS2_FALSE;
}
- if (duration_one->is_negative != duration_two->is_negative)
+ if(duration_one->is_negative != duration_two->is_negative)
return AXIS2_FALSE;
- if (duration_one->years != duration_two->years)
+ if(duration_one->years != duration_two->years)
return AXIS2_FALSE;
- if (duration_one->months != duration_two->months)
+ if(duration_one->months != duration_two->months)
return AXIS2_FALSE;
- if (duration_one->days != duration_two->days)
+ if(duration_one->days != duration_two->days)
return AXIS2_FALSE;
- if (duration_one->hours != duration_two->hours)
+ if(duration_one->hours != duration_two->hours)
return AXIS2_FALSE;
- if (duration_one->mins != duration_two->mins)
+ if(duration_one->mins != duration_two->mins)
return AXIS2_FALSE;
- if (duration_one->secs != duration_two->secs)
+ if(duration_one->secs != duration_two->secs)
return AXIS2_FALSE;
return AXIS2_SUCCESS;
}