-
Notifications
You must be signed in to change notification settings - Fork 2.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Common: Write PNGs in two steps to allow Unicode target paths. #9339
Conversation
So, writing to memory and then to a file seems slower. Is it? If so, I wonder if it'd make sense to somehow determine if we are using a unicode pathes and then take this slower approach (but if ascii write directly to file?). |
In theory yes, in practice who really cares, fileio is slow enough as-is. I doubt it makes a noticeable difference. |
If we want something that's more similar speed-wise to what master does, we could use |
I don't think you can use |
I'm curious. What is your reasoning for avoiding
|
It's the Though I suppose it might really be better to just use |
I agree that it likely Just Doesn't Matter That Much and that this is fine to avoid the usage of |
f36a740
to
5bbd5fc
Compare
I think there are other ways to accomplish what #9023 is doing. It's possible to get the Win32 HANDLE from a file descriptor (FILE*) and it's also possible to construct a file descriptor around a HANDLE (which is what fopen() does). I agree that maintaining parallel file wrappers is something to be avoided. |
break; | ||
default: | ||
return false; | ||
} | ||
|
||
png_image_write_to_file(&png, path.c_str(), 0, input, stride, nullptr); | ||
if (png.warning_or_error & PNG_IMAGE_ERROR) | ||
// libpng doesn't handle non-ASCII characters in path, so write in two steps: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This... doesn't have anything to do with ASCII, as I understand it. It's about the active Windows code page not being UTF-8, which is what Dolphin operates in exclusively. libpng is just calling fopen on the string that is passed in.
Edit: perhaps this was a bit of an overstatement on my part. ASCII is related, in that it contains the subset of UTF-8 encoded characters that will work without this fix.
Fixes writes to paths with non-ASCII characters, as discussed after the merge in #9289.