[Scummvm-git-logs] scummvm master -> 906929338c2bd24d1763306f5b4b65e5d39e5e46
dreammaster
paulfgilbert at gmail.com
Thu Feb 20 02:30:08 UTC 2020
This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
906929338c ULTIMA8: Removing more unused code
Commit: 906929338c2bd24d1763306f5b4b65e5d39e5e46
https://github.com/scummvm/scummvm/commit/906929338c2bd24d1763306f5b4b65e5d39e5e46
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2020-02-19T18:28:42-08:00
Commit Message:
ULTIMA8: Removing more unused code
Changed paths:
R engines/ultima/ultima8/filesys/output_logger.cpp
R engines/ultima/ultima8/filesys/output_logger.h
engines/ultima/module.mk
diff --git a/engines/ultima/module.mk b/engines/ultima/module.mk
index 012f5a3..bc1679a 100644
--- a/engines/ultima/module.mk
+++ b/engines/ultima/module.mk
@@ -347,7 +347,6 @@ MODULE_OBJS := \
ultima8/filesys/data.o \
ultima8/filesys/file_system.o \
ultima8/filesys/flex_file.o \
- ultima8/filesys/output_logger.o \
ultima8/filesys/raw_archive.o \
ultima8/filesys/savegame.o \
ultima8/filesys/u8_save_file.o \
diff --git a/engines/ultima/ultima8/filesys/output_logger.cpp b/engines/ultima/ultima8/filesys/output_logger.cpp
deleted file mode 100644
index ba82a65..0000000
--- a/engines/ultima/ultima8/filesys/output_logger.cpp
+++ /dev/null
@@ -1,163 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "ultima/ultima8/misc/pent_include.h"
-#include "ultima/ultima8/filesys/output_logger.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-OutputLogger::OutputLogger(Common::WriteStream *file, const Std::string &filename) {
-#ifdef TODO
- // Get the underlying file descriptor for the FILE stream
- fd = _fileno(file);
-
- // Probably on windows and there is no stdout/stderr in Subsystem Windows
- if (fd < 0) {
- fileLog = freopen(filenameLog.c_str(), "w", file);
-#ifdef WIN32
- DWORD stdhandle = 0;
- if (fileLog == stdout)
- stdhandle = STD_OUTPUT_HANDLE;
- else if (fileLog == stderr)
- stdhandle = STD_ERROR_HANDLE;
- if (stdhandle)
- SetStdHandle(stdhandle, (HANDLE)_get_osfhandle(_fileno(fileLog)));
-#endif
- return;
- }
-
- // Create the pipe
- int fdsPipe[2];
- if (_pipe(fdsPipe, 256, _O_BINARY) != 0) {
- return;
- }
- fdPipeRead = fdsPipe[0];
- int fdPipeWrite = fdsPipe[1];
-
- // Make sure that buffering is turned off on the incoming file
- Std::setvbuf(file, NULL, _IONBF, 0);
-
- // Duplicate the fd and create new filestream for it
- fileOld = _fdopen(_dup(fd), "w");
- // If the file was stderr, make sure the new file doesn't have buffering
- if (fileOld && file == stderr) Std::setvbuf(fileOld, NULL, _IONBF, 0);
-
- // Create the output log file
- fileLog = Std::fopen(filenameLog.c_str(), "w");
-
- // Duplicate pipe write file descriptor and replace original
- _dup2(fdPipeWrite, fd);
-
- // Close the fd for the write end of the pipe
- _close(fdPipeWrite);
- fdPipeWrite = -1;
-
- // Create the thread
- pThread = SDL_CreateThread((int (SDLCALL *)(void *)) &OutputLogger::sThreadMain, this);
-#endif
-}
-
-OutputLogger::~OutputLogger(void) {
-#ifdef TODO
- // Replace fd with it's original details
- if (fileOld && fd >= 0) {
- _dup2(_fileno(fileOld), fd);
- fd = -1;
- }
-
- if (pThread) {
- // Wait for the thread to exit (the write handle is now invalid so it will have broken the pipe)
- SDL_WaitThread(pThread, NULL);
- pThread = NULL;
- }
-
- // Close the read end of the pipe, completely closing the pipe
- if (fdPipeRead >= 0) {
- _close(fdPipeRead);
- fdPipeRead = -1;
- }
-
- // Close the duplicated original file
- if (fileOld) {
- Std::fclose(fileOld);
- fileOld = NULL;
- }
-
- // Close the log file
- if (fileLog) {
-
- // In the event that we did a freopen on the handle remove the windows
- // output std handle
-#ifdef WIN32
- DWORD stdhandle = 0;
- if (fileLog == stdout)
- stdhandle = STD_OUTPUT_HANDLE;
- else if (fileLog == stderr)
- stdhandle = STD_ERROR_HANDLE;
- if (stdhandle)
- SetStdHandle(stdhandle, NULL);
-#endif
-
- // Get the size written to the log file
- int sizeLog = Std::ftell(fileLog);
-
- Std::fclose(fileLog);
- fileLog = NULL;
-
- // Delete the log file if it was empty
- if (!sizeLog) Std::remove(filenameLog.c_str());
- filenameLog = Std::string();
- }
-#endif
-}
-
-int OutputLogger::ThreadMain() {
-#ifdef TODO
- char buffer[4096];
- int numread;
-
- // Read from the pipe (till its broken)
- while ((numread = _read(fdPipeRead, buffer, 256)) > 0) {
- // Write to the duplicated original file stream
- if (fileOld) {
- fwrite(buffer, 1, numread, fileOld);
- if (fd == 1) {
- for (int i = 0; i < numread; i++) {
- if (buffer[i] == '\n') {
- fflush(fileOld);
- break;
- }
- }
- }
- }
- // And write to the log file
- if (fileLog) {
- fwrite(buffer, 1, numread, fileLog);
- }
- }
-#endif
- return 1;
-}
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
diff --git a/engines/ultima/ultima8/filesys/output_logger.h b/engines/ultima/ultima8/filesys/output_logger.h
deleted file mode 100644
index 9a982b2..0000000
--- a/engines/ultima/ultima8/filesys/output_logger.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ULTIMA8_FILESYS_OUTPUTLOGGER_H
-#define ULTIMA8_FILESYS_OUTPUTLOGGER_H
-
-#include "ultima/shared/std/string.h"
-#include "common/stream.h"
-
-namespace Ultima {
-namespace Ultima8 {
-
-//! Class that will duplicate output sent to FILE into another file
-class OutputLogger {
- int ThreadMain();
-public:
- OutputLogger(Common::WriteStream *file, const Std::string &filename);
- ~OutputLogger(void);
-};
-
-} // End of namespace Ultima8
-} // End of namespace Ultima
-
-#endif
More information about the Scummvm-git-logs
mailing list