Skip to content

Commit

Permalink
MinGW64 compat fixes
Browse files Browse the repository at this point in the history
Some fixes for successfully cross compiling with recent MinGW64 runtime.
  • Loading branch information
tobydox committed Feb 18, 2014
1 parent f1e96cb commit 640f081
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 2 deletions.
5 changes: 5 additions & 0 deletions src/DSP/SVFilter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,9 @@
#include <cstdio>
#include <cstring>
#include <cassert>
#ifndef WIN32
#include <err.h>
#endif
#include "../Misc/Util.h"
#include "SVFilter.h"

Expand Down Expand Up @@ -141,7 +143,10 @@ void SVFilter::singlefilterout(float *smp, fstage &x, parameters &par)
out = &x.notch;
break;
default:
#ifndef WIN32
errx(1, "Impossible SVFilter type encountered [%d]", type);
#endif
break;
}

for(int i = 0; i < synth->buffersize; ++i) {
Expand Down
4 changes: 4 additions & 0 deletions src/DSP/Unison.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,9 @@

#include <cmath>
#include <cstring>
#ifndef WIN32
#include <err.h>
#endif

#include "Unison.h"

Expand Down Expand Up @@ -108,8 +110,10 @@ void Unison::updateParameters(void)
//If functions exceed this limit, they should have requested a bigguer delay
//and thus are buggy
if(unison_amplitude_samples >= max_delay - 1) {
#ifndef WIN32
warnx("BUG: Unison amplitude samples too big");
warnx("Unision max_delay should be larger");
#endif
unison_amplitude_samples = max_delay - 2;
}

Expand Down
4 changes: 4 additions & 0 deletions src/Misc/Bank.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,11 @@ int Bank::newbank(string newbankdirname)
bankdir += "/";

bankdir += newbankdirname;
#ifdef WIN32
if(mkdir(bankdir.c_str()) < 0)
#else
if(mkdir(bankdir.c_str(), S_IRWXU | S_IRWXG | S_IROTH | S_IXOTH) < 0)
#endif
return -1;

const string tmpfilename = bankdir + '/' + FORCE_BANK_DIR_FILE;
Expand Down
4 changes: 4 additions & 0 deletions src/Misc/Util.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,9 @@
#include <cassert>
#include <math.h>
#include <stdio.h>
#ifndef WIN32
#include <err.h>
#endif

#include <sys/types.h>
#include <sys/stat.h>
Expand Down Expand Up @@ -195,9 +197,11 @@ void returnTmpBuffer(float *buf)
void clearTmpBuffers(void)
{
for(pool_itr_t itr = pool.begin(); itr != pool.end(); ++itr) {
#ifndef WIN32
if(!itr->free) //Warn about used buffers
warn("Temporary buffer (%p) about to be freed may be in use",
itr->dat);
#endif
delete [] itr->dat;
}
pool.clear();
Expand Down
1 change: 0 additions & 1 deletion src/Nio/InMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
#define INMGR_H

#include <string>
#include <semaphore.h>
#include "SafeQueue.h"

enum midi_type {
Expand Down
1 change: 1 addition & 0 deletions src/Nio/OutMgr.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include "../Misc/Stereo.h"
#include <list>
#include <string>
#include <pthread.h>
#include <semaphore.h>


Expand Down
2 changes: 1 addition & 1 deletion src/Nio/SafeQueue.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
#ifndef SAFEQUEUE_H
#define SAFEQUEUE_H
#include <cstdlib>
#include <semaphore.h>
#include <pthread.h>
#include <semaphore.h>

/**
* C++ thread safe lockless queue
Expand Down

0 comments on commit 640f081

Please sign in to comment.