DefaultSFSDataSerializer bug

Post here your questions about the C++ API for SFS2X

Moderators: Lapo, Bax, MBagnati

Post Reply
bqlf1907
Posts: 25
Joined: 13 May 2013, 10:28

DefaultSFSDataSerializer bug

Post by bqlf1907 »

Code: Select all

SFSDataWrapper* DefaultSFSDataSerializer::BinDecode_BYTE_ARRAY(ByteArray* buffer)
{
	long int size;
	buffer->ReadInt(size);
			
	if (size < 0) 
	{
		string* err = new string();
		 
		string* format = new string("Array negative size: %d");
		StringFormatter<long int> (err, format, size);

		delete format;
		format = NULL;

		boost::shared_ptr<SFSCodecError> exception(new SFSCodecError(err));
		throw exception;
	}
	
	// copy bytes
	vector<unsigned char> values;
	buffer->ReadBytes(size, values);
	ByteArray* arrayobj = new ByteArray(&values);

	return new SFSDataWrapper(SFSDATATYPE_BYTE_ARRAY, arrayobj);
}

modify

Code: Select all

        ........
        //ByteArray* arrayobj = new ByteArray(&values);
	//modify bqlf1907
	ByteArray* arrayobj = new ByteArray();
	arrayobj->WriteBytes(&values);
        .......
MBagnati
Posts: 126
Joined: 12 Feb 2013, 10:57

Re: DefaultSFSDataSerializer bug

Post by MBagnati »

I have inserted your change into the API software so it will be delivered into next version
Thanks
Post Reply