You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by na...@apache.org on 2006/04/21 07:01:04 UTC
svn commit: r395780 [3/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_derivation_method.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_derivation_method.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_derivation_method.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_derivation_method.c Thu Apr 20 22:00:55 2006
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_derivation_method.h>
+#include <axis2_xml_schema_derivation_method.h>
-typedef struct axis2_xml_schema_derivation_method_impl axis2_xml_schema_derivation_method_impl_t;
+typedef struct axis2_xml_schema_derivation_method_impl
+ axis2_xml_schema_derivation_method_impl_t;
/**
* @brief Other Extension Struct Impl
@@ -30,7 +31,8 @@
axis2_array_list_t *members;
};
-#define INTF_TO_IMPL(derivation_method) ((axis2_xml_schema_derivation_method_impl_t *) derivation_method)
+#define AXIS2_INTF_TO_IMPL(derivation_method) \
+ ((axis2_xml_schema_derivation_method_impl_t *) derivation_method)
axis2_status_t AXIS2_CALL
axis2_xml_schema_derivation_method_free(void *derivation_method,
@@ -61,46 +63,80 @@
derivation_method_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_derivation_method_impl_t));
-
+ if(!derivation_method_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
derivation_method_impl->schema_enum = NULL;
derivation_method_impl->methods = NULL;
derivation_method_impl->members = NULL;
+ derivation_method_impl->derivation_method.base.ops = NULL;
+ derivation_method_impl->derivation_method.ops = NULL;
+
derivation_method_impl->derivation_method.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_derivation_method_ops_t));
+ if(!derivation_method_impl->derivation_method.ops)
+ {
+ axis2_xml_schema_derivation_method_free(
+ &(derivation_method_impl->derivation_method), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
- derivation_method_impl->derivation_method.ops->free = axis2_xml_schema_derivation_method_free;
- derivation_method_impl->derivation_method.ops->get_base_impl = axis2_xml_schema_derivation_method_get_base_impl;
+ derivation_method_impl->derivation_method.ops->free =
+ axis2_xml_schema_derivation_method_free;
+ derivation_method_impl->derivation_method.ops->get_base_impl =
+ axis2_xml_schema_derivation_method_get_base_impl;
derivation_method_impl->derivation_method.ops->get_values =
axis2_xml_schema_derivation_method_get_values;
+ derivation_method_impl->members = axis2_array_list_create(env, 0);
+
if(!derivation_method_impl->members)
{
- derivation_method_impl->members = axis2_array_list_create(env, 0);
- if(!derivation_method_impl->members)
- return NULL;
- AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "All");
- AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "Empty");
- AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "Extension");
- AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "List");
- AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "None");
- AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "Restriction");
- AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "Substitution");
- AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "Union");
- }
+ axis2_xml_schema_derivation_method_free(
+ &(derivation_method_impl->derivation_method), env);
+ return NULL;
+ }
+ AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "All");
+ AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "Empty");
+ AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "Extension");
+ AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "List");
+ AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "None");
+ AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "Restriction");
+ AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "Substitution");
+ AXIS2_ARRAY_LIST_ADD(derivation_method_impl->members, env, "Union");
+
derivation_method_impl->methods = axis2_hash_make(env);
+
if(!derivation_method_impl->methods)
{
+ axis2_xml_schema_derivation_method_free(
+ &(derivation_method_impl->derivation_method), env);
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
+
axis2_hash_set(derivation_method_impl->methods, "free", AXIS2_HASH_KEY_STRING,
axis2_xml_schema_derivation_method_free);
+
axis2_hash_set(derivation_method_impl->methods, "get_values", AXIS2_HASH_KEY_STRING,
axis2_xml_schema_derivation_method_get_values);
- derivation_method_impl->schema_enum = axis2_xml_schema_enum_create(env, value);
+ derivation_method_impl->schema_enum =
+ axis2_xml_schema_enum_create(env, value);
+ if(!derivation_method_impl->schema_enum)
+ {
+ axis2_xml_schema_derivation_method_free(
+ &(derivation_method_impl->derivation_method), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
status = axis2_xml_schema_enum_resolve_methods(
- &(derivation_method_impl->derivation_method.base), env, derivation_method_impl->schema_enum,
+ &(derivation_method_impl->derivation_method.base),
+ env, derivation_method_impl->schema_enum,
derivation_method_impl->methods);
return &(derivation_method_impl->derivation_method);
@@ -113,27 +149,44 @@
axis2_xml_schema_derivation_method_impl_t *derivation_method_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- derivation_method_impl = INTF_TO_IMPL(derivation_method);
+ derivation_method_impl = AXIS2_INTF_TO_IMPL(derivation_method);
- if(derivation_method_impl->members)
+ if(NULL != derivation_method_impl->members)
{
+ int size = 0;
+ int i = 0;
+ size = AXIS2_ARRAY_LIST_SIZE(derivation_method_impl->members, env);
+ for(i = 0; i < size ; i++)
+ {
+ axis2_char_t *value = NULL;
+ value =(axis2_char_t* ) AXIS2_ARRAY_LIST_GET(derivation_method_impl->members, env, i);
+ if(NULL != value)
+ {
+ AXIS2_FREE((*env)->allocator, value);
+ value = NULL;
+ }
+ }
AXIS2_ARRAY_LIST_FREE(derivation_method_impl->members, env);
derivation_method_impl->members = NULL;
}
- if(derivation_method_impl->schema_enum)
+ if(NULL != derivation_method_impl->schema_enum)
{
AXIS2_XML_SCHEMA_ENUM_FREE(derivation_method_impl->schema_enum, env);
derivation_method_impl->schema_enum = NULL;
}
- if((&(derivation_method_impl->derivation_method))->ops)
+ if(NULL != derivation_method_impl->derivation_method.ops)
{
- AXIS2_FREE((*env)->allocator, (&(derivation_method_impl->derivation_method))->ops);
- (&(derivation_method_impl->derivation_method))->ops = NULL;
+ AXIS2_FREE((*env)->allocator, derivation_method_impl->derivation_method.ops);
+ derivation_method_impl->derivation_method.ops = NULL;
}
-
- if(derivation_method_impl)
+ if(NULL != derivation_method_impl->derivation_method.base.ops)
+ {
+ AXIS2_FREE((*env)->allocator, derivation_method_impl->derivation_method.base.ops);
+ derivation_method_impl->derivation_method.base.ops = NULL;
+ }
+ if(NULL != derivation_method_impl)
{
AXIS2_FREE((*env)->allocator, derivation_method_impl);
derivation_method_impl = NULL;
@@ -148,7 +201,7 @@
axis2_xml_schema_derivation_method_impl_t *derivation_method_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- derivation_method_impl = INTF_TO_IMPL(derivation_method);
+ derivation_method_impl = AXIS2_INTF_TO_IMPL(derivation_method);
return derivation_method_impl->schema_enum;
}
@@ -170,6 +223,11 @@
derivation_method->ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_derivation_method_ops_t));
+ if(!derivation_method->ops)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
derivation_method->ops->free = axis2_hash_get(methods, "free",
AXIS2_HASH_KEY_STRING);
derivation_method->ops->get_base_impl =
@@ -185,6 +243,5 @@
axis2_xml_schema_derivation_method_get_values(void *derivation_method,
axis2_env_t **env)
{
- return INTF_TO_IMPL(derivation_method)->members;
+ return AXIS2_INTF_TO_IMPL(derivation_method)->members;
}
-
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_element.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_element.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_element.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_element.c Thu Apr 20 22:00:55 2006
@@ -14,14 +14,14 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_element.h>
-#include <xml_schema/axis2_xml_schema_annotation.h>
-#include <xml_schema/axis2_xml_schema_type_receiver.h>
-#include <xml_schema/axis2_xml_schema_particle.h>
-#include <xml_schema/axis2_xml_schema_derivation_method.h>
-#include <xml_schema/axis2_xml_schema_obj_collection.h>
-#include <xml_schema/axis2_xml_schema_type.h>
-#include <xml_schema/axis2_xml_schema_form.h>
+#include <axis2_xml_schema_element.h>
+#include <axis2_xml_schema_annotation.h>
+#include <axis2_xml_schema_type_receiver.h>
+#include <axis2_xml_schema_particle.h>
+#include <axis2_xml_schema_derivation_method.h>
+#include <axis2_xml_schema_obj_collection.h>
+#include <axis2_xml_schema_type.h>
+#include <axis2_xml_schema_form.h>
typedef struct axis2_xml_schema_element_impl axis2_xml_schema_element_impl_t;
@@ -94,7 +94,7 @@
};
-#define INTF_TO_IMPL(element) ((axis2_xml_schema_element_impl_t *) element)
+#define AXIS2_INTF_TO_IMPL(element) ((axis2_xml_schema_element_impl_t *) element)
axis2_status_t AXIS2_CALL
axis2_xml_schema_element_free(void *element,
@@ -415,7 +415,7 @@
axis2_xml_schema_element_impl_t *element_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- element_impl = INTF_TO_IMPL(element);
+ element_impl = AXIS2_INTF_TO_IMPL(element);
if(element_impl->particle)
{
@@ -456,7 +456,7 @@
axis2_xml_schema_element_impl_t *element_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- element_impl = INTF_TO_IMPL(element);
+ element_impl = AXIS2_INTF_TO_IMPL(element);
return element_impl->type_recv;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_enum.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_enum.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_enum.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_enum.c Thu Apr 20 22:00:55 2006
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_enum.h>
+#include <axis2_xml_schema_enum.h>
#include <axis2_hash.h>
-typedef struct axis2_xml_schema_enum_impl axis2_xml_schema_enum_impl_t;
+typedef struct axis2_xml_schema_enum_impl
+ axis2_xml_schema_enum_impl_t;
/**
* @brief Xml Schema Enum Impl
@@ -26,11 +27,14 @@
struct axis2_xml_schema_enum_impl
{
axis2_xml_schema_enum_t schema_enum;
+
axis2_array_list_t *values;
+
axis2_char_t *value;
};
-#define INTF_TO_IMPL(schema_enum) ((axis2_xml_schema_enum_impl_t *) schema_enum)
+#define AXIS2_INTF_TO_IMPL(schema_enum) \
+ ((axis2_xml_schema_enum_impl_t *) schema_enum)
axis2_status_t AXIS2_CALL
axis2_xml_schema_enum_free(void *schema_enum,
@@ -62,22 +66,41 @@
schema_enum_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_enum_impl_t));
-
+ if(!schema_enum_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
schema_enum_impl->values = NULL;
schema_enum_impl->value = NULL;
+ schema_enum_impl->schema_enum.ops = NULL;
schema_enum_impl->schema_enum.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_enum_ops_t));
-
+
+ if(!(schema_enum_impl->schema_enum.ops))
+ {
+ AXIS2_FREE((*env)->allocator, schema_enum_impl);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
axis2_xml_schema_enum_set_value(&(schema_enum_impl->schema_enum),
env, value);
- schema_enum_impl->schema_enum.ops->free = axis2_xml_schema_enum_free;
+ schema_enum_impl->schema_enum.ops->free =
+ axis2_xml_schema_enum_free;
+
schema_enum_impl->schema_enum.ops->get_value =
axis2_xml_schema_enum_get_value;
+
schema_enum_impl->schema_enum.ops->set_value =
axis2_xml_schema_enum_set_value;
- schema_enum_impl->schema_enum.ops->equals = axis2_xml_schema_enum_equals;
+
+ schema_enum_impl->schema_enum.ops->equals =
+ axis2_xml_schema_enum_equals;
+
schema_enum_impl->schema_enum.ops->get_values =
axis2_xml_schema_enum_get_values;
@@ -90,29 +113,29 @@
{
axis2_xml_schema_enum_impl_t *schema_enum_impl = NULL;
- schema_enum_impl = INTF_TO_IMPL(schema_enum);
+ schema_enum_impl = AXIS2_INTF_TO_IMPL(schema_enum);
- if(schema_enum_impl->value)
+ if(NULL != schema_enum_impl->value)
{
AXIS2_FREE((*env)->allocator, schema_enum_impl->value);
schema_enum_impl->value = NULL;
}
- if(schema_enum_impl->values)
+ if(NULL != schema_enum_impl->values)
{
AXIS2_ARRAY_LIST_FREE(schema_enum_impl->values, env);
schema_enum_impl->values = NULL;
}
- if((&(schema_enum_impl->schema_enum))->ops)
+ if(NULL != (&(schema_enum_impl->schema_enum))->ops)
{
- free((&(schema_enum_impl->schema_enum))->ops);
+ AXIS2_FREE((*env)->allocator, ((&(schema_enum_impl->schema_enum))->ops));
(&(schema_enum_impl->schema_enum))->ops = NULL;
}
- if(schema_enum_impl)
+ if(NULL != schema_enum_impl)
{
- free(schema_enum_impl);
+ AXIS2_FREE((*env)->allocator, (schema_enum_impl));
schema_enum_impl = NULL;
}
return AXIS2_SUCCESS;
@@ -127,6 +150,7 @@
axis2_xml_schema_enum_impl_t *schema_enum_impl_l = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+
AXIS2_PARAM_CHECK((*env)->error, schema_enum_impl, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, methods, AXIS2_FAILURE);
@@ -134,6 +158,11 @@
schema_enum->ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_enum_ops_t));
+ if(NULL != schema_enum->ops)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
schema_enum->ops->free = axis2_hash_get(methods, "free",
AXIS2_HASH_KEY_STRING);
schema_enum->ops->get_value =
@@ -155,7 +184,7 @@
{
axis2_xml_schema_enum_impl_t *schema_enum_impl = NULL;
- schema_enum_impl = INTF_TO_IMPL(schema_enum);
+ schema_enum_impl = AXIS2_INTF_TO_IMPL(schema_enum);
return schema_enum_impl->value;
}
@@ -166,15 +195,19 @@
{
axis2_xml_schema_enum_impl_t *schema_enum_impl = NULL;
- schema_enum_impl = INTF_TO_IMPL(schema_enum);
+ schema_enum_impl = AXIS2_INTF_TO_IMPL(schema_enum);
- if(schema_enum_impl->value)
+ if(NULL != schema_enum_impl->value)
{
- free(schema_enum_impl->value);
+ AXIS2_FREE((*env)->allocator, (schema_enum_impl->value));
schema_enum_impl->value = NULL;
}
schema_enum_impl->value = AXIS2_STRDUP(value, env);
-
+ if(!schema_enum_impl->value)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
return AXIS2_SUCCESS;
}
@@ -185,8 +218,9 @@
{
axis2_xml_schema_enum_impl_t *schema_enum_impl = NULL;
- schema_enum_impl = INTF_TO_IMPL(schema_enum);
-
+ schema_enum_impl = AXIS2_INTF_TO_IMPL(schema_enum);
+
+ /** TODO */
return AXIS2_TRUE;
}
@@ -195,17 +229,30 @@
axis2_env_t **env)
{
axis2_xml_schema_enum_impl_t *schema_enum_impl = NULL;
-
- schema_enum_impl = INTF_TO_IMPL(schema_enum);
-
+ schema_enum_impl = AXIS2_INTF_TO_IMPL(schema_enum);
return schema_enum_impl->values;
}
int AXIS2_CALL
axis2_xml_schema_enum_index(axis2_char_t *value,
- axis2_array_list_t *values,
- axis2_env_t **env)
+ axis2_env_t **env,
+ axis2_array_list_t *values)
{
- return -1;
+ int size = 0;
+ int i = 0;
+ AXIS2_ENV_CHECK(env, -1);
+ AXIS2_PARAM_CHECK((*env)->error, value, -1);
+ AXIS2_PARAM_CHECK((*env)->error, values, -1);
+ size = AXIS2_ARRAY_LIST_SIZE(values, env);
+ for(i =0; i <size; i++)
+ {
+ axis2_char_t *mem_val = NULL;
+ mem_val = (axis2_char_t *)AXIS2_ARRAY_LIST_GET(values, env, i);
+ if(NULL != mem_val && AXIS2_STRCMP(mem_val, value) == 0)
+ {
+ return i;
+ }
+ }
+ return -1;
}
Added: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_external.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_external.c?rev=395780&view=auto
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_external.c (added)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_external.c Thu Apr 20 22:00:55 2006
@@ -0,0 +1,232 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <axis2_xml_schema_external.h>
+#include <axis2_xml_schema.h>
+
+/**
+ * @brief Other Extension Struct Impl
+ * Axis2 Other Extension
+ */
+typedef struct axis2_xml_schema_external_impl
+{
+ axis2_xml_schema_external_t external;
+
+ axis2_xml_schema_annotated_t *annotated;
+
+ axis2_xml_schema_t *schema;
+
+ axis2_hash_t *methods;
+
+}axis2_xml_schema_external_impl_t;
+
+#define AXIS2_INTF_TO_IMPL(external) \
+ ((axis2_xml_schema_external_impl_t *) external)
+
+/********************* function prototypes ***********************************/
+
+axis2_status_t AXIS2_CALL
+axis2_xml_schema_external_free(void *external,
+ axis2_env_t **env);
+
+axis2_xml_schema_annotated_t *AXIS2_CALL
+axis2_xml_schema_external_get_base_impl(void *external,
+ axis2_env_t **env);
+
+axis2_xml_schema_t* AXIS2_CALL
+axis2_xml_schema_external_get_schema(void *external,
+ axis2_env_t **env);
+
+axis2_status_t AXIS2_CALL
+axis2_xml_schema_external_set_schema(void *external,
+ axis2_env_t **env,
+ axis2_xml_schema_t *schema);
+
+/********************* end function prototypes ********************************/
+
+AXIS2_DECLARE(axis2_xml_schema_external_t *)
+axis2_xml_schema_external_create(axis2_env_t **env)
+{
+ axis2_xml_schema_external_impl_t *external_impl = NULL;
+ axis2_status_t status = AXIS2_FAILURE;
+
+ external_impl = AXIS2_MALLOC((*env)->allocator,
+ sizeof(axis2_xml_schema_external_impl_t));
+ if(!external_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+ external_impl->schema = NULL;
+ external_impl->annotated = NULL;
+ external_impl->methods = NULL;
+ external_impl->external.ops = NULL;
+ external_impl->external.base.ops = NULL;
+
+ external_impl->external.ops = AXIS2_MALLOC((*env)->allocator,
+ sizeof(axis2_xml_schema_external_ops_t));
+
+ if(!external_impl->external.ops)
+ {
+ axis2_xml_schema_external_free(&(external_impl->external), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ external_impl->external.ops->free =
+ axis2_xml_schema_external_free;
+ external_impl->external.ops->get_base_impl =
+ axis2_xml_schema_external_get_base_impl;
+
+ external_impl->external.ops->get_schema =
+ axis2_xml_schema_external_get_schema;
+
+ external_impl->external.ops->set_schema =
+ axis2_xml_schema_external_set_schema;
+
+ external_impl->methods = axis2_hash_make(env);
+ if(!external_impl->methods)
+ {
+ axis2_xml_schema_external_free(&(external_impl->external), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ axis2_hash_set(external_impl->methods, "free", AXIS2_HASH_KEY_STRING,
+ axis2_xml_schema_external_free);
+
+ axis2_hash_set(external_impl->methods, "get_schema",
+ AXIS2_HASH_KEY_STRING, axis2_xml_schema_external_get_schema);
+ axis2_hash_set(external_impl->methods, "set_schema",
+ AXIS2_HASH_KEY_STRING, axis2_xml_schema_external_set_schema);
+
+ external_impl->annotated = axis2_xml_schema_annotated_create(env);
+ if(!external_impl->annotated)
+ {
+ axis2_xml_schema_external_free(&(external_impl->external), env);
+ return NULL;
+ }
+ status = axis2_xml_schema_annotated_resolve_methods(
+ &(external_impl->external.base), env, external_impl->annotated,
+ external_impl->methods);
+
+ return &(external_impl->external);
+}
+
+axis2_status_t AXIS2_CALL
+axis2_xml_schema_external_free(void *external,
+ axis2_env_t **env)
+{
+ axis2_xml_schema_external_impl_t *external_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ external_impl = AXIS2_INTF_TO_IMPL(external);
+
+ if(NULL != external_impl->methods)
+ {
+ axis2_hash_free(external_impl->methods, env);
+ external_impl->methods = NULL;
+ }
+
+ if(NULL != external_impl->annotated)
+ {
+ AXIS2_XML_SCHEMA_ANNOTATED_FREE(external_impl->annotated, env);
+ external_impl->annotated = NULL;
+ }
+
+ if(NULL != external_impl->external.ops)
+ {
+ AXIS2_FREE((*env)->allocator, external_impl->external.ops);
+ external_impl->external.ops = NULL;
+ }
+ if(NULL != external_impl->external.base.ops)
+ {
+ AXIS2_FREE((*env)->allocator, external_impl->external.base.ops);
+ external_impl->external.base.ops = NULL;
+ }
+ AXIS2_FREE((*env)->allocator, external_impl);
+ external_impl = NULL;
+ return AXIS2_SUCCESS;
+}
+
+axis2_xml_schema_annotated_t *AXIS2_CALL
+axis2_xml_schema_external_get_base_impl(void *external,
+ axis2_env_t **env)
+{
+ axis2_xml_schema_external_impl_t *external_impl = NULL;
+
+ AXIS2_ENV_CHECK(env, NULL);
+ external_impl = AXIS2_INTF_TO_IMPL(external);
+
+ return external_impl->annotated;
+}
+
+AXIS2_DECLARE(axis2_status_t)
+axis2_xml_schema_external_resolve_methods(
+ axis2_xml_schema_external_t *external,
+ axis2_env_t **env,
+ axis2_xml_schema_external_t *external_impl,
+ axis2_hash_t *methods)
+{
+ axis2_xml_schema_external_impl_t *external_impl_l = NULL;
+
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, external_impl, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, methods, AXIS2_FAILURE);
+
+ external_impl_l = (axis2_xml_schema_external_impl_t *) external_impl;
+
+ external->ops = AXIS2_MALLOC((*env)->allocator,
+ sizeof(axis2_xml_schema_external_ops_t));
+
+ external->ops->free = axis2_hash_get(methods, "free",
+ AXIS2_HASH_KEY_STRING);
+
+ external->ops->get_base_impl =
+ external_impl_l->external.ops->get_base_impl;
+ external->ops->set_schema =
+ external_impl_l->external.ops->set_schema;
+ external->ops->get_schema =
+ external_impl_l->external.ops->get_schema;
+
+ return axis2_xml_schema_annotated_resolve_methods(&(external->base),
+ env, external_impl_l->annotated, methods);
+}
+
+axis2_xml_schema_t * AXIS2_CALL
+axis2_xml_schema_external_get_schema(void *external,
+ axis2_env_t **env)
+{
+ AXIS2_ENV_CHECK(env, NULL);
+ return AXIS2_INTF_TO_IMPL(external)->schema;
+}
+
+axis2_status_t AXIS2_CALL
+axis2_xml_schema_external_set_schema(void *external,
+ axis2_env_t **env,
+ axis2_xml_schema_t *schema)
+{
+ axis2_xml_schema_external_impl_t *ext_impl = NULL;
+ AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
+ ext_impl = AXIS2_INTF_TO_IMPL(external);
+ if(NULL != ext_impl->schema)
+ {
+ AXIS2_XML_SCHEMA_FREE(ext_impl->schema, env);
+ ext_impl->schema = NULL;
+ }
+ ext_impl->schema = schema;
+ return AXIS2_SUCCESS;
+}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_facet.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_facet.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_facet.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_facet.c Thu Apr 20 22:00:55 2006
@@ -14,9 +14,12 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_facet.h>
+#include <axis2_xml_schema_facet.h>
+#include <axis2_om_element.h>
+#include <axis2_om_node.h>
-typedef struct axis2_xml_schema_facet_impl axis2_xml_schema_facet_impl_t;
+typedef struct axis2_xml_schema_facet_impl
+ axis2_xml_schema_facet_impl_t;
/**
* @brief Other Extension Struct Impl
@@ -25,13 +28,20 @@
struct axis2_xml_schema_facet_impl
{
axis2_xml_schema_facet_t facet;
+
axis2_xml_schema_annotated_t *annotated;
+
axis2_hash_t *methods;
+
axis2_bool_t fixed;
+
void *value;
};
-#define INTF_TO_IMPL(facet) ((axis2_xml_schema_facet_impl_t *) facet)
+#define AXIS2_INTF_TO_IMPL(facet) \
+ ((axis2_xml_schema_facet_impl_t *) facet)
+
+/****************** function prototypes ***************************************/
axis2_status_t AXIS2_CALL
axis2_xml_schema_facet_free(void *facet,
@@ -59,11 +69,7 @@
axis2_env_t **env,
void *value);
-axis2_xml_schema_facet_t *AXIS2_CALL
-axis2_xml_schema_facet_construct (axis2_xml_schema_facet_t *facet,
- axis2_env_t **env,
- axis2_om_element_t *element,
- axis2_om_node_t **node);
+/********************** end function prototypes *******************************/
AXIS2_DECLARE(axis2_xml_schema_facet_t *)
axis2_xml_schema_facet_create(axis2_env_t **env,
@@ -75,31 +81,44 @@
facet_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_facet_impl_t));
+ if(!facet_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
facet_impl->annotated = NULL;
+ facet_impl->facet.ops = NULL;
+ facet_impl->facet.base.ops = NULL;
facet_impl->methods = NULL;
facet_impl->fixed = fixed;
facet_impl->value = value;
+
facet_impl->facet.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_facet_ops_t));
-
- facet_impl->facet.ops->free = axis2_xml_schema_facet_free;
+ if(!facet_impl->facet.ops)
+ {
+ axis2_xml_schema_facet_free(&(facet_impl->facet), env);
+ return NULL;
+ }
+
+ facet_impl->facet.ops->free =
+ axis2_xml_schema_facet_free;
facet_impl->facet.ops->get_base_impl =
- axis2_xml_schema_facet_get_base_impl;
+ axis2_xml_schema_facet_get_base_impl;
facet_impl->facet.ops->is_fixed =
- axis2_xml_schema_facet_is_fixed;
+ axis2_xml_schema_facet_is_fixed;
facet_impl->facet.ops->set_fixed =
- axis2_xml_schema_facet_set_fixed;
+ axis2_xml_schema_facet_set_fixed;
facet_impl->facet.ops->get_value =
- axis2_xml_schema_facet_get_value;
+ axis2_xml_schema_facet_get_value;
facet_impl->facet.ops->set_value =
- axis2_xml_schema_facet_set_value;
- facet_impl->facet.ops->construct =
- axis2_xml_schema_facet_construct;
+ axis2_xml_schema_facet_set_value;
facet_impl->methods = axis2_hash_make(env);
if(!facet_impl->methods)
{
+ axis2_xml_schema_facet_free(&(facet_impl->facet), env);
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
@@ -113,10 +132,14 @@
AXIS2_HASH_KEY_STRING, axis2_xml_schema_facet_get_value);
axis2_hash_set(facet_impl->methods, "set_value",
AXIS2_HASH_KEY_STRING, axis2_xml_schema_facet_set_value);
- axis2_hash_set(facet_impl->methods, "construct",
- AXIS2_HASH_KEY_STRING, axis2_xml_schema_facet_construct);
+
facet_impl->annotated = axis2_xml_schema_annotated_create(env);
+ if(!facet_impl->annotated)
+ {
+ axis2_xml_schema_facet_free(&(facet_impl->facet), env);
+ return NULL;
+ }
status = axis2_xml_schema_annotated_resolve_methods(
&(facet_impl->facet.base), env, facet_impl->annotated,
facet_impl->methods);
@@ -131,27 +154,29 @@
axis2_xml_schema_facet_impl_t *facet_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- facet_impl = INTF_TO_IMPL(facet);
-
- if(facet_impl->methods)
+ facet_impl = AXIS2_INTF_TO_IMPL(facet);
+ if(NULL != facet_impl->methods)
{
axis2_hash_free(facet_impl->methods, env);
facet_impl->methods = NULL;
}
-
- if(facet_impl->annotated)
+ if(NULL != facet_impl->annotated)
{
- AXIS2_XML_SCHEMA_OBJ_FREE(facet_impl->annotated, env);
+ AXIS2_XML_SCHEMA_ANNOTATED_FREE(facet_impl->annotated, env);
facet_impl->annotated = NULL;
}
- if((&(facet_impl->facet))->ops)
+ if(NULL != facet_impl->facet.ops)
{
- AXIS2_FREE((*env)->allocator, (&(facet_impl->facet))->ops);
- (&(facet_impl->facet))->ops = NULL;
+ AXIS2_FREE((*env)->allocator, facet_impl->facet.ops);
+ facet_impl->facet.ops = NULL;
}
-
- if(facet_impl)
+ if(NULL != facet_impl->facet.base.ops)
+ {
+ AXIS2_FREE((*env)->allocator, facet_impl->facet.base.ops);
+ facet_impl->facet.base.ops = NULL;
+ }
+ if(NULL != facet_impl)
{
AXIS2_FREE((*env)->allocator, facet_impl);
facet_impl = NULL;
@@ -166,7 +191,7 @@
axis2_xml_schema_facet_impl_t *facet_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- facet_impl = INTF_TO_IMPL(facet);
+ facet_impl = AXIS2_INTF_TO_IMPL(facet);
return facet_impl->annotated;
}
@@ -188,6 +213,12 @@
facet->ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_facet_ops_t));
+ if(!facet->ops)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+
facet->ops->free = axis2_hash_get(methods, "free",
AXIS2_HASH_KEY_STRING);
facet->ops->get_base_impl =
@@ -200,9 +231,6 @@
facet_impl_l->facet.ops->get_value;
facet->ops->set_value =
facet_impl_l->facet.ops->set_value;
- facet->ops->construct =
- facet_impl_l->facet.ops->construct;
-
return axis2_xml_schema_annotated_resolve_methods(&(facet->base),
env, facet_impl_l->annotated, methods);
}
@@ -212,7 +240,7 @@
axis2_env_t **env)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(facet)->fixed;
+ return AXIS2_INTF_TO_IMPL(facet)->fixed;
}
axis2_status_t AXIS2_CALL
@@ -221,7 +249,7 @@
axis2_bool_t fixed)
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- INTF_TO_IMPL(facet)->fixed = fixed;
+ AXIS2_INTF_TO_IMPL(facet)->fixed = fixed;
return AXIS2_SUCCESS;
}
@@ -229,8 +257,8 @@
axis2_xml_schema_facet_get_value(void *facet,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(facet)->value;
+ AXIS2_ENV_CHECK(env, NULL);
+ return AXIS2_INTF_TO_IMPL(facet)->value;
}
axis2_status_t AXIS2_CALL
@@ -240,17 +268,21 @@
{
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
/* TODO if value already exist free it */
- INTF_TO_IMPL(facet)->value = value;
+
+
+
+ AXIS2_INTF_TO_IMPL(facet)->value = value;
return AXIS2_SUCCESS;
}
-axis2_xml_schema_facet_t *AXIS2_CALL
-axis2_xml_schema_facet_construct (axis2_xml_schema_facet_t *facet,
- axis2_env_t **env,
- axis2_om_element_t *element,
- axis2_om_node_t **node)
+AXIS2_DECLARE(axis2_xml_schema_facet_t*)
+axis2_xml_schema_facet_construct (axis2_env_t **env,
+ axis2_om_node_t *node)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- /* TODO write logic */
+ axis2_om_element_t *om_ele = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+ AXIS2_PARAM_CHECK((*env)->error, node, NULL);
+
+
return NULL;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_form.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_form.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_form.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_form.c Thu Apr 20 22:00:55 2006
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_form.h>
+#include <axis2_xml_schema_form.h>
-typedef struct axis2_xml_schema_form_impl axis2_xml_schema_form_impl_t;
+typedef struct axis2_xml_schema_form_impl
+ axis2_xml_schema_form_impl_t;
/**
* @brief Other Extension Struct Impl
@@ -30,7 +31,7 @@
axis2_array_list_t *members;
};
-#define INTF_TO_IMPL(form) ((axis2_xml_schema_form_impl_t *) form)
+#define AXIS2_INTF_TO_IMPL(form) ((axis2_xml_schema_form_impl_t *) form)
axis2_status_t AXIS2_CALL
axis2_xml_schema_form_free(void *form,
@@ -61,39 +62,62 @@
form_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_form_impl_t));
+ if(!form_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
form_impl->schema_enum = NULL;
form_impl->methods = NULL;
form_impl->members = NULL;
form_impl->form.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_form_ops_t));
-
+ if(!form_impl->form.ops)
+ {
+ axis2_xml_schema_form_free(&(form_impl->form), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+
form_impl->form.ops->free = axis2_xml_schema_form_free;
form_impl->form.ops->get_base_impl = axis2_xml_schema_form_get_base_impl;
form_impl->form.ops->get_values =
axis2_xml_schema_form_get_values;
+
+ form_impl->members = axis2_array_list_create(env, 0);
if(!form_impl->members)
- {
- form_impl->members = axis2_array_list_create(env, 0);
- if(!form_impl->members)
- return NULL;
- AXIS2_ARRAY_LIST_ADD(form_impl->members, env, AXIS2_XML_SCHEMA_NONE);
- AXIS2_ARRAY_LIST_ADD(form_impl->members, env, AXIS2_XML_SCHEMA_QUALIFIED);
- AXIS2_ARRAY_LIST_ADD(form_impl->members, env, AXIS2_XML_SCHEMA_UNQUALIFIED);
- }
+ {
+ axis2_xml_schema_form_free(&(form_impl->form), env);
+ return NULL;
+ }
+ AXIS2_ARRAY_LIST_ADD(form_impl->members, env, AXIS2_XML_SCHEMA_NONE);
+ AXIS2_ARRAY_LIST_ADD(form_impl->members, env, AXIS2_XML_SCHEMA_QUALIFIED);
+ AXIS2_ARRAY_LIST_ADD(form_impl->members, env, AXIS2_XML_SCHEMA_UNQUALIFIED);
+
form_impl->methods = axis2_hash_make(env);
if(!form_impl->methods)
{
+ axis2_xml_schema_form_free(&(form_impl->form), env);
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
+
axis2_hash_set(form_impl->methods, "free", AXIS2_HASH_KEY_STRING,
axis2_xml_schema_form_free);
axis2_hash_set(form_impl->methods, "get_values", AXIS2_HASH_KEY_STRING,
axis2_xml_schema_form_get_values);
form_impl->schema_enum = axis2_xml_schema_enum_create(env, value);
+ if(!form_impl->schema_enum)
+ {
+ axis2_xml_schema_form_free(&(form_impl->form), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
status = axis2_xml_schema_enum_resolve_methods(
&(form_impl->form.base), env, form_impl->schema_enum,
form_impl->methods);
@@ -108,10 +132,23 @@
axis2_xml_schema_form_impl_t *form_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- form_impl = INTF_TO_IMPL(form);
+ form_impl = AXIS2_INTF_TO_IMPL(form);
if(form_impl->members)
{
+ int size = 0;
+ int i = 0;
+ size = AXIS2_ARRAY_LIST_SIZE(form_impl->members, env);
+ for(i = 0; i < size ; i++)
+ {
+ axis2_char_t *value = NULL;
+ value =(axis2_char_t* ) AXIS2_ARRAY_LIST_GET(form_impl->members, env, i);
+ if(NULL != value)
+ {
+ AXIS2_FREE((*env)->allocator, value);
+ value = NULL;
+ }
+ }
AXIS2_ARRAY_LIST_FREE(form_impl->members, env);
form_impl->members = NULL;
}
@@ -143,8 +180,7 @@
axis2_xml_schema_form_impl_t *form_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- form_impl = INTF_TO_IMPL(form);
-
+ form_impl = AXIS2_INTF_TO_IMPL(form);
return form_impl->schema_enum;
}
@@ -180,7 +216,6 @@
axis2_xml_schema_form_get_values(void *form,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, NULL);
- return INTF_TO_IMPL(form)->members;
+ return AXIS2_INTF_TO_IMPL(form)->members;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_group.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_group.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_group.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_group.c Thu Apr 20 22:00:55 2006
@@ -14,8 +14,8 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_group.h>
-#include <xml_schema/axis2_xml_schema_group_base.h>
+#include <axis2_xml_schema_group.h>
+#include <axis2_xml_schema_group_base.h>
typedef struct axis2_xml_schema_group_impl axis2_xml_schema_group_impl_t;
@@ -32,7 +32,7 @@
axis2_xml_schema_group_base_t *particle;
};
-#define INTF_TO_IMPL(group) ((axis2_xml_schema_group_impl_t *) group)
+#define AXIS2_INTF_TO_IMPL(group) ((axis2_xml_schema_group_impl_t *) group)
axis2_status_t AXIS2_CALL
axis2_xml_schema_group_free(void *group,
@@ -68,15 +68,31 @@
group_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_group_impl_t));
-
+ if(!group_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
group_impl->annotated = NULL;
group_impl->methods = NULL;
group_impl->name = NULL;
group_impl->particle = NULL;
+ group_impl->group.base.ops = NULL;
+ group_impl->group.ops = NULL;
+
group_impl->group.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_group_ops_t));
+ if(!group_impl->group.ops)
+ {
+ axis2_xml_schema_group_free(&(group_impl->group), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
- group_impl->group.ops->free = axis2_xml_schema_group_free;
+ group_impl->group.ops->free =
+ axis2_xml_schema_group_free;
group_impl->group.ops->get_base_impl =
axis2_xml_schema_group_get_base_impl;
group_impl->group.ops->get_name =
@@ -91,6 +107,7 @@
group_impl->methods = axis2_hash_make(env);
if(!group_impl->methods)
{
+ axis2_xml_schema_group_free(&(group_impl->group), env);
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
@@ -106,6 +123,11 @@
AXIS2_HASH_KEY_STRING, axis2_xml_schema_group_set_particle);
group_impl->annotated = axis2_xml_schema_annotated_create(env);
+ if(!group_impl->annotated)
+ {
+ axis2_xml_schema_group_free(&(group_impl->group), env);
+ return NULL;
+ }
status = axis2_xml_schema_annotated_resolve_methods(
&(group_impl->group.base), env, group_impl->annotated,
group_impl->methods);
@@ -120,43 +142,44 @@
axis2_xml_schema_group_impl_t *group_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- group_impl = INTF_TO_IMPL(group);
+ group_impl = AXIS2_INTF_TO_IMPL(group);
- if(group_impl->name)
+ if(NULL != group_impl->name)
{
AXIS2_FREE((*env)->allocator, group_impl->name);
group_impl->name = NULL;
}
- if(group_impl->particle)
+ if(NULL != group_impl->particle)
{
AXIS2_XML_SCHEMA_PARTICLE_FREE(group_impl->particle, env);
group_impl->particle = NULL;
}
- if(group_impl->methods)
+ if(NULL != group_impl->methods)
{
axis2_hash_free(group_impl->methods, env);
group_impl->methods = NULL;
}
- if(group_impl->annotated)
+ if(NULL != group_impl->annotated)
{
AXIS2_XML_SCHEMA_ANNOTATED_FREE(group_impl->annotated, env);
group_impl->annotated = NULL;
}
- if((&(group_impl->group))->ops)
+ if(NULL != group_impl->group.ops)
{
- AXIS2_FREE((*env)->allocator, (&(group_impl->group))->ops);
- (&(group_impl->group))->ops = NULL;
+ AXIS2_FREE((*env)->allocator, group_impl->group.ops);
+ group_impl->group.ops = NULL;
}
-
- if(group_impl)
+ if(NULL != group_impl->group.base.ops)
{
- AXIS2_FREE((*env)->allocator, group_impl);
- group_impl = NULL;
+ AXIS2_FREE((*env)->allocator, group_impl->group.base.ops);
+ group_impl->group.base.ops = NULL;
}
+ AXIS2_FREE((*env)->allocator, group_impl);
+ group_impl = NULL;
return AXIS2_SUCCESS;
}
@@ -167,8 +190,7 @@
axis2_xml_schema_group_impl_t *group_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- group_impl = INTF_TO_IMPL(group);
-
+ group_impl = AXIS2_INTF_TO_IMPL(group);
return group_impl->annotated;
}
@@ -184,11 +206,17 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, group_impl, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, methods, AXIS2_FAILURE);
+ AXIS2_PARAM_CHECK((*env)->error, group, AXIS2_FAILURE);
group_impl_l = (axis2_xml_schema_group_impl_t *) group_impl;
group->ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_group_ops_t));
+ if(!group->ops)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
group->ops->free = axis2_hash_get(methods, "free",
AXIS2_HASH_KEY_STRING);
group->ops->get_base_impl =
@@ -210,8 +238,8 @@
axis2_xml_schema_group_get_name(void *group,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(group)->name;
+ AXIS2_ENV_CHECK(env, NULL);
+ return AXIS2_INTF_TO_IMPL(group)->name;
}
axis2_status_t AXIS2_CALL
@@ -222,9 +250,9 @@
axis2_xml_schema_group_impl_t *group_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- group_impl = INTF_TO_IMPL(group);
+ group_impl = AXIS2_INTF_TO_IMPL(group);
- if(group_impl->name)
+ if(NULL != group_impl->name)
{
AXIS2_FREE((*env)->allocator, group_impl->name);
group_impl->name = NULL;
@@ -242,8 +270,8 @@
axis2_xml_schema_group_get_particle(void *group,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(group)->particle;
+ AXIS2_ENV_CHECK(env, NULL);
+ return AXIS2_INTF_TO_IMPL(group)->particle;
}
axis2_status_t AXIS2_CALL
@@ -254,8 +282,13 @@
axis2_xml_schema_group_impl_t *group_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- group_impl = INTF_TO_IMPL(group);
-
+ group_impl = AXIS2_INTF_TO_IMPL(group);
+ AXIS2_PARAM_CHECK((*env)->error , particle, AXIS2_FAILURE);
+ if(NULL != group_impl->particle)
+ {
+ /** TODO Free particle */
+ group_impl->particle = NULL;
+ }
group_impl->particle = particle;
return AXIS2_SUCCESS;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_group_base.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_group_base.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_group_base.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_group_base.c Thu Apr 20 22:00:55 2006
@@ -14,9 +14,10 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_group_base.h>
+#include <axis2_xml_schema_group_base.h>
-typedef struct axis2_xml_schema_group_base_impl axis2_xml_schema_group_base_impl_t;
+typedef struct axis2_xml_schema_group_base_impl
+ axis2_xml_schema_group_base_impl_t;
/**
* @brief Other Extension Struct Impl
@@ -25,14 +26,19 @@
struct axis2_xml_schema_group_base_impl
{
axis2_xml_schema_group_base_t group_base;
+
axis2_xml_schema_particle_t *particle;
+
axis2_hash_t *methods;
+
axis2_xml_schema_obj_collection_t *items;
};
-#define INTF_TO_IMPL(group_base) ((axis2_xml_schema_group_base_impl_t *) group_base)
+#define AXIS2_INTF_TO_IMPL(group_base) \
+ ((axis2_xml_schema_group_base_impl_t *) group_base)
-axis2_status_t AXIS2_CALL
+/****************** *****************************************************/
+axis2_status_t AXIS2_CALL
axis2_xml_schema_group_base_free(void *group_base,
axis2_env_t **env);
@@ -40,11 +46,11 @@
axis2_xml_schema_group_base_get_base_impl(void *group_base,
axis2_env_t **env);
-
axis2_xml_schema_obj_collection_t *AXIS2_CALL
axis2_xml_schema_group_base_get_items(void *group_base,
axis2_env_t **env);
+/***********************************************************************/
AXIS2_DECLARE(axis2_xml_schema_group_base_t *)
axis2_xml_schema_group_base_create(axis2_env_t **env)
@@ -54,20 +60,38 @@
group_base_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_group_base_impl_t));
+ if(NULL != group_base_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
group_base_impl->particle = NULL;
group_base_impl->methods = NULL;
group_base_impl->items = NULL;
+ group_base_impl->group_base.ops = NULL;
+ group_base_impl->group_base.base.ops = NULL;
+
group_base_impl->group_base.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_group_base_ops_t));
+ if(!group_base_impl->group_base.ops)
+ {
+ axis2_xml_schema_group_base_free(&(group_base_impl->group_base), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
- group_base_impl->group_base.ops->free = axis2_xml_schema_group_base_free;
- group_base_impl->group_base.ops->get_base_impl = axis2_xml_schema_group_base_get_base_impl;
- group_base_impl->group_base.ops->get_items = axis2_xml_schema_group_base_get_items;
+ group_base_impl->group_base.ops->free =
+ axis2_xml_schema_group_base_free;
+ group_base_impl->group_base.ops->get_base_impl =
+ axis2_xml_schema_group_base_get_base_impl;
+ group_base_impl->group_base.ops->get_items =
+ axis2_xml_schema_group_base_get_items;
group_base_impl->methods = axis2_hash_make(env);
if(!group_base_impl->methods)
{
+ axis2_xml_schema_group_base_free(&(group_base_impl->group_base), env);
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
@@ -77,6 +101,12 @@
axis2_xml_schema_group_base_get_items);
group_base_impl->particle = axis2_xml_schema_particle_create(env);
+ if(!group_base_impl->particle)
+ {
+ axis2_xml_schema_group_base_free(&(group_base_impl->group_base), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
status = axis2_xml_schema_particle_resolve_methods(
&(group_base_impl->group_base.base), env, group_base_impl->particle,
group_base_impl->methods);
@@ -90,32 +120,36 @@
axis2_xml_schema_group_base_impl_t *group_base_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- group_base_impl = INTF_TO_IMPL(group_base);
+ group_base_impl = AXIS2_INTF_TO_IMPL(group_base);
- if(group_base_impl->items)
+ if(NULL != group_base_impl->items)
{
AXIS2_XML_SCHEMA_OBJ_COLLECTION_FREE(group_base_impl->items, env);
group_base_impl->items = NULL;
}
- if(group_base_impl->methods)
+ if(NULL != group_base_impl->methods)
{
axis2_hash_free(group_base_impl->methods, env);
group_base_impl->methods = NULL;
}
- if(group_base_impl->particle)
+ if(NULL != group_base_impl->particle)
{
- AXIS2_XML_SCHEMA_OBJ_FREE(group_base_impl->particle, env);
+ AXIS2_XML_SCHEMA_PARTICLE_FREE(group_base_impl->particle, env);
group_base_impl->particle = NULL;
}
- if((&(group_base_impl->group_base))->ops)
+ if(NULL != group_base_impl->group_base.ops)
{
- AXIS2_FREE((*env)->allocator, (&(group_base_impl->group_base))->ops);
- (&(group_base_impl->group_base))->ops = NULL;
+ AXIS2_FREE((*env)->allocator, group_base_impl->group_base.ops);
+ group_base_impl->group_base.ops = NULL;
+ }
+ if(NULL != group_base_impl->group_base.base.ops)
+ {
+ AXIS2_FREE((*env)->allocator, group_base_impl->group_base.base.ops);
+ group_base_impl->group_base.base.ops = NULL;
}
-
if(group_base_impl)
{
AXIS2_FREE((*env)->allocator, group_base_impl);
@@ -131,7 +165,7 @@
axis2_xml_schema_group_base_impl_t *group_base_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- group_base_impl = INTF_TO_IMPL(group_base);
+ group_base_impl = AXIS2_INTF_TO_IMPL(group_base);
return group_base_impl->particle;
}
@@ -153,6 +187,12 @@
group_base->ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_group_base_ops_t));
+ if(!group_base->ops)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+
group_base->ops->free = axis2_hash_get(methods, "free",
AXIS2_HASH_KEY_STRING);
group_base->ops->get_base_impl =
@@ -169,6 +209,6 @@
axis2_env_t **env)
{
AXIS2_ENV_CHECK(env, NULL);
- return INTF_TO_IMPL(group_base)->items;
+ return AXIS2_INTF_TO_IMPL(group_base)->items;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_group_ref.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_group_ref.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_group_ref.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_group_ref.c Thu Apr 20 22:00:55 2006
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_group_ref.h>
-#include <xml_schema/axis2_xml_schema_group_base.h>
+#include <axis2_xml_schema_group_ref.h>
+#include <axis2_xml_schema_group_base.h>
-typedef struct axis2_xml_schema_group_ref_impl axis2_xml_schema_group_ref_impl_t;
+typedef struct axis2_xml_schema_group_ref_impl
+ axis2_xml_schema_group_ref_impl_t;
/**
* @brief Other Extension Struct Impl
@@ -26,13 +27,18 @@
struct axis2_xml_schema_group_ref_impl
{
axis2_xml_schema_group_ref_t group_ref;
+
axis2_xml_schema_particle_t *base;
+
axis2_hash_t *methods;
+
axis2_qname_t *ref_qname;
+
axis2_xml_schema_group_base_t *particle;
};
-#define INTF_TO_IMPL(group_ref) ((axis2_xml_schema_group_ref_impl_t *) group_ref)
+#define AXIS2_INTF_TO_IMPL(group_ref) \
+ ((axis2_xml_schema_group_ref_impl_t *) group_ref)
axis2_status_t AXIS2_CALL
axis2_xml_schema_group_ref_free(void *group_ref,
@@ -68,15 +74,31 @@
group_ref_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_group_ref_impl_t));
-
+ if(!group_ref_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ group_ref_impl->group_ref.base.ops = NULL;
group_ref_impl->base = NULL;
group_ref_impl->methods = NULL;
group_ref_impl->ref_qname = NULL;
group_ref_impl->particle = NULL;
+ group_ref_impl->group_ref.ops = NULL;
+
group_ref_impl->group_ref.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_group_ref_ops_t));
-
- group_ref_impl->group_ref.ops->free = axis2_xml_schema_group_ref_free;
+
+ if(!group_ref_impl->group_ref.ops)
+ {
+ axis2_xml_schema_group_ref_free(&(group_ref_impl->group_ref), env);
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
+
+ group_ref_impl->group_ref.ops->free =
+ axis2_xml_schema_group_ref_free;
group_ref_impl->group_ref.ops->get_base_impl =
axis2_xml_schema_group_ref_get_base_impl;
group_ref_impl->group_ref.ops->get_ref_qname =
@@ -89,6 +111,7 @@
group_ref_impl->methods = axis2_hash_make(env);
if(!group_ref_impl->methods)
{
+ axis2_xml_schema_group_ref_free(&(group_ref_impl->group_ref), env);
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
@@ -102,6 +125,11 @@
AXIS2_HASH_KEY_STRING, axis2_xml_schema_group_ref_get_particle);
group_ref_impl->base = axis2_xml_schema_particle_create(env);
+ if(!group_ref_impl->base)
+ {
+ axis2_xml_schema_group_ref_free(&(group_ref_impl->group_ref), env);
+ return NULL;
+ }
status = axis2_xml_schema_particle_resolve_methods(
&(group_ref_impl->group_ref.base), env, group_ref_impl->base,
group_ref_impl->methods);
@@ -116,43 +144,44 @@
axis2_xml_schema_group_ref_impl_t *group_ref_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- group_ref_impl = INTF_TO_IMPL(group_ref);
+ group_ref_impl = AXIS2_INTF_TO_IMPL(group_ref);
- if(group_ref_impl->ref_qname)
+ if(NULL != group_ref_impl->ref_qname)
{
AXIS2_FREE((*env)->allocator, group_ref_impl->ref_qname);
group_ref_impl->ref_qname = NULL;
}
- if(group_ref_impl->particle)
+ if(NULL != group_ref_impl->particle)
{
AXIS2_XML_SCHEMA_GROUP_BASE_FREE(group_ref_impl->particle, env);
group_ref_impl->particle = NULL;
}
- if(group_ref_impl->methods)
+ if(NULL != group_ref_impl->methods)
{
axis2_hash_free(group_ref_impl->methods, env);
group_ref_impl->methods = NULL;
}
- if(group_ref_impl->base)
+ if(NULL != group_ref_impl->base)
{
AXIS2_XML_SCHEMA_PARTICLE_FREE(group_ref_impl->base, env);
group_ref_impl->base = NULL;
}
- if((&(group_ref_impl->group_ref))->ops)
+ if(NULL != group_ref_impl->group_ref.base.ops)
{
- AXIS2_FREE((*env)->allocator, (&(group_ref_impl->group_ref))->ops);
- (&(group_ref_impl->group_ref))->ops = NULL;
+ AXIS2_FREE((*env)->allocator, group_ref_impl->group_ref.base.ops);
+ group_ref_impl->group_ref.base.ops = NULL;
}
-
- if(group_ref_impl)
+ if(NULL != group_ref_impl->group_ref.ops)
{
- AXIS2_FREE((*env)->allocator, group_ref_impl);
- group_ref_impl = NULL;
+ AXIS2_FREE((*env)->allocator, group_ref_impl->group_ref.ops);
+ group_ref_impl->group_ref.ops = NULL;
}
+ AXIS2_FREE((*env)->allocator, group_ref_impl);
+ group_ref_impl = NULL;
return AXIS2_SUCCESS;
}
@@ -163,7 +192,7 @@
axis2_xml_schema_group_ref_impl_t *group_ref_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- group_ref_impl = INTF_TO_IMPL(group_ref);
+ group_ref_impl = AXIS2_INTF_TO_IMPL(group_ref);
return group_ref_impl->base;
}
@@ -204,8 +233,8 @@
axis2_xml_schema_group_ref_get_ref_qname(void *group_ref,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(group_ref)->ref_qname;
+ AXIS2_ENV_CHECK(env, NULL);
+ return AXIS2_INTF_TO_IMPL(group_ref)->ref_qname;
}
axis2_status_t AXIS2_CALL
@@ -216,7 +245,7 @@
axis2_xml_schema_group_ref_impl_t *group_ref_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- group_ref_impl = INTF_TO_IMPL(group_ref);
+ group_ref_impl = AXIS2_INTF_TO_IMPL(group_ref);
if(group_ref_impl->ref_qname)
{
@@ -236,7 +265,7 @@
axis2_xml_schema_group_ref_get_particle(void *group_ref,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(group_ref)->particle;
+ AXIS2_ENV_CHECK(env, NULL);
+ return AXIS2_INTF_TO_IMPL(group_ref)->particle;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_identity_constraint.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_identity_constraint.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_identity_constraint.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_identity_constraint.c Thu Apr 20 22:00:55 2006
@@ -14,9 +14,9 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_identity_constraint.h>
-#include <xml_schema/axis2_xml_schema_obj_collection.h>
-#include <xml_schema/axis2_xml_schema_xpath.h>
+#include <axis2_xml_schema_identity_constraint.h>
+#include <axis2_xml_schema_obj_collection.h>
+#include <axis2_xml_schema_xpath.h>
typedef struct axis2_xml_schema_identity_constraint_impl axis2_xml_schema_identity_constraint_impl_t;
@@ -34,7 +34,7 @@
axis2_xml_schema_xpath_t *selector;
};
-#define INTF_TO_IMPL(identity_constraint) ((axis2_xml_schema_identity_constraint_impl_t *) identity_constraint)
+#define AXIS2_INTF_TO_IMPL(identity_constraint) ((axis2_xml_schema_identity_constraint_impl_t *) identity_constraint)
axis2_status_t AXIS2_CALL
axis2_xml_schema_identity_constraint_free(void *identity_constraint,
@@ -132,7 +132,7 @@
axis2_xml_schema_identity_constraint_impl_t *identity_constraint_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- identity_constraint_impl = INTF_TO_IMPL(identity_constraint);
+ identity_constraint_impl = AXIS2_INTF_TO_IMPL(identity_constraint);
if(identity_constraint_impl->name)
{
@@ -179,7 +179,7 @@
axis2_xml_schema_identity_constraint_impl_t *identity_constraint_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- identity_constraint_impl = INTF_TO_IMPL(identity_constraint);
+ identity_constraint_impl = AXIS2_INTF_TO_IMPL(identity_constraint);
return identity_constraint_impl->annotated;
}
@@ -224,15 +224,15 @@
axis2_xml_schema_identity_constraint_get_fields(void *identity_constraint,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(identity_constraint)->fields;
+ AXIS2_ENV_CHECK(env, NULL);
+ return AXIS2_INTF_TO_IMPL(identity_constraint)->fields;
}
axis2_char_t *AXIS2_CALL
axis2_xml_schema_identity_constraint_get_name(void *identity_constraint,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(identity_constraint)->name;
+ AXIS2_ENV_CHECK(env, NULL);
+ return AXIS2_INTF_TO_IMPL(identity_constraint)->name;
}
axis2_status_t AXIS2_CALL
@@ -243,7 +243,7 @@
axis2_xml_schema_identity_constraint_impl_t *identity_constraint_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- identity_constraint_impl = INTF_TO_IMPL(identity_constraint);
+ identity_constraint_impl = AXIS2_INTF_TO_IMPL(identity_constraint);
if(identity_constraint_impl->name)
{
@@ -263,8 +263,8 @@
axis2_xml_schema_identity_constraint_get_selector(void *identity_constraint,
axis2_env_t **env)
{
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- return INTF_TO_IMPL(identity_constraint)->selector;
+ AXIS2_ENV_CHECK(env, NULL);
+ return AXIS2_INTF_TO_IMPL(identity_constraint)->selector;
}
axis2_status_t AXIS2_CALL
@@ -276,7 +276,7 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, selector, AXIS2_FAILURE);
- identity_constraint_impl = INTF_TO_IMPL(identity_constraint);
+ identity_constraint_impl = AXIS2_INTF_TO_IMPL(identity_constraint);
identity_constraint_impl->selector = selector;
return AXIS2_SUCCESS;
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_obj.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_obj.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_obj.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_obj.c Thu Apr 20 22:00:55 2006
@@ -14,7 +14,7 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_obj.h>
+#include <axis2_xml_schema_obj.h>
#include <axis2_hash.h>
typedef struct axis2_xml_schema_obj_impl axis2_xml_schema_obj_impl_t;
@@ -31,7 +31,9 @@
axis2_char_t *source_uri;
};
-#define INTF_TO_IMPL(obj) ((axis2_xml_schema_obj_impl_t *) obj)
+#define AXIS2_INTF_TO_IMPL(obj) ((axis2_xml_schema_obj_impl_t *) obj)
+
+/***************** function pointers ******************************************/
axis2_status_t AXIS2_CALL
axis2_xml_schema_obj_free(void *obj,
@@ -69,31 +71,54 @@
axis2_env_t **env,
int line_pos);
+/******************* end function pointers ************************************/
+
AXIS2_DECLARE(axis2_xml_schema_obj_t *)
axis2_xml_schema_obj_create(axis2_env_t **env)
{
axis2_xml_schema_obj_impl_t *obj_impl = NULL;
+ AXIS2_ENV_CHECK(env, NULL);
+
obj_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_obj_impl_t));
+ if(!obj_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error , AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
obj_impl->line_num = -1;
obj_impl->line_pos = -1;
obj_impl->source_uri = NULL;
-
+ obj_impl->obj.ops = NULL;
+
obj_impl->obj.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_obj_ops_t));
+ if(!obj_impl->obj.ops)
+ {
+ axis2_xml_schema_obj_free(&(obj_impl->obj), env);
+ AXIS2_ERROR_SET((*env)->error ,
+ AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
-
- obj_impl->obj.ops->free = axis2_xml_schema_obj_free;
- obj_impl->obj.ops->get_line_num = axis2_xml_schema_obj_get_line_num;
- obj_impl->obj.ops->set_line_num = axis2_xml_schema_obj_set_line_num;
- obj_impl->obj.ops->get_line_pos = axis2_xml_schema_obj_get_line_pos;
- obj_impl->obj.ops->set_line_pos = axis2_xml_schema_obj_set_line_pos;
- obj_impl->obj.ops->get_source_uri = axis2_xml_schema_obj_get_source_uri;
- obj_impl->obj.ops->set_source_uri = axis2_xml_schema_obj_set_source_uri;
- obj_impl->obj.ops->equals = axis2_xml_schema_obj_equals;
-
+ obj_impl->obj.ops->free =
+ axis2_xml_schema_obj_free;
+ obj_impl->obj.ops->get_line_num =
+ axis2_xml_schema_obj_get_line_num;
+ obj_impl->obj.ops->set_line_num =
+ axis2_xml_schema_obj_set_line_num;
+ obj_impl->obj.ops->get_line_pos =
+ axis2_xml_schema_obj_get_line_pos;
+ obj_impl->obj.ops->set_line_pos =
+ axis2_xml_schema_obj_set_line_pos;
+ obj_impl->obj.ops->get_source_uri =
+ axis2_xml_schema_obj_get_source_uri;
+ obj_impl->obj.ops->set_source_uri =
+ axis2_xml_schema_obj_set_source_uri;
+ obj_impl->obj.ops->equals =
+ axis2_xml_schema_obj_equals;
return &(obj_impl->obj);
}
@@ -104,23 +129,23 @@
{
axis2_xml_schema_obj_impl_t *obj_impl = NULL;
- obj_impl = INTF_TO_IMPL(obj);
+ obj_impl = AXIS2_INTF_TO_IMPL(obj);
- if(obj_impl->source_uri)
+ if(NULL != obj_impl->source_uri)
{
AXIS2_FREE((*env)->allocator, obj_impl->source_uri);
obj_impl->source_uri = NULL;
}
- if((&(obj_impl->obj))->ops)
+ if(NULL != obj_impl->obj.ops)
{
- free((&(obj_impl->obj))->ops);
- (&(obj_impl->obj))->ops = NULL;
+ AXIS2_FREE((*env)->allocator, obj_impl->obj.ops);
+ obj_impl->obj.ops = NULL;
}
- if(obj_impl)
+ if(NULL != obj_impl)
{
- free(obj_impl);
+ AXIS2_FREE((*env)->allocator, obj_impl);
obj_impl = NULL;
}
return AXIS2_SUCCESS;
@@ -142,8 +167,15 @@
obj->ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_obj_ops_t));
+ if(!obj->ops)
+ {
+ AXIS2_ERROR_SET((*env)->error , AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return AXIS2_FAILURE;
+ }
+
obj->ops->free = axis2_hash_get(methods, "free",
AXIS2_HASH_KEY_STRING);
+
obj->ops->get_line_num =
obj_impl_l->obj.ops->get_line_num;
obj->ops->set_line_num =
@@ -156,8 +188,8 @@
obj_impl_l->obj.ops->get_source_uri;
obj->ops->set_source_uri =
obj_impl_l->obj.ops->set_source_uri;
- obj->ops->equals =
- obj_impl_l->obj.ops->equals;
+ obj->ops->equals = obj_impl_l->obj.ops->equals;
+
return AXIS2_SUCCESS;
}
@@ -167,7 +199,7 @@
{
axis2_xml_schema_obj_impl_t *obj_impl = NULL;
- obj_impl = INTF_TO_IMPL(obj);
+ obj_impl = AXIS2_INTF_TO_IMPL(obj);
return obj_impl->line_num;
}
@@ -178,7 +210,7 @@
{
axis2_xml_schema_obj_impl_t *obj_impl = NULL;
- obj_impl = INTF_TO_IMPL(obj);
+ obj_impl = AXIS2_INTF_TO_IMPL(obj);
obj_impl->line_num = line_num;
@@ -191,7 +223,7 @@
{
axis2_xml_schema_obj_impl_t *obj_impl = NULL;
- obj_impl = INTF_TO_IMPL(obj);
+ obj_impl = AXIS2_INTF_TO_IMPL(obj);
return obj_impl->line_pos;
}
@@ -202,7 +234,7 @@
{
axis2_xml_schema_obj_impl_t *obj_impl = NULL;
- obj_impl = INTF_TO_IMPL(obj);
+ obj_impl = AXIS2_INTF_TO_IMPL(obj);
obj_impl->line_pos = line_pos;
@@ -215,7 +247,7 @@
{
axis2_xml_schema_obj_impl_t *obj_impl = NULL;
- obj_impl = INTF_TO_IMPL(obj);
+ obj_impl = AXIS2_INTF_TO_IMPL(obj);
return obj_impl->source_uri;
}
@@ -226,11 +258,11 @@
{
axis2_xml_schema_obj_impl_t *obj_impl = NULL;
- obj_impl = INTF_TO_IMPL(obj);
+ obj_impl = AXIS2_INTF_TO_IMPL(obj);
- if(obj_impl->source_uri)
+ if(NULL != obj_impl->source_uri)
{
- free(obj_impl->source_uri);
+ AXIS2_FREE((*env)->allocator, obj_impl->source_uri);
obj_impl->source_uri = NULL;
}
obj_impl->source_uri = AXIS2_STRDUP(source_uri, env);
@@ -245,7 +277,7 @@
{
axis2_xml_schema_obj_impl_t *obj_impl = NULL;
- obj_impl = INTF_TO_IMPL(obj);
+ obj_impl = AXIS2_INTF_TO_IMPL(obj);
return AXIS2_TRUE;
}
Modified: webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_obj_collection.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_obj_collection.c?rev=395780&r1=395779&r2=395780&view=diff
==============================================================================
--- webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_obj_collection.c (original)
+++ webservices/axis2/trunk/c/modules/xml/xml_schema/xml_schema_obj_collection.c Thu Apr 20 22:00:55 2006
@@ -14,10 +14,11 @@
* limitations under the License.
*/
-#include <xml_schema/axis2_xml_schema_obj_collection.h>
+#include <axis2_xml_schema_obj_collection.h>
#include <axis2_hash.h>
-typedef struct axis2_xml_schema_obj_collection_impl axis2_xml_schema_obj_collection_impl_t;
+typedef struct axis2_xml_schema_obj_collection_impl
+ axis2_xml_schema_obj_collection_impl_t;
/**
* @brief Xml Schema Obj Struct Impl
@@ -29,46 +30,54 @@
axis2_array_list_t *objs;
};
-#define INTF_TO_IMPL(obj_collection) ((axis2_xml_schema_obj_collection_impl_t *) obj_collection)
+#define AXIS2_INTF_TO_IMPL(obj_collection) \
+ ((axis2_xml_schema_obj_collection_impl_t *) obj_collection)
+
+/**************************** end function prototypes ************************/
axis2_status_t AXIS2_CALL
-axis2_xml_schema_obj_collection_free(void *obj_collection,
+axis2_xml_schema_obj_collection_free(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env);
int AXIS2_CALL
-axis2_xml_schema_obj_collection_get_count(void *obj_collection,
+axis2_xml_schema_obj_collection_get_count(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env);
axis2_xml_schema_obj_t *AXIS2_CALL
-axis2_xml_schema_obj_collection_get_item(void *obj_collection,
+axis2_xml_schema_obj_collection_get_item(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env,
int i);
axis2_status_t AXIS2_CALL
-axis2_xml_schema_obj_collection_set_item(void *obj_collection,
+axis2_xml_schema_obj_collection_set_item(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env,
int i,
axis2_xml_schema_obj_t *item);
axis2_status_t AXIS2_CALL
-axis2_xml_schema_obj_collection_add(void *obj_collection,
+axis2_xml_schema_obj_collection_add(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env,
axis2_xml_schema_obj_t *item);
axis2_bool_t AXIS2_CALL
-axis2_xml_schema_obj_collection_contains(void *obj_collection,
+axis2_xml_schema_obj_collection_contains(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env,
axis2_xml_schema_obj_t *item);
int AXIS2_CALL
-axis2_xml_schema_obj_collection_index_of(void *obj_collection,
+axis2_xml_schema_obj_collection_index_of(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env,
axis2_xml_schema_obj_t *item);
-axis2_status_t AXIS2_CALL
-axis2_xml_schema_obj_collection_remove_at(void *obj_collection,
+void* AXIS2_CALL
+axis2_xml_schema_obj_collection_remove_at(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env,
int index);
+axis2_array_list_t* AXIS2_CALL
+axis2_xml_schema_obj_collection_to_array(axis2_xml_schema_obj_collection_t *obj_collection,
+ axis2_env_t **env);
+
+/**************************** end function prototypes ************************/
AXIS2_DECLARE(axis2_xml_schema_obj_collection_t *)
axis2_xml_schema_obj_collection_create(axis2_env_t **env)
@@ -77,15 +86,20 @@
obj_collection_impl = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_obj_collection_impl_t));
-
+ if(!obj_collection_impl)
+ {
+ AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
+ return NULL;
+ }
obj_collection_impl->objs = NULL;
-
+
obj_collection_impl->obj_collection.ops = AXIS2_MALLOC((*env)->allocator,
sizeof(axis2_xml_schema_obj_collection_ops_t));
obj_collection_impl->objs = axis2_array_list_create(env, 0);
if(!obj_collection_impl->objs)
{
+ axis2_xml_schema_obj_collection_free(&(obj_collection_impl->obj_collection), env);
AXIS2_ERROR_SET((*env)->error, AXIS2_ERROR_NO_MEMORY, AXIS2_FAILURE);
return NULL;
}
@@ -111,94 +125,55 @@
axis2_status_t AXIS2_CALL
-axis2_xml_schema_obj_collection_free(void *obj_collection,
+axis2_xml_schema_obj_collection_free(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env)
{
axis2_xml_schema_obj_collection_impl_t *obj_collection_impl = NULL;
- obj_collection_impl = INTF_TO_IMPL(obj_collection);
+ obj_collection_impl = AXIS2_INTF_TO_IMPL(obj_collection);
- if(obj_collection_impl->objs)
+ if(NULL != obj_collection_impl->objs)
{
AXIS2_ARRAY_LIST_FREE(obj_collection_impl->objs, env);
obj_collection_impl->objs = NULL;
}
- if((&(obj_collection_impl->obj_collection))->ops)
+ if(NULL != obj_collection_impl->obj_collection.ops)
{
- free((&(obj_collection_impl->obj_collection))->ops);
- (&(obj_collection_impl->obj_collection))->ops = NULL;
+ AXIS2_FREE((*env)->allocator, obj_collection_impl->obj_collection.ops);
+ obj_collection_impl->obj_collection.ops = NULL;
}
- if(obj_collection_impl)
- {
- free(obj_collection_impl);
- obj_collection_impl = NULL;
- }
+ AXIS2_FREE((*env)->allocator, obj_collection_impl);
+ obj_collection_impl = NULL;
return AXIS2_SUCCESS;
}
-AXIS2_DECLARE(axis2_status_t)
-axis2_xml_schema_obj_collection_resolve_methods(
- axis2_xml_schema_obj_collection_t *obj_collection,
- axis2_env_t **env,
- axis2_xml_schema_obj_collection_t *obj_collection_impl,
- axis2_hash_t *methods)
-{
- axis2_xml_schema_obj_collection_impl_t *obj_collection_impl_l = NULL;
-
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, obj_collection_impl, AXIS2_FAILURE);
- AXIS2_PARAM_CHECK((*env)->error, methods, AXIS2_FAILURE);
-
- obj_collection_impl_l = (axis2_xml_schema_obj_collection_impl_t *) obj_collection_impl;
-
- obj_collection->ops = AXIS2_MALLOC((*env)->allocator,
- sizeof(axis2_xml_schema_obj_collection_ops_t));
- obj_collection->ops->free = axis2_hash_get(methods, "free",
- AXIS2_HASH_KEY_STRING);
- obj_collection->ops->get_count =
- obj_collection_impl_l->obj_collection.ops->get_count;
- obj_collection->ops->get_item =
- obj_collection_impl_l->obj_collection.ops->get_item;
- obj_collection->ops->set_item =
- obj_collection_impl_l->obj_collection.ops->set_item;
- obj_collection->ops->add =
- obj_collection_impl_l->obj_collection.ops->add;
- obj_collection->ops->contains =
- obj_collection_impl_l->obj_collection.ops->contains;
- obj_collection->ops->index_of =
- obj_collection_impl_l->obj_collection.ops->index_of;
- obj_collection->ops->remove_at =
- obj_collection_impl_l->obj_collection.ops->remove_at;
- return AXIS2_SUCCESS;
-
-}
int AXIS2_CALL
-axis2_xml_schema_obj_collection_get_count(void *obj_collection,
+axis2_xml_schema_obj_collection_get_count(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env)
{
axis2_xml_schema_obj_collection_impl_t *obj_collection_impl = NULL;
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- obj_collection_impl = INTF_TO_IMPL(obj_collection);
+ obj_collection_impl = AXIS2_INTF_TO_IMPL(obj_collection);
return AXIS2_ARRAY_LIST_SIZE(obj_collection_impl->objs, env);
}
axis2_xml_schema_obj_t *AXIS2_CALL
-axis2_xml_schema_obj_collection_get_item(void *obj_collection,
+axis2_xml_schema_obj_collection_get_item(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env,
int i)
{
axis2_xml_schema_obj_collection_impl_t *obj_collection_impl = NULL;
AXIS2_ENV_CHECK(env, NULL);
- obj_collection_impl = INTF_TO_IMPL(obj_collection);
+ obj_collection_impl = AXIS2_INTF_TO_IMPL(obj_collection);
return AXIS2_ARRAY_LIST_GET(obj_collection_impl->objs, env, i);
}
axis2_status_t AXIS2_CALL
-axis2_xml_schema_obj_collection_set_item(void *obj_collection,
+axis2_xml_schema_obj_collection_set_item(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env,
int i,
axis2_xml_schema_obj_t *item)
@@ -207,14 +182,14 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, item, AXIS2_FAILURE);
- obj_collection_impl = INTF_TO_IMPL(obj_collection);
+ obj_collection_impl = AXIS2_INTF_TO_IMPL(obj_collection);
AXIS2_ARRAY_LIST_SET(obj_collection_impl->objs, env, i, item);
return AXIS2_SUCCESS;
}
axis2_status_t AXIS2_CALL
-axis2_xml_schema_obj_collection_add(void *obj_collection,
+axis2_xml_schema_obj_collection_add(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env,
axis2_xml_schema_obj_t *item)
{
@@ -222,12 +197,12 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, item, AXIS2_FAILURE);
- obj_collection_impl = INTF_TO_IMPL(obj_collection);
+ obj_collection_impl = AXIS2_INTF_TO_IMPL(obj_collection);
return AXIS2_ARRAY_LIST_ADD(obj_collection_impl->objs, env, item);
}
axis2_bool_t AXIS2_CALL
-axis2_xml_schema_obj_collection_contains(void *obj_collection,
+axis2_xml_schema_obj_collection_contains(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env,
axis2_xml_schema_obj_t *item)
{
@@ -235,13 +210,13 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, item, AXIS2_FAILURE);
- obj_collection_impl = INTF_TO_IMPL(obj_collection);
+ obj_collection_impl = AXIS2_INTF_TO_IMPL(obj_collection);
return AXIS2_ARRAY_LIST_CONTAINS(obj_collection_impl->objs, env, item);
}
int AXIS2_CALL
-axis2_xml_schema_obj_collection_index_of(void *obj_collection,
+axis2_xml_schema_obj_collection_index_of(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env,
axis2_xml_schema_obj_t *item)
{
@@ -249,26 +224,29 @@
AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
AXIS2_PARAM_CHECK((*env)->error, item, AXIS2_FAILURE);
- obj_collection_impl = INTF_TO_IMPL(obj_collection);
+ obj_collection_impl = AXIS2_INTF_TO_IMPL(obj_collection);
return AXIS2_ARRAY_LIST_INDEX_OF(obj_collection_impl->objs, env, item);
}
-axis2_status_t AXIS2_CALL
-axis2_xml_schema_obj_collection_remove_at(void *obj_collection,
+void* AXIS2_CALL
+axis2_xml_schema_obj_collection_remove_at(axis2_xml_schema_obj_collection_t *obj_collection,
axis2_env_t **env,
int index)
{
axis2_xml_schema_obj_collection_impl_t *obj_collection_impl = NULL;
void *item = NULL;
- AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
- obj_collection_impl = INTF_TO_IMPL(obj_collection);
+ AXIS2_ENV_CHECK(env, NULL);
+ obj_collection_impl = AXIS2_INTF_TO_IMPL(obj_collection);
item = AXIS2_ARRAY_LIST_REMOVE(obj_collection_impl->objs, env, index);
- if(!item)
- return AXIS2_FAILURE;
- return AXIS2_SUCCESS;
+ return item;
}
-
+axis2_array_list_t* AXIS2_CALL
+axis2_xml_schema_obj_collection_to_array(axis2_xml_schema_obj_collection_t *obj_collection,
+ axis2_env_t **env)
+{
+ return AXIS2_INTF_TO_IMPL(obj_collection)->objs;
+}