1
0
Fork 0

Fix unsafe memory operations and warnings in the fatDrive class

- Move imageDiskList from pointer to vector of unique_ptr
- Replace string operations with size-limited versions
- Initialize members
- Eliminate unecessary casts
- Eliminate memory-leak on pointer assignment
This commit is contained in:
krcroft 2019-12-07 11:55:38 -08:00 committed by Patryk Obara
parent e942a02fcb
commit c9198b2944
11 changed files with 219 additions and 131 deletions

View file

@ -45,6 +45,8 @@ extern DOS_Shell * first_shell;
class BatchFile {
public:
BatchFile(DOS_Shell * host,char const* const resolved_name,char const* const entered_name, char const * const cmd_line);
BatchFile(const BatchFile&) = delete; // prevent copying
BatchFile& operator=(const BatchFile&) = delete; // prevent assignment
virtual ~BatchFile();
virtual bool ReadLine(char * line);
bool Goto(char * where);
@ -70,7 +72,8 @@ private:
public:
DOS_Shell();
DOS_Shell(const DOS_Shell&) = delete; // prevent copy
DOS_Shell& operator=(const DOS_Shell&) = delete; // prevent assignment
void Run(void);
void RunInternal(void); //for command /C
/* A load of subfunctions */
@ -136,7 +139,10 @@ private:
bool installed;
std::string buf;
public:
AutoexecObject():installed(false){ };
AutoexecObject()
: installed(false),
buf("")
{}
void Install(std::string const &in);
void InstallBefore(std::string const &in);
~AutoexecObject();