From 31033bd2f156acbbd1c6ad4494dfb153bcf4c01e Mon Sep 17 00:00:00 2001 From: sezero Date: Thu, 5 Jan 2017 20:51:50 +0300 Subject: [PATCH] fix broken semaphore usage in OS/2 DART driver. whitespace cleanups. --- src/sound_dart.c | 26 ++++++++++---------------- 1 file changed, 10 insertions(+), 16 deletions(-) diff --git a/src/sound_dart.c b/src/sound_dart.c index 6deb703..4aa27d7 100644 --- a/src/sound_dart.c +++ b/src/sound_dart.c @@ -6,17 +6,11 @@ * file for more information. */ -//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// -//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// /* - This should work for OS/2 Dart - - History: - 1.0 - By Kevin Langman - -*/ -//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// -//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\//\\// + * This should work for OS/2 Dart + * History: + * 1.0 - By Kevin Langman + */ #undef VERSION /* stop conflict with os2medef.h */ @@ -29,6 +23,7 @@ #include #define INCL_DOS +#define INCL_DOSERRORS #include #include #include @@ -52,7 +47,7 @@ static short ready = 1; static HMTX mutex; -// Buffer update thread (created and called by DART) +/* Buffer update thread (created and called by DART) */ static LONG APIENTRY OS2_Dart_UpdateBuffers (ULONG ulStatus, PMCI_MIX_BUFFER pBuffer, ULONG ulFlags) { @@ -83,16 +78,15 @@ static int init(struct options *options) chkparm1("buffer", bsize = strtoul(token, NULL, 0)); parm_end(); + if (DosCreateMutexSem(NULL, &mutex, 0, 0) != NO_ERROR) + return -1; + if ((bsize < BUF_MIN || bsize > BUF_MAX) && bsize != 0) { bsize = 16 * 1024; } else { bsize *= 1024; } - //if( sharing < 1 || sharing > 0 ){ - // sharing = 0; - //} - MixBuffers[0].pBuffer = NULL; /* marker */ memset(&GenericParms, 0, sizeof(MCI_GENERIC_PARMS)); @@ -140,7 +134,7 @@ static int init(struct options *options) if (bsize == 0) { bsize = MixSetupParms.ulBufferSize; } - //printf( "Dart Buffer Size = %d\n", bsize ); + /*printf("Dart Buffer Size = %d\n", bsize);*/ BufferParms.ulNumBuffers = BUFFERCOUNT; BufferParms.ulBufferSize = bsize;