mirror of
git://sourceware.org/git/newlib-cygwin.git
synced 2025-02-21 00:07:36 +08:00
* exceptions.cc (handle_exceptions): Bump repeat count for debugging kick out.
* fhandler.h (fhandler_dev_dsp): Add a fixup_after_exec. * fhandler_dsp.cc (class Audio): Add TOT_BLOCK_SIZE to enum. (operator new): New. (bigwavebuffer): Declare using TOT_BLOCK_SIZE to avoid buffer overruns. (Audio::Audio): Optimize slightly. (fhandler_dev_dsp::open): Allocate s_audio using static buffer. (fhandler_dev_dsp::fixup_after_exec): New function. Ditto.
This commit is contained in:
parent
ffa9dc2c1c
commit
52cd2f88cd
@ -1,3 +1,16 @@
|
||||
Thu May 24 01:17:33 2001 Christopher Faylor <cgf@cygnus.com>
|
||||
|
||||
* exceptions.cc (handle_exceptions): Bump repeat count for debugging
|
||||
kick out.
|
||||
|
||||
* fhandler.h (fhandler_dev_dsp): Add a fixup_after_exec.
|
||||
* fhandler_dsp.cc (class Audio): Add TOT_BLOCK_SIZE to enum.
|
||||
(operator new): New.
|
||||
(bigwavebuffer): Declare using TOT_BLOCK_SIZE to avoid buffer overruns.
|
||||
(Audio::Audio): Optimize slightly.
|
||||
(fhandler_dev_dsp::open): Allocate s_audio using static buffer.
|
||||
(fhandler_dev_dsp::fixup_after_exec): New function. Ditto.
|
||||
|
||||
Wed May 23 17:45:00 2001 Corinna Vinschen <corinna@vinschen.de>
|
||||
|
||||
* syscalls.cc (seteuid): Restrict overriding external provided
|
||||
|
@ -405,7 +405,7 @@ handle_exceptions (EXCEPTION_RECORD *e, void *, CONTEXT *in, void *)
|
||||
static int NO_COPY debugging = 0;
|
||||
static int NO_COPY recursed = 0;
|
||||
|
||||
if (debugging && ++debugging < 50000)
|
||||
if (debugging && ++debugging < 500000)
|
||||
{
|
||||
SetThreadPriority (hMainThread, THREAD_PRIORITY_NORMAL);
|
||||
return 0;
|
||||
|
@ -973,6 +973,7 @@ public:
|
||||
int close (void);
|
||||
int dup (fhandler_base * child);
|
||||
void dump (void);
|
||||
void fixup_after_exec (HANDLE);
|
||||
};
|
||||
|
||||
#if 0
|
||||
|
@ -28,7 +28,12 @@ static void CALLBACK wave_callback (HWAVE hWave, UINT msg, DWORD instance,
|
||||
class Audio
|
||||
{
|
||||
public:
|
||||
enum { MAX_BLOCKS = 12, BLOCK_SIZE = 16384 };
|
||||
enum
|
||||
{
|
||||
MAX_BLOCKS = 12,
|
||||
BLOCK_SIZE = 16384,
|
||||
TOT_BLOCK_SIZE = BLOCK_SIZE + sizeof (WAVEHDR)
|
||||
};
|
||||
|
||||
Audio ();
|
||||
~Audio ();
|
||||
@ -43,6 +48,8 @@ public:
|
||||
void setformat (int format) {formattype_ = format;}
|
||||
int numbytesoutput ();
|
||||
|
||||
void *operator new (size_t, void *p) {return p;}
|
||||
|
||||
private:
|
||||
char *initialisebuffer ();
|
||||
void waitforcallback ();
|
||||
@ -57,21 +64,17 @@ private:
|
||||
char *freeblocks_[MAX_BLOCKS];
|
||||
int formattype_;
|
||||
|
||||
char bigwavebuffer_[MAX_BLOCKS * BLOCK_SIZE];
|
||||
char bigwavebuffer_[MAX_BLOCKS * TOT_BLOCK_SIZE];
|
||||
};
|
||||
|
||||
static char audio_buf[sizeof (class Audio)];
|
||||
|
||||
Audio::Audio ()
|
||||
{
|
||||
int size = BLOCK_SIZE + sizeof (WAVEHDR);
|
||||
|
||||
InitializeCriticalSection (&lock_);
|
||||
memset (freeblocks_, 0, sizeof (freeblocks_));
|
||||
memset (bigwavebuffer_, 0, sizeof (bigwavebuffer_));
|
||||
for (int i = 0; i < MAX_BLOCKS; i++)
|
||||
{
|
||||
char *pBuffer = &bigwavebuffer_[i * size];
|
||||
memset (pBuffer, 0, size);
|
||||
freeblocks_[i] = pBuffer;
|
||||
}
|
||||
freeblocks_[i] = &bigwavebuffer_[i * TOT_BLOCK_SIZE];
|
||||
}
|
||||
|
||||
Audio::~Audio ()
|
||||
@ -436,7 +439,7 @@ fhandler_dev_dsp::open (const char *path, int flags, mode_t mode = 0)
|
||||
set_flags (flags);
|
||||
|
||||
if (!s_audio)
|
||||
s_audio = new Audio;
|
||||
s_audio = new (audio_buf) Audio;
|
||||
|
||||
// Work out initial sample format & frequency
|
||||
if (strcmp (path, "/dev/dsp") == 0L)
|
||||
@ -632,3 +635,10 @@ fhandler_dev_dsp::dump ()
|
||||
{
|
||||
paranoid_printf ("here, fhandler_dev_dsp");
|
||||
}
|
||||
|
||||
void
|
||||
fhandler_dev_dsp::fixup_after_exec (HANDLE)
|
||||
{
|
||||
/* FIXME: Is there a better way to do this? */
|
||||
s_audio = new (audio_buf) Audio;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user