You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jun 11, 2022. It is now read-only.
There a number of places in Dgame where D strings are passed to D functions using some_string.ptr. I think the .ptr needs to be replaced with .toStringz. I'm not sure because the crashes are not on all calls to C functions taking a D string via .ptr so it could be a bug in my own code.
But I think it's work looking into because D strings are not 0-terminated and .ptr, as I understand it, doesn't append '\0'. That's what toStringz is for.
I see errors like the following...
E.g. in my code I have
auto s = Surface("my_image.png");
This results in a call to Surface.d::loadFrmoFile(string filename), which in turn calls _surface = IMG_Load(filename.ptr) with the following runtime result...
Could not load image my_img.png�PowerInfo.
The '�PowerInfo' part is where IMG_Load(filename.ptr); has run off the end of the string because it's missing the null terminator.
My workaround for now is to manually add an ugly \0 to the D strings like so:
auto s = Surface("my_image.png\0");
The text was updated successfully, but these errors were encountered:
It will be included with the upcomming Dgame 0.6.0 if I finally found the time to test the last piece (VertexArray) and I finish the new website (http://rswhite.de/dgame6/).
But I leave that open, maybe you find places which I've overlooked.
There a number of places in Dgame where D strings are passed to D functions using
some_string.ptr
. I think the .ptr needs to be replaced with .toStringz. I'm not sure because the crashes are not on all calls to C functions taking a D string via .ptr so it could be a bug in my own code.But I think it's work looking into because D strings are not 0-terminated and .ptr, as I understand it, doesn't append '\0'. That's what toStringz is for.
I see errors like the following...
E.g. in my code I have
This results in a call to Surface.d::loadFrmoFile(string filename), which in turn calls
_surface = IMG_Load(filename.ptr)
with the following runtime result...The '�PowerInfo' part is where IMG_Load(filename.ptr); has run off the end of the string because it's missing the null terminator.
My workaround for now is to manually add an ugly \0 to the D strings like so:
auto s = Surface("my_image.png\0");
The text was updated successfully, but these errors were encountered: