diff options
author | Thorvald Natvig <slicer@users.sourceforge.net> | 2008-03-20 17:26:20 +0300 |
---|---|---|
committer | Thorvald Natvig <slicer@users.sourceforge.net> | 2008-03-20 17:26:20 +0300 |
commit | e93c194397fad82fce2411ad3a193d9f2934fa79 (patch) | |
tree | 673b4d17082a62bdac91755ff55fbc3979bfde9b | |
parent | 0f22bcfbda2641f32cad80f2ee0b860e0621e855 (diff) |
Indenting run
git-svn-id: https://mumble.svn.sourceforge.net/svnroot/mumble/trunk@1019 05730e5d-ab1b-0410-a4ac-84af385074fa
37 files changed, 2043 insertions, 2027 deletions
diff --git a/overlay/d3d9.cpp b/overlay/d3d9.cpp index eed00ce08..e5e5ff6ce 100644 --- a/overlay/d3d9.cpp +++ b/overlay/d3d9.cpp @@ -31,11 +31,10 @@ #include "lib.h"
#include <d3d9.h>
-typedef IDirect3D9* (WINAPI *pDirect3DCreate9) (UINT SDKVersion) ;
-typedef HRESULT (WINAPI *pDirect3DCreate9Ex) (UINT SDKVersion, IDirect3D9Ex **ppD3D) ;
+typedef IDirect3D9*(WINAPI *pDirect3DCreate9)(UINT SDKVersion) ;
+typedef HRESULT(WINAPI *pDirect3DCreate9Ex)(UINT SDKVersion, IDirect3D9Ex **ppD3D) ;
-struct D3DTLVERTEX
-{
+struct D3DTLVERTEX {
float x, y, z, rhw; // Position
D3DCOLOR color; // Vertex colour
float tu, tv; // Texture coordinates
@@ -43,24 +42,24 @@ struct D3DTLVERTEX const DWORD D3DFVF_TLVERTEX = D3DFVF_XYZRHW | D3DFVF_DIFFUSE | D3DFVF_TEX1;
class DevState {
-public:
- IDirect3DDevice9 *dev;
- IDirect3DStateBlock9 *pSB;
+ public:
+ IDirect3DDevice9 *dev;
+ IDirect3DStateBlock9 *pSB;
- LONG initRefCount;
- LONG refCount;
- LONG myRefCount;
- bool bMyRefs;
+ LONG initRefCount;
+ LONG refCount;
+ LONG myRefCount;
+ bool bMyRefs;
- LPDIRECT3DTEXTURE9 tex[NUM_TEXTS];
+ LPDIRECT3DTEXTURE9 tex[NUM_TEXTS];
- DevState();
+ DevState();
- void createCleanState();
- void releaseData();
- void releaseAll();
- void draw();
- void postDraw();
+ void createCleanState();
+ void releaseData();
+ void releaseAll();
+ void draw();
+ void postDraw();
};
static map<IDirect3DDevice9 *, DevState *> devMap;
@@ -74,18 +73,18 @@ DevState::DevState() { bMyRefs = false;
refCount = 0;
myRefCount = 0;
- for(int i = 0;i < NUM_TEXTS;i++)
+ for (int i = 0;i < NUM_TEXTS;i++)
tex[i] = NULL;
}
void DevState::releaseData() {
ods("D3D9: Release Data");
- for(int i=0;i<NUM_TEXTS;i++)
+ for (int i=0;i<NUM_TEXTS;i++)
if (tex[i]) {
- tex[i]->Release();
- tex[i] = NULL;
- }
+ tex[i]->Release();
+ tex[i] = NULL;
+ }
}
void DevState::releaseAll() {
@@ -125,7 +124,7 @@ void DevState::draw() { DWORD dwWaitResult = WaitForSingleObject(hSharedMutex, 50L);
if (dwWaitResult == WAIT_OBJECT_0) {
- for(int i=0;i<NUM_TEXTS;i++) {
+ for (int i=0;i<NUM_TEXTS;i++) {
if (sm->texts[i].width == 0) {
y += iHeight / 4;
} else if (sm->texts[i].width > 0) {
@@ -138,8 +137,8 @@ void DevState::draw() { D3DLOCKED_RECT lr;
tex[i]->LockRect(0, &lr, NULL, D3DLOCK_DISCARD);
- for(int r=0;r<TEXT_HEIGHT;r++) {
- unsigned char *dptr = reinterpret_cast<unsigned char *>(lr.pBits) + r * lr.Pitch;
+ for (int r=0;r<TEXT_HEIGHT;r++) {
+ unsigned char *dptr = reinterpret_cast<unsigned char *>(lr.pBits) + r * lr.Pitch;
memcpy(dptr, sm->texts[i].texture + r * TEXT_WIDTH * 4, sm->texts[i].width * 4);
}
@@ -177,7 +176,7 @@ void DevState::draw() { if ((y + height + 1) > vp.Height)
y = vp.Height - height - 1;
- for(int i=0;i<idx;i++) {
+ for (int i=0;i<idx;i++) {
unsigned int width = widths[i];
int x = lround(vp.Width * sm->fX);
@@ -202,8 +201,7 @@ void DevState::draw() { float bottom = top + iHeight;
const float z = 1.0f;
- D3DTLVERTEX vertices[4] =
- {
+ D3DTLVERTEX vertices[4] = {
// x, y, z, color, tu, tv
{ left, top, z, 1, color, 0, 0 },
{ right, top, z, 1, color, 1, 0 },
@@ -225,10 +223,10 @@ void DevState::createCleanState() { pSB = NULL;
IDirect3DStateBlock9* pStateBlock = NULL;
- dev->CreateStateBlock( D3DSBT_ALL, &pStateBlock );
- pStateBlock->Capture();
+ dev->CreateStateBlock(D3DSBT_ALL, &pStateBlock);
+ pStateBlock->Capture();
- dev->CreateStateBlock( D3DSBT_ALL, &pSB );
+ dev->CreateStateBlock(D3DSBT_ALL, &pSB);
D3DVIEWPORT9 vp;
dev->GetViewport(&vp);
@@ -238,7 +236,7 @@ void DevState::createCleanState() { dev->SetFVF(D3DFVF_TLVERTEX);
dev->SetRenderState(D3DRS_FILLMODE, D3DFILL_SOLID);
- dev->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_GOURAUD );
+ dev->SetRenderState(D3DRS_SHADEMODE, D3DSHADE_GOURAUD);
dev->SetRenderState(D3DRS_CULLMODE, D3DCULL_NONE); // 0x16
dev->SetRenderState(D3DRS_WRAP0, FALSE); // 0x80
@@ -246,8 +244,8 @@ void DevState::createCleanState() { dev->SetRenderState(D3DRS_SRCBLEND, D3DBLEND_SRCALPHA);
dev->SetRenderState(D3DRS_DESTBLEND, D3DBLEND_INVSRCALPHA);
- dev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE );
- dev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER );
+ dev->SetRenderState(D3DRS_ALPHATESTENABLE, TRUE);
+ dev->SetRenderState(D3DRS_ALPHAFUNC, D3DCMP_GREATER);
dev->SetRenderState(D3DRS_ZENABLE, FALSE);
dev->SetRenderState(D3DRS_ZWRITEENABLE, FALSE);
@@ -291,8 +289,8 @@ static void doPresent(IDirect3DDevice9 *idd) { ds->bMyRefs = true;
IDirect3DStateBlock9* pStateBlock = NULL;
- idd->CreateStateBlock( D3DSBT_ALL, &pStateBlock );
- pStateBlock->Capture();
+ idd->CreateStateBlock(D3DSBT_ALL, &pStateBlock);
+ pStateBlock->Capture();
ds->pSB->Apply();
@@ -304,7 +302,7 @@ static void doPresent(IDirect3DDevice9 *idd) { ds->releaseData();
}
- idd->BeginScene();
+ idd->BeginScene();
ds->draw();
idd->EndScene();
diff --git a/overlay/dsound.cpp b/overlay/dsound.cpp index fbaee74d2..9e6a41a66 100644 --- a/overlay/dsound.cpp +++ b/overlay/dsound.cpp @@ -31,7 +31,7 @@ #include "lib.h"
#include <dsound.h>
-typedef HRESULT (*pDirectSoundCreate8)(LPCGUID lpcGuidDevice, LPDIRECTSOUND8 * ppDS8, LPUNKNOWN pUnkOuter);
+typedef HRESULT(*pDirectSoundCreate8)(LPCGUID lpcGuidDevice, LPDIRECTSOUND8 * ppDS8, LPUNKNOWN pUnkOuter);
static bool bHooked = false;
static bool bChaining = false;
diff --git a/overlay/lib.cpp b/overlay/lib.cpp index 4b1ac08b9..805b2a754 100644 --- a/overlay/lib.cpp +++ b/overlay/lib.cpp @@ -45,7 +45,7 @@ static HHOOK hhookWnd = 0; HardHook::HardHook() { int i; baseptr = NULL; - for(i=0;i<5;i++) + for (i=0;i<5;i++) orig[i]=replace[i]=0; } @@ -67,7 +67,7 @@ void HardHook::setup(voidFunc func, voidFunc replacement) { replace[0] = 0xe9; if (VirtualProtect(fptr, 5, PAGE_EXECUTE_READ, &oldProtect)) { - for(i=0;i<5;i++) + for (i=0;i<5;i++) orig[i]=fptr[i]; VirtualProtect(fptr, 5, oldProtect, &restoreProtect); baseptr = fptr; @@ -88,12 +88,12 @@ void HardHook::inject() { if (! baseptr) return; if (VirtualProtect(baseptr, 5, PAGE_EXECUTE_READWRITE, &oldProtect)) { - for(i=0;i<5;i++) + for (i=0;i<5;i++) baseptr[i] = replace[i]; VirtualProtect(baseptr, 5, oldProtect, &restoreProtect); FlushInstructionCache(GetCurrentProcess(),baseptr, 5); } - for(i=0;i<5;i++) + for (i=0;i<5;i++) if (baseptr[i] != replace[i]) ods("HH: Injection failure at byte %d", i); } @@ -105,7 +105,7 @@ void HardHook::restore() { if (! baseptr) return; if (VirtualProtect(baseptr, 5, PAGE_EXECUTE_READWRITE, &oldProtect)) { - for(i=0;i<5;i++) + for (i=0;i<5;i++) baseptr[i] = orig[i]; VirtualProtect(baseptr, 5, oldProtect, &restoreProtect); FlushInstructionCache(GetCurrentProcess(),baseptr, 5); @@ -114,41 +114,41 @@ void HardHook::restore() { void HardHook::print() { ods("HH: %02x %02x %02x %02x %02x => %02x %02x %02x %02x %02x (%02x %02x %02x %02x %02x)", - orig[0], orig[1], orig[2], orig[3], orig[4], - replace[0], replace[1], replace[2], replace[3], replace[4], - baseptr[0], baseptr[1], baseptr[2], baseptr[3], baseptr[4]); + orig[0], orig[1], orig[2], orig[3], orig[4], + replace[0], replace[1], replace[2], replace[3], replace[4], + baseptr[0], baseptr[1], baseptr[2], baseptr[3], baseptr[4]); } void __cdecl ods(const char *format, ...) { - if (!sm || ! sm->bDebug) - return; + if (!sm || ! sm->bDebug) + return; - char buf[4096], *p = buf; - va_list args; + char buf[4096], *p = buf; + va_list args; - va_start(args, format); - int len = _vsnprintf_s(p, sizeof(buf) - 1, _TRUNCATE, format, args); - va_end(args); + va_start(args, format); + int len = _vsnprintf_s(p, sizeof(buf) - 1, _TRUNCATE, format, args); + va_end(args); - if (len <= 0) - return; + if (len <= 0) + return; - p += len; + p += len; - while ( p > buf && isspace(p[-1]) ) - *--p = '\0'; + while (p > buf && isspace(p[-1])) + *--p = '\0'; - *p++ = '\r'; - *p++ = '\n'; - *p = '\0'; + *p++ = '\r'; + *p++ = '\n'; + *p = '\0'; - OutputDebugStringA(buf); - FILE *f = NULL; - errno_t res = fopen_s(&f, "c:\\overlay.log", "a"); - if (f && (res == 0)) { - fprintf(f, "%d %s", GetTickCount(), buf); - fclose(f); - } + OutputDebugStringA(buf); + FILE *f = NULL; + errno_t res = fopen_s(&f, "c:\\overlay.log", "a"); + if (f && (res == 0)) { + fprintf(f, "%d %s", GetTickCount(), buf); + fclose(f); + } } static LRESULT CALLBACK CallWndProc(int nCode, WPARAM wParam, LPARAM lParam) { @@ -225,8 +225,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID) { // return TRUE; switch (fdwReason) { - case DLL_PROCESS_ATTACH: - { + case DLL_PROCESS_ATTACH: { ods("Lib: ProcAttach: %s", procname); hSharedMutex = CreateMutex(NULL, false, "MumbleSharedMutex"); hHookMutex = CreateMutex(NULL, false, "MumbleHookMutex"); @@ -273,8 +272,7 @@ extern "C" BOOL WINAPI DllMain(HINSTANCE, DWORD fdwReason, LPVOID) { ReleaseMutex(hSharedMutex); } break; - case DLL_PROCESS_DETACH: - { + case DLL_PROCESS_DETACH: { UnmapViewOfFile(sm); CloseHandle(hMapObject); CloseHandle(hSharedMutex); diff --git a/overlay/openal.cpp b/overlay/openal.cpp index d54075ab7..bb4ef0701 100644 --- a/overlay/openal.cpp +++ b/overlay/openal.cpp @@ -50,28 +50,26 @@ static void __cdecl myalListenerfv(ALenum param, ALfloat *values) { if (bVideoHooked) {
DWORD t = GetTickCount();
- switch(param) {
- case AL_POSITION:
- {
- uiAudioCount++;
- sm->uiAudioTick = t;
- sm->fPos[0] = values[0];
- sm->fPos[1] = values[1];
- sm->fPos[2] = values[2];
- break;
- }
- case AL_ORIENTATION:
- {
- uiAudioCount++;
- sm->uiAudioTick = t;
- sm->fFront[0] = values[0];
- sm->fFront[1] = values[1];
- sm->fFront[2] = values[2];
- sm->fTop[0] = values[3];
- sm->fTop[1] = values[4];
- sm->fTop[2] = values[5];
- break;
- }
+ switch (param) {
+ case AL_POSITION: {
+ uiAudioCount++;
+ sm->uiAudioTick = t;
+ sm->fPos[0] = values[0];
+ sm->fPos[1] = values[1];
+ sm->fPos[2] = values[2];
+ break;
+ }
+ case AL_ORIENTATION: {
+ uiAudioCount++;
+ sm->uiAudioTick = t;
+ sm->fFront[0] = values[0];
+ sm->fFront[1] = values[1];
+ sm->fFront[2] = values[2];
+ sm->fTop[0] = values[3];
+ sm->fTop[1] = values[4];
+ sm->fTop[2] = values[5];
+ break;
+ }
default:
break;
}
@@ -86,28 +84,26 @@ static void __cdecl myalListeneriv(ALenum param, ALint *values) { if (bVideoHooked) {
DWORD t = GetTickCount();
- switch(param) {
- case AL_POSITION:
- {
- uiAudioCount++;
- sm->uiAudioTick = t;
- sm->fPos[0] = values[0];
- sm->fPos[1] = values[1];
- sm->fPos[2] = values[2];
- break;
- }
- case AL_ORIENTATION:
- {
- uiAudioCount++;
- sm->uiAudioTick = t;
- sm->fFront[0] = values[0];
- sm->fFront[1] = values[1];
- sm->fFront[2] = values[2];
- sm->fTop[0] = values[3];
- sm->fTop[1] = values[4];
- sm->fTop[2] = values[5];
- break;
- }
+ switch (param) {
+ case AL_POSITION: {
+ uiAudioCount++;
+ sm->uiAudioTick = t;
+ sm->fPos[0] = values[0];
+ sm->fPos[1] = values[1];
+ sm->fPos[2] = values[2];
+ break;
+ }
+ case AL_ORIENTATION: {
+ uiAudioCount++;
+ sm->uiAudioTick = t;
+ sm->fFront[0] = values[0];
+ sm->fFront[1] = values[1];
+ sm->fFront[2] = values[2];
+ sm->fTop[0] = values[3];
+ sm->fTop[1] = values[4];
+ sm->fTop[2] = values[5];
+ break;
+ }
default:
break;
}
@@ -122,16 +118,15 @@ static void __cdecl myalListener3f(ALenum param, ALfloat v1, ALfloat v2, ALfloat if (bVideoHooked) {
DWORD t = GetTickCount();
- switch(param) {
- case AL_POSITION:
- {
- uiAudioCount++;
- sm->uiAudioTick = t;
- sm->fPos[0] = v1;
- sm->fPos[1] = v2;
- sm->fPos[2] = v3;
- break;
- }
+ switch (param) {
+ case AL_POSITION: {
+ uiAudioCount++;
+ sm->uiAudioTick = t;
+ sm->fPos[0] = v1;
+ sm->fPos[1] = v2;
+ sm->fPos[2] = v3;
+ break;
+ }
default:
break;
}
@@ -147,16 +142,15 @@ static void __cdecl myalListener3i(ALenum param, ALint v1, ALint v2, ALint v3) { if (bVideoHooked) {
DWORD t = GetTickCount();
- switch(param) {
- case AL_POSITION:
- {
- uiAudioCount++;
- sm->uiAudioTick = t;
- sm->fPos[0] = v1;
- sm->fPos[1] = v2;
- sm->fPos[2] = v3;
- break;
- }
+ switch (param) {
+ case AL_POSITION: {
+ uiAudioCount++;
+ sm->uiAudioTick = t;
+ sm->fPos[0] = v1;
+ sm->fPos[1] = v2;
+ sm->fPos[2] = v3;
+ break;
+ }
default:
break;
}
diff --git a/overlay_gl/overlay.c b/overlay_gl/overlay.c index 25c4224e4..2545ae43f 100644 --- a/overlay_gl/overlay.c +++ b/overlay_gl/overlay.c @@ -92,7 +92,7 @@ static void resolveOpenGL() { static void resolveSM() { static bool warned_sm = false; - static bool warned_ver = false; + static bool warned_ver = false; int fd = shm_open("/MumbleOverlayMem", O_RDWR, 0600); if (fd >= 0) { @@ -102,17 +102,17 @@ static void resolveSM() { close(fd); } else { if ((sm->version[0] != OVERLAY_VERSION_MAJ) || - (sm->version[1] != OVERLAY_VERSION_MIN) || - (sm->version[2] != OVERLAY_VERSION_PATCH)) { - if (! warned_ver) { + (sm->version[1] != OVERLAY_VERSION_MIN) || + (sm->version[2] != OVERLAY_VERSION_PATCH)) { + if (! warned_ver) { fflush(stderr); fprintf(stderr, "MUMBLE OVERLAY:: Version mismatch. Library is %u.%u.%u.%u, application is %u.%u.%u.%u\n", - OVERLAY_VERSION_MAJ, OVERLAY_VERSION_MIN, OVERLAY_VERSION_PATCH, OVERLAY_VERSION_SUB, - sm->version[0], sm->version[1], sm->version[2], sm->version[3] - ); + OVERLAY_VERSION_MAJ, OVERLAY_VERSION_MIN, OVERLAY_VERSION_PATCH, OVERLAY_VERSION_SUB, + sm->version[0], sm->version[1], sm->version[2], sm->version[3] + ); fflush(stderr); warned_ver = true; - } + } munmap(sm, sizeof(struct SharedMem)); sm = NULL; close(fd); diff --git a/plugins/bf2/bf2.cpp b/plugins/bf2/bf2.cpp index 39f5c0d2d..8ee5562db 100644 --- a/plugins/bf2/bf2.cpp +++ b/plugins/bf2/bf2.cpp @@ -85,7 +85,7 @@ static bool sane(float *pos, float *vel, float *face, float *top, bool initial = float min = (initial) ? 0.1f : 0.00001f; // Sanity check #1: Position should be from -1000 to +1000, and not 0. - for(i=0;i<3;i++) { + for (i=0;i<3;i++) { ok = ok && (fabs(pos[i]) > min); ok = ok && (fabs(pos[i]) < 1000.0); } @@ -154,9 +154,9 @@ static int trylock() { float top[3]; bool ok = peekProc(posptr, pos, 12) && - peekProc(velptr, vel, 12) && - peekProc(faceptr, face, 12) && - peekProc(topptr, top, 12); + peekProc(velptr, vel, 12) && + peekProc(faceptr, face, 12) && + peekProc(topptr, top, 12); if (ok) ok = sane(pos, vel, face, top, true); @@ -181,9 +181,9 @@ static int fetch(float *pos, float *front, float *top) { float vel[3]; bool ok; ok = peekProc(posptr, pos, 12) && - peekProc(velptr, vel, 12) && - peekProc(faceptr, front, 12) && - peekProc(topptr, top, 12); + peekProc(velptr, vel, 12) && + peekProc(faceptr, front, 12) && + peekProc(topptr, top, 12); if (ok) { ok = sane(pos, vel, front, top); diff --git a/plugins/link/link.cpp b/plugins/link/link.cpp index 0d0fe4a5b..f995b8343 100644 --- a/plugins/link/link.cpp +++ b/plugins/link/link.cpp @@ -60,11 +60,11 @@ static int fetch(float *pos, float *front, float *top) { if ((GetTickCount() - lm->dwTick) > 500)
return false;
- for(int i=0;i<3;i++)
+ for (int i=0;i<3;i++)
pos[i]=lm->fPosition[i];
- for(int i=0;i<3;i++)
+ for (int i=0;i<3;i++)
front[i]=lm->fFront[i];
- for(int i=0;i<3;i++)
+ for (int i=0;i<3;i++)
top[i]=lm->fTop[i];
return true;
diff --git a/plugins/wow/wow.cpp b/plugins/wow/wow.cpp index 10891170d..c28022a87 100644 --- a/plugins/wow/wow.cpp +++ b/plugins/wow/wow.cpp @@ -40,7 +40,7 @@ static void about(HWND h) { } static int fetch(float *pos, float *front, float *top) { - for(int i=0;i<3;i++) + for (int i=0;i<3;i++) pos[i]=front[i]=top[i]=0.0; BOOL ok = true; diff --git a/src/mumble/ALSAAudio.cpp b/src/mumble/ALSAAudio.cpp index def7e98a9..a33d92a7b 100644 --- a/src/mumble/ALSAAudio.cpp +++ b/src/mumble/ALSAAudio.cpp @@ -49,8 +49,13 @@ class ALSAEnumerator { static ALSAEnumerator *cards = NULL; class ALSAAudioInit : public DeferInit { - void initialize() { cards = new ALSAEnumerator(); }; - void destroy() { delete cards; cards = NULL; }; + void initialize() { + cards = new ALSAEnumerator(); + }; + void destroy() { + delete cards; + cards = NULL; + }; }; static ALSAAudioInit aai; @@ -97,7 +102,7 @@ const QList<audioDevice> ALSAAudioInputRegistrar::getDeviceChoices() { QString t=QString::fromLatin1("[%1] %2").arg(dev).arg(cards->qhInput.value(dev)); qlReturn << audioDevice(t, dev); } - + return qlReturn; } @@ -405,7 +410,7 @@ void ALSAAudioOutput::initialize(snd_pcm_t * &pcm_handle, int period, bool stere ALSA_ERRBAIL(snd_pcm_hw_params_set_access(pcm_handle, hw_params, SND_PCM_ACCESS_RW_INTERLEAVED)); ALSA_ERRBAIL(snd_pcm_hw_params_set_format(pcm_handle, hw_params, SND_PCM_FORMAT_S16_LE)); ALSA_ERRBAIL(snd_pcm_hw_params_set_rate_near(pcm_handle, hw_params, &rate, NULL)); - ALSA_ERRBAIL(snd_pcm_hw_params_set_channels(pcm_handle, hw_params, (stereo ? 2 : 1 ))); + ALSA_ERRBAIL(snd_pcm_hw_params_set_channels(pcm_handle, hw_params, (stereo ? 2 : 1))); ALSA_ERRBAIL(snd_pcm_hw_params_set_buffer_size_near(pcm_handle, hw_params, &buffer_size)); ALSA_ERRBAIL(snd_pcm_hw_params_set_period_size_near(pcm_handle, hw_params, &period_size, NULL)); @@ -502,7 +507,7 @@ void ALSAAudioOutput::run() { if (! stillRun) { snd_pcm_drain(pcm_handle); - while (! (stereo ? mixStereoAudio(buffer) : mixAudio(buffer)) && bRunning) + while (!(stereo ? mixStereoAudio(buffer) : mixAudio(buffer)) && bRunning) this->usleep(20 * 1000); if (! bRunning) diff --git a/src/mumble/AudioInput.cpp b/src/mumble/AudioInput.cpp index b0a2bceba..867caf55d 100644 --- a/src/mumble/AudioInput.cpp +++ b/src/mumble/AudioInput.cpp @@ -260,20 +260,20 @@ void AudioInput::encodeAudioFrame() { STACKVAR(float, fft, iFrameSize); STACKVAR(float, power, iFrameSize); float scale = 1.f / iFrameSize; - for(i=0;i<iFrameSize;i++) + for (i=0;i<iFrameSize;i++) fft[i] = psMic[i] * scale; mumble_drft_forward(&fftTable, fft); float mp = 0.0; int bin = 0; power[0]=power[1]=0.0; - for(i=2;i < iFrameSize / 2;i++) { + for (i=2;i < iFrameSize / 2;i++) { power[i] = sqrtf(fft[2*i]*fft[2*i]+fft[2*i-1]*fft[2*i-1]); if (power[i] > mp) { bin = i; mp = power[i]; } } - for(i=2;i< iFrameSize / 2;i++) { + for (i=2;i< iFrameSize / 2;i++) { if (power[i] * 2 > mp) { if (i != bin) bin = 0; diff --git a/src/mumble/AudioOutput.cpp b/src/mumble/AudioOutput.cpp index a4e06de3f..069ac802b 100644 --- a/src/mumble/AudioOutput.cpp +++ b/src/mumble/AudioOutput.cpp @@ -342,89 +342,91 @@ bool AudioOutput::mixAudio(short *buffer) { } bool AudioOutput::mixStereoAudio(short *buffer) { - AudioOutputPlayer *aop; - QList<AudioOutputPlayer *> qlMix; - QList<AudioOutputPlayer *> qlDel; - - qrwlOutputs.lockForRead(); - foreach(aop, qmOutputs) { - if (! aop->decodeNextFrame()) { - qlDel.append(aop); - } else { - qlMix.append(aop); - } - } - - int t[iFrameSize*2]; - - for (int i=0;i< (iFrameSize*2);i++) - t[i]=0; - - Plugins *p = g.p; - - p->fetch(); // Make sure we use the actual position - - if(p->bValid) { // Use stereo if plugin data is valid - const float left[3] = { // We have an LHS coordinate system - - p->fTop[1]*p->fFront[2] + p->fTop[2]*p->fFront[1], - - p->fTop[2]*p->fFront[0] + p->fTop[0]*p->fFront[2], - - p->fTop[0]*p->fFront[1] + p->fTop[1]*p->fFront[0] }; - // This cross-product defines the left/right split plane - - const float left_norm = sqrtf(left[0]*left[0] + left[1]*left[1]+left[2]*left[2]); - foreach(aop, qlMix) { - float vol_scal = 1.0; - float vol_stereo = 0; - - // Test if source has valid position data - if(aop->fPos[0] != 0.0 or aop->fPos[1] != 0.0 or aop->fPos[2] != 0.0) { - const float source_direction[3] = { - aop->fPos[0] - p->fPosition[0], - aop->fPos[1] - p->fPosition[1], - aop->fPos[1] - p->fPosition[1] }; - - const float source_direction_norm = sqrtf( - source_direction[0]*source_direction[0] - + source_direction[1]*source_direction[1] - + source_direction[2]*source_direction[2]); - - vol_stereo = ( left[0]*source_direction[0] + - left[1]*source_direction[1] + - left[2]*source_direction[2]) - / left_norm / source_direction_norm; - // asin(scalar_product) = angle from center, where - // angle < 0 is right and angle > 0 is left - - if(g.s.bPositionalSoundSwap) - vol_stereo *= (-1); - - vol_scal= PositionalSound::toRatio(PositionalSound::calcdB(source_direction_norm)); - } - const float vol_left= vol_scal * (1.0 + vol_stereo); - const float vol_right= vol_scal * (1.0 - vol_stereo); - for (int i=0;i<iFrameSize;i++) { - t[2*i] += (int) (vol_left * aop->psBuffer[i]); - t[2*i+1] += (int) (vol_right *aop->psBuffer[i]); - } - } - } else { // no stereo - foreach(aop, qlMix) { - for (int i=0;i<iFrameSize;i++) { - t[2*i] += aop->psBuffer[i]; - t[2*i+1] += aop->psBuffer[i]; - } - } - } - - for (int i=0;i<(iFrameSize*2);i++) - buffer[i]=qMax(-32727,qMin(32767,t[i])); - - qrwlOutputs.unlock(); - - foreach(aop, qlDel) - removeBuffer(aop); - - return (! qlMix.isEmpty()); + AudioOutputPlayer *aop; + QList<AudioOutputPlayer *> qlMix; + QList<AudioOutputPlayer *> qlDel; + + qrwlOutputs.lockForRead(); + foreach(aop, qmOutputs) { + if (! aop->decodeNextFrame()) { + qlDel.append(aop); + } else { + qlMix.append(aop); + } + } + + int t[iFrameSize*2]; + + for (int i=0;i< (iFrameSize*2);i++) + t[i]=0; + + Plugins *p = g.p; + + p->fetch(); // Make sure we use the actual position + + if (p->bValid) { // Use stereo if plugin data is valid + const float left[3] = { // We have an LHS coordinate system + - p->fTop[1]*p->fFront[2] + p->fTop[2]*p->fFront[1], + - p->fTop[2]*p->fFront[0] + p->fTop[0]*p->fFront[2], + - p->fTop[0]*p->fFront[1] + p->fTop[1]*p->fFront[0] + }; + // This cross-product defines the left/right split plane + + const float left_norm = sqrtf(left[0]*left[0] + left[1]*left[1]+left[2]*left[2]); + foreach(aop, qlMix) { + float vol_scal = 1.0; + float vol_stereo = 0; + + // Test if source has valid position data + if (aop->fPos[0] != 0.0 or aop->fPos[1] != 0.0 or aop->fPos[2] != 0.0) { + const float source_direction[3] = { + aop->fPos[0] - p->fPosition[0], + aop->fPos[1] - p->fPosition[1], + aop->fPos[1] - p->fPosition[1] + }; + + const float source_direction_norm = sqrtf( + source_direction[0]*source_direction[0] + + source_direction[1]*source_direction[1] + + source_direction[2]*source_direction[2]); + + vol_stereo = (left[0]*source_direction[0] + + left[1]*source_direction[1] + + left[2]*source_direction[2]) + / left_norm / source_direction_norm; + // asin(scalar_product) = angle from center, where + // angle < 0 is right and angle > 0 is left + + if (g.s.bPositionalSoundSwap) + vol_stereo *= (-1); + + vol_scal= PositionalSound::toRatio(PositionalSound::calcdB(source_direction_norm)); + } + const float vol_left= vol_scal * (1.0 + vol_stereo); + const float vol_right= vol_scal * (1.0 - vol_stereo); + for (int i=0;i<iFrameSize;i++) { + t[2*i] += (int)(vol_left * aop->psBuffer[i]); + t[2*i+1] += (int)(vol_right *aop->psBuffer[i]); + } + } + } else { // no stereo + foreach(aop, qlMix) { + for (int i=0;i<iFrameSize;i++) { + t[2*i] += aop->psBuffer[i]; + t[2*i+1] += aop->psBuffer[i]; + } + } + } + + for (int i=0;i<(iFrameSize*2);i++) + buffer[i]=qMax(-32727,qMin(32767,t[i])); + + qrwlOutputs.unlock(); + + foreach(aop, qlDel) + removeBuffer(aop); + + return (! qlMix.isEmpty()); } AudioSine::AudioSine(float hz, float i, unsigned int frm, float vol) : AudioOutputPlayer(QLatin1String("Sine")) { @@ -465,7 +467,7 @@ bool AudioSine::decodeNextFrame() { g.iAudioPathTime = cntr; } - for(unsigned int i=0;i<iFrameSize;i++) + for (unsigned int i=0;i<iFrameSize;i++) psBuffer[i] = lroundf(32768.0f * volume * sinf(M_PI * i * (tbin * 1.0f) / (1.0f * iFrameSize))); return true; diff --git a/src/mumble/AudioStats.cpp b/src/mumble/AudioStats.cpp index b31e2c62d..37bbd3c48 100644 --- a/src/mumble/AudioStats.cpp +++ b/src/mumble/AudioStats.cpp @@ -168,8 +168,8 @@ void AudioEchoWidget::paintGL() { drft_lookup d; mumble_drft_init(&d, n); - for(int j=0;j<M;j++) { - for(int i=0;i<n;i++) + for (int j=0;j<M;j++) { + for (int i=0;i<n;i++) W[j*n+i] = w[j*n+i] / (1.f * n); mumble_drft_forward(&d, & W[j*n]); } @@ -203,7 +203,7 @@ void AudioEchoWidget::paintGL() { glColor3f(1.0, 0.0, 1.0); xscale = 1.0f / (2*n); yscale = 1.0f / (200.0f * 32767.0f); - for(int i=0;i<2*n;i++) { + for (int i=0;i<2*n;i++) { glVertex2f(i*xscale, 0.5 + w[i] * yscale); } glEnd(); @@ -339,7 +339,7 @@ void AudioStats::on_Tick_timeout() { int start = (ps_size * 300) / SAMPLE_RATE; int stop = (ps_size * 2000) / SAMPLE_RATE; - for(int i=start;i<stop;i++) { + for (int i=start;i<stop;i++) { s += sqrtf(ps[i]); n += sqrtf(noise[i]); } diff --git a/src/mumble/AudioWizard.cpp b/src/mumble/AudioWizard.cpp index 7b261d844..a18def39f 100644 --- a/src/mumble/AudioWizard.cpp +++ b/src/mumble/AudioWizard.cpp @@ -387,8 +387,8 @@ QWizardPage *AudioWizard::deviceTuningPage() { grid->addWidget(qlOutputDelay, 2, 2);
l = new QLabel(tr("If you position the microphone so it can pick up the speakers or headset, Mumble will measure the total audio path "
- "delay in your system; this means the delay from a sample is placed in an outbound buffer until it's found in "
- "a matching incoming buffer."));
+ "delay in your system; this means the delay from a sample is placed in an outbound buffer until it's found in "
+ "a matching incoming buffer."));
l->setWordWrap(true);
grid->addWidget(l, 3, 0, 1, 2);
diff --git a/src/mumble/ConnectDialog.cpp b/src/mumble/ConnectDialog.cpp index af0e743bc..5a7919350 100644 --- a/src/mumble/ConnectDialog.cpp +++ b/src/mumble/ConnectDialog.cpp @@ -281,7 +281,7 @@ void ConnectDialog::on_qpbAdd_clicked() { qslFields << QLatin1String("password"); qslFields << QLatin1String("port"); - for(int i=0; i < nrec;++i) { + for (int i=0; i < nrec;++i) { rec = qstmServers->record(i); bool match = true; foreach(const QString &s, qslFields) { diff --git a/src/mumble/Global.h b/src/mumble/Global.h index e79dc3eae..14379f6a8 100644 --- a/src/mumble/Global.h +++ b/src/mumble/Global.h @@ -97,8 +97,12 @@ class DeferInit { static QMultiMap<int, DeferInit *> *qmDeferers; void add(int priority); public: - DeferInit(int priority) { add(priority); }; - DeferInit() { add(0); }; + DeferInit(int priority) { + add(priority); + }; + DeferInit() { + add(0); + }; virtual ~DeferInit(); virtual void initialize() { }; virtual void destroy() { }; diff --git a/src/mumble/GlobalShortcut_macx.cpp b/src/mumble/GlobalShortcut_macx.cpp index 6279c4006..ee6ff4a45 100644 --- a/src/mumble/GlobalShortcut_macx.cpp +++ b/src/mumble/GlobalShortcut_macx.cpp @@ -42,8 +42,7 @@ GlobalShortcutEngine *GlobalShortcutEngine::platformInit() { static OSStatus MonitorHandler(EventHandlerCallRef caller, EventRef event, - void *udata) -{ + void *udata) { GlobalShortcutMac *gs = reinterpret_cast<GlobalShortcutMac *>(udata); OSType type = GetEventClass(event); UInt32 kind = GetEventKind(event); @@ -64,7 +63,7 @@ static OSStatus MonitorHandler(EventHandlerCallRef caller, NULL, sizeof(UInt32), NULL, &ch); gs->handleModButton(ch); - /* Regular keypresses. */ + /* Regular keypresses. */ } else { GetEventParameter(event, kEventParamKeyCode, typeUInt32, NULL, sizeof(UInt32), NULL, &ch); @@ -73,7 +72,7 @@ static OSStatus MonitorHandler(EventHandlerCallRef caller, gs->handleButton(keycode, down); } - /* Mouse events */ + /* Mouse events */ } else if (type == kEventClassMouse) { GetEventParameter(event, kEventParamMouseButton, typeMouseButton, NULL, sizeof(EventMouseButton), NULL, &mb); @@ -87,8 +86,7 @@ static OSStatus MonitorHandler(EventHandlerCallRef caller, static OSStatus CmdHandler(EventHandlerCallRef caller, EventRef event, - void *udata) -{ + void *udata) { OSStatus err; UInt32 klass = GetEventClass(event); @@ -154,7 +152,7 @@ void GlobalShortcutMac::needRemap() { void GlobalShortcutMac::handleModButton(UInt32 newmask) { bool down; - #define MOD_CHANGED(mask, btn) do { \ +#define MOD_CHANGED(mask, btn) do { \ if ((newmask & mask) != (modmask & mask)) { \ down = newmask & mask; \ handleButton(MOD_OFFSET+btn, down); \ diff --git a/src/mumble/GlobalShortcut_unix.cpp b/src/mumble/GlobalShortcut_unix.cpp index a8929c3b6..4a298cdc8 100644 --- a/src/mumble/GlobalShortcut_unix.cpp +++ b/src/mumble/GlobalShortcut_unix.cpp @@ -55,7 +55,7 @@ GlobalShortcutX::GlobalShortcutX() { QFileSystemWatcher *fsw = new QFileSystemWatcher(QStringList(dir), this); connect(fsw, SIGNAL(directoryChanged(const QString &)), this, SLOT(directoryChanged(const QString &))); directoryChanged(dir); - + if (qmInputDevices.isEmpty()) { delete fsw; qWarning("GlobalShortcutX: Unable to open any input devices under /dev/input, falling back to XEVIE"); @@ -152,9 +152,9 @@ void GlobalShortcutX::inputReadyRead(int) { QFile *f=qobject_cast<QFile *>(sender()->parent()); if (!f) return; - + bool found = false; - + while (f->read(reinterpret_cast<char *>(&ev), sizeof(ev)) == sizeof(ev)) { found = true; if (ev.type != EV_KEY) @@ -173,7 +173,7 @@ void GlobalShortcutX::inputReadyRead(int) { int evtcode = ev.code + 8; handleButton(evtcode, down); } - + if (! found) { int fd = f->handle(); int version = 0; diff --git a/src/mumble/MainWindow.cpp b/src/mumble/MainWindow.cpp index 3207a1d38..b271b503e 100644 --- a/src/mumble/MainWindow.cpp +++ b/src/mumble/MainWindow.cpp @@ -363,12 +363,12 @@ void MainWindow::on_qmPlayer_aboutToShow() { qmPlayer->clear(); - qmPlayer->addAction(qaPlayerKick); - qmPlayer->addAction(qaPlayerBan); - qmPlayer->addAction(qaPlayerMute); - qmPlayer->addAction(qaPlayerDeaf); - qmPlayer->addAction(qaPlayerLocalMute); - qmPlayer->addAction(qaPlayerTextMessage); + qmPlayer->addAction(qaPlayerKick); + qmPlayer->addAction(qaPlayerBan); + qmPlayer->addAction(qaPlayerMute); + qmPlayer->addAction(qaPlayerDeaf); + qmPlayer->addAction(qaPlayerLocalMute); + qmPlayer->addAction(qaPlayerTextMessage); if (self) { qmPlayer->addSeparator(); diff --git a/src/mumble/NetworkConfig.cpp b/src/mumble/NetworkConfig.cpp index cbb92c047..e186ea107 100644 --- a/src/mumble/NetworkConfig.cpp +++ b/src/mumble/NetworkConfig.cpp @@ -82,12 +82,14 @@ void NetworkConfig::save() const { s.qsProxyPassword = qlePassword->text(); } -static QNetworkProxy::ProxyType local_to_qt_proxy(Settings::ProxyType pt) -{ +static QNetworkProxy::ProxyType local_to_qt_proxy(Settings::ProxyType pt) { switch (pt) { - case Settings::NoProxy: return QNetworkProxy::NoProxy; - case Settings::HttpProxy: return QNetworkProxy::HttpProxy; - case Settings::Socks5Proxy: return QNetworkProxy::Socks5Proxy; + case Settings::NoProxy: + return QNetworkProxy::NoProxy; + case Settings::HttpProxy: + return QNetworkProxy::HttpProxy; + case Settings::Socks5Proxy: + return QNetworkProxy::Socks5Proxy; } return QNetworkProxy::NoProxy; @@ -132,8 +134,7 @@ bool NetworkConfig::expert(bool b) { return true; } -void NetworkConfig::on_qcbType_currentIndexChanged(int v) -{ +void NetworkConfig::on_qcbType_currentIndexChanged(int v) { Settings::ProxyType pt = static_cast<Settings::ProxyType>(v); qleHostname->setEnabled(pt != Settings::NoProxy); diff --git a/src/mumble/OSS.cpp b/src/mumble/OSS.cpp index 2b00c59d6..2e1aacbf0 100644 --- a/src/mumble/OSS.cpp +++ b/src/mumble/OSS.cpp @@ -53,8 +53,13 @@ class OSSEnumerator { static OSSEnumerator *cards = NULL; class OSSInit : public DeferInit { - void initialize() { cards = new OSSEnumerator(); }; - void destroy() { delete cards; cards = NULL; }; + void initialize() { + cards = new OSSEnumerator(); + }; + void destroy() { + delete cards; + cards = NULL; + }; }; static OSSInit ossi; diff --git a/src/mumble/PlayerModel.cpp b/src/mumble/PlayerModel.cpp index 48e87c356..39d846cb3 100644 --- a/src/mumble/PlayerModel.cpp +++ b/src/mumble/PlayerModel.cpp @@ -77,11 +77,11 @@ ModelItem::~ModelItem() { void ModelItem::stealChildren(ModelItem *other) { Q_ASSERT(qlChildren.count() == 0); - + qlChildren = other->qlChildren; other->qlChildren.clear(); - foreach(ModelItem *mi, qlChildren) - mi->parent = this; + foreach(ModelItem *mi, qlChildren) + mi->parent = this; } ModelItem *ModelItem::child(int idx) const { @@ -496,7 +496,7 @@ void PlayerModel::moveItem(ModelItem *oldparent, ModelItem *newparent, ModelItem } else { newparent->cChan->addPlayer(item->pPlayer); } - + t->stealChildren(item); endInsertRows(); diff --git a/src/mumble/PositionalSound.cpp b/src/mumble/PositionalSound.cpp index 0c08b49b4..ba1b661fc 100644 --- a/src/mumble/PositionalSound.cpp +++ b/src/mumble/PositionalSound.cpp @@ -34,85 +34,86 @@ PlotWidget::PlotWidget(QWidget *p, const QList<float> &xl,const QList<float> &yl) : QWidget(p), xdata(xl), ydata(yl) { - setPalette(QPalette(QColor(255,255,255))); - setAutoFillBackground(true); - setMinimumSize(20,20); - setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); + setPalette(QPalette(QColor(255,255,255))); + setAutoFillBackground(true); + setMinimumSize(20,20); + setSizePolicy(QSizePolicy::Expanding,QSizePolicy::Expanding); } void PlotWidget::paintEvent(QPaintEvent *) { - QPainter painter(this); - if(xdata.size() < 2 || ydata.size() < 2) - return; + QPainter painter(this); + if (xdata.size() < 2 || ydata.size() < 2) + return; - float minx = xdata.front(); - float maxx = xdata.back(); + float minx = xdata.front(); + float maxx = xdata.back(); - float miny = ydata.front(); - float maxy = ydata.back(); - - float f; + float miny = ydata.front(); + float maxy = ydata.back(); - foreach(f,ydata) { - miny = qMin(miny,f); - maxy = qMax(maxy,f); - } + float f; - if( miny == maxy) { - miny -= 1; - maxy += 1; - } + foreach(f,ydata) { + miny = qMin(miny,f); + maxy = qMax(maxy,f); + } - const int hght = this->height(); - const int wdth = this->width(); + if (miny == maxy) { + miny -= 1; + maxy += 1; + } - painter.drawLine(15,hght - 20, wdth, hght -20); - painter.drawLine(20,hght - 15, 20, 0); + const int hght = this->height(); + const int wdth = this->width(); - float ticstep = 1; + painter.drawLine(15,hght - 20, wdth, hght -20); + painter.drawLine(20,hght - 15, 20, 0); - while( (maxx - minx) / ticstep > 10.9) - ticstep *= 2; + float ticstep = 1; - for(f = (lround(minx / ticstep) + 1) * ticstep; f < maxx; f += ticstep) { - const int ipos = lround(20 + (wdth-20) * (f-minx) / (maxx-minx)); + while ((maxx - minx) / ticstep > 10.9) + ticstep *= 2; - painter.drawLine(ipos,hght - 20, ipos, hght -17); - painter.drawText(QRect(ipos-20,hght-17,40,17),Qt::AlignCenter,QString::number(roundf(f))); - } + for (f = (lround(minx / ticstep) + 1) * ticstep; f < maxx; f += ticstep) { + const int ipos = lround(20 + (wdth-20) * (f-minx) / (maxx-minx)); - ticstep = 1; + painter.drawLine(ipos,hght - 20, ipos, hght -17); + painter.drawText(QRect(ipos-20,hght-17,40,17),Qt::AlignCenter,QString::number(roundf(f))); + } - while( (maxy - miny) / ticstep > 10.9) - ticstep *= 2; + ticstep = 1; - for(f = (lround(miny / ticstep) + 1) * ticstep; f < maxy; f += ticstep) { - const int ipos = lround((hght-20) *(1 - (f - miny) / (maxy-miny))); + while ((maxy - miny) / ticstep > 10.9) + ticstep *= 2; - painter.drawLine(17 ,ipos , 20, ipos); - painter.drawText(QRect(0,ipos-10,17,20),Qt::AlignCenter,QString::number(roundf(f))); - } + for (f = (lround(miny / ticstep) + 1) * ticstep; f < maxy; f += ticstep) { + const int ipos = lround((hght-20) *(1 - (f - miny) / (maxy-miny))); - QList<float>::const_iterator xit = xdata.begin(); - QList<float>::const_iterator yit = ydata.begin(); + painter.drawLine(17 ,ipos , 20, ipos); + painter.drawText(QRect(0,ipos-10,17,20),Qt::AlignCenter,QString::number(roundf(f))); + } - float xold = *(xit++); - float yold = *(yit++); + QList<float>::const_iterator xit = xdata.begin(); + QList<float>::const_iterator yit = ydata.begin(); - painter.setPen(QColor(255,0,0)); - while(xit != xdata.end() && yit != ydata.end()) { - painter.drawLine( - lround(20 + (wdth-20) * (xold-minx) / (maxx-minx)), - lround((hght-20) *(1 - (yold - miny) / (maxy-miny))), - lround(20 + (wdth-20) * (*xit-minx) / (maxx-minx)), - lround((hght-20) * ( 1 - (*yit - miny) / (maxy-miny)))); - xold = *(xit++); yold = *(yit++); - } + float xold = *(xit++); + float yold = *(yit++); + + painter.setPen(QColor(255,0,0)); + while (xit != xdata.end() && yit != ydata.end()) { + painter.drawLine( + lround(20 + (wdth-20) * (xold-minx) / (maxx-minx)), + lround((hght-20) *(1 - (yold - miny) / (maxy-miny))), + lround(20 + (wdth-20) * (*xit-minx) / (maxx-minx)), + lround((hght-20) * (1 - (*yit - miny) / (maxy-miny)))); + xold = *(xit++); + yold = *(yit++); + } } int PlotWidget::heightForWidth(int w) const { - return w * 3 / 4; + return w * 3 / 4; } static ConfigWidget *PositionalSoundConfigDialogNew(Settings &st) { @@ -123,21 +124,21 @@ static ConfigRegistrar registrar(29, PositionalSoundConfigDialogNew); PositionalSoundConfig::PositionalSoundConfig(Settings &st) : ConfigWidget(st) { - setupUi(this); + setupUi(this); - plot = new PlotWidget(qgbVolume,xdata,ydata); - plot->setObjectName(QString::fromUtf8("Plot")); + plot = new PlotWidget(qgbVolume,xdata,ydata); + plot->setObjectName(QString::fromUtf8("Plot")); - gridLayout->addWidget(plot, 3, 1, 1, 3); + gridLayout->addWidget(plot, 3, 1, 1, 3); - qcbModel->addItem(tr("constant"),Settings::CONSTANT); - qcbModel->addItem(tr("linear"),Settings::LINEAR); + qcbModel->addItem(tr("constant"),Settings::CONSTANT); + qcbModel->addItem(tr("linear"),Settings::LINEAR); - update(); + update(); } PositionalSoundConfig::~PositionalSoundConfig() { - delete plot; + delete plot; } QString PositionalSoundConfig::title() const { @@ -149,32 +150,32 @@ QIcon PositionalSoundConfig::icon() const { } void PositionalSoundConfig::save() const { - s.ePositionalSoundModel = static_cast<Settings::PositionalSoundModels>(qcbModel->itemData(qcbModel->currentIndex()).toInt()); + s.ePositionalSoundModel = static_cast<Settings::PositionalSoundModels>(qcbModel->itemData(qcbModel->currentIndex()).toInt()); - s.fPositionalSoundDistance = qdsbDistance->value(); - s.fPositionalSoundPreGain = qdsbPreGain->value(); - s.fPositionalSoundMaxAtt = qdsbMaxAtt->value(); + s.fPositionalSoundDistance = qdsbDistance->value(); + s.fPositionalSoundPreGain = qdsbPreGain->value(); + s.fPositionalSoundMaxAtt = qdsbMaxAtt->value(); - s.bPositionalSoundEnable = qcbEnable->checkState() == Qt::Checked; - s.bPositionalSoundSwap = qcbSwap->checkState() == Qt::Checked; + s.bPositionalSoundEnable = qcbEnable->checkState() == Qt::Checked; + s.bPositionalSoundSwap = qcbSwap->checkState() == Qt::Checked; } void PositionalSoundConfig::load(const Settings &r) { - for (int i=0;i<qcbModel->count();i++) { - if (qcbModel->itemData(i).toInt() == r.ePositionalSoundModel) { - loadComboBox(qcbModel, i); - break; - } - } + for (int i=0;i<qcbModel->count();i++) { + if (qcbModel->itemData(i).toInt() == r.ePositionalSoundModel) { + loadComboBox(qcbModel, i); + break; + } + } - qdsbDistance->setValue(r.fPositionalSoundDistance); - qdsbPreGain->setValue(r.fPositionalSoundPreGain); - qdsbMaxAtt->setValue(r.fPositionalSoundMaxAtt); + qdsbDistance->setValue(r.fPositionalSoundDistance); + qdsbPreGain->setValue(r.fPositionalSoundPreGain); + qdsbMaxAtt->setValue(r.fPositionalSoundMaxAtt); - qcbEnable->setCheckState( r.bPositionalSoundEnable ? Qt::Checked : Qt::Unchecked); - qcbSwap->setCheckState( r.bPositionalSoundSwap ? Qt::Checked : Qt::Unchecked); + qcbEnable->setCheckState(r.bPositionalSoundEnable ? Qt::Checked : Qt::Unchecked); + qcbSwap->setCheckState(r.bPositionalSoundSwap ? Qt::Checked : Qt::Unchecked); - update(); + update(); } bool PositionalSoundConfig::expert(bool) { @@ -182,73 +183,73 @@ bool PositionalSoundConfig::expert(bool) { } void PositionalSoundConfig::update() { - - const Settings::PositionalSoundModels model = - static_cast<Settings::PositionalSoundModels>(qcbModel->itemData(qcbModel->currentIndex()).toInt()); - const float distance = qdsbDistance->value(); - const float pregain = qdsbPreGain->value(); - const float maxatt = qdsbMaxAtt->value(); + const Settings::PositionalSoundModels model = + static_cast<Settings::PositionalSoundModels>(qcbModel->itemData(qcbModel->currentIndex()).toInt()); + + const float distance = qdsbDistance->value(); + const float pregain = qdsbPreGain->value(); + const float maxatt = qdsbMaxAtt->value(); + + float yold = pregain; + float xmax = 1000; - float yold = pregain; - float xmax = 1000; + xdata.clear(); + ydata.clear(); - xdata.clear(); - ydata.clear(); + for (float xv = 0; xv < xmax; xv+= 1) { + xdata << xv; - for(float xv = 0; xv < xmax; xv+= 1) { - xdata << xv; + float yv = 0; + switch (model) { + case Settings::CONSTANT: + yv = PositionalSound::ModelConstant(pregain); + break; + case Settings::LINEAR: + yv = PositionalSound::ModelLinear(pregain,maxatt,distance,xv); + break; + } - float yv = 0; - switch(model) { - case Settings::CONSTANT: - yv = PositionalSound::ModelConstant(pregain); - break; - case Settings::LINEAR: - yv = PositionalSound::ModelLinear(pregain,maxatt,distance,xv); - break; - } + ydata << yv; - ydata << yv; + if (yold - yv < 1e-10 && xmax >= 1000 && xv > 0) + xmax = 1.1*xv+1; - if(yold - yv < 1e-10 && xmax >= 1000 && xv > 0) - xmax = 1.1*xv+1; - - yold = yv; - } + yold = yv; + } - plot->update(); + plot->update(); } void PositionalSoundConfig::on_qcbEnable_stateChanged(int state) { - if(state == Qt::Checked) { - qcbSwap->setEnabled(true); - qgbVolume->setEnabled(true); - } else { - qcbSwap->setEnabled(false); - qgbVolume->setEnabled(false); - } + if (state == Qt::Checked) { + qcbSwap->setEnabled(true); + qgbVolume->setEnabled(true); + } else { + qcbSwap->setEnabled(false); + qgbVolume->setEnabled(false); + } } void PositionalSoundConfig::on_qcbModel_currentIndexChanged(int i) { - if( qcbModel->itemData(i).toInt() == Settings::CONSTANT) { - qdsbDistance->setEnabled(false); - qdsbMaxAtt->setEnabled(false); - } else { - qdsbDistance->setEnabled(true); - qdsbMaxAtt->setEnabled(true); - } + if (qcbModel->itemData(i).toInt() == Settings::CONSTANT) { + qdsbDistance->setEnabled(false); + qdsbMaxAtt->setEnabled(false); + } else { + qdsbDistance->setEnabled(true); + qdsbMaxAtt->setEnabled(true); + } - update(); + update(); } void PositionalSoundConfig::on_qdsbDistance_valueChanged(double) { - update(); + update(); } void PositionalSoundConfig::on_qdsbPreGain_valueChanged(double) { - update(); + update(); } void PositionalSoundConfig::on_qdsbMaxAtt_valueChanged(double) { - update(); + update(); } diff --git a/src/mumble/PositionalSound.h b/src/mumble/PositionalSound.h index cd279a8ae..19b62dd71 100644 --- a/src/mumble/PositionalSound.h +++ b/src/mumble/PositionalSound.h @@ -38,28 +38,27 @@ #include "ui_PositionalSound.h" -class PlotWidget : public QWidget -{ - Q_OBJECT - protected: - const QList<float> &xdata; - const QList<float> &ydata; - - void paintEvent(QPaintEvent*); - - public: - PlotWidget(QWidget *parent, const QList<float> &x, const QList<float> &y); - int heightForWidth(int) const; +class PlotWidget : public QWidget { + Q_OBJECT + protected: + const QList<float> &xdata; + const QList<float> &ydata; + + void paintEvent(QPaintEvent*); + + public: + PlotWidget(QWidget *parent, const QList<float> &x, const QList<float> &y); + int heightForWidth(int) const; }; -class PositionalSoundConfig : public ConfigWidget, - public Ui::PositionalSoundConfig { +class PositionalSoundConfig : public ConfigWidget, + public Ui::PositionalSoundConfig { Q_OBJECT - protected: - QList<float> xdata; - QList<float> ydata; + protected: + QList<float> xdata; + QList<float> ydata; - PlotWidget* plot; + PlotWidget* plot; public: PositionalSoundConfig(Settings &st); ~PositionalSoundConfig(); @@ -79,30 +78,36 @@ class PositionalSoundConfig : public ConfigWidget, }; class PositionalSound { - public: - static inline float todB(const float ratio) { return 20 * log10f(ratio);} - static inline float toRatio(const float dB) { return exp10f(dB/20);} + public: + static inline float todB(const float ratio) { + return 20 * log10f(ratio); + } + static inline float toRatio(const float dB) { + return exp10f(dB/20); + } - static inline float ModelConstant(const float pregain) { - return pregain; - } + static inline float ModelConstant(const float pregain) { + return pregain; + } - static inline float ModelLinear(const float pregain, const float maxatt, const float distance, const float d) { - const float att = 10 * d/distance; + static inline float ModelLinear(const float pregain, const float maxatt, const float distance, const float d) { + const float att = 10 * d/distance; - return pregain - (att < maxatt ? att : maxatt); - } + return pregain - (att < maxatt ? att : maxatt); + } - static inline float calcdB(const float d) { - switch (g.s.ePositionalSoundModel) { - case Settings::CONSTANT: return ModelConstant(g.s.fPositionalSoundPreGain); - case Settings::LINEAR: return ModelLinear( g.s.fPositionalSoundPreGain, g.s.fPositionalSoundMaxAtt, g.s.fPositionalSoundDistance, d); - } + static inline float calcdB(const float d) { + switch (g.s.ePositionalSoundModel) { + case Settings::CONSTANT: + return ModelConstant(g.s.fPositionalSoundPreGain); + case Settings::LINEAR: + return ModelLinear(g.s.fPositionalSoundPreGain, g.s.fPositionalSoundMaxAtt, g.s.fPositionalSoundDistance, d); + } - return 0; - } + return 0; + } }; diff --git a/src/mumble/PulseAudio.cpp b/src/mumble/PulseAudio.cpp index 498e55d07..041d11647 100644 --- a/src/mumble/PulseAudio.cpp +++ b/src/mumble/PulseAudio.cpp @@ -69,8 +69,13 @@ static PulseAudioOutputRegistrar aorPulseAudio; class PulseAudioInit : public DeferInit { public: - void initialize() { pasys = new PulseAudioSystem(); }; - void destroy() { delete pasys; pasys = NULL; }; + void initialize() { + pasys = new PulseAudioSystem(); + }; + void destroy() { + delete pasys; + pasys = NULL; + }; }; static PulseAudioInit pulseinit; @@ -88,9 +93,9 @@ PulseAudioSystem::PulseAudioSystem() { pa_mainloop_api *api = pa_mainloop_get_api(pam); pacContext = pa_context_new(api, "Mumble"); - + pa_context_set_subscribe_callback(pacContext, subscribe_callback, this); - + pa_context_set_state_callback(pacContext, context_state_callback, this); pa_context_connect(pacContext, NULL, PA_CONTEXT_NOAUTOSPAWN, NULL); @@ -358,7 +363,7 @@ void PulseAudioSystem::read_callback(pa_stream *s, size_t bytes, void *userdata) pa_stream_peek(s, &data, &length); const short *buffer = reinterpret_cast<const short *>(data); int samples = length / 2; - + AudioInputPtr ai = g.ai; PulseAudioInput *pai = dynamic_cast<PulseAudioInput *>(ai.get()); if (! pai) { @@ -427,9 +432,9 @@ void PulseAudioSystem::write_callback(pa_stream *s, size_t bytes, void *userdata AudioOutputPtr ao = g.ao; PulseAudioOutput *pao = dynamic_cast<PulseAudioOutput *>(ao.get()); - + int samples = bytes / 2; - + if (! pao) { // Transitioning, but most likely transitions back, so just zero. short zero[samples]; diff --git a/src/mumble/Settings.cpp b/src/mumble/Settings.cpp index 2bda49a52..64f791844 100644 --- a/src/mumble/Settings.cpp +++ b/src/mumble/Settings.cpp @@ -83,12 +83,12 @@ Settings::Settings() { fDXMaxDistance = 50.0f; fDXRollOff = 0.15f; - bPositionalSoundEnable = true; - bPositionalSoundSwap = false; - ePositionalSoundModel = CONSTANT; - fPositionalSoundDistance= 70; - fPositionalSoundPreGain = 0; - fPositionalSoundMaxAtt = 10; + bPositionalSoundEnable = true; + bPositionalSoundSwap = false; + ePositionalSoundModel = CONSTANT; + fPositionalSoundDistance= 70; + fPositionalSoundPreGain = 0; + fPositionalSoundMaxAtt = 10; bOverlayEnable = true; @@ -194,12 +194,12 @@ void Settings::load() { SAVELOAD(qbaDXInput, "directsound/input"); SAVELOAD(qbaDXOutput, "directsound/output"); - SAVELOAD(bPositionalSoundEnable, "positionalsound/enable"); - SAVELOAD(bPositionalSoundSwap, "positionalsound/swap"); - LOADENUM(ePositionalSoundModel, "positionalsound/model"); - SAVELOAD(fPositionalSoundDistance, "positionalsound/distance"); - SAVELOAD(fPositionalSoundPreGain, "positionalsound/pregain"); - SAVELOAD(fPositionalSoundMaxAtt, "positionalsound/maxatt"); + SAVELOAD(bPositionalSoundEnable, "positionalsound/enable"); + SAVELOAD(bPositionalSoundSwap, "positionalsound/swap"); + LOADENUM(ePositionalSoundModel, "positionalsound/model"); + SAVELOAD(fPositionalSoundDistance, "positionalsound/distance"); + SAVELOAD(fPositionalSoundPreGain, "positionalsound/pregain"); + SAVELOAD(fPositionalSoundMaxAtt, "positionalsound/maxatt"); SAVELOAD(bTTS, "tts/enable"); SAVELOAD(iTTSVolume, "tts/volume"); @@ -318,12 +318,12 @@ void Settings::save() { SAVELOAD(qbaDXInput, "directsound/input"); SAVELOAD(qbaDXOutput, "directsound/output"); - SAVELOAD(bPositionalSoundEnable, "positionalsound/enable"); - SAVELOAD(bPositionalSoundSwap, "positionalsound/swap"); - SAVELOAD(ePositionalSoundModel, "positionalsound/model"); - SAVELOAD(fPositionalSoundDistance, "positionalsound/distance"); - SAVELOAD(fPositionalSoundPreGain, "positionalsound/pregain"); - SAVELOAD(fPositionalSoundMaxAtt, "positionalsound/maxatt"); + SAVELOAD(bPositionalSoundEnable, "positionalsound/enable"); + SAVELOAD(bPositionalSoundSwap, "positionalsound/swap"); + SAVELOAD(ePositionalSoundModel, "positionalsound/model"); + SAVELOAD(fPositionalSoundDistance, "positionalsound/distance"); + SAVELOAD(fPositionalSoundPreGain, "positionalsound/pregain"); + SAVELOAD(fPositionalSoundMaxAtt, "positionalsound/maxatt"); SAVELOAD(bTTS, "tts/enable"); SAVELOAD(iTTSVolume, "tts/volume"); diff --git a/src/mumble/Settings.h b/src/mumble/Settings.h index 1a6551768..5ebd6a2f3 100644 --- a/src/mumble/Settings.h +++ b/src/mumble/Settings.h @@ -84,12 +84,12 @@ struct Settings { QByteArray qbaDXInput, qbaDXOutput; float fDXMinDistance, fDXMaxDistance, fDXRollOff; - bool bPositionalSoundEnable, bPositionalSoundSwap; - enum PositionalSoundModels { CONSTANT, LINEAR }; - PositionalSoundModels ePositionalSoundModel; - float fPositionalSoundDistance, - fPositionalSoundPreGain, //in dB - fPositionalSoundMaxAtt; //in dB + bool bPositionalSoundEnable, bPositionalSoundSwap; + enum PositionalSoundModels { CONSTANT, LINEAR }; + PositionalSoundModels ePositionalSoundModel; + float fPositionalSoundDistance, + fPositionalSoundPreGain, //in dB + fPositionalSoundMaxAtt; //in dB bool bOverlayEnable; bool bOverlayUserTextures; diff --git a/src/mumble/WASAPI.cpp b/src/mumble/WASAPI.cpp index a7c12a486..2db8a7b8d 100644 --- a/src/mumble/WASAPI.cpp +++ b/src/mumble/WASAPI.cpp @@ -58,9 +58,9 @@ static ConfigWidget *WASAPIConfigDialogNew(Settings &st) { } class WASAPIInit : public DeferInit { - ConfigRegistrar *confReg; - WASAPIInputRegistrar *wirReg; - WASAPIOutputRegistrar *worReg; + ConfigRegistrar *confReg; + WASAPIInputRegistrar *wirReg; + WASAPIOutputRegistrar *worReg; public: void initialize(); void destroy(); @@ -165,7 +165,7 @@ const QHash<QString, QString> WASAPISystem::getDevices(EDataFlow dataflow) { UINT ndev = 0; pCollection->GetCount(&ndev); - for(unsigned int idx=0;idx<ndev;++idx) { + for (unsigned int idx=0;idx<ndev;++idx) { IMMDevice *pDevice = NULL; IPropertyStore *pStore = NULL; @@ -295,8 +295,8 @@ void WASAPIInput::run() { UINT32 wantLength; HANDLE hEvent; BYTE *pData; - DWORD flags; - int err = 0; + DWORD flags; + int err = 0; DWORD gotLength = 0; DWORD dwTaskIndex = 0; HANDLE hMmThread; @@ -402,7 +402,7 @@ void WASAPIInput::run() { float *inData = reinterpret_cast<float *>(pData); while (numFramesLeft) { float v = 0.0f; - for(int i=0;i<pwfx->nChannels;i++) { + for (int i=0;i<pwfx->nChannels;i++) { v+= *inData; ++inData; } @@ -413,7 +413,7 @@ void WASAPIInput::run() { spx_uint32_t inlen = wantLength; spx_uint32_t outlen = iFrameSize; speex_resampler_process_float(srs, 0, inbuff, &inlen, outbuff, &outlen); - for(int i=0;i<iFrameSize;i++) + for (int i=0;i<iFrameSize;i++) psMic[i] = static_cast<short>(outbuff[i] * mul); encodeAudioFrame(); diff --git a/src/mumble/WASAPI.h b/src/mumble/WASAPI.h index 213269c50..1afb1d6e5 100644 --- a/src/mumble/WASAPI.h +++ b/src/mumble/WASAPI.h @@ -60,7 +60,7 @@ class WASAPIConfig : public ConfigWidget, public Ui::WASAPIConfig { }; class WASAPISystem : public QObject { - Q_OBJECT + Q_OBJECT public: static const QHash<QString, QString> getDevices(EDataFlow dataflow); static const QHash<QString, QString> getInputDevices(); diff --git a/src/mumble/licenses.h b/src/mumble/licenses.h index 206f2084c..4805f66e6 100644 --- a/src/mumble/licenses.h +++ b/src/mumble/licenses.h @@ -1,342 +1,342 @@ static const char *licenseMumble = " GNU GENERAL PUBLIC LICENSE\n" -" Version 2, June 1991\n" -"\n" -" Copyright (C) 1989, 1991 Free Software Foundation, Inc.\n" -" 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n" -" Everyone is permitted to copy and distribute verbatim copies\n" -" of this license document, but changing it is not allowed.\n" -"\n" -" Preamble\n" -"\n" -" The licenses for most software are designed to take away your\n" -"freedom to share and change it. By contrast, the GNU General Public\n" -"License is intended to guarantee your freedom to share and change free\n" -"software--to make sure the software is free for all its users. This\n" -"General Public License applies to most of the Free Software\n" -"Foundation's software and to any other program whose authors commit to\n" -"using it. (Some other Free Software Foundation software is covered by\n" -"the GNU Library General Public License instead.) You can apply it to\n" -"your programs, too.\n" -"\n" -" When we speak of free software, we are referring to freedom, not\n" -"price. Our General Public Licenses are designed to make sure that you\n" -"have the freedom to distribute copies of free software (and charge for\n" -"this service if you wish), that you receive source code or can get it\n" -"if you want it, that you can change the software or use pieces of it\n" -"in new free programs; and that you know you can do these things.\n" -"\n" -" To protect your rights, we need to make restrictions that forbid\n" -"anyone to deny you these rights or to ask you to surrender the rights.\n" -"These restrictions translate to certain responsibilities for you if you\n" -"distribute copies of the software, or if you modify it.\n" -"\n" -" For example, if you distribute copies of such a program, whether\n" -"gratis or for a fee, you must give the recipients all the rights that\n" -"you have. You must make sure that they, too, receive or can get the\n" -"source code. And you must show them these terms so they know their\n" -"rights.\n" -"\n" -" We protect your rights with two steps: (1) copyright the software, and\n" -"(2) offer you this license which gives you legal permission to copy,\n" -"distribute and/or modify the software.\n" -"\n" -" Also, for each author's protection and ours, we want to make certain\n" -"that everyone understands that there is no warranty for this free\n" -"software. If the software is modified by someone else and passed on, we\n" -"want its recipients to know that what they have is not the original, so\n" -"that any problems introduced by others will not reflect on the original\n" -"authors' reputations.\n" -"\n" -" Finally, any free program is threatened constantly by software\n" -"patents. We wish to avoid the danger that redistributors of a free\n" -"program will individually obtain patent licenses, in effect making the\n" -"program proprietary. To prevent this, we have made it clear that any\n" -"patent must be licensed for everyone's free use or not licensed at all.\n" -"\n" -" The precise terms and conditions for copying, distribution and\n" -"modification follow.\n" -"\n" -" GNU GENERAL PUBLIC LICENSE\n" -" TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n" -"\n" -" 0. This License applies to any program or other work which contains\n" -"a notice placed by the copyright holder saying it may be distributed\n" -"under the terms of this General Public License. The \"Program\", below,\n" -"refers to any such program or work, and a \"work based on the Program\"\n" -"means either the Program or any derivative work under copyright law:\n" -"that is to say, a work containing the Program or a portion of it,\n" -"either verbatim or with modifications and/or translated into another\n" -"language. (Hereinafter, translation is included without limitation in\n" -"the term \"modification\".) Each licensee is addressed as \"you\".\n" -"\n" -"Activities other than copying, distribution and modification are not\n" -"covered by this License; they are outside its scope. The act of\n" -"running the Program is not restricted, and the output from the Program\n" -"is covered only if its contents constitute a work based on the\n" -"Program (independent of having been made by running the Program).\n" -"Whether that is true depends on what the Program does.\n" -"\n" -" 1. You may copy and distribute verbatim copies of the Program's\n" -"source code as you receive it, in any medium, provided that you\n" -"conspicuously and appropriately publish on each copy an appropriate\n" -"copyright notice and disclaimer of warranty; keep intact all the\n" -"notices that refer to this License and to the absence of any warranty;\n" -"and give any other recipients of the Program a copy of this License\n" -"along with the Program.\n" -"\n" -"You may charge a fee for the physical act of transferring a copy, and\n" -"you may at your option offer warranty protection in exchange for a fee.\n" -"\n" -" 2. You may modify your copy or copies of the Program or any portion\n" -"of it, thus forming a work based on the Program, and copy and\n" -"distribute such modifications or work under the terms of Section 1\n" -"above, provided that you also meet all of these conditions:\n" -"\n" -" a) You must cause the modified files to carry prominent notices\n" -" stating that you changed the files and the date of any change.\n" -"\n" -" b) You must cause any work that you distribute or publish, that in\n" -" whole or in part contains or is derived from the Program or any\n" -" part thereof, to be licensed as a whole at no charge to all third\n" -" parties under the terms of this License.\n" -"\n" -" c) If the modified program normally reads commands interactively\n" -" when run, you must cause it, when started running for such\n" -" interactive use in the most ordinary way, to print or display an\n" -" announcement including an appropriate copyright notice and a\n" -" notice that there is no warranty (or else, saying that you provide\n" -" a warranty) and that users may redistribute the program under\n" -" these conditions, and telling the user how to view a copy of this\n" -" License. (Exception: if the Program itself is interactive but\n" -" does not normally print such an announcement, your work based on\n" -" the Program is not required to print an announcement.)\n" -"\n" -"These requirements apply to the modified work as a whole. If\n" -"identifiable sections of that work are not derived from the Program,\n" -"and can be reasonably considered independent and separate works in\n" -"themselves, then this License, and its terms, do not apply to those\n" -"sections when you distribute them as separate works. But when you\n" -"distribute the same sections as part of a whole which is a work based\n" -"on the Program, the distribution of the whole must be on the terms of\n" -"this License, whose permissions for other licensees extend to the\n" -"entire whole, and thus to each and every part regardless of who wrote it.\n" -"\n" -"Thus, it is not the intent of this section to claim rights or contest\n" -"your rights to work written entirely by you; rather, the intent is to\n" -"exercise the right to control the distribution of derivative or\n" -"collective works based on the Program.\n" -"\n" -"In addition, mere aggregation of another work not based on the Program\n" -"with the Program (or with a work based on the Program) on a volume of\n" -"a storage or distribution medium does not bring the other work under\n" -"the scope of this License.\n" -"\n" -" 3. You may copy and distribute the Program (or a work based on it,\n" -"under Section 2) in object code or executable form under the terms of\n" -"Sections 1 and 2 above provided that you also do one of the following:\n" -"\n" -" a) Accompany it with the complete corresponding machine-readable\n" -" source code, which must be distributed under the terms of Sections\n" -" 1 and 2 above on a medium customarily used for software interchange; or,\n" -"\n" -" b) Accompany it with a written offer, valid for at least three\n" -" years, to give any third party, for a charge no more than your\n" -" cost of physically performing source distribution, a complete\n" -" machine-readable copy of the corresponding source code, to be\n" -" distributed under the terms of Sections 1 and 2 above on a medium\n" -" customarily used for software interchange; or,\n" -"\n" -" c) Accompany it with the information you received as to the offer\n" -" to distribute corresponding source code. (This alternative is\n" -" allowed only for noncommercial distribution and only if you\n" -" received the program in object code or executable form with such\n" -" an offer, in accord with Subsection b above.)\n" -"\n" -"The source code for a work means the preferred form of the work for\n" -"making modifications to it. For an executable work, complete source\n" -"code means all the source code for all modules it contains, plus any\n" -"associated interface definition files, plus the scripts used to\n" -"control compilation and installation of the executable. However, as a\n" -"special exception, the source code distributed need not include\n" -"anything that is normally distributed (in either source or binary\n" -"form) with the major components (compiler, kernel, and so on) of the\n" -"operating system on which the executable runs, unless that component\n" -"itself accompanies the executable.\n" -"\n" -"If distribution of executable or object code is made by offering\n" -"access to copy from a designated place, then offering equivalent\n" -"access to copy the source code from the same place counts as\n" -"distribution of the source code, even though third parties are not\n" -"compelled to copy the source along with the object code.\n" -"\n" -" 4. You may not copy, modify, sublicense, or distribute the Program\n" -"except as expressly provided under this License. Any attempt\n" -"otherwise to copy, modify, sublicense or distribute the Program is\n" -"void, and will automatically terminate your rights under this License.\n" -"However, parties who have received copies, or rights, from you under\n" -"this License will not have their licenses terminated so long as such\n" -"parties remain in full compliance.\n" -"\n" -" 5. You are not required to accept this License, since you have not\n" -"signed it. However, nothing else grants you permission to modify or\n" -"distribute the Program or its derivative works. These actions are\n" -"prohibited by law if you do not accept this License. Therefore, by\n" -"modifying or distributing the Program (or any work based on the\n" -"Program), you indicate your acceptance of this License to do so, and\n" -"all its terms and conditions for copying, distributing or modifying\n" -"the Program or works based on it.\n" -"\n" -" 6. Each time you redistribute the Program (or any work based on the\n" -"Program), the recipient automatically receives a license from the\n" -"original licensor to copy, distribute or modify the Program subject to\n" -"these terms and conditions. You may not impose any further\n" -"restrictions on the recipients' exercise of the rights granted herein.\n" -"You are not responsible for enforcing compliance by third parties to\n" -"this License.\n" -"\n" -" 7. If, as a consequence of a court judgment or allegation of patent\n" -"infringement or for any other reason (not limited to patent issues),\n" -"conditions are imposed on you (whether by court order, agreement or\n" -"otherwise) that contradict the conditions of this License, they do not\n" -"excuse you from the conditions of this License. If you cannot\n" -"distribute so as to satisfy simultaneously your obligations under this\n" -"License and any other pertinent obligations, then as a consequence you\n" -"may not distribute the Program at all. For example, if a patent\n" -"license would not permit royalty-free redistribution of the Program by\n" -"all those who receive copies directly or indirectly through you, then\n" -"the only way you could satisfy both it and this License would be to\n" -"refrain entirely from distribution of the Program.\n" -"\n" -"If any portion of this section is held invalid or unenforceable under\n" -"any particular circumstance, the balance of the section is intended to\n" -"apply and the section as a whole is intended to apply in other\n" -"circumstances.\n" -"\n" -"It is not the purpose of this section to induce you to infringe any\n" -"patents or other property right claims or to contest validity of any\n" -"such claims; this section has the sole purpose of protecting the\n" -"integrity of the free software distribution system, which is\n" -"implemented by public license practices. Many people have made\n" -"generous contributions to the wide range of software distributed\n" -"through that system in reliance on consistent application of that\n" -"system; it is up to the author/donor to decide if he or she is willing\n" -"to distribute software through any other system and a licensee cannot\n" -"impose that choice.\n" -"\n" -"This section is intended to make thoroughly clear what is believed to\n" -"be a consequence of the rest of this License.\n" -"\n" -" 8. If the distribution and/or use of the Program is restricted in\n" -"certain countries either by patents or by copyrighted interfaces, the\n" -"original copyright holder who places the Program under this License\n" -"may add an explicit geographical distribution limitation excluding\n" -"those countries, so that distribution is permitted only in or among\n" -"countries not thus excluded. In such case, this License incorporates\n" -"the limitation as if written in the body of this License.\n" -"\n" -" 9. The Free Software Foundation may publish revised and/or new versions\n" -"of the General Public License from time to time. Such new versions will\n" -"be similar in spirit to the present version, but may differ in detail to\n" -"address new problems or concerns.\n" -"\n" -"Each version is given a distinguishing version number. If the Program\n" -"specifies a version number of this License which applies to it and \"any\n" -"later version\", you have the option of following the terms and conditions\n" -"either of that version or of any later version published by the Free\n" -"Software Foundation. If the Program does not specify a version number of\n" -"this License, you may choose any version ever published by the Free Software\n" -"Foundation.\n" -"\n" -" 10. If you wish to incorporate parts of the Program into other free\n" -"programs whose distribution conditions are different, write to the author\n" -"to ask for permission. For software which is copyrighted by the Free\n" -"Software Foundation, write to the Free Software Foundation; we sometimes\n" -"make exceptions for this. Our decision will be guided by the two goals\n" -"of preserving the free status of all derivatives of our free software and\n" -"of promoting the sharing and reuse of software generally.\n" -"\n" -" NO WARRANTY\n" -"\n" -" 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n" -"FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\n" -"OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\n" -"PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\n" -"OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n" -"MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\n" -"TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\n" -"PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\n" -"REPAIR OR CORRECTION.\n" -"\n" -" 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n" -"WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\n" -"REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\n" -"INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\n" -"OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\n" -"TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\n" -"YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\n" -"PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\n" -"POSSIBILITY OF SUCH DAMAGES.\n" -"\n" -" END OF TERMS AND CONDITIONS\n" -"\n" -" How to Apply These Terms to Your New Programs\n" -"\n" -" If you develop a new program, and you want it to be of the greatest\n" -"possible use to the public, the best way to achieve this is to make it\n" -"free software which everyone can redistribute and change under these terms.\n" -"\n" -" To do so, attach the following notices to the program. It is safest\n" -"to attach them to the start of each source file to most effectively\n" -"convey the exclusion of warranty; and each file should have at least\n" -"the \"copyright\" line and a pointer to where the full notice is found.\n" -"\n" -" <one line to give the program's name and a brief idea of what it does.>\n" -" Copyright (C) <year> <name of author>\n" -"\n" -" This program is free software; you can redistribute it and/or modify\n" -" it under the terms of the GNU General Public License as published by\n" -" the Free Software Foundation; either version 2 of the License, or\n" -" (at your option) any later version.\n" -"\n" -" This program is distributed in the hope that it will be useful,\n" -" but WITHOUT ANY WARRANTY; without even the implied warranty of\n" -" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" -" GNU General Public License for more details.\n" -"\n" -" You should have received a copy of the GNU General Public License\n" -" along with this program; if not, write to the Free Software\n" -" Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n" -"\n" -"\n" -"Also add information on how to contact you by electronic and paper mail.\n" -"\n" -"If the program is interactive, make it output a short notice like this\n" -"when it starts in an interactive mode:\n" -"\n" -" Gnomovision version 69, Copyright (C) year name of author\n" -" Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n" -" This is free software, and you are welcome to redistribute it\n" -" under certain conditions; type `show c' for details.\n" -"\n" -"The hypothetical commands `show w' and `show c' should show the appropriate\n" -"parts of the General Public License. Of course, the commands you use may\n" -"be called something other than `show w' and `show c'; they could even be\n" -"mouse-clicks or menu items--whatever suits your program.\n" -"\n" -"You should also get your employer (if you work as a programmer) or your\n" -"school, if any, to sign a \"copyright disclaimer\" for the program, if\n" -"necessary. Here is a sample; alter the names:\n" -"\n" -" Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n" -" `Gnomovision' (which makes passes at compilers) written by James Hacker.\n" -"\n" -" <signature of Ty Coon>, 1 April 1989\n" -" Ty Coon, President of Vice\n" -"\n" -"This General Public License does not permit incorporating your program into\n" -"proprietary programs. If your program is a subroutine library, you may\n" -"consider it more useful to permit linking proprietary applications with the\n" -"library. If this is what you want to do, use the GNU Library General\n" -"Public License instead of this License."; + " Version 2, June 1991\n" + "\n" + " Copyright (C) 1989, 1991 Free Software Foundation, Inc.\n" + " 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n" + " Everyone is permitted to copy and distribute verbatim copies\n" + " of this license document, but changing it is not allowed.\n" + "\n" + " Preamble\n" + "\n" + " The licenses for most software are designed to take away your\n" + "freedom to share and change it. By contrast, the GNU General Public\n" + "License is intended to guarantee your freedom to share and change free\n" + "software--to make sure the software is free for all its users. This\n" + "General Public License applies to most of the Free Software\n" + "Foundation's software and to any other program whose authors commit to\n" + "using it. (Some other Free Software Foundation software is covered by\n" + "the GNU Library General Public License instead.) You can apply it to\n" + "your programs, too.\n" + "\n" + " When we speak of free software, we are referring to freedom, not\n" + "price. Our General Public Licenses are designed to make sure that you\n" + "have the freedom to distribute copies of free software (and charge for\n" + "this service if you wish), that you receive source code or can get it\n" + "if you want it, that you can change the software or use pieces of it\n" + "in new free programs; and that you know you can do these things.\n" + "\n" + " To protect your rights, we need to make restrictions that forbid\n" + "anyone to deny you these rights or to ask you to surrender the rights.\n" + "These restrictions translate to certain responsibilities for you if you\n" + "distribute copies of the software, or if you modify it.\n" + "\n" + " For example, if you distribute copies of such a program, whether\n" + "gratis or for a fee, you must give the recipients all the rights that\n" + "you have. You must make sure that they, too, receive or can get the\n" + "source code. And you must show them these terms so they know their\n" + "rights.\n" + "\n" + " We protect your rights with two steps: (1) copyright the software, and\n" + "(2) offer you this license which gives you legal permission to copy,\n" + "distribute and/or modify the software.\n" + "\n" + " Also, for each author's protection and ours, we want to make certain\n" + "that everyone understands that there is no warranty for this free\n" + "software. If the software is modified by someone else and passed on, we\n" + "want its recipients to know that what they have is not the original, so\n" + "that any problems introduced by others will not reflect on the original\n" + "authors' reputations.\n" + "\n" + " Finally, any free program is threatened constantly by software\n" + "patents. We wish to avoid the danger that redistributors of a free\n" + "program will individually obtain patent licenses, in effect making the\n" + "program proprietary. To prevent this, we have made it clear that any\n" + "patent must be licensed for everyone's free use or not licensed at all.\n" + "\n" + " The precise terms and conditions for copying, distribution and\n" + "modification follow.\n" + "\n" + " GNU GENERAL PUBLIC LICENSE\n" + " TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION\n" + "\n" + " 0. This License applies to any program or other work which contains\n" + "a notice placed by the copyright holder saying it may be distributed\n" + "under the terms of this General Public License. The \"Program\", below,\n" + "refers to any such program or work, and a \"work based on the Program\"\n" + "means either the Program or any derivative work under copyright law:\n" + "that is to say, a work containing the Program or a portion of it,\n" + "either verbatim or with modifications and/or translated into another\n" + "language. (Hereinafter, translation is included without limitation in\n" + "the term \"modification\".) Each licensee is addressed as \"you\".\n" + "\n" + "Activities other than copying, distribution and modification are not\n" + "covered by this License; they are outside its scope. The act of\n" + "running the Program is not restricted, and the output from the Program\n" + "is covered only if its contents constitute a work based on the\n" + "Program (independent of having been made by running the Program).\n" + "Whether that is true depends on what the Program does.\n" + "\n" + " 1. You may copy and distribute verbatim copies of the Program's\n" + "source code as you receive it, in any medium, provided that you\n" + "conspicuously and appropriately publish on each copy an appropriate\n" + "copyright notice and disclaimer of warranty; keep intact all the\n" + "notices that refer to this License and to the absence of any warranty;\n" + "and give any other recipients of the Program a copy of this License\n" + "along with the Program.\n" + "\n" + "You may charge a fee for the physical act of transferring a copy, and\n" + "you may at your option offer warranty protection in exchange for a fee.\n" + "\n" + " 2. You may modify your copy or copies of the Program or any portion\n" + "of it, thus forming a work based on the Program, and copy and\n" + "distribute such modifications or work under the terms of Section 1\n" + "above, provided that you also meet all of these conditions:\n" + "\n" + " a) You must cause the modified files to carry prominent notices\n" + " stating that you changed the files and the date of any change.\n" + "\n" + " b) You must cause any work that you distribute or publish, that in\n" + " whole or in part contains or is derived from the Program or any\n" + " part thereof, to be licensed as a whole at no charge to all third\n" + " parties under the terms of this License.\n" + "\n" + " c) If the modified program normally reads commands interactively\n" + " when run, you must cause it, when started running for such\n" + " interactive use in the most ordinary way, to print or display an\n" + " announcement including an appropriate copyright notice and a\n" + " notice that there is no warranty (or else, saying that you provide\n" + " a warranty) and that users may redistribute the program under\n" + " these conditions, and telling the user how to view a copy of this\n" + " License. (Exception: if the Program itself is interactive but\n" + " does not normally print such an announcement, your work based on\n" + " the Program is not required to print an announcement.)\n" + "\n" + "These requirements apply to the modified work as a whole. If\n" + "identifiable sections of that work are not derived from the Program,\n" + "and can be reasonably considered independent and separate works in\n" + "themselves, then this License, and its terms, do not apply to those\n" + "sections when you distribute them as separate works. But when you\n" + "distribute the same sections as part of a whole which is a work based\n" + "on the Program, the distribution of the whole must be on the terms of\n" + "this License, whose permissions for other licensees extend to the\n" + "entire whole, and thus to each and every part regardless of who wrote it.\n" + "\n" + "Thus, it is not the intent of this section to claim rights or contest\n" + "your rights to work written entirely by you; rather, the intent is to\n" + "exercise the right to control the distribution of derivative or\n" + "collective works based on the Program.\n" + "\n" + "In addition, mere aggregation of another work not based on the Program\n" + "with the Program (or with a work based on the Program) on a volume of\n" + "a storage or distribution medium does not bring the other work under\n" + "the scope of this License.\n" + "\n" + " 3. You may copy and distribute the Program (or a work based on it,\n" + "under Section 2) in object code or executable form under the terms of\n" + "Sections 1 and 2 above provided that you also do one of the following:\n" + "\n" + " a) Accompany it with the complete corresponding machine-readable\n" + " source code, which must be distributed under the terms of Sections\n" + " 1 and 2 above on a medium customarily used for software interchange; or,\n" + "\n" + " b) Accompany it with a written offer, valid for at least three\n" + " years, to give any third party, for a charge no more than your\n" + " cost of physically performing source distribution, a complete\n" + " machine-readable copy of the corresponding source code, to be\n" + " distributed under the terms of Sections 1 and 2 above on a medium\n" + " customarily used for software interchange; or,\n" + "\n" + " c) Accompany it with the information you received as to the offer\n" + " to distribute corresponding source code. (This alternative is\n" + " allowed only for noncommercial distribution and only if you\n" + " received the program in object code or executable form with such\n" + " an offer, in accord with Subsection b above.)\n" + "\n" + "The source code for a work means the preferred form of the work for\n" + "making modifications to it. For an executable work, complete source\n" + "code means all the source code for all modules it contains, plus any\n" + "associated interface definition files, plus the scripts used to\n" + "control compilation and installation of the executable. However, as a\n" + "special exception, the source code distributed need not include\n" + "anything that is normally distributed (in either source or binary\n" + "form) with the major components (compiler, kernel, and so on) of the\n" + "operating system on which the executable runs, unless that component\n" + "itself accompanies the executable.\n" + "\n" + "If distribution of executable or object code is made by offering\n" + "access to copy from a designated place, then offering equivalent\n" + "access to copy the source code from the same place counts as\n" + "distribution of the source code, even though third parties are not\n" + "compelled to copy the source along with the object code.\n" + "\n" + " 4. You may not copy, modify, sublicense, or distribute the Program\n" + "except as expressly provided under this License. Any attempt\n" + "otherwise to copy, modify, sublicense or distribute the Program is\n" + "void, and will automatically terminate your rights under this License.\n" + "However, parties who have received copies, or rights, from you under\n" + "this License will not have their licenses terminated so long as such\n" + "parties remain in full compliance.\n" + "\n" + " 5. You are not required to accept this License, since you have not\n" + "signed it. However, nothing else grants you permission to modify or\n" + "distribute the Program or its derivative works. These actions are\n" + "prohibited by law if you do not accept this License. Therefore, by\n" + "modifying or distributing the Program (or any work based on the\n" + "Program), you indicate your acceptance of this License to do so, and\n" + "all its terms and conditions for copying, distributing or modifying\n" + "the Program or works based on it.\n" + "\n" + " 6. Each time you redistribute the Program (or any work based on the\n" + "Program), the recipient automatically receives a license from the\n" + "original licensor to copy, distribute or modify the Program subject to\n" + "these terms and conditions. You may not impose any further\n" + "restrictions on the recipients' exercise of the rights granted herein.\n" + "You are not responsible for enforcing compliance by third parties to\n" + "this License.\n" + "\n" + " 7. If, as a consequence of a court judgment or allegation of patent\n" + "infringement or for any other reason (not limited to patent issues),\n" + "conditions are imposed on you (whether by court order, agreement or\n" + "otherwise) that contradict the conditions of this License, they do not\n" + "excuse you from the conditions of this License. If you cannot\n" + "distribute so as to satisfy simultaneously your obligations under this\n" + "License and any other pertinent obligations, then as a consequence you\n" + "may not distribute the Program at all. For example, if a patent\n" + "license would not permit royalty-free redistribution of the Program by\n" + "all those who receive copies directly or indirectly through you, then\n" + "the only way you could satisfy both it and this License would be to\n" + "refrain entirely from distribution of the Program.\n" + "\n" + "If any portion of this section is held invalid or unenforceable under\n" + "any particular circumstance, the balance of the section is intended to\n" + "apply and the section as a whole is intended to apply in other\n" + "circumstances.\n" + "\n" + "It is not the purpose of this section to induce you to infringe any\n" + "patents or other property right claims or to contest validity of any\n" + "such claims; this section has the sole purpose of protecting the\n" + "integrity of the free software distribution system, which is\n" + "implemented by public license practices. Many people have made\n" + "generous contributions to the wide range of software distributed\n" + "through that system in reliance on consistent application of that\n" + "system; it is up to the author/donor to decide if he or she is willing\n" + "to distribute software through any other system and a licensee cannot\n" + "impose that choice.\n" + "\n" + "This section is intended to make thoroughly clear what is believed to\n" + "be a consequence of the rest of this License.\n" + "\n" + " 8. If the distribution and/or use of the Program is restricted in\n" + "certain countries either by patents or by copyrighted interfaces, the\n" + "original copyright holder who places the Program under this License\n" + "may add an explicit geographical distribution limitation excluding\n" + "those countries, so that distribution is permitted only in or among\n" + "countries not thus excluded. In such case, this License incorporates\n" + "the limitation as if written in the body of this License.\n" + "\n" + " 9. The Free Software Foundation may publish revised and/or new versions\n" + "of the General Public License from time to time. Such new versions will\n" + "be similar in spirit to the present version, but may differ in detail to\n" + "address new problems or concerns.\n" + "\n" + "Each version is given a distinguishing version number. If the Program\n" + "specifies a version number of this License which applies to it and \"any\n" + "later version\", you have the option of following the terms and conditions\n" + "either of that version or of any later version published by the Free\n" + "Software Foundation. If the Program does not specify a version number of\n" + "this License, you may choose any version ever published by the Free Software\n" + "Foundation.\n" + "\n" + " 10. If you wish to incorporate parts of the Program into other free\n" + "programs whose distribution conditions are different, write to the author\n" + "to ask for permission. For software which is copyrighted by the Free\n" + "Software Foundation, write to the Free Software Foundation; we sometimes\n" + "make exceptions for this. Our decision will be guided by the two goals\n" + "of preserving the free status of all derivatives of our free software and\n" + "of promoting the sharing and reuse of software generally.\n" + "\n" + " NO WARRANTY\n" + "\n" + " 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY\n" + "FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN\n" + "OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES\n" + "PROVIDE THE PROGRAM \"AS IS\" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED\n" + "OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF\n" + "MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS\n" + "TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE\n" + "PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,\n" + "REPAIR OR CORRECTION.\n" + "\n" + " 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING\n" + "WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR\n" + "REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,\n" + "INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING\n" + "OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED\n" + "TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY\n" + "YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER\n" + "PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE\n" + "POSSIBILITY OF SUCH DAMAGES.\n" + "\n" + " END OF TERMS AND CONDITIONS\n" + "\n" + " How to Apply These Terms to Your New Programs\n" + "\n" + " If you develop a new program, and you want it to be of the greatest\n" + "possible use to the public, the best way to achieve this is to make it\n" + "free software which everyone can redistribute and change under these terms.\n" + "\n" + " To do so, attach the following notices to the program. It is safest\n" + "to attach them to the start of each source file to most effectively\n" + "convey the exclusion of warranty; and each file should have at least\n" + "the \"copyright\" line and a pointer to where the full notice is found.\n" + "\n" + " <one line to give the program's name and a brief idea of what it does.>\n" + " Copyright (C) <year> <name of author>\n" + "\n" + " This program is free software; you can redistribute it and/or modify\n" + " it under the terms of the GNU General Public License as published by\n" + " the Free Software Foundation; either version 2 of the License, or\n" + " (at your option) any later version.\n" + "\n" + " This program is distributed in the hope that it will be useful,\n" + " but WITHOUT ANY WARRANTY; without even the implied warranty of\n" + " MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n" + " GNU General Public License for more details.\n" + "\n" + " You should have received a copy of the GNU General Public License\n" + " along with this program; if not, write to the Free Software\n" + " Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA\n" + "\n" + "\n" + "Also add information on how to contact you by electronic and paper mail.\n" + "\n" + "If the program is interactive, make it output a short notice like this\n" + "when it starts in an interactive mode:\n" + "\n" + " Gnomovision version 69, Copyright (C) year name of author\n" + " Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.\n" + " This is free software, and you are welcome to redistribute it\n" + " under certain conditions; type `show c' for details.\n" + "\n" + "The hypothetical commands `show w' and `show c' should show the appropriate\n" + "parts of the General Public License. Of course, the commands you use may\n" + "be called something other than `show w' and `show c'; they could even be\n" + "mouse-clicks or menu items--whatever suits your program.\n" + "\n" + "You should also get your employer (if you work as a programmer) or your\n" + "school, if any, to sign a \"copyright disclaimer\" for the program, if\n" + "necessary. Here is a sample; alter the names:\n" + "\n" + " Yoyodyne, Inc., hereby disclaims all copyright interest in the program\n" + " `Gnomovision' (which makes passes at compilers) written by James Hacker.\n" + "\n" + " <signature of Ty Coon>, 1 April 1989\n" + " Ty Coon, President of Vice\n" + "\n" + "This General Public License does not permit incorporating your program into\n" + "proprietary programs. If your program is a subroutine library, you may\n" + "consider it more useful to permit linking proprietary applications with the\n" + "library. If this is what you want to do, use the GNU Library General\n" + "Public License instead of this License."; diff --git a/src/mumble/smallft.cpp b/src/mumble/smallft.cpp index aa5a5caf9..a842602be 100644 --- a/src/mumble/smallft.cpp +++ b/src/mumble/smallft.cpp @@ -41,1221 +41,1221 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #include "mumble_pch.hpp" #include "smallft.h" -static void drfti1(int n, float *wa, int *ifac){ - static int ntryh[4] = { 4,2,3,5 }; - static float tpi = 6.28318530717958648f; - float arg,argh,argld,fi; - int ntry=0,i,j=-1; - int k1, l1, l2, ib; - int ld, ii, ip, is, nq, nr; - int ido, ipm, nfm1; - int nl=n; - int nf=0; - - L101: - j++; - if (j < 4) - ntry=ntryh[j]; - else - ntry+=2; - - L104: - nq=nl/ntry; - nr=nl-ntry*nq; - if (nr!=0) goto L101; - - nf++; - ifac[nf+1]=ntry; - nl=nq; - if(ntry!=2)goto L107; - if(nf==1)goto L107; - - for (i=1;i<nf;i++){ - ib=nf-i+1; - ifac[ib+1]=ifac[ib]; - } - ifac[2] = 2; - - L107: - if(nl!=1)goto L104; - ifac[0]=n; - ifac[1]=nf; - argh=tpi/n; - is=0; - nfm1=nf-1; - l1=1; - - if(nfm1==0)return; - - for (k1=0;k1<nfm1;k1++){ - ip=ifac[k1+2]; - ld=0; - l2=l1*ip; - ido=n/l2; - ipm=ip-1; - - for (j=0;j<ipm;j++){ - ld+=l1; - i=is; - argld=ld*argh; - fi=0.f; - for (ii=2;ii<ido;ii+=2){ - fi+=1.f; - arg=fi*argld; - wa[i++]=cosf(arg); - wa[i++]=sinf(arg); - } - is+=ido; - } - l1=l2; - } +static void drfti1(int n, float *wa, int *ifac) { + static int ntryh[4] = { 4,2,3,5 }; + static float tpi = 6.28318530717958648f; + float arg,argh,argld,fi; + int ntry=0,i,j=-1; + int k1, l1, l2, ib; + int ld, ii, ip, is, nq, nr; + int ido, ipm, nfm1; + int nl=n; + int nf=0; + +L101: + j++; + if (j < 4) + ntry=ntryh[j]; + else + ntry+=2; + +L104: + nq=nl/ntry; + nr=nl-ntry*nq; + if (nr!=0) goto L101; + + nf++; + ifac[nf+1]=ntry; + nl=nq; + if (ntry!=2)goto L107; + if (nf==1)goto L107; + + for (i=1;i<nf;i++) { + ib=nf-i+1; + ifac[ib+1]=ifac[ib]; + } + ifac[2] = 2; + +L107: + if (nl!=1)goto L104; + ifac[0]=n; + ifac[1]=nf; + argh=tpi/n; + is=0; + nfm1=nf-1; + l1=1; + + if (nfm1==0)return; + + for (k1=0;k1<nfm1;k1++) { + ip=ifac[k1+2]; + ld=0; + l2=l1*ip; + ido=n/l2; + ipm=ip-1; + + for (j=0;j<ipm;j++) { + ld+=l1; + i=is; + argld=ld*argh; + fi=0.f; + for (ii=2;ii<ido;ii+=2) { + fi+=1.f; + arg=fi*argld; + wa[i++]=cosf(arg); + wa[i++]=sinf(arg); + } + is+=ido; + } + l1=l2; + } } -static void fdrffti(int n, float *wsave, int *ifac){ +static void fdrffti(int n, float *wsave, int *ifac) { - if (n == 1) return; - drfti1(n, wsave+n, ifac); + if (n == 1) return; + drfti1(n, wsave+n, ifac); } -static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1){ - int i,k; - float ti2,tr2; - int t0,t1,t2,t3,t4,t5,t6; - - t1=0; - t0=(t2=l1*ido); - t3=ido<<1; - for(k=0;k<l1;k++){ - ch[t1<<1]=cc[t1]+cc[t2]; - ch[(t1<<1)+t3-1]=cc[t1]-cc[t2]; - t1+=ido; - t2+=ido; - } - - if(ido<2)return; - if(ido==2)goto L105; - - t1=0; - t2=t0; - for(k=0;k<l1;k++){ - t3=t2; - t4=(t1<<1)+(ido<<1); - t5=t1; - t6=t1+t1; - for(i=2;i<ido;i+=2){ - t3+=2; - t4-=2; - t5+=2; - t6+=2; - tr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3]; - ti2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1]; - ch[t6]=cc[t5]+ti2; - ch[t4]=ti2-cc[t5]; - ch[t6-1]=cc[t5-1]+tr2; - ch[t4-1]=cc[t5-1]-tr2; - } - t1+=ido; - t2+=ido; - } - - if(ido%2==1)return; - - L105: - t3=(t2=(t1=ido)-1); - t2+=t0; - for(k=0;k<l1;k++){ - ch[t1]=-cc[t2]; - ch[t1-1]=cc[t3]; - t1+=ido<<1; - t2+=ido; - t3+=ido; - } +static void dradf2(int ido,int l1,float *cc,float *ch,float *wa1) { + int i,k; + float ti2,tr2; + int t0,t1,t2,t3,t4,t5,t6; + + t1=0; + t0=(t2=l1*ido); + t3=ido<<1; + for (k=0;k<l1;k++) { + ch[t1<<1]=cc[t1]+cc[t2]; + ch[(t1<<1)+t3-1]=cc[t1]-cc[t2]; + t1+=ido; + t2+=ido; + } + + if (ido<2)return; + if (ido==2)goto L105; + + t1=0; + t2=t0; + for (k=0;k<l1;k++) { + t3=t2; + t4=(t1<<1)+(ido<<1); + t5=t1; + t6=t1+t1; + for (i=2;i<ido;i+=2) { + t3+=2; + t4-=2; + t5+=2; + t6+=2; + tr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3]; + ti2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1]; + ch[t6]=cc[t5]+ti2; + ch[t4]=ti2-cc[t5]; + ch[t6-1]=cc[t5-1]+tr2; + ch[t4-1]=cc[t5-1]-tr2; + } + t1+=ido; + t2+=ido; + } + + if (ido%2==1)return; + +L105: + t3=(t2=(t1=ido)-1); + t2+=t0; + for (k=0;k<l1;k++) { + ch[t1]=-cc[t2]; + ch[t1-1]=cc[t3]; + t1+=ido<<1; + t2+=ido; + t3+=ido; + } } static void dradf4(int ido,int l1,float *cc,float *ch,float *wa1, - float *wa2,float *wa3){ - static float hsqt2 = .70710678118654752f; - int i,k,t0,t1,t2,t3,t4,t5,t6; - float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; - t0=l1*ido; - - t1=t0; - t4=t1<<1; - t2=t1+(t1<<1); - t3=0; - - for(k=0;k<l1;k++){ - tr1=cc[t1]+cc[t2]; - tr2=cc[t3]+cc[t4]; - - ch[t5=t3<<2]=tr1+tr2; - ch[(ido<<2)+t5-1]=tr2-tr1; - ch[(t5+=(ido<<1))-1]=cc[t3]-cc[t4]; - ch[t5]=cc[t2]-cc[t1]; - - t1+=ido; - t2+=ido; - t3+=ido; - t4+=ido; - } - - if(ido<2)return; - if(ido==2)goto L105; - - - t1=0; - for(k=0;k<l1;k++){ - t2=t1; - t4=t1<<2; - t5=(t6=ido<<1)+t4; - for(i=2;i<ido;i+=2){ - t3=(t2+=2); - t4+=2; - t5-=2; - - t3+=t0; - cr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3]; - ci2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1]; - t3+=t0; - cr3=wa2[i-2]*cc[t3-1]+wa2[i-1]*cc[t3]; - ci3=wa2[i-2]*cc[t3]-wa2[i-1]*cc[t3-1]; - t3+=t0; - cr4=wa3[i-2]*cc[t3-1]+wa3[i-1]*cc[t3]; - ci4=wa3[i-2]*cc[t3]-wa3[i-1]*cc[t3-1]; - - tr1=cr2+cr4; - tr4=cr4-cr2; - ti1=ci2+ci4; - ti4=ci2-ci4; - - ti2=cc[t2]+ci3; - ti3=cc[t2]-ci3; - tr2=cc[t2-1]+cr3; - tr3=cc[t2-1]-cr3; - - ch[t4-1]=tr1+tr2; - ch[t4]=ti1+ti2; - - ch[t5-1]=tr3-ti4; - ch[t5]=tr4-ti3; - - ch[t4+t6-1]=ti4+tr3; - ch[t4+t6]=tr4+ti3; - - ch[t5+t6-1]=tr2-tr1; - ch[t5+t6]=ti1-ti2; - } - t1+=ido; - } - if(ido&1)return; - - L105: - - t2=(t1=t0+ido-1)+(t0<<1); - t3=ido<<2; - t4=ido; - t5=ido<<1; - t6=ido; - - for(k=0;k<l1;k++){ - ti1=-hsqt2*(cc[t1]+cc[t2]); - tr1=hsqt2*(cc[t1]-cc[t2]); - - ch[t4-1]=tr1+cc[t6-1]; - ch[t4+t5-1]=cc[t6-1]-tr1; - - ch[t4]=ti1-cc[t1+t0]; - ch[t4+t5]=ti1+cc[t1+t0]; - - t1+=ido; - t2+=ido; - t4+=t3; - t6+=ido; - } + float *wa2,float *wa3) { + static float hsqt2 = .70710678118654752f; + int i,k,t0,t1,t2,t3,t4,t5,t6; + float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; + t0=l1*ido; + + t1=t0; + t4=t1<<1; + t2=t1+(t1<<1); + t3=0; + + for (k=0;k<l1;k++) { + tr1=cc[t1]+cc[t2]; + tr2=cc[t3]+cc[t4]; + + ch[t5=t3<<2]=tr1+tr2; + ch[(ido<<2)+t5-1]=tr2-tr1; + ch[(t5+=(ido<<1))-1]=cc[t3]-cc[t4]; + ch[t5]=cc[t2]-cc[t1]; + + t1+=ido; + t2+=ido; + t3+=ido; + t4+=ido; + } + + if (ido<2)return; + if (ido==2)goto L105; + + + t1=0; + for (k=0;k<l1;k++) { + t2=t1; + t4=t1<<2; + t5=(t6=ido<<1)+t4; + for (i=2;i<ido;i+=2) { + t3=(t2+=2); + t4+=2; + t5-=2; + + t3+=t0; + cr2=wa1[i-2]*cc[t3-1]+wa1[i-1]*cc[t3]; + ci2=wa1[i-2]*cc[t3]-wa1[i-1]*cc[t3-1]; + t3+=t0; + cr3=wa2[i-2]*cc[t3-1]+wa2[i-1]*cc[t3]; + ci3=wa2[i-2]*cc[t3]-wa2[i-1]*cc[t3-1]; + t3+=t0; + cr4=wa3[i-2]*cc[t3-1]+wa3[i-1]*cc[t3]; + ci4=wa3[i-2]*cc[t3]-wa3[i-1]*cc[t3-1]; + + tr1=cr2+cr4; + tr4=cr4-cr2; + ti1=ci2+ci4; + ti4=ci2-ci4; + + ti2=cc[t2]+ci3; + ti3=cc[t2]-ci3; + tr2=cc[t2-1]+cr3; + tr3=cc[t2-1]-cr3; + + ch[t4-1]=tr1+tr2; + ch[t4]=ti1+ti2; + + ch[t5-1]=tr3-ti4; + ch[t5]=tr4-ti3; + + ch[t4+t6-1]=ti4+tr3; + ch[t4+t6]=tr4+ti3; + + ch[t5+t6-1]=tr2-tr1; + ch[t5+t6]=ti1-ti2; + } + t1+=ido; + } + if (ido&1)return; + +L105: + + t2=(t1=t0+ido-1)+(t0<<1); + t3=ido<<2; + t4=ido; + t5=ido<<1; + t6=ido; + + for (k=0;k<l1;k++) { + ti1=-hsqt2*(cc[t1]+cc[t2]); + tr1=hsqt2*(cc[t1]-cc[t2]); + + ch[t4-1]=tr1+cc[t6-1]; + ch[t4+t5-1]=cc[t6-1]-tr1; + + ch[t4]=ti1-cc[t1+t0]; + ch[t4+t5]=ti1+cc[t1+t0]; + + t1+=ido; + t2+=ido; + t4+=t3; + t6+=ido; + } } static void dradfg(int ido,int ip,int l1,int idl1,float *cc,float *c1, - float *c2,float *ch,float *ch2,float *wa){ - - static float tpi=6.283185307179586f; - int idij,ipph,i,j,k,l,ic,ik,is; - int t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; - float dc2,ai1,ai2,ar1,ar2,ds2; - int nbd; - float dcp,arg,dsp,ar1h,ar2h; - int idp2,ipp2; - - arg=tpi/(ip * 1.f); - dcp=cosf(arg); - dsp=sinf(arg); - ipph=(ip+1)>>1; - ipp2=ip; - idp2=ido; - nbd=(ido-1)>>1; - t0=l1*ido; - t10=ip*ido; - - if(ido==1)goto L119; - for(ik=0;ik<idl1;ik++)ch2[ik]=c2[ik]; - - t1=0; - for(j=1;j<ip;j++){ - t1+=t0; - t2=t1; - for(k=0;k<l1;k++){ - ch[t2]=c1[t2]; - t2+=ido; - } - } - - is=-ido; - t1=0; - if(nbd>l1){ - for(j=1;j<ip;j++){ - t1+=t0; - is+=ido; - t2= -ido+t1; - for(k=0;k<l1;k++){ - idij=is-1; - t2+=ido; - t3=t2; - for(i=2;i<ido;i+=2){ - idij+=2; - t3+=2; - ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3]; - ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1]; - } - } - } - }else{ - - for(j=1;j<ip;j++){ - is+=ido; - idij=is-1; - t1+=t0; - t2=t1; - for(i=2;i<ido;i+=2){ - idij+=2; - t2+=2; - t3=t2; - for(k=0;k<l1;k++){ - ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3]; - ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1]; - t3+=ido; - } - } - } - } - - t1=0; - t2=ipp2*t0; - if(nbd<l1){ - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(i=2;i<ido;i+=2){ - t3+=2; - t4+=2; - t5=t3-ido; - t6=t4-ido; - for(k=0;k<l1;k++){ - t5+=ido; - t6+=ido; - c1[t5-1]=ch[t5-1]+ch[t6-1]; - c1[t6-1]=ch[t5]-ch[t6]; - c1[t5]=ch[t5]+ch[t6]; - c1[t6]=ch[t6-1]-ch[t5-1]; - } - } - } - }else{ - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(k=0;k<l1;k++){ - t5=t3; - t6=t4; - for(i=2;i<ido;i+=2){ - t5+=2; - t6+=2; - c1[t5-1]=ch[t5-1]+ch[t6-1]; - c1[t6-1]=ch[t5]-ch[t6]; - c1[t5]=ch[t5]+ch[t6]; - c1[t6]=ch[t6-1]-ch[t5-1]; - } - t3+=ido; - t4+=ido; - } - } - } + float *c2,float *ch,float *ch2,float *wa) { + + static float tpi=6.283185307179586f; + int idij,ipph,i,j,k,l,ic,ik,is; + int t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; + float dc2,ai1,ai2,ar1,ar2,ds2; + int nbd; + float dcp,arg,dsp,ar1h,ar2h; + int idp2,ipp2; + + arg=tpi/(ip * 1.f); + dcp=cosf(arg); + dsp=sinf(arg); + ipph=(ip+1)>>1; + ipp2=ip; + idp2=ido; + nbd=(ido-1)>>1; + t0=l1*ido; + t10=ip*ido; + + if (ido==1)goto L119; + for (ik=0;ik<idl1;ik++)ch2[ik]=c2[ik]; + + t1=0; + for (j=1;j<ip;j++) { + t1+=t0; + t2=t1; + for (k=0;k<l1;k++) { + ch[t2]=c1[t2]; + t2+=ido; + } + } + + is=-ido; + t1=0; + if (nbd>l1) { + for (j=1;j<ip;j++) { + t1+=t0; + is+=ido; + t2= -ido+t1; + for (k=0;k<l1;k++) { + idij=is-1; + t2+=ido; + t3=t2; + for (i=2;i<ido;i+=2) { + idij+=2; + t3+=2; + ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3]; + ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1]; + } + } + } + } else { + + for (j=1;j<ip;j++) { + is+=ido; + idij=is-1; + t1+=t0; + t2=t1; + for (i=2;i<ido;i+=2) { + idij+=2; + t2+=2; + t3=t2; + for (k=0;k<l1;k++) { + ch[t3-1]=wa[idij-1]*c1[t3-1]+wa[idij]*c1[t3]; + ch[t3]=wa[idij-1]*c1[t3]-wa[idij]*c1[t3-1]; + t3+=ido; + } + } + } + } + + t1=0; + t2=ipp2*t0; + if (nbd<l1) { + for (j=1;j<ipph;j++) { + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + for (i=2;i<ido;i+=2) { + t3+=2; + t4+=2; + t5=t3-ido; + t6=t4-ido; + for (k=0;k<l1;k++) { + t5+=ido; + t6+=ido; + c1[t5-1]=ch[t5-1]+ch[t6-1]; + c1[t6-1]=ch[t5]-ch[t6]; + c1[t5]=ch[t5]+ch[t6]; + c1[t6]=ch[t6-1]-ch[t5-1]; + } + } + } + } else { + for (j=1;j<ipph;j++) { + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + for (k=0;k<l1;k++) { + t5=t3; + t6=t4; + for (i=2;i<ido;i+=2) { + t5+=2; + t6+=2; + c1[t5-1]=ch[t5-1]+ch[t6-1]; + c1[t6-1]=ch[t5]-ch[t6]; + c1[t5]=ch[t5]+ch[t6]; + c1[t6]=ch[t6-1]-ch[t5-1]; + } + t3+=ido; + t4+=ido; + } + } + } L119: - for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik]; - - t1=0; - t2=ipp2*idl1; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1-ido; - t4=t2-ido; - for(k=0;k<l1;k++){ - t3+=ido; - t4+=ido; - c1[t3]=ch[t3]+ch[t4]; - c1[t4]=ch[t4]-ch[t3]; - } - } - - ar1=1.f; - ai1=0.f; - t1=0; - t2=ipp2*idl1; - t3=(ip-1)*idl1; - for(l=1;l<ipph;l++){ - t1+=idl1; - t2-=idl1; - ar1h=dcp*ar1-dsp*ai1; - ai1=dcp*ai1+dsp*ar1; - ar1=ar1h; - t4=t1; - t5=t2; - t6=t3; - t7=idl1; - - for(ik=0;ik<idl1;ik++){ - ch2[t4++]=c2[ik]+ar1*c2[t7++]; - ch2[t5++]=ai1*c2[t6++]; - } - - dc2=ar1; - ds2=ai1; - ar2=ar1; - ai2=ai1; - - t4=idl1; - t5=(ipp2-1)*idl1; - for(j=2;j<ipph;j++){ - t4+=idl1; - t5-=idl1; - - ar2h=dc2*ar2-ds2*ai2; - ai2=dc2*ai2+ds2*ar2; - ar2=ar2h; - - t6=t1; - t7=t2; - t8=t4; - t9=t5; - for(ik=0;ik<idl1;ik++){ - ch2[t6++]+=ar2*c2[t8++]; - ch2[t7++]+=ai2*c2[t9++]; - } - } - } - - t1=0; - for(j=1;j<ipph;j++){ - t1+=idl1; - t2=t1; - for(ik=0;ik<idl1;ik++)ch2[ik]+=c2[t2++]; - } - - if(ido<l1)goto L132; - - t1=0; - t2=0; - for(k=0;k<l1;k++){ - t3=t1; - t4=t2; - for(i=0;i<ido;i++)cc[t4++]=ch[t3++]; - t1+=ido; - t2+=t10; - } - - goto L135; - - L132: - for(i=0;i<ido;i++){ - t1=i; - t2=i; - for(k=0;k<l1;k++){ - cc[t2]=ch[t1]; - t1+=ido; - t2+=t10; - } - } - - L135: - t1=0; - t2=ido<<1; - t3=0; - t4=ipp2*t0; - for(j=1;j<ipph;j++){ - - t1+=t2; - t3+=t0; - t4-=t0; - - t5=t1; - t6=t3; - t7=t4; - - for(k=0;k<l1;k++){ - cc[t5-1]=ch[t6]; - cc[t5]=ch[t7]; - t5+=t10; - t6+=ido; - t7+=ido; - } - } - - if(ido==1)return; - if(nbd<l1)goto L141; - - t1=-ido; - t3=0; - t4=0; - t5=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t2; - t3+=t2; - t4+=t0; - t5-=t0; - t6=t1; - t7=t3; - t8=t4; - t9=t5; - for(k=0;k<l1;k++){ - for(i=2;i<ido;i+=2){ - ic=idp2-i; - cc[i+t7-1]=ch[i+t8-1]+ch[i+t9-1]; - cc[ic+t6-1]=ch[i+t8-1]-ch[i+t9-1]; - cc[i+t7]=ch[i+t8]+ch[i+t9]; - cc[ic+t6]=ch[i+t9]-ch[i+t8]; - } - t6+=t10; - t7+=t10; - t8+=ido; - t9+=ido; - } - } - return; - - L141: - - t1=-ido; - t3=0; - t4=0; - t5=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t2; - t3+=t2; - t4+=t0; - t5-=t0; - for(i=2;i<ido;i+=2){ - t6=idp2+t1-i; - t7=i+t3; - t8=i+t4; - t9=i+t5; - for(k=0;k<l1;k++){ - cc[t7-1]=ch[t8-1]+ch[t9-1]; - cc[t6-1]=ch[t8-1]-ch[t9-1]; - cc[t7]=ch[t8]+ch[t9]; - cc[t6]=ch[t9]-ch[t8]; - t6+=t10; - t7+=t10; - t8+=ido; - t9+=ido; - } - } - } + for (ik=0;ik<idl1;ik++)c2[ik]=ch2[ik]; + + t1=0; + t2=ipp2*idl1; + for (j=1;j<ipph;j++) { + t1+=t0; + t2-=t0; + t3=t1-ido; + t4=t2-ido; + for (k=0;k<l1;k++) { + t3+=ido; + t4+=ido; + c1[t3]=ch[t3]+ch[t4]; + c1[t4]=ch[t4]-ch[t3]; + } + } + + ar1=1.f; + ai1=0.f; + t1=0; + t2=ipp2*idl1; + t3=(ip-1)*idl1; + for (l=1;l<ipph;l++) { + t1+=idl1; + t2-=idl1; + ar1h=dcp*ar1-dsp*ai1; + ai1=dcp*ai1+dsp*ar1; + ar1=ar1h; + t4=t1; + t5=t2; + t6=t3; + t7=idl1; + + for (ik=0;ik<idl1;ik++) { + ch2[t4++]=c2[ik]+ar1*c2[t7++]; + ch2[t5++]=ai1*c2[t6++]; + } + + dc2=ar1; + ds2=ai1; + ar2=ar1; + ai2=ai1; + + t4=idl1; + t5=(ipp2-1)*idl1; + for (j=2;j<ipph;j++) { + t4+=idl1; + t5-=idl1; + + ar2h=dc2*ar2-ds2*ai2; + ai2=dc2*ai2+ds2*ar2; + ar2=ar2h; + + t6=t1; + t7=t2; + t8=t4; + t9=t5; + for (ik=0;ik<idl1;ik++) { + ch2[t6++]+=ar2*c2[t8++]; + ch2[t7++]+=ai2*c2[t9++]; + } + } + } + + t1=0; + for (j=1;j<ipph;j++) { + t1+=idl1; + t2=t1; + for (ik=0;ik<idl1;ik++)ch2[ik]+=c2[t2++]; + } + + if (ido<l1)goto L132; + + t1=0; + t2=0; + for (k=0;k<l1;k++) { + t3=t1; + t4=t2; + for (i=0;i<ido;i++)cc[t4++]=ch[t3++]; + t1+=ido; + t2+=t10; + } + + goto L135; + +L132: + for (i=0;i<ido;i++) { + t1=i; + t2=i; + for (k=0;k<l1;k++) { + cc[t2]=ch[t1]; + t1+=ido; + t2+=t10; + } + } + +L135: + t1=0; + t2=ido<<1; + t3=0; + t4=ipp2*t0; + for (j=1;j<ipph;j++) { + + t1+=t2; + t3+=t0; + t4-=t0; + + t5=t1; + t6=t3; + t7=t4; + + for (k=0;k<l1;k++) { + cc[t5-1]=ch[t6]; + cc[t5]=ch[t7]; + t5+=t10; + t6+=ido; + t7+=ido; + } + } + + if (ido==1)return; + if (nbd<l1)goto L141; + + t1=-ido; + t3=0; + t4=0; + t5=ipp2*t0; + for (j=1;j<ipph;j++) { + t1+=t2; + t3+=t2; + t4+=t0; + t5-=t0; + t6=t1; + t7=t3; + t8=t4; + t9=t5; + for (k=0;k<l1;k++) { + for (i=2;i<ido;i+=2) { + ic=idp2-i; + cc[i+t7-1]=ch[i+t8-1]+ch[i+t9-1]; + cc[ic+t6-1]=ch[i+t8-1]-ch[i+t9-1]; + cc[i+t7]=ch[i+t8]+ch[i+t9]; + cc[ic+t6]=ch[i+t9]-ch[i+t8]; + } + t6+=t10; + t7+=t10; + t8+=ido; + t9+=ido; + } + } + return; + +L141: + + t1=-ido; + t3=0; + t4=0; + t5=ipp2*t0; + for (j=1;j<ipph;j++) { + t1+=t2; + t3+=t2; + t4+=t0; + t5-=t0; + for (i=2;i<ido;i+=2) { + t6=idp2+t1-i; + t7=i+t3; + t8=i+t4; + t9=i+t5; + for (k=0;k<l1;k++) { + cc[t7-1]=ch[t8-1]+ch[t9-1]; + cc[t6-1]=ch[t8-1]-ch[t9-1]; + cc[t7]=ch[t8]+ch[t9]; + cc[t6]=ch[t9]-ch[t8]; + t6+=t10; + t7+=t10; + t8+=ido; + t9+=ido; + } + } + } } -static void drftf1(int n,float *c,float *ch,float *wa,int *ifac){ - int i,k1,l1,l2; - int na,kh,nf; - int ip,iw,ido,idl1,ix2,ix3; - - nf=ifac[1]; - na=1; - l2=n; - iw=n; - - for(k1=0;k1<nf;k1++){ - kh=nf-k1; - ip=ifac[kh+1]; - l1=l2/ip; - ido=n/l2; - idl1=ido*l1; - iw-=(ip-1)*ido; - na=1-na; - - if(ip!=4)goto L102; - - ix2=iw+ido; - ix3=ix2+ido; - if(na!=0) - dradf4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1); - else - dradf4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1); - goto L110; - - L102: - if(ip!=2)goto L104; - if(na!=0)goto L103; - - dradf2(ido,l1,c,ch,wa+iw-1); - goto L110; - - L103: - dradf2(ido,l1,ch,c,wa+iw-1); - goto L110; - - L104: - if(ido==1)na=1-na; - if(na!=0)goto L109; - - dradfg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1); - na=1; - goto L110; - - L109: - dradfg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1); - na=0; - - L110: - l2=l1; - } - - if(na==1)return; - - for(i=0;i<n;i++)c[i]=ch[i]; +static void drftf1(int n,float *c,float *ch,float *wa,int *ifac) { + int i,k1,l1,l2; + int na,kh,nf; + int ip,iw,ido,idl1,ix2,ix3; + + nf=ifac[1]; + na=1; + l2=n; + iw=n; + + for (k1=0;k1<nf;k1++) { + kh=nf-k1; + ip=ifac[kh+1]; + l1=l2/ip; + ido=n/l2; + idl1=ido*l1; + iw-=(ip-1)*ido; + na=1-na; + + if (ip!=4)goto L102; + + ix2=iw+ido; + ix3=ix2+ido; + if (na!=0) + dradf4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1); + else + dradf4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1); + goto L110; + +L102: + if (ip!=2)goto L104; + if (na!=0)goto L103; + + dradf2(ido,l1,c,ch,wa+iw-1); + goto L110; + +L103: + dradf2(ido,l1,ch,c,wa+iw-1); + goto L110; + +L104: + if (ido==1)na=1-na; + if (na!=0)goto L109; + + dradfg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1); + na=1; + goto L110; + +L109: + dradfg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1); + na=0; + +L110: + l2=l1; + } + + if (na==1)return; + + for (i=0;i<n;i++)c[i]=ch[i]; } -static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1){ - int i,k,t0,t1,t2,t3,t4,t5,t6; - float ti2,tr2; - - t0=l1*ido; - - t1=0; - t2=0; - t3=(ido<<1)-1; - for(k=0;k<l1;k++){ - ch[t1]=cc[t2]+cc[t3+t2]; - ch[t1+t0]=cc[t2]-cc[t3+t2]; - t2=(t1+=ido)<<1; - } - - if(ido<2)return; - if(ido==2)goto L105; - - t1=0; - t2=0; - for(k=0;k<l1;k++){ - t3=t1; - t5=(t4=t2)+(ido<<1); - t6=t0+t1; - for(i=2;i<ido;i+=2){ - t3+=2; - t4+=2; - t5-=2; - t6+=2; - ch[t3-1]=cc[t4-1]+cc[t5-1]; - tr2=cc[t4-1]-cc[t5-1]; - ch[t3]=cc[t4]-cc[t5]; - ti2=cc[t4]+cc[t5]; - ch[t6-1]=wa1[i-2]*tr2-wa1[i-1]*ti2; - ch[t6]=wa1[i-2]*ti2+wa1[i-1]*tr2; - } - t2=(t1+=ido)<<1; - } - - if(ido%2==1)return; +static void dradb2(int ido,int l1,float *cc,float *ch,float *wa1) { + int i,k,t0,t1,t2,t3,t4,t5,t6; + float ti2,tr2; + + t0=l1*ido; + + t1=0; + t2=0; + t3=(ido<<1)-1; + for (k=0;k<l1;k++) { + ch[t1]=cc[t2]+cc[t3+t2]; + ch[t1+t0]=cc[t2]-cc[t3+t2]; + t2=(t1+=ido)<<1; + } + + if (ido<2)return; + if (ido==2)goto L105; + + t1=0; + t2=0; + for (k=0;k<l1;k++) { + t3=t1; + t5=(t4=t2)+(ido<<1); + t6=t0+t1; + for (i=2;i<ido;i+=2) { + t3+=2; + t4+=2; + t5-=2; + t6+=2; + ch[t3-1]=cc[t4-1]+cc[t5-1]; + tr2=cc[t4-1]-cc[t5-1]; + ch[t3]=cc[t4]-cc[t5]; + ti2=cc[t4]+cc[t5]; + ch[t6-1]=wa1[i-2]*tr2-wa1[i-1]*ti2; + ch[t6]=wa1[i-2]*ti2+wa1[i-1]*tr2; + } + t2=(t1+=ido)<<1; + } + + if (ido%2==1)return; L105: - t1=ido-1; - t2=ido-1; - for(k=0;k<l1;k++){ - ch[t1]=cc[t2]+cc[t2]; - ch[t1+t0]=-(cc[t2+1]+cc[t2+1]); - t1+=ido; - t2+=ido<<1; - } + t1=ido-1; + t2=ido-1; + for (k=0;k<l1;k++) { + ch[t1]=cc[t2]+cc[t2]; + ch[t1+t0]=-(cc[t2+1]+cc[t2+1]); + t1+=ido; + t2+=ido<<1; + } } static void dradb3(int ido,int l1,float *cc,float *ch,float *wa1, - float *wa2){ - static float taur = -.5f; - static float taui = .8660254037844386f; - int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; - float ci2,ci3,di2,di3,cr2,cr3,dr2,dr3,ti2,tr2; - t0=l1*ido; - - t1=0; - t2=t0<<1; - t3=ido<<1; - t4=ido+(ido<<1); - t5=0; - for(k=0;k<l1;k++){ - tr2=cc[t3-1]+cc[t3-1]; - cr2=cc[t5]+(taur*tr2); - ch[t1]=cc[t5]+tr2; - ci3=taui*(cc[t3]+cc[t3]); - ch[t1+t0]=cr2-ci3; - ch[t1+t2]=cr2+ci3; - t1+=ido; - t3+=t4; - t5+=t4; - } - - if(ido==1)return; - - t1=0; - t3=ido<<1; - for(k=0;k<l1;k++){ - t7=t1+(t1<<1); - t6=(t5=t7+t3); - t8=t1; - t10=(t9=t1+t0)+t0; - - for(i=2;i<ido;i+=2){ - t5+=2; - t6-=2; - t7+=2; - t8+=2; - t9+=2; - t10+=2; - tr2=cc[t5-1]+cc[t6-1]; - cr2=cc[t7-1]+(taur*tr2); - ch[t8-1]=cc[t7-1]+tr2; - ti2=cc[t5]-cc[t6]; - ci2=cc[t7]+(taur*ti2); - ch[t8]=cc[t7]+ti2; - cr3=taui*(cc[t5-1]-cc[t6-1]); - ci3=taui*(cc[t5]+cc[t6]); - dr2=cr2-ci3; - dr3=cr2+ci3; - di2=ci2+cr3; - di3=ci2-cr3; - ch[t9-1]=wa1[i-2]*dr2-wa1[i-1]*di2; - ch[t9]=wa1[i-2]*di2+wa1[i-1]*dr2; - ch[t10-1]=wa2[i-2]*dr3-wa2[i-1]*di3; - ch[t10]=wa2[i-2]*di3+wa2[i-1]*dr3; - } - t1+=ido; - } + float *wa2) { + static float taur = -.5f; + static float taui = .8660254037844386f; + int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10; + float ci2,ci3,di2,di3,cr2,cr3,dr2,dr3,ti2,tr2; + t0=l1*ido; + + t1=0; + t2=t0<<1; + t3=ido<<1; + t4=ido+(ido<<1); + t5=0; + for (k=0;k<l1;k++) { + tr2=cc[t3-1]+cc[t3-1]; + cr2=cc[t5]+(taur*tr2); + ch[t1]=cc[t5]+tr2; + ci3=taui*(cc[t3]+cc[t3]); + ch[t1+t0]=cr2-ci3; + ch[t1+t2]=cr2+ci3; + t1+=ido; + t3+=t4; + t5+=t4; + } + + if (ido==1)return; + + t1=0; + t3=ido<<1; + for (k=0;k<l1;k++) { + t7=t1+(t1<<1); + t6=(t5=t7+t3); + t8=t1; + t10=(t9=t1+t0)+t0; + + for (i=2;i<ido;i+=2) { + t5+=2; + t6-=2; + t7+=2; + t8+=2; + t9+=2; + t10+=2; + tr2=cc[t5-1]+cc[t6-1]; + cr2=cc[t7-1]+(taur*tr2); + ch[t8-1]=cc[t7-1]+tr2; + ti2=cc[t5]-cc[t6]; + ci2=cc[t7]+(taur*ti2); + ch[t8]=cc[t7]+ti2; + cr3=taui*(cc[t5-1]-cc[t6-1]); + ci3=taui*(cc[t5]+cc[t6]); + dr2=cr2-ci3; + dr3=cr2+ci3; + di2=ci2+cr3; + di3=ci2-cr3; + ch[t9-1]=wa1[i-2]*dr2-wa1[i-1]*di2; + ch[t9]=wa1[i-2]*di2+wa1[i-1]*dr2; + ch[t10-1]=wa2[i-2]*dr3-wa2[i-1]*di3; + ch[t10]=wa2[i-2]*di3+wa2[i-1]*dr3; + } + t1+=ido; + } } static void dradb4(int ido,int l1,float *cc,float *ch,float *wa1, - float *wa2,float *wa3){ - static float sqrt2=1.414213562373095f; - int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8; - float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; - t0=l1*ido; - - t1=0; - t2=ido<<2; - t3=0; - t6=ido<<1; - for(k=0;k<l1;k++){ - t4=t3+t6; - t5=t1; - tr3=cc[t4-1]+cc[t4-1]; - tr4=cc[t4]+cc[t4]; - tr1=cc[t3]-cc[(t4+=t6)-1]; - tr2=cc[t3]+cc[t4-1]; - ch[t5]=tr2+tr3; - ch[t5+=t0]=tr1-tr4; - ch[t5+=t0]=tr2-tr3; - ch[t5+=t0]=tr1+tr4; - t1+=ido; - t3+=t2; - } - - if(ido<2)return; - if(ido==2)goto L105; - - t1=0; - for(k=0;k<l1;k++){ - t5=(t4=(t3=(t2=t1<<2)+t6))+t6; - t7=t1; - for(i=2;i<ido;i+=2){ - t2+=2; - t3+=2; - t4-=2; - t5-=2; - t7+=2; - ti1=cc[t2]+cc[t5]; - ti2=cc[t2]-cc[t5]; - ti3=cc[t3]-cc[t4]; - tr4=cc[t3]+cc[t4]; - tr1=cc[t2-1]-cc[t5-1]; - tr2=cc[t2-1]+cc[t5-1]; - ti4=cc[t3-1]-cc[t4-1]; - tr3=cc[t3-1]+cc[t4-1]; - ch[t7-1]=tr2+tr3; - cr3=tr2-tr3; - ch[t7]=ti2+ti3; - ci3=ti2-ti3; - cr2=tr1-tr4; - cr4=tr1+tr4; - ci2=ti1+ti4; - ci4=ti1-ti4; - - ch[(t8=t7+t0)-1]=wa1[i-2]*cr2-wa1[i-1]*ci2; - ch[t8]=wa1[i-2]*ci2+wa1[i-1]*cr2; - ch[(t8+=t0)-1]=wa2[i-2]*cr3-wa2[i-1]*ci3; - ch[t8]=wa2[i-2]*ci3+wa2[i-1]*cr3; - ch[(t8+=t0)-1]=wa3[i-2]*cr4-wa3[i-1]*ci4; - ch[t8]=wa3[i-2]*ci4+wa3[i-1]*cr4; - } - t1+=ido; - } - - if(ido%2 == 1)return; - - L105: - - t1=ido; - t2=ido<<2; - t3=ido-1; - t4=ido+(ido<<1); - for(k=0;k<l1;k++){ - t5=t3; - ti1=cc[t1]+cc[t4]; - ti2=cc[t4]-cc[t1]; - tr1=cc[t1-1]-cc[t4-1]; - tr2=cc[t1-1]+cc[t4-1]; - ch[t5]=tr2+tr2; - ch[t5+=t0]=sqrt2*(tr1-ti1); - ch[t5+=t0]=ti2+ti2; - ch[t5+=t0]=-sqrt2*(tr1+ti1); - - t3+=ido; - t1+=t2; - t4+=t2; - } + float *wa2,float *wa3) { + static float sqrt2=1.414213562373095f; + int i,k,t0,t1,t2,t3,t4,t5,t6,t7,t8; + float ci2,ci3,ci4,cr2,cr3,cr4,ti1,ti2,ti3,ti4,tr1,tr2,tr3,tr4; + t0=l1*ido; + + t1=0; + t2=ido<<2; + t3=0; + t6=ido<<1; + for (k=0;k<l1;k++) { + t4=t3+t6; + t5=t1; + tr3=cc[t4-1]+cc[t4-1]; + tr4=cc[t4]+cc[t4]; + tr1=cc[t3]-cc[(t4+=t6)-1]; + tr2=cc[t3]+cc[t4-1]; + ch[t5]=tr2+tr3; + ch[t5+=t0]=tr1-tr4; + ch[t5+=t0]=tr2-tr3; + ch[t5+=t0]=tr1+tr4; + t1+=ido; + t3+=t2; + } + + if (ido<2)return; + if (ido==2)goto L105; + + t1=0; + for (k=0;k<l1;k++) { + t5=(t4=(t3=(t2=t1<<2)+t6))+t6; + t7=t1; + for (i=2;i<ido;i+=2) { + t2+=2; + t3+=2; + t4-=2; + t5-=2; + t7+=2; + ti1=cc[t2]+cc[t5]; + ti2=cc[t2]-cc[t5]; + ti3=cc[t3]-cc[t4]; + tr4=cc[t3]+cc[t4]; + tr1=cc[t2-1]-cc[t5-1]; + tr2=cc[t2-1]+cc[t5-1]; + ti4=cc[t3-1]-cc[t4-1]; + tr3=cc[t3-1]+cc[t4-1]; + ch[t7-1]=tr2+tr3; + cr3=tr2-tr3; + ch[t7]=ti2+ti3; + ci3=ti2-ti3; + cr2=tr1-tr4; + cr4=tr1+tr4; + ci2=ti1+ti4; + ci4=ti1-ti4; + + ch[(t8=t7+t0)-1]=wa1[i-2]*cr2-wa1[i-1]*ci2; + ch[t8]=wa1[i-2]*ci2+wa1[i-1]*cr2; + ch[(t8+=t0)-1]=wa2[i-2]*cr3-wa2[i-1]*ci3; + ch[t8]=wa2[i-2]*ci3+wa2[i-1]*cr3; + ch[(t8+=t0)-1]=wa3[i-2]*cr4-wa3[i-1]*ci4; + ch[t8]=wa3[i-2]*ci4+wa3[i-1]*cr4; + } + t1+=ido; + } + + if (ido%2 == 1)return; + +L105: + + t1=ido; + t2=ido<<2; + t3=ido-1; + t4=ido+(ido<<1); + for (k=0;k<l1;k++) { + t5=t3; + ti1=cc[t1]+cc[t4]; + ti2=cc[t4]-cc[t1]; + tr1=cc[t1-1]-cc[t4-1]; + tr2=cc[t1-1]+cc[t4-1]; + ch[t5]=tr2+tr2; + ch[t5+=t0]=sqrt2*(tr1-ti1); + ch[t5+=t0]=ti2+ti2; + ch[t5+=t0]=-sqrt2*(tr1+ti1); + + t3+=ido; + t1+=t2; + t4+=t2; + } } static void dradbg(int ido,int ip,int l1,int idl1,float *cc,float *c1, - float *c2,float *ch,float *ch2,float *wa){ - static float tpi=6.283185307179586f; - int idij,ipph,i,j,k,l,ik,is,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10, - t11,t12; - float dc2,ai1,ai2,ar1,ar2,ds2; - int nbd; - float dcp,arg,dsp,ar1h,ar2h; - int ipp2; - - t10=ip*ido; - t0=l1*ido; - arg=tpi/(ip * 1.f); - dcp=cosf(arg); - dsp=sinf(arg); - nbd=(ido-1)>>1; - ipp2=ip; - ipph=(ip+1)>>1; - if(ido<l1)goto L103; - - t1=0; - t2=0; - for(k=0;k<l1;k++){ - t3=t1; - t4=t2; - for(i=0;i<ido;i++){ - ch[t3]=cc[t4]; - t3++; - t4++; - } - t1+=ido; - t2+=t10; - } - goto L106; - - L103: - t1=0; - for(i=0;i<ido;i++){ - t2=t1; - t3=t1; - for(k=0;k<l1;k++){ - ch[t2]=cc[t3]; - t2+=ido; - t3+=t10; - } - t1++; - } - - L106: - t1=0; - t2=ipp2*t0; - t7=(t5=ido<<1); - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - t6=t5; - for(k=0;k<l1;k++){ - ch[t3]=cc[t6-1]+cc[t6-1]; - ch[t4]=cc[t6]+cc[t6]; - t3+=ido; - t4+=ido; - t6+=t10; - } - t5+=t7; - } - - if (ido == 1)goto L116; - if(nbd<l1)goto L112; - - t1=0; - t2=ipp2*t0; - t7=0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - - t7+=(ido<<1); - t8=t7; - for(k=0;k<l1;k++){ - t5=t3; - t6=t4; - t9=t8; - t11=t8; - for(i=2;i<ido;i+=2){ - t5+=2; - t6+=2; - t9+=2; - t11-=2; - ch[t5-1]=cc[t9-1]+cc[t11-1]; - ch[t6-1]=cc[t9-1]-cc[t11-1]; - ch[t5]=cc[t9]-cc[t11]; - ch[t6]=cc[t9]+cc[t11]; - } - t3+=ido; - t4+=ido; - t8+=t10; - } - } - goto L116; - - L112: - t1=0; - t2=ipp2*t0; - t7=0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - t7+=(ido<<1); - t8=t7; - t9=t7; - for(i=2;i<ido;i+=2){ - t3+=2; - t4+=2; - t8+=2; - t9-=2; - t5=t3; - t6=t4; - t11=t8; - t12=t9; - for(k=0;k<l1;k++){ - ch[t5-1]=cc[t11-1]+cc[t12-1]; - ch[t6-1]=cc[t11-1]-cc[t12-1]; - ch[t5]=cc[t11]-cc[t12]; - ch[t6]=cc[t11]+cc[t12]; - t5+=ido; - t6+=ido; - t11+=t10; - t12+=t10; - } - } - } + float *c2,float *ch,float *ch2,float *wa) { + static float tpi=6.283185307179586f; + int idij,ipph,i,j,k,l,ik,is,t0,t1,t2,t3,t4,t5,t6,t7,t8,t9,t10, + t11,t12; + float dc2,ai1,ai2,ar1,ar2,ds2; + int nbd; + float dcp,arg,dsp,ar1h,ar2h; + int ipp2; + + t10=ip*ido; + t0=l1*ido; + arg=tpi/(ip * 1.f); + dcp=cosf(arg); + dsp=sinf(arg); + nbd=(ido-1)>>1; + ipp2=ip; + ipph=(ip+1)>>1; + if (ido<l1)goto L103; + + t1=0; + t2=0; + for (k=0;k<l1;k++) { + t3=t1; + t4=t2; + for (i=0;i<ido;i++) { + ch[t3]=cc[t4]; + t3++; + t4++; + } + t1+=ido; + t2+=t10; + } + goto L106; + +L103: + t1=0; + for (i=0;i<ido;i++) { + t2=t1; + t3=t1; + for (k=0;k<l1;k++) { + ch[t2]=cc[t3]; + t2+=ido; + t3+=t10; + } + t1++; + } + +L106: + t1=0; + t2=ipp2*t0; + t7=(t5=ido<<1); + for (j=1;j<ipph;j++) { + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + t6=t5; + for (k=0;k<l1;k++) { + ch[t3]=cc[t6-1]+cc[t6-1]; + ch[t4]=cc[t6]+cc[t6]; + t3+=ido; + t4+=ido; + t6+=t10; + } + t5+=t7; + } + + if (ido == 1)goto L116; + if (nbd<l1)goto L112; + + t1=0; + t2=ipp2*t0; + t7=0; + for (j=1;j<ipph;j++) { + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + + t7+=(ido<<1); + t8=t7; + for (k=0;k<l1;k++) { + t5=t3; + t6=t4; + t9=t8; + t11=t8; + for (i=2;i<ido;i+=2) { + t5+=2; + t6+=2; + t9+=2; + t11-=2; + ch[t5-1]=cc[t9-1]+cc[t11-1]; + ch[t6-1]=cc[t9-1]-cc[t11-1]; + ch[t5]=cc[t9]-cc[t11]; + ch[t6]=cc[t9]+cc[t11]; + } + t3+=ido; + t4+=ido; + t8+=t10; + } + } + goto L116; + +L112: + t1=0; + t2=ipp2*t0; + t7=0; + for (j=1;j<ipph;j++) { + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + t7+=(ido<<1); + t8=t7; + t9=t7; + for (i=2;i<ido;i+=2) { + t3+=2; + t4+=2; + t8+=2; + t9-=2; + t5=t3; + t6=t4; + t11=t8; + t12=t9; + for (k=0;k<l1;k++) { + ch[t5-1]=cc[t11-1]+cc[t12-1]; + ch[t6-1]=cc[t11-1]-cc[t12-1]; + ch[t5]=cc[t11]-cc[t12]; + ch[t6]=cc[t11]+cc[t12]; + t5+=ido; + t6+=ido; + t11+=t10; + t12+=t10; + } + } + } L116: - ar1=1.f; - ai1=0.f; - t1=0; - t9=(t2=ipp2*idl1); - t3=(ip-1)*idl1; - for(l=1;l<ipph;l++){ - t1+=idl1; - t2-=idl1; - - ar1h=dcp*ar1-dsp*ai1; - ai1=dcp*ai1+dsp*ar1; - ar1=ar1h; - t4=t1; - t5=t2; - t6=0; - t7=idl1; - t8=t3; - for(ik=0;ik<idl1;ik++){ - c2[t4++]=ch2[t6++]+ar1*ch2[t7++]; - c2[t5++]=ai1*ch2[t8++]; - } - dc2=ar1; - ds2=ai1; - ar2=ar1; - ai2=ai1; - - t6=idl1; - t7=t9-idl1; - for(j=2;j<ipph;j++){ - t6+=idl1; - t7-=idl1; - ar2h=dc2*ar2-ds2*ai2; - ai2=dc2*ai2+ds2*ar2; - ar2=ar2h; - t4=t1; - t5=t2; - t11=t6; - t12=t7; - for(ik=0;ik<idl1;ik++){ - c2[t4++]+=ar2*ch2[t11++]; - c2[t5++]+=ai2*ch2[t12++]; - } - } - } - - t1=0; - for(j=1;j<ipph;j++){ - t1+=idl1; - t2=t1; - for(ik=0;ik<idl1;ik++)ch2[ik]+=ch2[t2++]; - } - - t1=0; - t2=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(k=0;k<l1;k++){ - ch[t3]=c1[t3]-c1[t4]; - ch[t4]=c1[t3]+c1[t4]; - t3+=ido; - t4+=ido; - } - } - - if(ido==1)goto L132; - if(nbd<l1)goto L128; - - t1=0; - t2=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(k=0;k<l1;k++){ - t5=t3; - t6=t4; - for(i=2;i<ido;i+=2){ - t5+=2; - t6+=2; - ch[t5-1]=c1[t5-1]-c1[t6]; - ch[t6-1]=c1[t5-1]+c1[t6]; - ch[t5]=c1[t5]+c1[t6-1]; - ch[t6]=c1[t5]-c1[t6-1]; - } - t3+=ido; - t4+=ido; - } - } - goto L132; - - L128: - t1=0; - t2=ipp2*t0; - for(j=1;j<ipph;j++){ - t1+=t0; - t2-=t0; - t3=t1; - t4=t2; - for(i=2;i<ido;i+=2){ - t3+=2; - t4+=2; - t5=t3; - t6=t4; - for(k=0;k<l1;k++){ - ch[t5-1]=c1[t5-1]-c1[t6]; - ch[t6-1]=c1[t5-1]+c1[t6]; - ch[t5]=c1[t5]+c1[t6-1]; - ch[t6]=c1[t5]-c1[t6-1]; - t5+=ido; - t6+=ido; - } - } - } + ar1=1.f; + ai1=0.f; + t1=0; + t9=(t2=ipp2*idl1); + t3=(ip-1)*idl1; + for (l=1;l<ipph;l++) { + t1+=idl1; + t2-=idl1; + + ar1h=dcp*ar1-dsp*ai1; + ai1=dcp*ai1+dsp*ar1; + ar1=ar1h; + t4=t1; + t5=t2; + t6=0; + t7=idl1; + t8=t3; + for (ik=0;ik<idl1;ik++) { + c2[t4++]=ch2[t6++]+ar1*ch2[t7++]; + c2[t5++]=ai1*ch2[t8++]; + } + dc2=ar1; + ds2=ai1; + ar2=ar1; + ai2=ai1; + + t6=idl1; + t7=t9-idl1; + for (j=2;j<ipph;j++) { + t6+=idl1; + t7-=idl1; + ar2h=dc2*ar2-ds2*ai2; + ai2=dc2*ai2+ds2*ar2; + ar2=ar2h; + t4=t1; + t5=t2; + t11=t6; + t12=t7; + for (ik=0;ik<idl1;ik++) { + c2[t4++]+=ar2*ch2[t11++]; + c2[t5++]+=ai2*ch2[t12++]; + } + } + } + + t1=0; + for (j=1;j<ipph;j++) { + t1+=idl1; + t2=t1; + for (ik=0;ik<idl1;ik++)ch2[ik]+=ch2[t2++]; + } + + t1=0; + t2=ipp2*t0; + for (j=1;j<ipph;j++) { + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + for (k=0;k<l1;k++) { + ch[t3]=c1[t3]-c1[t4]; + ch[t4]=c1[t3]+c1[t4]; + t3+=ido; + t4+=ido; + } + } + + if (ido==1)goto L132; + if (nbd<l1)goto L128; + + t1=0; + t2=ipp2*t0; + for (j=1;j<ipph;j++) { + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + for (k=0;k<l1;k++) { + t5=t3; + t6=t4; + for (i=2;i<ido;i+=2) { + t5+=2; + t6+=2; + ch[t5-1]=c1[t5-1]-c1[t6]; + ch[t6-1]=c1[t5-1]+c1[t6]; + ch[t5]=c1[t5]+c1[t6-1]; + ch[t6]=c1[t5]-c1[t6-1]; + } + t3+=ido; + t4+=ido; + } + } + goto L132; + +L128: + t1=0; + t2=ipp2*t0; + for (j=1;j<ipph;j++) { + t1+=t0; + t2-=t0; + t3=t1; + t4=t2; + for (i=2;i<ido;i+=2) { + t3+=2; + t4+=2; + t5=t3; + t6=t4; + for (k=0;k<l1;k++) { + ch[t5-1]=c1[t5-1]-c1[t6]; + ch[t6-1]=c1[t5-1]+c1[t6]; + ch[t5]=c1[t5]+c1[t6-1]; + ch[t6]=c1[t5]-c1[t6-1]; + t5+=ido; + t6+=ido; + } + } + } L132: - if(ido==1)return; - - for(ik=0;ik<idl1;ik++)c2[ik]=ch2[ik]; - - t1=0; - for(j=1;j<ip;j++){ - t2=(t1+=t0); - for(k=0;k<l1;k++){ - c1[t2]=ch[t2]; - t2+=ido; - } - } - - if(nbd>l1)goto L139; - - is= -ido-1; - t1=0; - for(j=1;j<ip;j++){ - is+=ido; - t1+=t0; - idij=is; - t2=t1; - for(i=2;i<ido;i+=2){ - t2+=2; - idij+=2; - t3=t2; - for(k=0;k<l1;k++){ - c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3]; - c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1]; - t3+=ido; - } - } - } - return; - - L139: - is= -ido-1; - t1=0; - for(j=1;j<ip;j++){ - is+=ido; - t1+=t0; - t2=t1; - for(k=0;k<l1;k++){ - idij=is; - t3=t2; - for(i=2;i<ido;i+=2){ - idij+=2; - t3+=2; - c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3]; - c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1]; - } - t2+=ido; - } - } + if (ido==1)return; + + for (ik=0;ik<idl1;ik++)c2[ik]=ch2[ik]; + + t1=0; + for (j=1;j<ip;j++) { + t2=(t1+=t0); + for (k=0;k<l1;k++) { + c1[t2]=ch[t2]; + t2+=ido; + } + } + + if (nbd>l1)goto L139; + + is= -ido-1; + t1=0; + for (j=1;j<ip;j++) { + is+=ido; + t1+=t0; + idij=is; + t2=t1; + for (i=2;i<ido;i+=2) { + t2+=2; + idij+=2; + t3=t2; + for (k=0;k<l1;k++) { + c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3]; + c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1]; + t3+=ido; + } + } + } + return; + +L139: + is= -ido-1; + t1=0; + for (j=1;j<ip;j++) { + is+=ido; + t1+=t0; + t2=t1; + for (k=0;k<l1;k++) { + idij=is; + t3=t2; + for (i=2;i<ido;i+=2) { + idij+=2; + t3+=2; + c1[t3-1]=wa[idij-1]*ch[t3-1]-wa[idij]*ch[t3]; + c1[t3]=wa[idij-1]*ch[t3]+wa[idij]*ch[t3-1]; + } + t2+=ido; + } + } } -static void drftb1(int n, float *c, float *ch, float *wa, int *ifac){ - int i,k1,l1,l2; - int na; - int nf,ip,iw,ix2,ix3,ido,idl1; - - nf=ifac[1]; - na=0; - l1=1; - iw=1; - - for(k1=0;k1<nf;k1++){ - ip=ifac[k1 + 2]; - l2=ip*l1; - ido=n/l2; - idl1=ido*l1; - if(ip!=4)goto L103; - ix2=iw+ido; - ix3=ix2+ido; - - if(na!=0) - dradb4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1); - else - dradb4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1); - na=1-na; - goto L115; - - L103: - if(ip!=2)goto L106; - - if(na!=0) - dradb2(ido,l1,ch,c,wa+iw-1); - else - dradb2(ido,l1,c,ch,wa+iw-1); - na=1-na; - goto L115; - - L106: - if(ip!=3)goto L109; - - ix2=iw+ido; - if(na!=0) - dradb3(ido,l1,ch,c,wa+iw-1,wa+ix2-1); - else - dradb3(ido,l1,c,ch,wa+iw-1,wa+ix2-1); - na=1-na; - goto L115; - - L109: -/* The radix five case can be translated later..... */ -/* if(ip!=5)goto L112; - - ix2=iw+ido; - ix3=ix2+ido; - ix4=ix3+ido; - if(na!=0) - dradb5(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1); - else - dradb5(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1); - na=1-na; - goto L115; - - L112:*/ - if(na!=0) - dradbg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1); - else - dradbg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1); - if(ido==1)na=1-na; - - L115: - l1=l2; - iw+=(ip-1)*ido; - } - - if(na==0)return; - - for(i=0;i<n;i++)c[i]=ch[i]; +static void drftb1(int n, float *c, float *ch, float *wa, int *ifac) { + int i,k1,l1,l2; + int na; + int nf,ip,iw,ix2,ix3,ido,idl1; + + nf=ifac[1]; + na=0; + l1=1; + iw=1; + + for (k1=0;k1<nf;k1++) { + ip=ifac[k1 + 2]; + l2=ip*l1; + ido=n/l2; + idl1=ido*l1; + if (ip!=4)goto L103; + ix2=iw+ido; + ix3=ix2+ido; + + if (na!=0) + dradb4(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1); + else + dradb4(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1); + na=1-na; + goto L115; + +L103: + if (ip!=2)goto L106; + + if (na!=0) + dradb2(ido,l1,ch,c,wa+iw-1); + else + dradb2(ido,l1,c,ch,wa+iw-1); + na=1-na; + goto L115; + +L106: + if (ip!=3)goto L109; + + ix2=iw+ido; + if (na!=0) + dradb3(ido,l1,ch,c,wa+iw-1,wa+ix2-1); + else + dradb3(ido,l1,c,ch,wa+iw-1,wa+ix2-1); + na=1-na; + goto L115; + +L109: + /* The radix five case can be translated later..... */ + /* if(ip!=5)goto L112; + + ix2=iw+ido; + ix3=ix2+ido; + ix4=ix3+ido; + if(na!=0) + dradb5(ido,l1,ch,c,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1); + else + dradb5(ido,l1,c,ch,wa+iw-1,wa+ix2-1,wa+ix3-1,wa+ix4-1); + na=1-na; + goto L115; + + L112:*/ + if (na!=0) + dradbg(ido,ip,l1,idl1,ch,ch,ch,c,c,wa+iw-1); + else + dradbg(ido,ip,l1,idl1,c,c,c,ch,ch,wa+iw-1); + if (ido==1)na=1-na; + +L115: + l1=l2; + iw+=(ip-1)*ido; + } + + if (na==0)return; + + for (i=0;i<n;i++)c[i]=ch[i]; } -void mumble_drft_forward(drft_lookup *l,float *data){ - if(l->n==1)return; - drftf1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); +void mumble_drft_forward(drft_lookup *l,float *data) { + if (l->n==1)return; + drftf1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); } -void mumble_drft_backward(drft_lookup *l,float *data){ - if (l->n==1)return; - drftb1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); +void mumble_drft_backward(drft_lookup *l,float *data) { + if (l->n==1)return; + drftb1(l->n,data,l->trigcache,l->trigcache+l->n,l->splitcache); } -void mumble_drft_init(drft_lookup *l,int n){ - l->n=n; - l->trigcache=reinterpret_cast<float *>(calloc(3*n,sizeof(*l->trigcache))); - l->splitcache=reinterpret_cast<int *>(calloc(32,sizeof(*l->splitcache))); - fdrffti(n, l->trigcache, l->splitcache); +void mumble_drft_init(drft_lookup *l,int n) { + l->n=n; + l->trigcache=reinterpret_cast<float *>(calloc(3*n,sizeof(*l->trigcache))); + l->splitcache=reinterpret_cast<int *>(calloc(32,sizeof(*l->splitcache))); + fdrffti(n, l->trigcache, l->splitcache); } -void mumble_drft_clear(drft_lookup *l){ - if(l){ - if(l->trigcache)free(l->trigcache); - if(l->splitcache)free(l->splitcache); - memset(l,0,sizeof(*l)); - } +void mumble_drft_clear(drft_lookup *l) { + if (l) { + if (l->trigcache)free(l->trigcache); + if (l->splitcache)free(l->splitcache); + memset(l,0,sizeof(*l)); + } } diff --git a/src/mumble/smallft.h b/src/mumble/smallft.h index f276e43a9..faea89ff8 100644 --- a/src/mumble/smallft.h +++ b/src/mumble/smallft.h @@ -42,9 +42,9 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. #define _MUMBLE_SMFT_H_ typedef struct { - int n; - float *trigcache; - int *splitcache; + int n; + float *trigcache; + int *splitcache; } drft_lookup; diff --git a/src/murmur/DBus.cpp b/src/murmur/DBus.cpp index 663591143..0a05bf4f3 100644 --- a/src/murmur/DBus.cpp +++ b/src/murmur/DBus.cpp @@ -1071,7 +1071,7 @@ void MetaDBus::rotateLogs(const QDBusMessage &msg) { } else { qfLog->setTextModeEnabled(true); qWarning("Log rotated successfully"); - } + } } void MetaDBus::quit() { diff --git a/src/murmur/Register.cpp b/src/murmur/Register.cpp index fbbe8baec..d145c631d 100644 --- a/src/murmur/Register.cpp +++ b/src/murmur/Register.cpp @@ -110,12 +110,12 @@ void Server::update() { qssReg = new QSslSocket(this); qssReg->setLocalCertificate(qscCert); qssReg->setPrivateKey(qskKey); - + http = new QHttp(QLatin1String("mumble.hive.no"), QHttp::ConnectionModeHttps, 443, this); http->setSocket(qssReg); connect(http, SIGNAL(done(bool)), this, SLOT(done(bool))); - connect(http, SIGNAL(sslErrors ( const QList<QSslError> &)), this, SLOT(regSslError(const QList<QSslError> &))); + connect(http, SIGNAL(sslErrors(const QList<QSslError> &)), this, SLOT(regSslError(const QList<QSslError> &))); QHttpRequestHeader h(QLatin1String("POST"), QLatin1String("/register.cgi")); h.setValue(QLatin1String("Connection"), QLatin1String("Keep-Alive")); @@ -138,5 +138,5 @@ void Server::done(bool err) { void Server::regSslError(const QList<QSslError> &errs) { foreach(const QSslError &e, errs) - log("Registration: SSL Handshake error: %s", qPrintable(e.errorString())); + log("Registration: SSL Handshake error: %s", qPrintable(e.errorString())); } diff --git a/src/murmur/ServerDB.cpp b/src/murmur/ServerDB.cpp index f845abce3..b901e4cac 100644 --- a/src/murmur/ServerDB.cpp +++ b/src/murmur/ServerDB.cpp @@ -1188,7 +1188,7 @@ QList<QPair<unsigned int, QString> > ServerDB::getLog(int server_id, unsigned in SQLEXEC(); QList<QPair<unsigned int, QString> > ql; - while(query.next()) { + while (query.next()) { QDateTime qdt = query.value(0).toDateTime(); QString msg = query.value(1).toString(); ql << QPair<unsigned int, QString>(qdt.toTime_t(), msg); diff --git a/src/murmur/UnixMurmur.cpp b/src/murmur/UnixMurmur.cpp index c8a562310..bf78c57e3 100644 --- a/src/murmur/UnixMurmur.cpp +++ b/src/murmur/UnixMurmur.cpp @@ -44,26 +44,26 @@ UnixMurmur::UnixMurmur() { if (::socketpair(AF_UNIX, SOCK_STREAM, 0, iTermFd)) qFatal("Couldn't create TERM socketpair"); - + qsnHup = new QSocketNotifier(iHupFd[1], QSocketNotifier::Read, this); qsnTerm = new QSocketNotifier(iTermFd[1], QSocketNotifier::Read, this); - + connect(qsnHup, SIGNAL(activated(int)), this, SLOT(handleSigHup())); connect(qsnTerm, SIGNAL(activated(int)), this, SLOT(handleSigTerm())); - + struct sigaction hup, term; - + hup.sa_handler = hupSignalHandler; sigemptyset(&hup.sa_mask); hup.sa_flags = SA_RESTART; - + if (sigaction(SIGHUP, &hup, NULL)) qFatal("Failed to install SIGHUP handler"); term.sa_handler = termSignalHandler; sigemptyset(&term.sa_mask); term.sa_flags = SA_RESTART; - + if (sigaction(SIGTERM, &term, NULL)) qFatal("Failed to install SIGTERM handler"); } @@ -71,7 +71,7 @@ UnixMurmur::UnixMurmur() { UnixMurmur::~UnixMurmur() { delete qsnHup; delete qsnTerm; - + qsnHup = NULL; qsnTerm = NULL; @@ -98,9 +98,9 @@ void UnixMurmur::handleSigHup() { qsnHup->setEnabled(false); char tmp; ::read(iHupFd[1], &tmp, sizeof(tmp)); - - if (! qfLog || ! qfLog->isOpen()) { - qWarning("Caught SIGHUP, but logfile not in use"); + + if (! qfLog || ! qfLog->isOpen()) { + qWarning("Caught SIGHUP, but logfile not in use"); } else { qWarning("Caught SIGHUP, will reopen %s", qPrintable(Meta::mp.qsLogfile)); qfLog->close(); @@ -120,10 +120,10 @@ void UnixMurmur::handleSigTerm() { qsnTerm->setEnabled(false); char tmp; ::read(iTermFd[1], &tmp, sizeof(tmp)); - + qWarning("Caught SIGTERM, exiting"); QCoreApplication::instance()->quit(); - + qsnTerm->setEnabled(true); } diff --git a/src/murmur/UnixMurmur.h b/src/murmur/UnixMurmur.h index 5058b67f4..36d2a1a30 100644 --- a/src/murmur/UnixMurmur.h +++ b/src/murmur/UnixMurmur.h @@ -38,7 +38,7 @@ class UnixMurmur : public QObject { protected:
static int iHupFd[2], iTermFd[2];
QSocketNotifier *qsnHup, *qsnTerm;
-
+
static void hupSignalHandler(int);
static void termSignalHandler(int);
public slots:
diff --git a/src/tests/TestTimer.cpp b/src/tests/TestTimer.cpp index 8a4937d97..3bd54159b 100644 --- a/src/tests/TestTimer.cpp +++ b/src/tests/TestTimer.cpp @@ -14,12 +14,12 @@ class TestTimer : public QObject { void TestTimer::accuracy() { QTime a; Timer t; - + a.restart(); t.restart(); do { - } while(a.elapsed() < 1000); - + } while (a.elapsed() < 1000); + QVERIFY(abs(t.elapsed() / 1000ULL - a.elapsed()) < 10); } |