- 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 March 13, 2006
- Fixed: ActorFlagSetOrReset() wasn't receiving the + or - character from - Fixed: ActorFlagSetOrReset() wasn't receiving the + or - character from
ParseActorProperties(). ParseActorProperties().

View file

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

View file

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

View file

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

View file

@ -948,7 +948,14 @@ void A_GiveInventory(AActor * self)
if (mi) if (mi)
{ {
AInventory *item = static_cast<AInventory *>(Spawn (mi, 0, 0, 0)); 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; item->flags |= MF_DROPPED;
if (item->flags & MF_COUNTITEM) if (item->flags & MF_COUNTITEM)
{ {

View file

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

View file

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