From 49eea1af58ca9b7c40be61730b3dfe2833471362 Mon Sep 17 00:00:00 2001 From: Peter Veenstra Date: Fri, 30 Jun 2006 20:04:21 +0000 Subject: [PATCH] Make valgrind happy and set a few strings to zero. Imported-from: https://svn.code.sf.net/p/dosbox/code-0/dosbox/trunk@2666 --- src/dos/dos_files.cpp | 10 +++++----- src/shell/shell.cpp | 6 +++--- src/shell/shell_batch.cpp | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/src/dos/dos_files.cpp b/src/dos/dos_files.cpp index 9d6d350a..8c3e6082 100644 --- a/src/dos/dos_files.cpp +++ b/src/dos/dos_files.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: dos_files.cpp,v 1.75 2006-06-22 13:15:07 qbix79 Exp $ */ +/* $Id: dos_files.cpp,v 1.76 2006-06-30 20:04:21 qbix79 Exp $ */ #include #include @@ -655,10 +655,10 @@ static bool isvalid(const char in){ Bit8u FCB_Parsename(Bit16u seg,Bit16u offset,Bit8u parser ,char *string, Bit8u *change) { char * string_begin=string;Bit8u ret=0; - DOS_FCB fcb(seg,offset); - bool hasdrive,hasname,hasext; - hasdrive=hasname=hasext=false; - Bitu index;bool finished;Bit8u fill; + DOS_FCB fcb(seg,offset); + bool hasdrive,hasname,hasext,finished; + hasdrive=hasname=hasext=finished=false; + Bitu index=0;Bit8u fill=' '; /* First get the old data from the fcb */ #ifdef _MSC_VER #pragma pack (1) diff --git a/src/shell/shell.cpp b/src/shell/shell.cpp index 3d4f1f6f..cdba628f 100644 --- a/src/shell/shell.cpp +++ b/src/shell/shell.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell.cpp,v 1.74 2006-05-25 15:08:40 qbix79 Exp $ */ +/* $Id: shell.cpp,v 1.75 2006-06-30 20:04:21 qbix79 Exp $ */ #include #include @@ -263,7 +263,7 @@ void DOS_Shell::ParseLine(char * line) { void DOS_Shell::RunInternal(void) { - char input_line[CMD_MAXLINE]; + char input_line[CMD_MAXLINE] = {0}; std::string line; while(bf && bf->ReadLine(input_line)) { @@ -281,7 +281,7 @@ void DOS_Shell::RunInternal(void) void DOS_Shell::Run(void) { - char input_line[CMD_MAXLINE]; + char input_line[CMD_MAXLINE] = {0}; std::string line; if (cmd->FindStringRemain("/C",line)) { strcpy(input_line,line.c_str()); diff --git a/src/shell/shell_batch.cpp b/src/shell/shell_batch.cpp index b151a7ab..e9ac29f2 100644 --- a/src/shell/shell_batch.cpp +++ b/src/shell/shell_batch.cpp @@ -16,7 +16,7 @@ * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -/* $Id: shell_batch.cpp,v 1.21 2006-05-25 15:08:40 qbix79 Exp $ */ +/* $Id: shell_batch.cpp,v 1.22 2006-06-30 20:04:21 qbix79 Exp $ */ #include #include @@ -43,7 +43,7 @@ BatchFile::~BatchFile() { } bool BatchFile::ReadLine(char * line) { - Bit8u c;Bit16u n; + Bit8u c=0;Bit16u n=1; char temp[CMD_MAXLINE]; emptyline: char * cmd_write=temp;