Mindwerks / wildmidi

WildMIDI is a simple software midi player which has a core softsynth library that can be used with other applications.
https://github.com/Mindwerks/wildmidi
Other
201 stars 41 forks source link

A bugfix, some const-ifying, and some portability improvements #240

Closed Clownacy closed 1 year ago

Clownacy commented 1 year ago

I've fixed #234, made the user-supplied input buffers const, added a standard C fallback to the file IO, and converted the codebase to C89 (which only required changing some comments and eliminating the use of __FUNCTION__/__func__, as the codebase was already mostly written in C89).

sezero commented 1 year ago

converted the codebase to C89 (which only required changing some comments and eliminating the use of __FUNCTION__/__func__,

__func__ is not C89 though: it is C99. Users of old compilers will hit failures with that.

Clownacy commented 1 year ago

I think you misunderstood: I converted the codebase to C89 by removing the uses of __func__ (and __FUNCTION__).

sezero commented 1 year ago

In a different project, I have something like this. Maybe we should do something like that??

#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
#define __thisfunc__    __func__
#elif defined(__GNUC__) && __GNUC__ < 3
#define __thisfunc__    __FUNCTION__
#elif defined(__GNUC__) && __GNUC__ > 2
#define __thisfunc__    __func__
#elif defined(__WATCOMC__)
#define __thisfunc__    __FUNCTION__
#elif defined(__LCC__)
#define __thisfunc__    __func__
#elif defined(_MSC_VER) && _MSC_VER >= 1300 /* VC7++ */
#define __thisfunc__    __FUNCTION__
#else   /* stupid fallback */
/*#define   __thisfunc__    __FILE__*/
#error  __func__ or __FUNCTION__ compiler token not supported? define one...
#endif
sezero commented 1 year ago

@psi29a: What do you think?

sezero commented 1 year ago

@psi29a: What do you think?

PING @psi29a ?

sezero commented 1 year ago

Picked and applied the MUS drums channel, constification, and C++-style comment patches.

Looking at the rest: will probably apply the stdio file_io patch later; probably won't apply the __FUNCTION__ patch.

psi29a commented 1 year ago

Hello, I'm back. I've also had to do something like https://github.com/Mindwerks/wildmidi/pull/240#issuecomment-1352049419 in another project as well.

psi29a commented 1 year ago

We should also have "that" conversation if we want to support older compilers?

psi29a commented 1 year ago

There are conflicts in this as well :)

sezero commented 1 year ago

There are conflicts in this as well :)

Conflicts are there because I hand-picked and applied some of the patches from the patchset.

psi29a commented 1 year ago

Alright, then this can be closed or are there other bits that need to be done?

sezero commented 1 year ago

Alright, then this can be closed or are there other bits that need to be done?

I'll be looking at the stdio file-io patch (https://github.com/Mindwerks/wildmidi/pull/240/commits/9addc7d5ab42f2d68ea86debba589b460e2ada87). Maybe will apply maybe not.

sezero commented 1 year ago

The stdio file-io patch is in with small edits.

Closing the pull request. Thanks.