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 na...@apache.org on 2006/04/21 07:01:04 UTC
svn commit: r395780 [4/4] - in /webservices/axis2/trunk/c: include/
include/xml_schema/ modules/xml/om/ modules/xml/soap/ modules/xml/xml_schema/
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_obj_table.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_obj_table.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_obj_table.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_obj_table.c Thu Apr 20 22:00:55 2006
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_obj_table.h>
+#include <axis2_xml_schema_obj_table.h>
#include <axis2_hash.h>
-typedef struct axis2_xml_schema_obj_table_impl axis2_xml_schema_obj_table_impl_t;
+typedef struct axis2_xml_schema_obj_table_impl
+ axis2_xml_schema_obj_table_impl_t;
/**
* @brief Xml Schema Obj Struct Impl
@@ -26,44 +27,52 @@
struct axis2_xml_schema_obj_table_impl
{
axis2_xml_schema_obj_table_t obj_table;
+
axis2_hash_t *collection;
+
axis2_array_list_t *names;
+
axis2_array_list_t *values;
};
-#define INTF_TO_IMPL(obj_table) ((axis2_xml_schema_obj_table_impl_t *) obj_table)
+#define AXIS2_INTF_TO_IMPL(obj_table) \
+ ((axis2_xml_schema_obj_table_impl_t *) obj_table)
+
+/******************** function prototypes **************************************/
axis2_status_t AXIS2_CALL
-axis2_xml_schema_obj_table_free(void *obj_table,
+axis2_xml_schema_obj_table_free(axis2_xml_schema_obj_table_t *obj_table,
axis2_env_t **env);
int AXIS2_CALL
-axis2_xml_schema_obj_table_get_count(void *obj_table,
- axis2_env_t **env);
+axis2_xml_schema_obj_table_get_count(axis2_xml_schema_obj_table_t *obj_table,
+ axis2_env_t **env);
axis2_xml_schema_obj_t *AXIS2_CALL
-axis2_xml_schema_obj_table_get_item(void *obj_table,
- axis2_env_t **env,
- axis2_qname_t *qname);
+axis2_xml_schema_obj_table_get_item(axis2_xml_schema_obj_table_t *obj_table,
+ axis2_env_t **env,
+ axis2_qname_t *qname);
axis2_array_list_t *AXIS2_CALL
-axis2_xml_schema_obj_table_get_names(void *obj_table,
- axis2_env_t **env);
+axis2_xml_schema_obj_table_get_names(axis2_xml_schema_obj_table_t *obj_table,
+ axis2_env_t **env);
axis2_array_list_t *AXIS2_CALL
-axis2_xml_schema_obj_table_get_values(void *obj_table,
- axis2_env_t **env);
+axis2_xml_schema_obj_table_get_values(axis2_xml_schema_obj_table_t *obj_table,
+ axis2_env_t **env);
axis2_bool_t AXIS2_CALL
-axis2_xml_schema_obj_table_contains(void *obj_table,
- axis2_env_t **env,
- axis2_qname_t *qname);
+axis2_xml_schema_obj_table_contains(axis2_xml_schema_obj_table_t *obj_table,
+ axis2_env_t **env,
+ axis2_qname_t *qname);
axis2_status_t AXIS2_CALL
-axis2_xml_schema_obj_table_add(void *obj_table,
+axis2_xml_schema_obj_table_add(axis2_xml_schema_obj_table_t *obj_table,
axis2_env_t **env,
axis2_qname_t *qname,
axis2_xml_schema_obj_t *value);
+
+/******************** end function pointers ***********************************/
AXIS2_DECLARE(axis2_xml_schema_obj_table_t *)
axis2_xml_schema_obj_table_create(axis2_env_t **env)
@@ -73,14 +82,27 @@
obj_table_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_obj_table_impl_t));
+ if(!obj_table_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
obj_table_impl->collection = NULL;
obj_table_impl->names = NULL;
obj_table_impl->values = NULL;
+ obj_table_impl->obj_table.ops = NULL;
obj_table_impl->obj_table.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_obj_table_ops_t));
+ if(!obj_table_impl->obj_table.ops)
+ {
+ axis2_xml_schema_obj_table_free(&(obj_table_impl->obj_table), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
obj_table_impl->collection = axis2_hash_make(env);
+
if(!obj_table_impl->collection)
{
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
@@ -106,92 +128,59 @@
axis2_status_t AXIS2_CALL
-axis2_xml_schema_obj_table_free(void *obj_table,
+axis2_xml_schema_obj_table_free(axis2_xml_schema_obj_table_t *obj_table,
axis2_env_t **env)
{
axis2_xml_schema_obj_table_impl_t *obj_table_impl = NULL;
- obj_table_impl = INTF_TO_IMPL(obj_table);
+ obj_table_impl = AXIS2_INTF_TO_IMPL(obj_table);
- if(obj_table_impl->names)
+ if(NULL != obj_table_impl->names)
{
AXIS2_ARRAY_LIST_FREE(obj_table_impl->names, env);
obj_table_impl->names = NULL;
}
- if(obj_table_impl->values)
+ if(NULL != obj_table_impl->values)
{
AXIS2_ARRAY_LIST_FREE(obj_table_impl->values, env);
obj_table_impl->values = NULL;
}
- if(obj_table_impl->collection)
+ if(NULL != obj_table_impl->collection)
{
axis2_hash_free(obj_table_impl->collection, env);
obj_table_impl->collection = NULL;
}
- if((&(obj_table_impl->obj_table))->ops)
+ if(NULL != obj_table_impl->obj_table.ops)
{
- free((&(obj_table_impl->obj_table))->ops);
- (&(obj_table_impl->obj_table))->ops = NULL;
+ AXIS2_FREE((*env)->allocator, obj_table_impl->obj_table.ops);
+ obj_table_impl->obj_table.ops = NULL;
}
- if(obj_table_impl)
- {
- free(obj_table_impl);
- obj_table_impl = NULL;
- }
+ AXIS2_FREE((*env)->allocator, obj_table_impl);
+ obj_table_impl = NULL;
return AXIS2_SUCCESS;
}
-AXIS2_DECLARE(axis2_status_t)
-axis2_xml_schema_obj_table_resolve_methods(
- axis2_xml_schema_obj_table_t *obj_table,
- axis2_env_t **env,
- axis2_xml_schema_obj_table_t *obj_table_impl,
- axis2_hash_t *methods)
-{
- axis2_xml_schema_obj_table_impl_t *obj_table_impl_l = NULL;
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, obj_table_impl, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, methods, AXIS2_FAILURE);
-
- obj_table_impl_l = (axis2_xml_schema_obj_table_impl_t *) obj_table_impl;
-
- obj_table->ops = AXIS2_MALLOC((*env)->allocator,
- sizeof(axis2_xml_schema_obj_table_ops_t));
- obj_table->ops->free = axis2_hash_get(methods, "free",
- AXIS2_HASH_KEY_STRING);
- obj_table->ops->get_count =
- obj_table_impl_l->obj_table.ops->get_count;
- obj_table->ops->get_item =
- obj_table_impl_l->obj_table.ops->get_item;
- obj_table->ops->get_names =
- obj_table_impl_l->obj_table.ops->get_names;
- obj_table->ops->get_values =
- obj_table_impl_l->obj_table.ops->get_values;
- obj_table->ops->contains =
- obj_table_impl_l->obj_table.ops->contains;
- obj_table->ops->add =
- obj_table_impl_l->obj_table.ops->add;
- return AXIS2_SUCCESS;
-
-}
-
int AXIS2_CALL
-axis2_xml_schema_obj_table_get_count(void *obj_table,
+axis2_xml_schema_obj_table_get_count(axis2_xml_schema_obj_table_t *obj_table,
axis2_env_t **env)
{
axis2_xml_schema_obj_table_impl_t *obj_table_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- obj_table_impl = INTF_TO_IMPL(obj_table);
- return axis2_hash_count(obj_table_impl->collection);
-}
+ obj_table_impl = AXIS2_INTF_TO_IMPL(obj_table);
+ if(NULL != obj_table_impl->collection)
+ {
+ return axis2_hash_count(obj_table_impl->collection);
+ }
+ else
+ return -1;
+}
axis2_xml_schema_obj_t *AXIS2_CALL
-axis2_xml_schema_obj_table_get_item(void *obj_table,
+axis2_xml_schema_obj_table_get_item(axis2_xml_schema_obj_table_t *obj_table,
axis2_env_t **env,
axis2_qname_t *qname)
{
@@ -199,89 +188,88 @@
axis2_char_t *name = NULL;
AXIS2_ENV_CHECK(env, NULL);
- obj_table_impl = INTF_TO_IMPL(obj_table);
+ AXIS2_PARAM_CHECK((*env)->error, qname, NULL);
+
+ obj_table_impl = AXIS2_INTF_TO_IMPL(obj_table);
name = AXIS2_QNAME_TO_STRING(qname, env);
- return axis2_hash_get(obj_table_impl->collection, name,
+ if(NULL != name)
+ {
+ return axis2_hash_get(obj_table_impl->collection, name,
AXIS2_HASH_KEY_STRING);
+ }
+ return NULL;
}
axis2_array_list_t *AXIS2_CALL
-axis2_xml_schema_obj_table_get_names(void *obj_table,
+axis2_xml_schema_obj_table_get_names(axis2_xml_schema_obj_table_t *obj_table,
axis2_env_t **env)
{
axis2_xml_schema_obj_table_impl_t *obj_table_impl = NULL;
axis2_hash_index_t *hi = NULL;
AXIS2_ENV_CHECK(env, NULL);
+ obj_table_impl = AXIS2_INTF_TO_IMPL(obj_table);
- if(obj_table_impl->names)
+ if(NULL != obj_table_impl->names)
{
- int i = 0;
- int size = 0;
-
- size = AXIS2_ARRAY_LIST_SIZE(obj_table_impl->names, env);
- for (i = 0; i < size; i++)
- {
- AXIS2_FREE((*env)->allocator, AXIS2_ARRAY_LIST_GET(obj_table_impl->
- names, env, i));
- }
+ AXIS2_ARRAY_LIST_FREE(obj_table_impl->names, env);
+ obj_table_impl->names = NULL;
}
- else
+
+ obj_table_impl->names = axis2_array_list_create(env, 0);
+ if(!obj_table_impl->names)
{
- obj_table_impl->names = axis2_array_list_create(env, 0);
- if(!obj_table_impl->names)
- {
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- return NULL;
- }
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
}
+
for (hi = axis2_hash_first (obj_table_impl->collection, env); hi;
hi = axis2_hash_next ( env, hi))
{
void *val = NULL;
-
axis2_hash_this (hi, &val, NULL, NULL);
AXIS2_ARRAY_LIST_ADD(obj_table_impl->names, env, val);
val = NULL;
-
}
return obj_table_impl->names;
}
axis2_array_list_t *AXIS2_CALL
-axis2_xml_schema_obj_table_get_values(void *obj_table,
+axis2_xml_schema_obj_table_get_values(axis2_xml_schema_obj_table_t *obj_table,
axis2_env_t **env)
{
axis2_xml_schema_obj_table_impl_t *obj_table_impl = NULL;
axis2_hash_index_t *hi = NULL;
-
AXIS2_ENV_CHECK(env, NULL);
+ obj_table_impl = AXIS2_INTF_TO_IMPL(obj_table);
+
+ if(NULL != obj_table_impl->values)
+ {
+ AXIS2_ARRAY_LIST_FREE(obj_table_impl->values, env);
+ obj_table_impl->values = NULL;
+ }
+ obj_table_impl->values = axis2_array_list_create(env, 0);
if(!obj_table_impl->values)
{
- obj_table_impl->values = axis2_array_list_create(env, 0);
- if(!obj_table_impl->values)
- {
- AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
- return NULL;
- }
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
}
+
for (hi = axis2_hash_first (obj_table_impl->collection, env); hi;
hi = axis2_hash_next ( env, hi))
{
void *val = NULL;
-
axis2_hash_this (hi, NULL, NULL, &val);
AXIS2_ARRAY_LIST_ADD(obj_table_impl->values, env, val);
val = NULL;
-
}
return obj_table_impl->values;
}
axis2_bool_t AXIS2_CALL
-axis2_xml_schema_obj_table_contains(void *obj_table,
+axis2_xml_schema_obj_table_contains(axis2_xml_schema_obj_table_t *obj_table,
axis2_env_t **env,
axis2_qname_t *qname)
{
@@ -291,17 +279,21 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, qname, AXIS2_FAILURE);
- obj_table_impl = INTF_TO_IMPL(obj_table);
-
+ obj_table_impl = AXIS2_INTF_TO_IMPL(obj_table);
name = AXIS2_QNAME_TO_STRING(qname, env);
- value = axis2_hash_get(obj_table_impl->collection, name,
- AXIS2_HASH_KEY_STRING);
- if(value) return AXIS2_TRUE;
- else return AXIS2_FALSE;
+ if(NULL != name)
+ {
+ value = axis2_hash_get(obj_table_impl->collection, name,
+ AXIS2_HASH_KEY_STRING);
+ if(NULL != value)
+ return AXIS2_TRUE;
+ }
+
+ return AXIS2_FALSE;
}
axis2_status_t AXIS2_CALL
-axis2_xml_schema_obj_table_add(void *obj_table,
+axis2_xml_schema_obj_table_add(axis2_xml_schema_obj_table_t *obj_table,
axis2_env_t **env,
axis2_qname_t *qname,
axis2_xml_schema_obj_t *value)
@@ -312,11 +304,15 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, qname, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, value, AXIS2_FAILURE);
- obj_table_impl = INTF_TO_IMPL(obj_table);
-
+ obj_table_impl = AXIS2_INTF_TO_IMPL(obj_table);
name = AXIS2_QNAME_TO_STRING(qname, env);
- axis2_hash_set(obj_table_impl->collection, name, AXIS2_HASH_KEY_STRING, value);
- return AXIS2_SUCCESS;
+ if(NULL != name)
+ {
+ axis2_hash_set(obj_table_impl->collection,
+ name, AXIS2_HASH_KEY_STRING, value);
+ return AXIS2_SUCCESS;
+ }
+ return AXIS2_FAILURE;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_particle.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_particle.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_particle.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_particle.c Thu Apr 20 22:00:55 2006
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_particle.h>
+#include <axis2_xml_schema_particle.h>
-typedef struct axis2_xml_schema_particle_impl axis2_xml_schema_particle_impl_t;
+typedef struct axis2_xml_schema_particle_impl
+ axis2_xml_schema_particle_impl_t;
/**
* @brief Other Extension Struct Impl
@@ -25,16 +26,25 @@
struct axis2_xml_schema_particle_impl
{
axis2_xml_schema_particle_t particle;
+
axis2_xml_schema_annotated_t *annotated;
+
long max_occurs;
+
axis2_char_t *max_occurs_string;
+
long min_occurs;
+
axis2_char_t *min_occurs_string;
+
axis2_hash_t *methods;
- void *inherited;
+
};
-#define INTF_TO_IMPL(particle) ((axis2_xml_schema_particle_impl_t *) particle)
+#define AXIS2_INTF_TO_IMPL(particle) \
+ ((axis2_xml_schema_particle_impl_t *) particle)
+
+/*************** function prototypes *****************************************/
axis2_status_t AXIS2_CALL
axis2_xml_schema_particle_free(void *particle,
@@ -62,6 +72,8 @@
axis2_env_t **env,
long min_occurs);
+/*************** function prototypes *****************************************/
+
AXIS2_DECLARE(axis2_xml_schema_particle_t *)
axis2_xml_schema_particle_create(axis2_env_t **env)
{
@@ -70,13 +82,33 @@
particle_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_particle_impl_t));
-
+
+ if(!particle_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error,
+ AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
particle_impl->annotated = NULL;
+ particle_impl->particle.ops = NULL;
+ particle_impl->particle.base.ops = NULL;
particle_impl->methods = NULL;
+ particle_impl->max_occurs_string = NULL;
+ particle_impl->min_occurs_string = NULL;
+
+
particle_impl->particle.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_particle_ops_t));
- particle_impl->particle.ops->free = axis2_xml_schema_particle_free;
+ if(!particle_impl->particle.ops)
+ {
+ axis2_xml_schema_particle_free(&(particle_impl->particle), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ particle_impl->particle.ops->free =
+ axis2_xml_schema_particle_free;
particle_impl->particle.ops->get_base_impl =
axis2_xml_schema_particle_get_base_impl;
particle_impl->particle.ops->get_max_occurs =
@@ -91,6 +123,7 @@
particle_impl->methods = axis2_hash_make(env);
if(!particle_impl->methods)
{
+ axis2_xml_schema_particle_free(&(particle_impl->particle), env);
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
@@ -106,6 +139,11 @@
AXIS2_HASH_KEY_STRING, axis2_xml_schema_particle_set_min_occurs);
particle_impl->annotated = axis2_xml_schema_annotated_create(env);
+ if(!particle_impl->annotated)
+ {
+ axis2_xml_schema_particle_free(&(particle_impl->particle), env);
+ return NULL;
+ }
status = axis2_xml_schema_annotated_resolve_methods(
&(particle_impl->particle.base), env, particle_impl->annotated,
particle_impl->methods);
@@ -120,27 +158,32 @@
axis2_xml_schema_particle_impl_t *particle_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- particle_impl = INTF_TO_IMPL(particle);
+ particle_impl = AXIS2_INTF_TO_IMPL(particle);
- if(particle_impl->methods)
+ if(NULL != particle_impl->methods)
{
axis2_hash_free(particle_impl->methods, env);
particle_impl->methods = NULL;
}
- if(particle_impl->annotated)
+ if(NULL != particle_impl->annotated)
{
- AXIS2_XML_SCHEMA_OBJ_FREE(particle_impl->annotated, env);
+ AXIS2_XML_SCHEMA_ANNOTATED_FREE(particle_impl->annotated, env);
particle_impl->annotated = NULL;
}
- if((&(particle_impl->particle))->ops)
+ if(NULL != particle_impl->particle.ops)
{
- AXIS2_FREE((*env)->allocator, (&(particle_impl->particle))->ops);
- (&(particle_impl->particle))->ops = NULL;
+ AXIS2_FREE((*env)->allocator, particle_impl->particle.ops);
+ particle_impl->particle.ops = NULL;
}
-
- if(particle_impl)
+ if(NULL != particle_impl->particle.base.ops)
+ {
+ AXIS2_FREE((*env)->allocator, particle_impl->particle.base.ops);
+ particle_impl->particle.base.ops = NULL;
+ }
+
+ if(NULL != particle_impl)
{
AXIS2_FREE((*env)->allocator, particle_impl);
particle_impl = NULL;
@@ -155,7 +198,7 @@
axis2_xml_schema_particle_impl_t *particle_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- particle_impl = INTF_TO_IMPL(particle);
+ particle_impl = AXIS2_INTF_TO_IMPL(particle);
return particle_impl->annotated;
}
@@ -177,6 +220,12 @@
particle->ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_particle_ops_t));
+ if(NULL != particle->ops)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+
particle->ops->free = axis2_hash_get(methods, "free",
AXIS2_HASH_KEY_STRING);
particle->ops->get_base_impl =
@@ -199,7 +248,7 @@
axis2_env_t **env)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(particle)->max_occurs;
+ return AXIS2_INTF_TO_IMPL(particle)->max_occurs;
}
axis2_status_t AXIS2_CALL
@@ -208,7 +257,7 @@
long max_occurs)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- INTF_TO_IMPL(particle)->max_occurs = max_occurs;
+ AXIS2_INTF_TO_IMPL(particle)->max_occurs = max_occurs;
return AXIS2_SUCCESS;
}
@@ -217,7 +266,7 @@
axis2_env_t **env)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(particle)->min_occurs;
+ return AXIS2_INTF_TO_IMPL(particle)->min_occurs;
}
axis2_status_t AXIS2_CALL
@@ -226,7 +275,7 @@
long min_occurs)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- INTF_TO_IMPL(particle)->min_occurs = min_occurs;
+ AXIS2_INTF_TO_IMPL(particle)->min_occurs = min_occurs;
return AXIS2_SUCCESS;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_sequence.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_sequence.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_sequence.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_sequence.c Thu Apr 20 22:00:55 2006
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_sequence.h>
-#include <xml_schema/axis2_xml_schema_group_base.h>
+#include <axis2_xml_schema_sequence.h>
+#include <axis2_xml_schema_group_base.h>
-typedef struct axis2_xml_schema_sequence_impl axis2_xml_schema_sequence_impl_t;
+typedef struct axis2_xml_schema_sequence_impl
+ axis2_xml_schema_sequence_impl_t;
/**
* @brief Other Extension Struct Impl
@@ -31,7 +32,8 @@
axis2_xml_schema_obj_collection_t *items;
};
-#define INTF_TO_IMPL(sequence) ((axis2_xml_schema_sequence_impl_t *) sequence)
+#define AXIS2_INTF_TO_IMPL(sequence) \
+ ((axis2_xml_schema_sequence_impl_t *) sequence)
axis2_status_t AXIS2_CALL
axis2_xml_schema_sequence_free(void *sequence,
@@ -54,13 +56,27 @@
sequence_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_sequence_impl_t));
-
+ if(!sequence_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY , AXIS2_FAILURE);
+ return NULL;
+ }
+
sequence_impl->base = NULL;
sequence_impl->methods = NULL;
sequence_impl->items = NULL;
+ sequence_impl->sequence.base.ops = NULL;
+ sequence_impl->sequence.ops = NULL;
+
sequence_impl->sequence.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_sequence_ops_t));
+ if(!sequence_impl->sequence.ops)
+ {
+ axis2_xml_schema_sequence_free(&(sequence_impl->sequence), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
sequence_impl->sequence.ops->free = axis2_xml_schema_sequence_free;
sequence_impl->sequence.ops->get_base_impl =
axis2_xml_schema_sequence_get_base_impl;
@@ -70,6 +86,7 @@
sequence_impl->methods = axis2_hash_make(env);
if(!sequence_impl->methods)
{
+ axis2_xml_schema_sequence_free(&(sequence_impl->sequence), env);
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
@@ -79,6 +96,11 @@
AXIS2_HASH_KEY_STRING, axis2_xml_schema_sequence_get_items);
sequence_impl->base = axis2_xml_schema_group_base_create(env);
+ if(!sequence_impl->base)
+ {
+ axis2_xml_schema_sequence_free(&(sequence_impl->sequence), env);
+ return NULL;
+ }
status = axis2_xml_schema_group_base_resolve_methods(
&(sequence_impl->sequence.base), env, sequence_impl->base,
sequence_impl->methods);
@@ -93,32 +115,36 @@
axis2_xml_schema_sequence_impl_t *sequence_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- sequence_impl = INTF_TO_IMPL(sequence);
+ sequence_impl = AXIS2_INTF_TO_IMPL(sequence);
- if(sequence_impl->items)
+ if(NULL != sequence_impl->items)
{
AXIS2_XML_SCHEMA_OBJ_COLLECTION_FREE(sequence_impl->items, env);
sequence_impl->items = NULL;
}
- if(sequence_impl->methods)
+ if(NULL != sequence_impl->methods)
{
axis2_hash_free(sequence_impl->methods, env);
sequence_impl->methods = NULL;
}
- if(sequence_impl->base)
+ if(NULL != sequence_impl->base)
{
AXIS2_XML_SCHEMA_GROUP_BASE_FREE(sequence_impl->base, env);
sequence_impl->base = NULL;
}
- if((&(sequence_impl->sequence))->ops)
+ if(NULL != sequence_impl->sequence.ops)
{
- AXIS2_FREE((*env)->allocator, (&(sequence_impl->sequence))->ops);
- (&(sequence_impl->sequence))->ops = NULL;
+ AXIS2_FREE((*env)->allocator, sequence_impl->sequence.ops);
+ sequence_impl->sequence.ops = NULL;
+ }
+ if(NULL != sequence_impl->sequence.base.ops)
+ {
+ AXIS2_FREE((*env)->allocator, sequence_impl->sequence.base.ops);
+ sequence_impl->sequence.base.ops = NULL;
}
-
if(sequence_impl)
{
AXIS2_FREE((*env)->allocator, sequence_impl);
@@ -134,7 +160,7 @@
axis2_xml_schema_sequence_impl_t *sequence_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- sequence_impl = INTF_TO_IMPL(sequence);
+ sequence_impl = AXIS2_INTF_TO_IMPL(sequence);
return sequence_impl->base;
}
@@ -171,7 +197,7 @@
axis2_xml_schema_sequence_get_items(void *sequence,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(sequence)->items;
+ AXIS2_ENV_CHECK(env, NULL);
+ return AXIS2_INTF_TO_IMPL(sequence)->items;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_type.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_type.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_type.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_type.c Thu Apr 20 22:00:55 2006
@@ -14,12 +14,13 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_type.h>
-#include <xml_schema/axis2_xml_schema_data_type.h>
-#include <xml_schema/axis2_xml_schema_derivation_method.h>
-#include <xml_schema/axis2_xml_schema.h>
+#include <axis2_xml_schema_type.h>
+#include <axis2_xml_schema_data_type.h>
+#include <axis2_xml_schema_derivation_method.h>
+#include <axis2_xml_schema.h>
-typedef struct axis2_xml_schema_type_impl axis2_xml_schema_type_impl_t;
+typedef struct axis2_xml_schema_type_impl
+ axis2_xml_schema_type_impl_t;
/**
* @brief Other Extension Struct Impl
@@ -40,7 +41,9 @@
axis2_xml_schema_t *schema;
};
-#define INTF_TO_IMPL(type) ((axis2_xml_schema_type_impl_t *) type)
+#define AXIS2_INTF_TO_IMPL(type) ((axis2_xml_schema_type_impl_t *) type)
+
+/************************** function prototypes ******************************/
axis2_status_t AXIS2_CALL
axis2_xml_schema_type_free(void *type,
@@ -96,6 +99,8 @@
axis2_qname_t *AXIS2_CALL
axis2_xml_schema_type_get_qname(void *type,
axis2_env_t **env);
+
+/************************** end ****************************************/
AXIS2_DECLARE(axis2_xml_schema_type_t *)
axis2_xml_schema_type_create(axis2_env_t **env,
@@ -106,13 +111,37 @@
type_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_type_impl_t));
+ if(!type_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error,
+ AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
- type_impl->annotated = NULL;
+ type_impl->type.base.ops = NULL;
+ type_impl->name = NULL;
+ type_impl->derive_by = NULL;
+ type_impl->final_derivation = NULL;
+ type_impl->final_resolved = NULL;
+ type_impl->schema = NULL;
+ type_impl->data_type = NULL;
type_impl->methods = NULL;
+ type_impl->annotated = NULL;
+
+
type_impl->schema = schema;
type_impl->type.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_type_ops_t));
+
+ if(!type_impl->type.ops)
+ {
+ axis2_xml_schema_type_free(&(type_impl->type), env);
+ AXIS2_ERROR_SET((*env)->error,
+ AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
type_impl->type.ops->free = axis2_xml_schema_type_free;
type_impl->type.ops->get_base_impl =
axis2_xml_schema_type_get_base_impl;
@@ -142,6 +171,7 @@
type_impl->methods = axis2_hash_make(env);
if(!type_impl->methods)
{
+ axis2_xml_schema_type_free(&(type_impl->type), env);
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
@@ -175,6 +205,11 @@
AXIS2_HASH_KEY_STRING, axis2_xml_schema_type_get_qname);
type_impl->annotated = axis2_xml_schema_annotated_create(env);
+ if(!type_impl->annotated)
+ {
+ axis2_xml_schema_type_free(&(type_impl->annotated), env);
+ return NULL;
+ }
status = axis2_xml_schema_annotated_resolve_methods(
&(type_impl->type.base), env, type_impl->annotated,
type_impl->methods);
@@ -189,31 +224,32 @@
axis2_xml_schema_type_impl_t *type_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- type_impl = INTF_TO_IMPL(type);
+ type_impl = AXIS2_INTF_TO_IMPL(type);
- if(type_impl->methods)
+ if(NULL != type_impl->methods)
{
axis2_hash_free(type_impl->methods, env);
type_impl->methods = NULL;
}
- if(type_impl->annotated)
+ if(NULL != type_impl->annotated)
{
- AXIS2_XML_SCHEMA_OBJ_FREE(type_impl->annotated, env);
+ AXIS2_XML_SCHEMA_ANNOTATED_FREE(type_impl->annotated, env);
type_impl->annotated = NULL;
}
- if((&(type_impl->type))->ops)
+ if(NULL != type_impl->type.ops)
{
- AXIS2_FREE((*env)->allocator, (&(type_impl->type))->ops);
- (&(type_impl->type))->ops = NULL;
+ AXIS2_FREE((*env)->allocator, type_impl->type.ops);
+ type_impl->type.ops = NULL;
}
-
- if(type_impl)
+ if(NULL != type_impl->type.base.ops)
{
- AXIS2_FREE((*env)->allocator, type_impl);
- type_impl = NULL;
+ AXIS2_FREE((*env)->allocator, type_impl->type.base.ops);
+ type_impl->type.base.ops = NULL;
}
+ AXIS2_FREE((*env)->allocator, type_impl);
+ type_impl = NULL;
return AXIS2_SUCCESS;
}
@@ -224,7 +260,7 @@
axis2_xml_schema_type_impl_t *type_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- type_impl = INTF_TO_IMPL(type);
+ type_impl = AXIS2_INTF_TO_IMPL(type);
return type_impl->annotated;
}
@@ -246,6 +282,12 @@
type->ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_type_ops_t));
+ if(!type->ops)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+
type->ops->free = axis2_hash_get(methods, "free",
AXIS2_HASH_KEY_STRING);
type->ops->get_base_impl =
@@ -281,7 +323,7 @@
axis2_xml_schema_type_get_base_schema_type(void *type,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_ENV_CHECK(env, NULL);
return NULL;
}
@@ -289,7 +331,7 @@
axis2_xml_schema_type_get_data_type(void *type,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_ENV_CHECK(env, NULL);
return NULL;
}
@@ -297,7 +339,7 @@
axis2_xml_schema_type_get_derive_by(void *type,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_ENV_CHECK(env, NULL);
return NULL;
}
@@ -305,7 +347,7 @@
axis2_xml_schema_type_get_final(void *type,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_ENV_CHECK(env, NULL);
return NULL;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_type_receiver.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_type_receiver.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_type_receiver.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_type_receiver.c Thu Apr 20 22:00:55 2006
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_type_receiver.h>
-#include <xml_schema/axis2_xml_schema_type.h>
+#include <axis2_xml_schema_type_receiver.h>
+#include <axis2_xml_schema_type.h>
#include <axis2_hash.h>
typedef struct axis2_xml_schema_type_receiver_impl axis2_xml_schema_type_receiver_impl_t;
@@ -29,7 +29,7 @@
axis2_xml_schema_type_receiver_t type_receiver;
};
-#define INTF_TO_IMPL(type_receiver) ((axis2_xml_schema_type_receiver_impl_t *) type_receiver)
+#define AXIS2_INTF_TO_IMPL(type_receiver) ((axis2_xml_schema_type_receiver_impl_t *) type_receiver)
axis2_status_t AXIS2_CALL
axis2_xml_schema_type_receiver_free(void *type_receiver,
@@ -65,7 +65,7 @@
{
axis2_xml_schema_type_receiver_impl_t *type_receiver_impl = NULL;
- type_receiver_impl = INTF_TO_IMPL(type_receiver);
+ type_receiver_impl = AXIS2_INTF_TO_IMPL(type_receiver);
if((&(type_receiver_impl->type_receiver))->ops)
{
@@ -112,7 +112,7 @@
{
axis2_xml_schema_type_receiver_impl_t *type_receiver_impl = NULL;
- type_receiver_impl = INTF_TO_IMPL(type_receiver);
+ type_receiver_impl = AXIS2_INTF_TO_IMPL(type_receiver);
return AXIS2_SUCCESS;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_use.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_use.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_use.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_use.c Thu Apr 20 22:00:55 2006
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_use.h>
+#include <axis2_xml_schema_use.h>
typedef struct axis2_xml_schema_use_impl axis2_xml_schema_use_impl_t;
@@ -30,7 +30,7 @@
axis2_array_list_t *members;
};
-#define INTF_TO_IMPL(use) ((axis2_xml_schema_use_impl_t *) use)
+#define AXIS2_INTF_TO_IMPL(use) ((axis2_xml_schema_use_impl_t *) use)
axis2_status_t AXIS2_CALL
axis2_xml_schema_use_free(void *use,
@@ -61,28 +61,37 @@
use_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_use_impl_t));
+ if(!use_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
use_impl->schema_enum = NULL;
use_impl->methods = NULL;
use_impl->members = NULL;
use_impl->use.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_use_ops_t));
-
+ if(!use_impl->use.ops)
+ {
+ axis2_xml_schema_use_free(&(use_impl->use), env);
+
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
use_impl->use.ops->free = axis2_xml_schema_use_free;
use_impl->use.ops->get_base_impl = axis2_xml_schema_use_get_base_impl;
use_impl->use.ops->get_values =
axis2_xml_schema_use_get_values;
+ use_impl->members = axis2_array_list_create(env, 0);
if(!use_impl->members)
- {
- use_impl->members = axis2_array_list_create(env, 0);
- if(!use_impl->members)
- return NULL;
- AXIS2_ARRAY_LIST_ADD(use_impl->members, env, "None");
- AXIS2_ARRAY_LIST_ADD(use_impl->members, env, "Optional");
- AXIS2_ARRAY_LIST_ADD(use_impl->members, env, "Prohibited");
- AXIS2_ARRAY_LIST_ADD(use_impl->members, env, "Required");
- }
+ return NULL;
+ AXIS2_ARRAY_LIST_ADD(use_impl->members, env, "None");
+ AXIS2_ARRAY_LIST_ADD(use_impl->members, env, "Optional");
+ AXIS2_ARRAY_LIST_ADD(use_impl->members, env, "Prohibited");
+ AXIS2_ARRAY_LIST_ADD(use_impl->members, env, "Required");
+
use_impl->methods = axis2_hash_make(env);
if(!use_impl->methods)
{
@@ -91,10 +100,12 @@
}
axis2_hash_set(use_impl->methods, "free", AXIS2_HASH_KEY_STRING,
axis2_xml_schema_use_free);
+
axis2_hash_set(use_impl->methods, "get_values", AXIS2_HASH_KEY_STRING,
axis2_xml_schema_use_get_values);
use_impl->schema_enum = axis2_xml_schema_enum_create(env, value);
+
status = axis2_xml_schema_enum_resolve_methods(
&(use_impl->use.base), env, use_impl->schema_enum,
use_impl->methods);
@@ -109,10 +120,23 @@
axis2_xml_schema_use_impl_t *use_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- use_impl = INTF_TO_IMPL(use);
+ use_impl = AXIS2_INTF_TO_IMPL(use);
if(use_impl->members)
{
+ int size = 0;
+ int i = 0;
+ size = AXIS2_ARRAY_LIST_SIZE(use_impl->members, env);
+ for(i = 0; i < size ; i++)
+ {
+ axis2_char_t *value = NULL;
+ value =(axis2_char_t* ) AXIS2_ARRAY_LIST_GET(use_impl->members, env, i);
+ if(NULL != value)
+ {
+ AXIS2_FREE((*env)->allocator, value);
+ value = NULL;
+ }
+ }
AXIS2_ARRAY_LIST_FREE(use_impl->members, env);
use_impl->members = NULL;
}
@@ -144,7 +168,7 @@
axis2_xml_schema_use_impl_t *use_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- use_impl = INTF_TO_IMPL(use);
+ use_impl = AXIS2_INTF_TO_IMPL(use);
return use_impl->schema_enum;
}
@@ -166,6 +190,12 @@
use->ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_use_ops_t));
+ if(!use->ops)
+ {
+ AXIS2_ERROR_SET((*env)->error,
+ AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
use->ops->free = axis2_hash_get(methods, "free",
AXIS2_HASH_KEY_STRING);
use->ops->get_base_impl =
@@ -181,6 +211,6 @@
axis2_xml_schema_use_get_values(void *use,
axis2_env_t **env)
{
- return INTF_TO_IMPL(use)->members;
+ return AXIS2_INTF_TO_IMPL(use)->members;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_xpath.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_xpath.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_xpath.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_xpath.c Thu Apr 20 22:00:55 2006
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_xpath.h>
+#include <axis2_xml_schema_xpath.h>
typedef struct axis2_xml_schema_xpath_impl axis2_xml_schema_xpath_impl_t;
@@ -30,7 +30,7 @@
axis2_char_t *x_path;
};
-#define INTF_TO_IMPL(xpath) ((axis2_xml_schema_xpath_impl_t *) xpath)
+#define AXIS2_INTF_TO_IMPL(xpath) ((axis2_xml_schema_xpath_impl_t *) xpath)
axis2_status_t AXIS2_CALL
axis2_xml_schema_xpath_free(void *xpath,
@@ -102,7 +102,7 @@
axis2_xml_schema_xpath_impl_t *xpath_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- xpath_impl = INTF_TO_IMPL(xpath);
+ xpath_impl = AXIS2_INTF_TO_IMPL(xpath);
if(xpath_impl->x_path)
{
@@ -143,7 +143,7 @@
axis2_xml_schema_xpath_impl_t *xpath_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- xpath_impl = INTF_TO_IMPL(xpath);
+ xpath_impl = AXIS2_INTF_TO_IMPL(xpath);
return xpath_impl->annotated;
}
@@ -182,8 +182,8 @@
axis2_xml_schema_xpath_get_xpath(void *xpath,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(xpath)->x_path;
+ AXIS2_ENV_CHECK(env, NULL);
+ return AXIS2_INTF_TO_IMPL(xpath)->x_path;
}
axis2_status_t AXIS2_CALL
@@ -195,7 +195,7 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, xpath, AXIS2_FAILURE);
- xpath_impl = INTF_TO_IMPL(xpath);
+ xpath_impl = AXIS2_INTF_TO_IMPL(xpath);
if(xpath_impl->x_path)
{
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_tokenized_type.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_tokenized_type.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_tokenized_type.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_tokenized_type.c Thu Apr 20 22:00:55 2006
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_tokenized_type.h>
+#include <axis2_xml_tokenized_type.h>
typedef struct axis2_xml_tokenized_type_impl axis2_xml_tokenized_type_impl_t;
@@ -30,7 +30,7 @@
axis2_array_list_t *members;
};
-#define INTF_TO_IMPL(tokenized_type) ((axis2_xml_tokenized_type_impl_t *) tokenized_type)
+#define AXIS2_INTF_TO_IMPL(tokenized_type) ((axis2_xml_tokenized_type_impl_t *) tokenized_type)
axis2_status_t AXIS2_CALL
axis2_xml_tokenized_type_free(void *tokenized_type,
@@ -61,48 +61,68 @@
tokenized_type_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_tokenized_type_impl_t));
-
+ if(!tokenized_type_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
tokenized_type_impl->schema_enum = NULL;
tokenized_type_impl->methods = NULL;
tokenized_type_impl->members = NULL;
+ tokenized_type_impl->tokenized_type.ops = NULL;
+
tokenized_type_impl->tokenized_type.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_tokenized_type_ops_t));
-
- tokenized_type_impl->tokenized_type.ops->free = axis2_xml_tokenized_type_free;
- tokenized_type_impl->tokenized_type.ops->get_base_impl = axis2_xml_tokenized_type_get_base_impl;
+ if(!tokenized_type_impl->tokenized_type.ops)
+ {
+ axis2_xml_tokenized_type_free(&(tokenized_type_impl->tokenized_type), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ tokenized_type_impl->tokenized_type.ops->free =
+ axis2_xml_tokenized_type_free;
+
+ tokenized_type_impl->tokenized_type.ops->get_base_impl =
+ axis2_xml_tokenized_type_get_base_impl;
+
tokenized_type_impl->tokenized_type.ops->get_values =
axis2_xml_tokenized_type_get_values;
+
+ tokenized_type_impl->members = axis2_array_list_create(env, 0);
if(!tokenized_type_impl->members)
- {
- tokenized_type_impl->members = axis2_array_list_create(env, 0);
- if(!tokenized_type_impl->members)
- return NULL;
- AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "CDATA");
- AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "IDREF");
- AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "IDREFS");
- AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "ENTITY");
- AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "ENTITIES");
- AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "NMTOKEN");
- AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "NMTOKENS");
- AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "NOTATION");
- AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "ENUMERATION");
- AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "QName");
- AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "NCName");
- AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "None");
- }
+ return NULL;
+
+ AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "CDATA");
+ AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "IDREF");
+ AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "IDREFS");
+ AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "ENTITY");
+ AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "ENTITIES");
+ AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "NMTOKEN");
+ AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "NMTOKENS");
+ AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "NOTATION");
+ AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "ENUMERATION");
+ AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "QName");
+ AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "NCName");
+ AXIS2_ARRAY_LIST_ADD(tokenized_type_impl->members, env, "None");
+
tokenized_type_impl->methods = axis2_hash_make(env);
+
if(!tokenized_type_impl->methods)
{
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
+
axis2_hash_set(tokenized_type_impl->methods, "free", AXIS2_HASH_KEY_STRING,
axis2_xml_tokenized_type_free);
axis2_hash_set(tokenized_type_impl->methods, "get_values", AXIS2_HASH_KEY_STRING,
axis2_xml_tokenized_type_get_values);
tokenized_type_impl->schema_enum = axis2_xml_schema_enum_create(env, value);
+
status = axis2_xml_schema_enum_resolve_methods(
&(tokenized_type_impl->tokenized_type.base), env, tokenized_type_impl->schema_enum,
tokenized_type_impl->methods);
@@ -112,12 +132,12 @@
axis2_status_t AXIS2_CALL
axis2_xml_tokenized_type_free(void *tokenized_type,
- axis2_env_t **env)
+ axis2_env_t **env)
{
axis2_xml_tokenized_type_impl_t *tokenized_type_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- tokenized_type_impl = INTF_TO_IMPL(tokenized_type);
+ tokenized_type_impl = AXIS2_INTF_TO_IMPL(tokenized_type);
if(tokenized_type_impl->members)
{
@@ -127,17 +147,30 @@
if(tokenized_type_impl->schema_enum)
{
+ int size = 0;
+ int i = 0;
+ size = AXIS2_ARRAY_LIST_SIZE(tokenized_type_impl->members, env);
+ for(i = 0; i < size ; i++)
+ {
+ axis2_char_t *value = NULL;
+ value =(axis2_char_t* ) AXIS2_ARRAY_LIST_GET(tokenized_type_impl->members, env, i);
+ if(NULL != value)
+ {
+ AXIS2_FREE((*env)->allocator, value);
+ value = NULL;
+ }
+ }
AXIS2_XML_SCHEMA_ENUM_FREE(tokenized_type_impl->schema_enum, env);
tokenized_type_impl->schema_enum = NULL;
}
- if((&(tokenized_type_impl->tokenized_type))->ops)
+ if(NULL != (&(tokenized_type_impl->tokenized_type))->ops)
{
AXIS2_FREE((*env)->allocator, (&(tokenized_type_impl->tokenized_type))->ops);
(&(tokenized_type_impl->tokenized_type))->ops = NULL;
}
- if(tokenized_type_impl)
+ if(NULL != tokenized_type_impl)
{
AXIS2_FREE((*env)->allocator, tokenized_type_impl);
tokenized_type_impl = NULL;
@@ -152,7 +185,7 @@
axis2_xml_tokenized_type_impl_t *tokenized_type_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- tokenized_type_impl = INTF_TO_IMPL(tokenized_type);
+ tokenized_type_impl = AXIS2_INTF_TO_IMPL(tokenized_type);
return tokenized_type_impl->schema_enum;
}
@@ -167,6 +200,7 @@
axis2_xml_tokenized_type_impl_t *tokenized_type_impl_l = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
AXIS2_PARAM_CHECK((*env)->error, tokenized_type_impl, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, methods, AXIS2_FAILURE);
@@ -175,8 +209,14 @@
tokenized_type->ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_tokenized_type_ops_t));
- tokenized_type->ops->free = axis2_hash_get(methods, "free",
- AXIS2_HASH_KEY_STRING);
+ if(!tokenized_type->ops)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+
+ tokenized_type->ops->free = axis2_hash_get(methods, "free", AXIS2_HASH_KEY_STRING);
+
tokenized_type->ops->get_base_impl =
tokenized_type_impl_l->tokenized_type.ops->get_base_impl;
tokenized_type->ops->get_values =
@@ -190,6 +230,6 @@
axis2_xml_tokenized_type_get_values(void *tokenized_type,
axis2_env_t **env)
{
- return INTF_TO_IMPL(tokenized_type)->members;
+ return AXIS2_INTF_TO_IMPL(tokenized_type)->members;
}