library/src/javascript/JSON/BP-JSON.cc
// access an entry as a unsigned long long (conversion status is stored in convert_status_in_out)
access an entry as a unsigned long long (conversion status is stored in convert_status_in_out)
access an entry as a unsigned long long ( conversion status is stored in convert_status_in_out )
unsigned long long BP_JSONAccessEntryAsUnsignedLongLong(P_BP_HASH_TABLE_KEYED_ENTRY entry, BP_BOOL * convert_status_in_out)
{
	if(!entry)
		return NULL;
	if(!entry->data)
		return NULL;
	if(!entry->data_size)
		return NULL;
	if(!BP_StringIsReasonableForUnsignedIntegerASCII((char *) entry->data, entry->data_size - 1))
	{
		if(convert_status_in_out)
			*convert_status_in_out = BP_FALSE;
		return 0;
	}
	errno = 0;
	unsigned long long ret_val = strtoull((char *) entry->data, NULL, 10);
	if(errno == EINVAL || errno == ERANGE)
	{
		if(convert_status_in_out)
			*convert_status_in_out = BP_FALSE;
		return 0;
	}
	 to success!
	if(convert_status_in_out)
		*convert_status_in_out = BP_TRUE;
	return ret_val;
}
unsigned long long BP_JSONAccessEntryAsUnsignedLongLong ( P_BP_HASH_TABLE_KEYED_ENTRY entry , BP_BOOL * convert_status_in_out ) { if ( ! entry ) return NULL ; if ( ! entry -> data ) return NULL ; if ( ! entry -> data_size ) return NULL ; if ( ! BP_StringIsReasonableForUnsignedIntegerASCII ( ( char * ) entry -> data , entry -> data_size - 1 ) ) { if ( convert_status_in_out ) * convert_status_in_out = BP_FALSE ; return 0 ; } errno = 0 ; unsigned long long ret_val = strtoull ( ( char * ) entry -> data , NULL , 10 ) ; if ( errno == EINVAL || errno == ERANGE ) { if ( convert_status_in_out ) * convert_status_in_out = BP_FALSE ; return 0 ; } if ( convert_status_in_out ) * convert_status_in_out = BP_TRUE ; return ret_val ; }
access an entry as a unsigned long long (conversion status is stored in convert_status_in_out)
access an entry as a unsigned long long ( conversion status is stored in convert_status_in_out )
// ensure we have an entry // set the conversion status // return zero for failure // set errno before conversion call // run errno checks to ensure conversion occured ok // set convert status // exit // set convert status to success! // return the ret val