- Fixed: The strupr() implementation in w_wad.cpp relied on compiler-dependant

behavior.
- Fixed fix: ParseActorProperties() still wasn't sending + or - to
  ActorFlagSetOrReset().
- Fixed: [GZ] An item without use state won't be removed when being picked up.
  The call to GoAwayAndDie is missing.
- Fixed: [GZ]  A_GiveInventory sets the amount to give to a value passed to
  this function. This is ok for everything except Health items. They should
  give their original amount multiplied with the passed parameter.
- Fixed: Potential buffer overrun when launching timidity.


SVN r21 (trunk)
This commit is contained in:
Randy Heit 2006-04-09 19:34:35 +00:00
parent 09c28e5bf9
commit 16c085e146
7 changed files with 57 additions and 37 deletions

View file

@ -1,3 +1,17 @@
April 9, 2006
- Fixed: The strupr() implementation in w_wad.cpp relied on compiler-dependant
behavior.
- Fixed fix: ParseActorProperties() still wasn't sending + or - to
ActorFlagSetOrReset().
- Fixed: [GZ] An item without use state won't be removed when being picked up.
The call to GoAwayAndDie is missing.
- Fixed: [GZ] A_GiveInventory sets the amount to give to a value passed to
this function. This is ok for everything except Health items. They should
give their original amount multiplied with the passed parameter.
April 3, 2006
- Fixed: Potential buffer overrun when launching timidity.
March 13, 2006
- Fixed: ActorFlagSetOrReset() wasn't receiving the + or - character from
ParseActorProperties().

View file

@ -246,7 +246,7 @@ public:
void Play (bool looping);
void Stop ();
bool IsPlaying ();
bool IsValid () const { return CommandLine != NULL; }
bool IsValid () const { return CommandLine.Len() > 0; }
protected:
void PrepTimidity ();
@ -264,8 +264,8 @@ protected:
int WavePipe[2];
pid_t ChildProcess;
#endif
char *CommandLine;
int LoopPos;
string CommandLine;
size_t LoopPos;
static bool FillStream (SoundStream *stream, void *buff, int len, void *userdata);
#ifdef _WIN32

View file

@ -158,10 +158,6 @@ TimiditySong::~TimiditySong ()
WavePipe[0] = -1;
}
#endif
if (CommandLine != NULL)
{
delete[] CommandLine;
}
}
TimiditySong::TimiditySong (FILE *file, int len)
@ -170,11 +166,10 @@ TimiditySong::TimiditySong (FILE *file, int len)
ReadWavePipe (INVALID_HANDLE_VALUE), WriteWavePipe (INVALID_HANDLE_VALUE),
KillerEvent (INVALID_HANDLE_VALUE),
ChildProcess (INVALID_HANDLE_VALUE),
Validated (false),
Validated (false)
#else
ChildProcess (-1),
ChildProcess (-1)
#endif
CommandLine (NULL)
{
bool success;
FILE *f;
@ -225,8 +220,6 @@ TimiditySong::TimiditySong (FILE *file, int len)
void TimiditySong::PrepTimidity ()
{
char cmdline[512];
int cmdsize;
int pipeSize;
#ifdef _WIN32
static SECURITY_ATTRIBUTES inheritable = { sizeof(inheritable), NULL, TRUE };
@ -245,7 +238,7 @@ void TimiditySong::PrepTimidity ()
}
#endif // WIN32
cmdsize = sprintf (cmdline, "%s %s -EFchorus=%s -EFreverb=%s -s%d ",
CommandLine.Format ("%s %s -EFchorus=%s -EFreverb=%s -s%d ",
*timidity_exe, *timidity_extargs,
*timidity_chorus, *timidity_reverb, *timidity_frequency);
@ -301,27 +294,26 @@ void TimiditySong::PrepTimidity ()
}
else
{
cmdsize += sprintf (cmdline + cmdsize, "-o - -Ors");
CommandLine += "-o - -Ors";
}
}
if (pipeSize == 0)
{
cmdsize += sprintf (cmdline + cmdsize, "-Od");
CommandLine += "-Od";
}
cmdline[cmdsize++] = timidity_stereo ? 'S' : 'M';
cmdline[cmdsize++] = timidity_8bit ? '8' : '1';
CommandLine += timidity_stereo ? 'S' : 'M';
CommandLine += timidity_8bit ? '8' : '1';
if (timidity_byteswap)
{
cmdline[cmdsize++] = 'x';
CommandLine += 'x';
}
LoopPos = cmdsize + 4;
LoopPos = CommandLine.Len() + 4;
sprintf (cmdline + cmdsize, " -idl %s", DiskName.GetName ());
CommandLine = copystring (cmdline);
CommandLine += " -idl ";
CommandLine += DiskName.GetName();
}
#ifdef _WIN32
@ -415,7 +407,7 @@ bool TimiditySong::ValidateTimidity ()
bool TimiditySong::LaunchTimidity ()
{
if (CommandLine == NULL)
if (CommandLine.Len() == 0)
{
return false;
}
@ -438,7 +430,7 @@ bool TimiditySong::LaunchTimidity ()
startup.lpTitle = "TiMidity (ZDoom Launched)";
startup.wShowWindow = SW_SHOWMINNOACTIVE;
if (CreateProcess (NULL, CommandLine, NULL, NULL, TRUE,
if (CreateProcess (NULL, CommandLine.GetChars(), NULL, NULL, TRUE,
/*HIGH_PRIORITY_CLASS|*/DETACHED_PROCESS, NULL, NULL, &startup, &procInfo))
{
ChildProcess = procInfo.hProcess;
@ -461,7 +453,7 @@ bool TimiditySong::LaunchTimidity ()
}
Printf (PRINT_BOLD, "Could not run timidity with the command line:\n%s\n"
"Reason: %s\n", CommandLine, msgBuf);
"Reason: %s\n", CommandLine.GetChars(), msgBuf);
if (msgBuf != hres)
{
LocalFree (msgBuf);
@ -484,7 +476,7 @@ bool TimiditySong::LaunchTimidity ()
int forkres;
wordexp_t words;
switch (wordexp (CommandLine, &words, 0))
switch (wordexp (CommandLine.GetChars(), &words, 0))
{
case 0: // all good
break;

View file

@ -1947,16 +1947,19 @@ void ParseActorProperties (Baggage &bag)
string propname = sc_String;
if (SC_CheckString ("."))
if (sc_String[0] != '-' && sc_String[1] != '+')
{
SC_MustGetString ();
propname += '.';
strlwr (sc_String);
propname += sc_String;
}
else if (sc_String[0] != '-' && sc_String[1] != '+')
{
SC_UnGet ();
if (SC_CheckString ("."))
{
SC_MustGetString ();
propname += '.';
strlwr (sc_String);
propname += sc_String;
}
else
{
SC_UnGet ();
}
}
prop = is_actorprop (propname.GetChars());

View file

@ -948,7 +948,14 @@ void A_GiveInventory(AActor * self)
if (mi)
{
AInventory *item = static_cast<AInventory *>(Spawn (mi, 0, 0, 0));
item->Amount = amount;
if (item->IsKindOf(RUNTIME_CLASS(AHealth)))
{
item->Amount *= amount;
}
else
{
item->Amount = amount;
}
item->flags |= MF_DROPPED;
if (item->flags & MF_COUNTITEM)
{

View file

@ -125,7 +125,10 @@ FWadCollection Wads;
void strupr (char *s)
{
while (*s)
*s++ = toupper (*s);
{
*s = toupper (*s);
s++;
}
}
#endif

View file

@ -30,6 +30,7 @@ public:
char *GetChars() const { return Chars; }
char &operator[] (int index) { return Chars[index]; }
char &operator[] (size_t index) { return Chars[index]; }
string &operator = (const string &other);
string &operator = (const char *copyStr);