
On Thu, 2014-02-20 at 23:34 +0100, Johan Engelen wrote:
I don't fully understand your question, but eventually, pretty much everything of Inkscape should use std::string. So it's good not to add any C-string stuff, to make the refactoring easier.
I agree. Although it's good to make sure that these things are being done right.
I've put everything in a new branch and I'm going to be asking for a full review when it's ready. Might take a while to get image.cpp done though.
use char*, if that is how the uri was stored in the first place. So you'd have to look at who will call parseDataUri and if they have the uri in a std::string or char*
parseDataUri is a private function for uri.cpp to store data from a data uri instead of passing the uri to libxml's uri handling which doesn't handle data uris.
So in the case of normal urls, the data gets copied by libxml. In the case of data uris, the fewer copies the better. So, instead of using cstring, how to say:
const char *preformed = "data:..........."
if preformed[:5] == "data:": // this is a data uri and we're going to parse it
Like this daft conditional:?
if(p[0]=='d' && p[1] =='a' && p[2] == 't' && p[3] =='a' && p[4]==':'){ ... }
I was also going to store the const char offsets to the data and only feed back the conversion from base64 when needed as part of a stream pattern which would feed gdk image creation.
1. Is this safe, the char is owned by the same object that creates the URI object. Technically they should both be still in use? 2. Would this work?
Martin,