-
-
Notifications
You must be signed in to change notification settings - Fork 57
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
C++20 Support #1235
C++20 Support #1235
Conversation
@KKQ-KKQ if you can check that this build with your toolchain thatd be great. I made a couple changes to reduce the number of ifdef and fix some other issues that popped up. |
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.
Sorry for my late review.
I commented some days ago but the comments remained "Pending".
I don't think there is always compatibility between std::string
and std::u8string
especially in file paths.
clients/sfizz_render.cpp
Outdated
@@ -165,7 +166,7 @@ int main(int argc, char** argv) | |||
ERROR_IF(!synth.loadSfzFile(sfzPath), "There was an error loading the SFZ file."); | |||
LOG_INFO(synth.getNumRegions() << " regions in the SFZ."); | |||
|
|||
fmidi_smf_u midiFile { fmidi_smf_file_read(midiPath.u8string().c_str()) }; | |||
fmidi_smf_u midiFile { fmidi_smf_file_read(from_u8string(midiPath.u8string()).c_str()) }; |
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.
Does this works in Windows environment with non-ASCII characters?
I cannot confirm it because I am with Mac.
Windows uses ANSI, UTF-16, and UTF-8.
ANSI and UTF-8 are different.
If you don't want to support non-ASCII characters, it might be Ok.
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.
fmidi_smf_file_read(const char *)
uses ANSI, as far as I confirmed.
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.
Hmm are you sure? From this it seems that the POSIX version would use fopen (which will be UTF-8 on linux afaik, not sure about macOS) and has some conversion from utf8 to utf16 to open on Windows. At least running this patch on windows for sfizz_render
works properly for me.
Did you have any failing scenario in mind?
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.
oh I misunderstood. I was wrong.
I'm sorry.
It use UTF-8 even on Windows.
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.
I read the code on my mac with the vs code and the wrong #if
block was grayed, I misunderstood.
Sorry for confusion.
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.
Do we need this change?
In my opinion, it is a little bit complex process.
It might be better that we add functions like |
No worries. We can add some functions if needed, but after reading https://www.open-std.org/jtc1/sc22/wg21/docs/papers/2019/p1423r2.html I felt their proposal was reasonable. |
If this patch works for you and your toolchain, we can solve problems as they arise and possibly add functions at that time! |
It is hard for me to apply this patch into my local mod without changes because I don't manage my mod with git. |
d917a5c
to
93245b2
Compare
From @KKQ-KKQ