You are viewing a plain text version of this content. The canonical link for it is here.
Posted to c-dev@axis.apache.org by "Dimuthu Gamage (JIRA)" <ji...@apache.org> on 2008/06/10 05:45:44 UTC

[jira] Resolved: (AXIS2C-1159) warning: 'k' is used uninitialized in this function

     [ https://issues.apache.org/jira/browse/AXIS2C-1159?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dimuthu Gamage resolved AXIS2C-1159.
------------------------------------

    Resolution: Fixed

Fixed in the latest svn.
The intention of the check is to avoid setting NULL value if it makes the array size less than minOccurs.
Since primitive values we don't have to check whether it is NULL, we don't need this check.
And renamed the variable name 'k' to 'non_nil_count', so it is more readable.

> warning: 'k' is used uninitialized in this function
> ---------------------------------------------------
>
>                 Key: AXIS2C-1159
>                 URL: https://issues.apache.org/jira/browse/AXIS2C-1159
>             Project: Axis2-C
>          Issue Type: Bug
>          Components: code generation
>    Affects Versions: 1.4.0
>         Environment: linux fc5
>            Reporter: Frederic Heem
>
> The warning "'k' is used uninitialized in this function" is much more than a warning, it's a real bug that will be hard to solved if not cured correclty. 
> Here is the piece of WSDL that cause the problem:
> 			<xsd:element name="ActiveEndpointResponseParam">
> 				<xsd:complexType>
> 					<xsd:sequence>
> 						<xsd:element name="activeEndpoint" type="xsd:unsignedShort" minOccurs="0" maxOccurs="256"/>
> 					</xsd:sequence>
> 				</xsd:complexType>
> 			</xsd:element>
> This is the generated code:
>             axis2_status_t AXIS2_CALL
>             adb_ActiveEndpointResponseParam_set_activeEndpoint_at(
>                     adb_ActiveEndpointResponseParam_t* _ActiveEndpointResponseParam,
>                     const axutil_env_t *env, int i,
>                     const unsigned short arg_activeEndpoint)
>             {
>                 void *element = NULL;
>                 int size = 0;
>                 int j;
>                 int k;
>                 axis2_bool_t non_nil_exists = AXIS2_FALSE;
>                 unsigned short* ptr_param_activeEndpoint;
>                 
>                 AXIS2_ENV_CHECK(env, AXIS2_FAILURE);
>                 AXIS2_PARAM_CHECK(env->error, _ActiveEndpointResponseParam, AXIS2_FAILURE);
>                 
>                 if( _ActiveEndpointResponseParam->is_valid_activeEndpoint &&
>                     _ActiveEndpointResponseParam->property_activeEndpoint &&
>                 
>                     arg_activeEndpoint == *((unsigned short*)axutil_array_list_get(_ActiveEndpointResponseParam->property_activeEndpoint, env, i)))
>                   
>                 {
>                     
>                     return AXIS2_SUCCESS; 
>                 }
>                 
>                      non_nil_exists = AXIS2_TRUE; /* no way to check for nill for each elements for primitive types */
>                   
>                 if( k < 0)
>                 {
>                        AXIS2_LOG_ERROR(env->log, AXIS2_LOG_SI, "Size of the array of activeEndpoint is beinng set to be smaller than the specificed number of minOccurs(0)");
>                        return AXIS2_FAILURE;
>                 }

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.


---------------------------------------------------------------------
To unsubscribe, e-mail: axis-c-dev-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-c-dev-help@ws.apache.org