From 6dcc195a5ef69ac95e5e4ebb33203dbcbbf2cee2 Mon Sep 17 00:00:00 2001 From: koldo Date: Fri, 23 Oct 2020 09:18:04 +0000 Subject: [PATCH] *Functions4U: Fixed null params in LaunchFile git-svn-id: svn://ultimatepp.org/upp/trunk@15296 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- bazaar/Functions4U/Functions4U.cpp | 14 ++++---- bazaar/Functions4U/Functions4U.h | 53 ++---------------------------- 2 files changed, 11 insertions(+), 56 deletions(-) diff --git a/bazaar/Functions4U/Functions4U.cpp b/bazaar/Functions4U/Functions4U.cpp index 344cb65d4..6d59a183e 100644 --- a/bazaar/Functions4U/Functions4U.cpp +++ b/bazaar/Functions4U/Functions4U.cpp @@ -123,7 +123,7 @@ String GetDesktopManagerNew() { bool LaunchFile(const char *_file, const char *_params, const char *) { String file = UnixPath(_file); - String params = UnixPath(_params); + String params = _params == nullptr ? "" : UnixPath(_params); int ret; if (GetDesktopManagerNew() == "gnome") ret = system("gnome-open \"" + file + "\" " + params); @@ -2823,11 +2823,11 @@ bool SetConsoleColor(CONSOLE_COLOR color) { if (hstdout == 0) { hstdout = GetStdHandle(STD_OUTPUT_HANDLE); - if (!GetConsoleScreenBufferInfo(hstdout, &csbiInfo)) { - hstdout = 0; - return false; - } - woldattrs = csbiInfo.wAttributes; + //if (!GetConsoleScreenBufferInfo(hstdout, &csbiInfo)) { + // hstdout = 0; + // return false; + //} + woldattrs = FOREGROUND_BLUE | FOREGROUND_GREEN | FOREGROUND_RED; //csbiInfo.wAttributes; } if (color == RESET) return SetConsoleTextAttribute(hstdout, woldattrs); @@ -2869,4 +2869,6 @@ void ConsoleOutputDisable(bool disable) { #endif } + + } \ No newline at end of file diff --git a/bazaar/Functions4U/Functions4U.h b/bazaar/Functions4U/Functions4U.h index 9443da55d..62d6c8282 100644 --- a/bazaar/Functions4U/Functions4U.h +++ b/bazaar/Functions4U/Functions4U.h @@ -24,7 +24,7 @@ enum EXT_FILE_FLAGS {NO_FLAG = 0, String GetDesktopManagerNew(); -bool LaunchFile(const char *file, const char *params = 0, const char *directory = "."); +bool LaunchFile(const char *file, const char *params = nullptr, const char *directory = "."); bool FileCat(const char *file, const char *appendFile); @@ -630,54 +630,7 @@ struct TempAssign { /* Replaced with std::atomic template class ThreadSafe { -public: - inline ThreadSafe() {val = Null;} - inline ThreadSafe(T v) {operator=(v);} - inline void operator=(T v) { - mutex.Enter(); - val = v; - mutex.Leave(); - } - inline void operator+=(T v) { - mutex.Enter(); - val += v; - mutex.Leave(); - } - inline void operator-=(T v) { - mutex.Enter(); - val -= v; - mutex.Leave(); - } - inline operator T() { - T ret; - mutex.Enter(); - ret = val; - mutex.Leave(); - return ret; - } - Value GetData() { - Value ret; - mutex.Enter(); - ret = val; - mutex.Leave(); - return ret; - } - Value operator~() const {return GetData();} - inline ThreadSafe& operator++() { - mutex.Enter(); - val++; - mutex.Leave(); - return *this; - } - inline ThreadSafe operator++(int) { - ThreadSafe tmp = *this; - ++*this; - return tmp; - } - -private: - Mutex mutex; - T val; +... };*/ template @@ -1238,7 +1191,7 @@ enum CONSOLE_COLOR { bool SetConsoleColor(CONSOLE_COLOR color); void ConsoleOutputDisable(bool disable); - + } #endif