
Hi, all,
After digging around the code looking for a particular bug, I was struck by the fact that although Inkscape went through the "c++ification" process almost 2 years ago, a great many of the classes are still merely wrappers of the legacy code. One thing I noticed in particular was that char *'s are still used in most of the code for the storage of file names and xml string data.
Wouldn't this cycle be a good time to convert these to Glib::ustring? We would get at least three benefits: 1) A uniform container and set of methods for Unicode data 2) Greater pointer safety if we can avoid countless explicit alloc/frees. 3) It would be harder to go out of bounds, since the string carries its size. And if you do, it is an exception, not a malloc or stack corruption.
I'm not talking about the GC'd stuff, but those so frequent snips of code like this:
if (uri) g_free(uri); uri = g_strdup(newuri);
In addition, shouldn't a document's "DocumentBase" uri (and resources it references) be a real W3C URI, or even an IRI? That way we can get a consistent method for referring to things, rather than always calculating paths explicitly all over the code tree.
Just a suggestion! :)
bob

On 22/06/06, Bob Jamison <rwjj@...127...> wrote:
Hi, all, [ snip ]
In addition, shouldn't a document's "DocumentBase" uri (and resources it references) be a real W3C URI, or even an IRI? That way we can get a consistent method for referring to things, rather than always calculating paths explicitly all over the code tree.
Just a suggestion! :)
It is a perfectly good suggestion. I noticed the same same thing in the XML code. When Inkscape wants to read an XML file, it passes the path in a C string to the XML module (which is pretty much the only interface to the XML module). I assumed that this was established long ago, and works, or at least works well enough, to not need changing.
My first idea would have been to have a 'file interface' and a 'local file' implementation, but your idea seems better.
What I can't estimate, is whether it is worth doing!
.Ben

On Jun 22, 2006, at 3:46 PM, MenTaLguY wrote:
On Thu, 2006-06-22 at 16:55 -0500, Bob Jamison wrote:
In addition, shouldn't a document's "DocumentBase" uri (and resources it references) be a real W3C URI, or even an IRI?
I personally think we should create an IRI class and use that for _everything_.
I agree... at least for things that file filepaths, etc.
maybe a *few* things might be bare strings, but we probably want to get things more logial like "IRI"
participants (4)
-
Ben Fowler
-
Bob Jamison
-
Jon A. Cruz
-
MenTaLguY