SethRobinson / proton

Proton SDK: Seth's GL/GLES messy multi-platform C++ game SDK. Can output to Windows, OS X, iOS, Android, Linux (Raspbian too), HTML5, Flash
Other
79 stars 16 forks source link

Fix SeparateString for musl C library. #7

Closed cernodile closed 2 years ago

cernodile commented 3 years ago

This also fixes several TextScanner functions that depended on it. Tested against gcc and clang on glibc and musl. Also should be quite a bit faster, reduced amount of strlen and sprintf calls.

Behaviour prior to this patch: glibc+gcc /glibc+clang separated string just fine, musl+gcc returned a single letter only Behaviour after this patch: Both glibc and musl return separated string fine.

This shouldn't break MSVC, but I am unable to test that.

iProgramMC commented 2 years ago

L480: l should probably be initialized to zero (MSVC) returns warning Once l is initialized everything works as expected.

SethRobinson commented 2 years ago

Thanks! Hmm, yeah, iProgramMC is right, under MSVC it doesn't auto-null variables so as is this will causes crashes without adding a l=0. I'm a github moron and couldn't figure out how to modify the pr with that. Can you commit that change to the pull request before I apply it? Or I guess I could fork your PR, then modify it, then apply it, hrm. Never tried that before

cernodile commented 2 years ago

Should be fixed.

iProgramMC commented 2 years ago

under MSVC it doesn't auto-null variables so as is this will causes crashes without adding a l=0.

It never does, regardless of compiler