Skip to content

Commit 4f549a3

Browse files
authored
Merge pull request #80 from sezero/os2
os2 and watcom compiler support
2 parents d52fcfc + e16f768 commit 4f549a3

File tree

4 files changed

+23
-11
lines changed

4 files changed

+23
-11
lines changed

src/libmodplug/stdafx.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ inline void ProcessPlugins(int n) { (void)n; }
137137
# else
138138
# define MODPLUG_EXPORT __declspec(dllimport) /* using libmodplug dll for windows */
139139
# endif
140+
#elif defined(__OS2__) && defined(__WATCOMC__)
141+
# if defined(MODPLUG_BUILD) && defined(__SW_BD) /* building libmodplug as a dll for os/2 */
142+
# define MODPLUG_EXPORT __declspec(dllexport)
143+
# else
144+
# define MODPLUG_EXPORT /* using dll or static libmodplug for os/2 */
145+
# endif
140146
#elif defined(MODPLUG_BUILD) && defined(SYM_VISIBILITY)
141147
# define MODPLUG_EXPORT __attribute__((visibility("default")))
142148
#else

src/load_abc.cpp

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2208,7 +2208,7 @@ static void abc_substitute(ABCHANDLE *h, char *target, char *s)
22082208
int n = strlen(s);
22092209
if (l <= 0 ||n <= 0 || strstr(s, target) || abs(n-l) > 10e3)
22102210
return;
2211-
while( (p=strstr(h->line, target)) ) {
2211+
while ((p=strstr(h->line, target)) != NULL) {
22122212
if( (i=strlen(h->line)) + n - l >= (int)h->len ) {
22132213
int reqsize = h->len<<1;
22142214
while (i + n - l >= reqsize) reqsize = reqsize<<1;
@@ -3684,7 +3684,7 @@ BOOL CSoundFile::ReadABC(const uint8_t *lpStream, DWORD dwMemLength)
36843684
abcstate = INSKIPFORX;
36853685
abcxcount = 0;
36863686
mmfseek(mmfile,0,SEEK_SET);
3687-
while( (line=abc_gets(h, mmfile)) ) {
3687+
while ((line=abc_gets(h, mmfile)) != NULL) {
36883688
for( p=line; isspace(*p); p++ ) ;
36893689
if( !strncmp(p,"X:",2) ) abcxcount++;
36903690
}
@@ -3697,7 +3697,7 @@ BOOL CSoundFile::ReadABC(const uint8_t *lpStream, DWORD dwMemLength)
36973697
}
36983698
while( mmsp > 0 ) {
36993699
mmsp--;
3700-
while((line=abc_gets(h, mmstack[mmsp]))) {
3700+
while ((line=abc_gets(h, mmstack[mmsp])) != NULL) {
37013701
char blankline[3] = "% ";
37023702
for( p=line; isspace(*p); p++ ) ;
37033703
switch(abcstate) {
@@ -4072,7 +4072,7 @@ BOOL CSoundFile::ReadABC(const uint8_t *lpStream, DWORD dwMemLength)
40724072
// plough thru the songline gathering mos....
40734073
ch0 = ' ';
40744074
pp = 0;
4075-
while( *p && (ch = *p++) ) {
4075+
while (*p && (ch = *p++) != '\0') {
40764076
if( !pp && isalpha(ch) && *p != ':' ) { // maybe a macro
40774077
for( mp=h->umacro; mp; mp=mp->next ) {
40784078
if( ch == mp->name[0] ) {
@@ -4178,7 +4178,7 @@ BOOL CSoundFile::ReadABC(const uint8_t *lpStream, DWORD dwMemLength)
41784178
h->tp = abc_check_track(h, h->tp);
41794179
abc_track_clear_tiedvpos(h);
41804180
abcbeatvol = abc_beat_vol(h, abcvol, (h->tracktime - bartime)/barticks);
4181-
while( *p && (ch=*p++) && (ch != ']') ) {
4181+
while (*p && (ch=*p++) != '\0' && (ch != ']')) {
41824182
h->tp = abc_locate_track(h, h->tp->v, abcchord? abcchord+DRONEPOS2: 0);
41834183
p += abc_add_noteon(h, ch, p, h->tracktime, barsig, abcbeatvol, abceffect, abceffoper);
41844184
p += abc_notelen(p, &notelen, &notediv);
@@ -4346,7 +4346,7 @@ BOOL CSoundFile::ReadABC(const uint8_t *lpStream, DWORD dwMemLength)
43464346
int barticks = notelen_notediv_to_ticks(h->speed,1,mnotediv);
43474347
if (barticks == 0) barticks = 1;
43484348
abcbeatvol = abc_beat_vol(h, abcvol, (h->tracktime - bartime)/barticks);
4349-
while( *p && (ch=*p++) && (ch != '}') ) {
4349+
while (*p && (ch=*p++) != '\0' && (ch != '}')) {
43504350
p += abc_add_noteon(h, ch, p, h->tracktime+abcgrace, barsig, abcbeatvol, none, 0);
43514351
p += abc_notelen(p, &notelen, &notediv);
43524352
if( *p=='-' ) {
@@ -4432,7 +4432,7 @@ BOOL CSoundFile::ReadABC(const uint8_t *lpStream, DWORD dwMemLength)
44324432
if( h->tp == h->tpc ) abc_add_chord(p, h, h->tpc, h->tracktime); // only do chords for one voice
44334433
}
44344434
abcto = 0;
4435-
while( *p && (ch=*p++) && (ch != '"') ) {
4435+
while (*p && (ch=*p++) != '\0' && (ch != '"')) {
44364436
if( !strncasecmp(p,"fade",4) && h->track && h->track->slidevol > -2 )
44374437
abc_globalslide(h, h->tracktime, -2); // set volumeslide to fade away...
44384438
if( !strncasecmp(p,"to coda",7) ) {
@@ -4641,7 +4641,7 @@ BOOL CSoundFile::ReadABC(const uint8_t *lpStream, DWORD dwMemLength)
46414641
else {
46424642
h->tp = abc_check_track(h, h->tp);
46434643
abcvol = abc_parse_decorations(h, h->tp, p);
4644-
while( *p && (ch=*p++) && (ch != '+') )
4644+
while (*p && (ch=*p++) != '\0' && (ch != '+'))
46454645
;
46464646
}
46474647
break;
@@ -4818,7 +4818,7 @@ BOOL CSoundFile::ReadABC(const uint8_t *lpStream, DWORD dwMemLength)
48184818
pat = (tracktick div speed) div 64
48194819
ord = calculated
48204820
*/
4821-
if( (p=getenv(ABC_ENV_DUMPTRACKS)) ) {
4821+
if ((p=getenv(ABC_ENV_DUMPTRACKS)) != NULL) {
48224822
printf("P:%s\n",abcparts);
48234823
for( t=0; t<26; t++ )
48244824
if( partpat[t][1] >= partpat[t][0] )

src/load_pat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@
4949

5050
#include "load_pat.h"
5151

52-
#ifdef _WIN32
52+
#if defined(_WIN32)||defined(__OS2__)
5353
#define DIRDELIM '\\'
5454
#define TIMIDITYCFG "C:\\TIMIDITY\\TIMIDITY.CFG"
5555
#define PATHFORPAT "C:\\TIMIDITY\\INSTRUMENTS"

src/modplug.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,12 @@ extern "C" {
1919
# else
2020
# define MODPLUG_EXPORT __declspec(dllimport) /* using libmodplug dll for windows */
2121
# endif
22+
#elif defined(__OS2__) && defined(__WATCOMC__)
23+
# if defined(MODPLUG_BUILD) && defined(__SW_BD) /* building libmodplug as a dll for os/2 */
24+
# define MODPLUG_EXPORT __declspec(dllexport)
25+
# else
26+
# define MODPLUG_EXPORT /* using dll or static libmodplug for os/2 */
27+
# endif
2228
#elif defined(MODPLUG_BUILD) && defined(SYM_VISIBILITY)
2329
# define MODPLUG_EXPORT __attribute__((visibility("default")))
2430
#else
@@ -182,4 +188,4 @@ MODPLUG_EXPORT void ModPlug_UnloadMixerCallback(ModPlugFile* file) ;
182188
} /* extern "C" */
183189
#endif
184190

185-
#endif
191+
#endif /* MODPLUG_H__INCLUDED */

0 commit comments

Comments
 (0)