-
Notifications
You must be signed in to change notification settings - Fork 404
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
Remove redunant definitions #189
Conversation
Closes three issues. |
@kurasu @baconpaul should this be merged in? |
|
The commit msg has the numbers I am not sure the sse version is metgable and still am without a laptop so left it until I can look I know it’s there though. No need from my side to put pings on prs or issues |
from commit text |
OK the only reason I am not merging this is because of the vst2/vst2plugsquartz.h removal of the #define. I haven't been able to get a windows image to see if that defined variable is used inside any of the subsequent headers. (I can confirm it is not on linux and mac which is why I'm fine with all the other changes). Have you either had a build with sse and vst2 work properly on windows with that change, have access to the headers for a grep -r, or mind backing that one diff out? Or maybe @kurasu is more comfy knowing the purpose of that variable on windows and then can merge it. I'm just not sure enough to press merge above. |
src/common/Sample.cpp
Outdated
if (!stricmp(extension, "wav")) | ||
#else | ||
if (!strcasecmp(extension, "wav")) |
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.
stupid question: is there a standard for this function?
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.
There isn't! Annoying right? If you squint you can convince yourself that c strings are memory blocks so ideas like 'case' are encoding specific, then get into wchar and encodings (and maybe even ebcdic!). So everyone needs to define one as the other or vice versa somewhere (which @whydoubt noted over on #173).
I'm not quite sure where that re-definition has gone in this PR, either. @jsakkine ?
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.
And as I noticed over on the issue I read this diffs backwards. We should not add a platform specific ifdef every time we do a stricmp. I added 3 more to squash a bug yesterday for instance
So if we are taking out of the premake it’s gotta go in a header somewhere and then we can just code to stricmp everywhere. I don’t think we should merge this change
@baconpaul, I can drop the |
Yeah just to be conservative We need to change the stricmp one also I think. Where do we want to define stricmp=strcasecmp? The platform if around every invocation is a bit too sloppy. |
Sure, NP, I'll get over my paid work and work on Surge issues tonight :) Finally through the holiday season... |
I updated this and work on GUI tonight when I get back from work... |
Cool. I think the general mood is the stricmp should be defined once someplace also so we don't need those ifs. So remove it from the premake but I think in src/common/globals.h add an
then back out the other #if macs and we can just use stricmp everywhere with no premake required. I also noticed global.h does a global using namespace std. Sigh. One day! |
@baconpaul, git grep of the use of stricmp() or strcasecmp() shows that there are total three call sites:
One of the call sites in DspUtilities.h looks like this:
The current patch actually makes thing more consistent than they were before. The most clean way IMHO to sort this out would be just to define an inline function and use it in all three call sites instead of macro substitutions. Works better with IDEs, can be namespaced etc. and is as lightweight. BTW, Microsoft has deprecated |
@jsakkine you should pull latest master. You'll see 6 then. I think yes we should introduce an inlined function in global.h and use that consistently. I'm fine with whatever we want to call it. I just don't want to always have to guard a case insensitive string comparison. So add if mac | linux int _stricmp (a b ) { return strcasecmp( a, b ); } would be fine with me if you prefer. |
oh and when you do the menu sorting patch, my bet is you will add two more! Chuckle. |
Take away redundant definitions from premake5.lua. Migrate on Windows to _stricmp() as according to MSDN stricmp() is deprecated. Implement _stricmp() on macOS and Linux as an inline function that calls strcasecmp(). Fixes: #172 ("Remove SSE_VERSION macro") Fixes: #173 ("Remove stricmp=strcasecmp definition from premake5.lua") Fixes: #174 ("Remove __cdecl definition in the Linux target in premake5.lua?") Signed-off-by: Jarkko Sakkinen <[email protected]>
Updated. |
I'll hold up until this is merged so I have kind of clean slate and work on menus when I wake up based on your good suggestions :) Thank you for patience. I can be bugging sometimes with my opinions... |
Great. That builds and works. I'll merge it now. Thanks also for your patience! |
Remove redunant definitions Former-commit-id: c771131 Former-commit-id: d304cd5848c62e929fa4462d8695d67a6b29421f
No description provided.