Thanks for the reply Stefan,

that memcpy() does not make much sense to me. I assume the aim is to append
the stuff in extraData at the end of event. However, if you set the
destination address as event + 1 arent you overwriting the data that belongs
to ConfigEvent? Wouldnt the proper dst address for the memcpy be event +
sizeof(configEvent) + 1?

The code currently looks as follows:

static eOgreLoadSceneEvent* loadEventPrepareForSending(std::string
filenameIn)
        {
                eOgreLoadSceneEvent* eventOut;
                const size_t filenameSize = (filenameIn.length() + 1) * 
sizeof(char);
                const size_t totalSize = filenameSize + sizeof(eq::ConfigEvent);
                eventOut = reinterpret_cast<eOgreLoadSceneEvent*>(malloc( 
totalSize ));
                eventOut->data.type = eOgreLoadSceneEvent::LOADSCENE;
                eventOut->size = totalSize;
                memcpy(eventOut + 1, filenameIn.c_str(), filenameSize);
                return eventOut;
        }

        static char* loadEventUnpackFilename(eOgreLoadSceneEvent* eventIn)
        {
                const size_t filenameSize = eventIn->size - 
sizeof(eq::ConfigEvent);
                char * chars = (char*) malloc(filenameSize * sizeof(char));
                memcpy(chars, eventIn + 1, filenameSize);
                return chars;
        }

(eOgreLoadSceneEvent just extends ConfigEvent, nothing extra is added)

After I send the packet, equalizer returns a "Abort: Unknown data type"
error and quits with a fatal error. 

If I change the memcpy to :
memcpy(eventOut + sizeof(eq::ConfigEvent) + 1, filenameIn.c_str(),
filenameSize);
I get an access violation while writing, which seems extremely odd
considering that I malloc enough room...


Any ideas?

-- 
View this message in context: 
http://n2.nabble.com/Propagating-non-static-size-input-data-through-ConfigEvents-tp4753149p4892454.html
Sent from the Equalizer - Parallel Rendering mailing list archive at Nabble.com.

_______________________________________________
eq-dev mailing list
[email protected]
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Reply via email to