upnp/src/gena/gena_device.c
static int GeneratePropertySet(
	/*! [in] Array of variable names (go in the event notify). */
	char **names,
	/*! [in] Array of variable values (go in the event notify). */
	char **values,
	/*! [in] number of variables. */
	int count,
	/*! [out] PropertySet node in the string format. */
	DOMString *out)
{
	char *buffer;
	int counter = 0;
	size_t size = 0;

	/*size += strlen(XML_VERSION);*/
	size += strlen(XML_PROPERTYSET_HEADER);
	size += strlen("</e:propertyset>\n\n");
	for (counter = 0; counter < count; counter++) {
		size += strlen( "<e:property>\n</e:property>\n" );
		size += 2 * strlen(names[counter]) +
			strlen(values[counter]) +
			strlen("<></>\n");
	}

	buffer = (char *)malloc(size + 1);
	if (buffer == NULL)
		return UPNP_E_OUTOF_MEMORY;
	memset(buffer, 0, size + 1);
	/*
	strcpy(buffer,XML_VERSION);
	strcat(buffer, XML_PROPERTYSET_HEADER);
	*/
	strcpy(buffer, XML_PROPERTYSET_HEADER);
	for (counter = 0; counter < count; counter++) {
		strcat(buffer, "<e:property>\n");
		sprintf(&buffer[strlen(buffer)],
			"<%s>%s</%s>\n</e:property>\n",
			names[counter],
			values[counter],
			names[counter]);
	}
	strcat(buffer, "</e:propertyset>\n\n");
	*out = ixmlCloneDOMString(buffer);
	free(buffer);

	return XML_SUCCESS;
}
/*!
 * \brief Generates XML property set for notifications.
 *
 * \return UPNP_E_SUCCESS if successful else returns GENA_E_BAD_HANDLE.
 *
 * \note The XML_VERSION comment is NOT sent due to interoperability issues
 * 	with other UPnP vendors.
 */
\brief Generates XML property set for notifications.
\return UPNP_E_SUCCESS if successful else returns GENA_E_BAD_HANDLE.

\note The XML_VERSION comment is NOT sent due to interoperability issues
with other UPnP vendors.
\ brief Generates XML property set for notifications . \ return UPNP_E_SUCCESS if successful else returns GENA_E_BAD_HANDLE . \ note The XML_VERSION comment is NOT sent due to interoperability issues with other UPnP vendors .
static int GeneratePropertySet(
	char **names,
	char **values,
	int count,
	DOMString *out)
{
	char *buffer;
	int counter = 0;
	size_t size = 0;
	size += strlen(XML_PROPERTYSET_HEADER);
	size += strlen("</e:propertyset>\n\n");
	for (counter = 0; counter < count; counter++) {
		size += strlen( "<e:property>\n</e:property>\n" );
		size += 2 * strlen(names[counter]) +
			strlen(values[counter]) +
			strlen("<></>\n");
	}
	buffer = (char *)malloc(size + 1);
	if (buffer == NULL)
		return UPNP_E_OUTOF_MEMORY;
	memset(buffer, 0, size + 1);
	strcpy(buffer, XML_PROPERTYSET_HEADER);
	for (counter = 0; counter < count; counter++) {
		strcat(buffer, "<e:property>\n");
		sprintf(&buffer[strlen(buffer)],
			"<%s>%s</%s>\n</e:property>\n",
			names[counter],
			values[counter],
			names[counter]);
	}
	strcat(buffer, "</e:propertyset>\n\n");
	*out = ixmlCloneDOMString(buffer);
	free(buffer);
	return XML_SUCCESS;
}
static int GeneratePropertySet ( char * * names , char * * values , int count , DOMString * out ) { char * buffer ; int counter = 0 ; size_t size = 0 ; size += strlen ( XML_PROPERTYSET_HEADER ) ; size += strlen ( " \n \n " ) ; for ( counter = 0 ; counter < count ; counter ++ ) { size += strlen ( " \n \n " ) ; size += 2 * strlen ( names [ counter ] ) + strlen ( values [ counter ] ) + strlen ( " \n " ) ; } buffer = ( char * ) malloc ( size + 1 ) ; if ( buffer == NULL ) return UPNP_E_OUTOF_MEMORY ; memset ( buffer , 0 , size + 1 ) ; strcpy ( buffer , XML_PROPERTYSET_HEADER ) ; for ( counter = 0 ; counter < count ; counter ++ ) { strcat ( buffer , " \n " ) ; sprintf ( & buffer [ strlen ( buffer ) ] , " \n \n " , names [ counter ] , values [ counter ] , names [ counter ] ) ; } strcat ( buffer , " \n \n " ) ; * out = ixmlCloneDOMString ( buffer ) ; free ( buffer ) ; return XML_SUCCESS ; }
\brief Generates XML property set for notifications.
\ brief Generates XML property set for notifications .
/*! [in] Array of variable names (go in the event notify). */ /*! [in] Array of variable values (go in the event notify). */ /*! [in] number of variables. */ /*! [out] PropertySet node in the string format. */ /*size += strlen(XML_VERSION);*/ /*
	strcpy(buffer,XML_VERSION);
	strcat(buffer, XML_PROPERTYSET_HEADER);
	*/