library/src/utility/BP-StringUtilities.cc
// Encodes a single character as chr(dec)
Encodes a single character as chr(dec)
Encodes a single character as chr ( dec )
char * BP_GenUCharAsPHPChr(unsigned char val, P_BP_LINKL tq)
{
	char *out_buff = NULL;
	if(tq)
		out_buff = (char *) tq_calloc(tq, 16, 1, BPLN);
	else
		out_buff = (char *) bpcalloc(16, 1);
	sprintf(out_buff, "chr(%u)", (unsigned char) val);
	if(out_buff && tq)
	{
		P_BP_LINKL_DATA linkl_data = BP_BackwardLookupDataItemFromPointer(tq, out_buff);
		linkl_data->data_type = BP_MEMPROF_ALLOC_TYPE_USER_DEFINED_ASCII;
	}
	return out_buff;
}
char * BP_GenUCharAsPHPChr ( unsigned char val , P_BP_LINKL tq ) { char * out_buff = NULL ; if ( tq ) out_buff = ( char * ) tq_calloc ( tq , 16 , 1 , BPLN ) ; else out_buff = ( char * ) bpcalloc ( 16 , 1 ) ; sprintf ( out_buff , " " , ( unsigned char ) val ) ; if ( out_buff && tq ) { P_BP_LINKL_DATA linkl_data = BP_BackwardLookupDataItemFromPointer ( tq , out_buff ) ; linkl_data -> data_type = BP_MEMPROF_ALLOC_TYPE_USER_DEFINED_ASCII ; } return out_buff ; }
Encodes a single character as chr(dec)
Encodes a single character as chr ( dec )
// DONT CHECK VALUES, AS EVERY BYTE FROM 0x00 to 0xff ARE VALID // define output buffer // allocate using tailqueue if we have one, if not use normal calloc // create the buffer // If the out buffer was generated ok, and the tail queue is set, // change the type of the assigned chunk to user defined ascii.  This // allows the List flattener to work on this chunk (if not it'd be considered // a binary calloc chunk) // set data type via manual means since we're creating a string // set the data type here // return the filled out buffer