diff options
| -rw-r--r-- | externals/CMakeLists.txt | 25 | ||||
| m--------- | externals/libressl | 0 | ||||
| -rw-r--r-- | externals/lurlparser/CMakeLists.txt | 8 | ||||
| -rw-r--r-- | externals/lurlparser/LUrlParser.cpp | 265 | ||||
| -rw-r--r-- | externals/lurlparser/LUrlParser.h | 78 | ||||
| -rw-r--r-- | externals/lurlparser/README.md | 19 | ||||
| -rw-r--r-- | src/tests/common/fibers.cpp | 71 | ||||
| -rw-r--r-- | src/video_core/CMakeLists.txt | 3 | ||||
| -rw-r--r-- | src/video_core/command_classes/codecs/vp9.cpp | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/gl_shader_disk_cache.cpp | 3 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/wrapper.cpp | 2 | ||||
| -rw-r--r-- | src/web_service/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/web_service/web_backend.cpp | 20 |
13 files changed, 63 insertions, 437 deletions
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index e01ff6930..421b35890 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt | |||
| @@ -73,17 +73,20 @@ if (NOT LIBZIP_FOUND) | |||
| 73 | endif() | 73 | endif() |
| 74 | 74 | ||
| 75 | if (ENABLE_WEB_SERVICE) | 75 | if (ENABLE_WEB_SERVICE) |
| 76 | # LibreSSL | 76 | find_package(OpenSSL 1.1) |
| 77 | set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "") | 77 | if (OPENSSL_FOUND) |
| 78 | add_subdirectory(libressl EXCLUDE_FROM_ALL) | 78 | set(OPENSSL_LIBRARIES OpenSSL::SSL OpenSSL::Crypto) |
| 79 | target_include_directories(ssl INTERFACE ./libressl/include) | 79 | else() |
| 80 | target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP) | 80 | # LibreSSL |
| 81 | get_directory_property(OPENSSL_LIBRARIES | 81 | set(LIBRESSL_SKIP_INSTALL ON CACHE BOOL "") |
| 82 | DIRECTORY libressl | 82 | set(OPENSSLDIR "/etc/ssl/") |
| 83 | DEFINITION OPENSSL_LIBS) | 83 | add_subdirectory(libressl EXCLUDE_FROM_ALL) |
| 84 | 84 | target_include_directories(ssl INTERFACE ./libressl/include) | |
| 85 | # lurlparser | 85 | target_compile_definitions(ssl PRIVATE -DHAVE_INET_NTOP) |
| 86 | add_subdirectory(lurlparser EXCLUDE_FROM_ALL) | 86 | get_directory_property(OPENSSL_LIBRARIES |
| 87 | DIRECTORY libressl | ||
| 88 | DEFINITION OPENSSL_LIBS) | ||
| 89 | endif() | ||
| 87 | 90 | ||
| 88 | # httplib | 91 | # httplib |
| 89 | add_library(httplib INTERFACE) | 92 | add_library(httplib INTERFACE) |
diff --git a/externals/libressl b/externals/libressl | |||
| Subproject 7d01cb01cb1a926ecb4c9c98b107ef3c26f59df | Subproject 8289d0d07de6553bf4b900bf60e808ea3f7f59d | ||
diff --git a/externals/lurlparser/CMakeLists.txt b/externals/lurlparser/CMakeLists.txt deleted file mode 100644 index 45046ffd3..000000000 --- a/externals/lurlparser/CMakeLists.txt +++ /dev/null | |||
| @@ -1,8 +0,0 @@ | |||
| 1 | add_library(lurlparser | ||
| 2 | LUrlParser.cpp | ||
| 3 | LUrlParser.h | ||
| 4 | ) | ||
| 5 | |||
| 6 | create_target_directory_groups(lurlparser) | ||
| 7 | |||
| 8 | target_include_directories(lurlparser INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}) | ||
diff --git a/externals/lurlparser/LUrlParser.cpp b/externals/lurlparser/LUrlParser.cpp deleted file mode 100644 index 9c134e330..000000000 --- a/externals/lurlparser/LUrlParser.cpp +++ /dev/null | |||
| @@ -1,265 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Lightweight URL & URI parser (RFC 1738, RFC 3986) | ||
| 3 | * https://github.com/corporateshark/LUrlParser | ||
| 4 | * | ||
| 5 | * The MIT License (MIT) | ||
| 6 | * | ||
| 7 | * Copyright (C) 2015 Sergey Kosarevsky (sk@linderdaum.com) | ||
| 8 | * | ||
| 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 10 | * of this software and associated documentation files (the "Software"), to deal | ||
| 11 | * in the Software without restriction, including without limitation the rights | ||
| 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 13 | * copies of the Software, and to permit persons to whom the Software is | ||
| 14 | * furnished to do so, subject to the following conditions: | ||
| 15 | * | ||
| 16 | * The above copyright notice and this permission notice shall be included in all | ||
| 17 | * copies or substantial portions of the Software. | ||
| 18 | * | ||
| 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 25 | * SOFTWARE. | ||
| 26 | */ | ||
| 27 | |||
| 28 | #include "LUrlParser.h" | ||
| 29 | |||
| 30 | #include <algorithm> | ||
| 31 | #include <cstring> | ||
| 32 | #include <stdlib.h> | ||
| 33 | |||
| 34 | // check if the scheme name is valid | ||
| 35 | static bool IsSchemeValid( const std::string& SchemeName ) | ||
| 36 | { | ||
| 37 | for ( auto c : SchemeName ) | ||
| 38 | { | ||
| 39 | if ( !isalpha( c ) && c != '+' && c != '-' && c != '.' ) return false; | ||
| 40 | } | ||
| 41 | |||
| 42 | return true; | ||
| 43 | } | ||
| 44 | |||
| 45 | bool LUrlParser::clParseURL::GetPort( int* OutPort ) const | ||
| 46 | { | ||
| 47 | if ( !IsValid() ) { return false; } | ||
| 48 | |||
| 49 | int Port = atoi( m_Port.c_str() ); | ||
| 50 | |||
| 51 | if ( Port <= 0 || Port > 65535 ) { return false; } | ||
| 52 | |||
| 53 | if ( OutPort ) { *OutPort = Port; } | ||
| 54 | |||
| 55 | return true; | ||
| 56 | } | ||
| 57 | |||
| 58 | // based on RFC 1738 and RFC 3986 | ||
| 59 | LUrlParser::clParseURL LUrlParser::clParseURL::ParseURL( const std::string& URL ) | ||
| 60 | { | ||
| 61 | LUrlParser::clParseURL Result; | ||
| 62 | |||
| 63 | const char* CurrentString = URL.c_str(); | ||
| 64 | |||
| 65 | /* | ||
| 66 | * <scheme>:<scheme-specific-part> | ||
| 67 | * <scheme> := [a-z\+\-\.]+ | ||
| 68 | * For resiliency, programs interpreting URLs should treat upper case letters as equivalent to lower case in scheme names | ||
| 69 | */ | ||
| 70 | |||
| 71 | // try to read scheme | ||
| 72 | { | ||
| 73 | const char* LocalString = strchr( CurrentString, ':' ); | ||
| 74 | |||
| 75 | if ( !LocalString ) | ||
| 76 | { | ||
| 77 | return clParseURL( LUrlParserError_NoUrlCharacter ); | ||
| 78 | } | ||
| 79 | |||
| 80 | // save the scheme name | ||
| 81 | Result.m_Scheme = std::string( CurrentString, LocalString - CurrentString ); | ||
| 82 | |||
| 83 | if ( !IsSchemeValid( Result.m_Scheme ) ) | ||
| 84 | { | ||
| 85 | return clParseURL( LUrlParserError_InvalidSchemeName ); | ||
| 86 | } | ||
| 87 | |||
| 88 | // scheme should be lowercase | ||
| 89 | std::transform( Result.m_Scheme.begin(), Result.m_Scheme.end(), Result.m_Scheme.begin(), ::tolower ); | ||
| 90 | |||
| 91 | // skip ':' | ||
| 92 | CurrentString = LocalString+1; | ||
| 93 | } | ||
| 94 | |||
| 95 | /* | ||
| 96 | * //<user>:<password>@<host>:<port>/<url-path> | ||
| 97 | * any ":", "@" and "/" must be normalized | ||
| 98 | */ | ||
| 99 | |||
| 100 | // skip "//" | ||
| 101 | if ( *CurrentString++ != '/' ) return clParseURL( LUrlParserError_NoDoubleSlash ); | ||
| 102 | if ( *CurrentString++ != '/' ) return clParseURL( LUrlParserError_NoDoubleSlash ); | ||
| 103 | |||
| 104 | // check if the user name and password are specified | ||
| 105 | bool bHasUserName = false; | ||
| 106 | |||
| 107 | const char* LocalString = CurrentString; | ||
| 108 | |||
| 109 | while ( *LocalString ) | ||
| 110 | { | ||
| 111 | if ( *LocalString == '@' ) | ||
| 112 | { | ||
| 113 | // user name and password are specified | ||
| 114 | bHasUserName = true; | ||
| 115 | break; | ||
| 116 | } | ||
| 117 | else if ( *LocalString == '/' ) | ||
| 118 | { | ||
| 119 | // end of <host>:<port> specification | ||
| 120 | bHasUserName = false; | ||
| 121 | break; | ||
| 122 | } | ||
| 123 | |||
| 124 | LocalString++; | ||
| 125 | } | ||
| 126 | |||
| 127 | // user name and password | ||
| 128 | LocalString = CurrentString; | ||
| 129 | |||
| 130 | if ( bHasUserName ) | ||
| 131 | { | ||
| 132 | // read user name | ||
| 133 | while ( *LocalString && *LocalString != ':' && *LocalString != '@' ) LocalString++; | ||
| 134 | |||
| 135 | Result.m_UserName = std::string( CurrentString, LocalString - CurrentString ); | ||
| 136 | |||
| 137 | // proceed with the current pointer | ||
| 138 | CurrentString = LocalString; | ||
| 139 | |||
| 140 | if ( *CurrentString == ':' ) | ||
| 141 | { | ||
| 142 | // skip ':' | ||
| 143 | CurrentString++; | ||
| 144 | |||
| 145 | // read password | ||
| 146 | LocalString = CurrentString; | ||
| 147 | |||
| 148 | while ( *LocalString && *LocalString != '@' ) LocalString++; | ||
| 149 | |||
| 150 | Result.m_Password = std::string( CurrentString, LocalString - CurrentString ); | ||
| 151 | |||
| 152 | CurrentString = LocalString; | ||
| 153 | } | ||
| 154 | |||
| 155 | // skip '@' | ||
| 156 | if ( *CurrentString != '@' ) | ||
| 157 | { | ||
| 158 | return clParseURL( LUrlParserError_NoAtSign ); | ||
| 159 | } | ||
| 160 | |||
| 161 | CurrentString++; | ||
| 162 | } | ||
| 163 | |||
| 164 | bool bHasBracket = ( *CurrentString == '[' ); | ||
| 165 | |||
| 166 | // go ahead, read the host name | ||
| 167 | LocalString = CurrentString; | ||
| 168 | |||
| 169 | while ( *LocalString ) | ||
| 170 | { | ||
| 171 | if ( bHasBracket && *LocalString == ']' ) | ||
| 172 | { | ||
| 173 | // end of IPv6 address | ||
| 174 | LocalString++; | ||
| 175 | break; | ||
| 176 | } | ||
| 177 | else if ( !bHasBracket && ( *LocalString == ':' || *LocalString == '/' ) ) | ||
| 178 | { | ||
| 179 | // port number is specified | ||
| 180 | break; | ||
| 181 | } | ||
| 182 | |||
| 183 | LocalString++; | ||
| 184 | } | ||
| 185 | |||
| 186 | Result.m_Host = std::string( CurrentString, LocalString - CurrentString ); | ||
| 187 | |||
| 188 | CurrentString = LocalString; | ||
| 189 | |||
| 190 | // is port number specified? | ||
| 191 | if ( *CurrentString == ':' ) | ||
| 192 | { | ||
| 193 | CurrentString++; | ||
| 194 | |||
| 195 | // read port number | ||
| 196 | LocalString = CurrentString; | ||
| 197 | |||
| 198 | while ( *LocalString && *LocalString != '/' ) LocalString++; | ||
| 199 | |||
| 200 | Result.m_Port = std::string( CurrentString, LocalString - CurrentString ); | ||
| 201 | |||
| 202 | CurrentString = LocalString; | ||
| 203 | } | ||
| 204 | |||
| 205 | // end of string | ||
| 206 | if ( !*CurrentString ) | ||
| 207 | { | ||
| 208 | Result.m_ErrorCode = LUrlParserError_Ok; | ||
| 209 | |||
| 210 | return Result; | ||
| 211 | } | ||
| 212 | |||
| 213 | // skip '/' | ||
| 214 | if ( *CurrentString != '/' ) | ||
| 215 | { | ||
| 216 | return clParseURL( LUrlParserError_NoSlash ); | ||
| 217 | } | ||
| 218 | |||
| 219 | CurrentString++; | ||
| 220 | |||
| 221 | // parse the path | ||
| 222 | LocalString = CurrentString; | ||
| 223 | |||
| 224 | while ( *LocalString && *LocalString != '#' && *LocalString != '?' ) LocalString++; | ||
| 225 | |||
| 226 | Result.m_Path = std::string( CurrentString, LocalString - CurrentString ); | ||
| 227 | |||
| 228 | CurrentString = LocalString; | ||
| 229 | |||
| 230 | // check for query | ||
| 231 | if ( *CurrentString == '?' ) | ||
| 232 | { | ||
| 233 | // skip '?' | ||
| 234 | CurrentString++; | ||
| 235 | |||
| 236 | // read query | ||
| 237 | LocalString = CurrentString; | ||
| 238 | |||
| 239 | while ( *LocalString && *LocalString != '#' ) LocalString++; | ||
| 240 | |||
| 241 | Result.m_Query = std::string( CurrentString, LocalString - CurrentString ); | ||
| 242 | |||
| 243 | CurrentString = LocalString; | ||
| 244 | } | ||
| 245 | |||
| 246 | // check for fragment | ||
| 247 | if ( *CurrentString == '#' ) | ||
| 248 | { | ||
| 249 | // skip '#' | ||
| 250 | CurrentString++; | ||
| 251 | |||
| 252 | // read fragment | ||
| 253 | LocalString = CurrentString; | ||
| 254 | |||
| 255 | while ( *LocalString ) LocalString++; | ||
| 256 | |||
| 257 | Result.m_Fragment = std::string( CurrentString, LocalString - CurrentString ); | ||
| 258 | |||
| 259 | CurrentString = LocalString; | ||
| 260 | } | ||
| 261 | |||
| 262 | Result.m_ErrorCode = LUrlParserError_Ok; | ||
| 263 | |||
| 264 | return Result; | ||
| 265 | } | ||
diff --git a/externals/lurlparser/LUrlParser.h b/externals/lurlparser/LUrlParser.h deleted file mode 100644 index 25d210981..000000000 --- a/externals/lurlparser/LUrlParser.h +++ /dev/null | |||
| @@ -1,78 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Lightweight URL & URI parser (RFC 1738, RFC 3986) | ||
| 3 | * https://github.com/corporateshark/LUrlParser | ||
| 4 | * | ||
| 5 | * The MIT License (MIT) | ||
| 6 | * | ||
| 7 | * Copyright (C) 2015 Sergey Kosarevsky (sk@linderdaum.com) | ||
| 8 | * | ||
| 9 | * Permission is hereby granted, free of charge, to any person obtaining a copy | ||
| 10 | * of this software and associated documentation files (the "Software"), to deal | ||
| 11 | * in the Software without restriction, including without limitation the rights | ||
| 12 | * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
| 13 | * copies of the Software, and to permit persons to whom the Software is | ||
| 14 | * furnished to do so, subject to the following conditions: | ||
| 15 | * | ||
| 16 | * The above copyright notice and this permission notice shall be included in all | ||
| 17 | * copies or substantial portions of the Software. | ||
| 18 | * | ||
| 19 | * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
| 20 | * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
| 21 | * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
| 22 | * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
| 23 | * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
| 24 | * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
| 25 | * SOFTWARE. | ||
| 26 | */ | ||
| 27 | |||
| 28 | #pragma once | ||
| 29 | |||
| 30 | #include <string> | ||
| 31 | |||
| 32 | namespace LUrlParser | ||
| 33 | { | ||
| 34 | enum LUrlParserError | ||
| 35 | { | ||
| 36 | LUrlParserError_Ok = 0, | ||
| 37 | LUrlParserError_Uninitialized = 1, | ||
| 38 | LUrlParserError_NoUrlCharacter = 2, | ||
| 39 | LUrlParserError_InvalidSchemeName = 3, | ||
| 40 | LUrlParserError_NoDoubleSlash = 4, | ||
| 41 | LUrlParserError_NoAtSign = 5, | ||
| 42 | LUrlParserError_UnexpectedEndOfLine = 6, | ||
| 43 | LUrlParserError_NoSlash = 7, | ||
| 44 | }; | ||
| 45 | |||
| 46 | class clParseURL | ||
| 47 | { | ||
| 48 | public: | ||
| 49 | LUrlParserError m_ErrorCode; | ||
| 50 | std::string m_Scheme; | ||
| 51 | std::string m_Host; | ||
| 52 | std::string m_Port; | ||
| 53 | std::string m_Path; | ||
| 54 | std::string m_Query; | ||
| 55 | std::string m_Fragment; | ||
| 56 | std::string m_UserName; | ||
| 57 | std::string m_Password; | ||
| 58 | |||
| 59 | clParseURL() | ||
| 60 | : m_ErrorCode( LUrlParserError_Uninitialized ) | ||
| 61 | {} | ||
| 62 | |||
| 63 | /// return 'true' if the parsing was successful | ||
| 64 | bool IsValid() const { return m_ErrorCode == LUrlParserError_Ok; } | ||
| 65 | |||
| 66 | /// helper to convert the port number to int, return 'true' if the port is valid (within the 0..65535 range) | ||
| 67 | bool GetPort( int* OutPort ) const; | ||
| 68 | |||
| 69 | /// parse the URL | ||
| 70 | static clParseURL ParseURL( const std::string& URL ); | ||
| 71 | |||
| 72 | private: | ||
| 73 | explicit clParseURL( LUrlParserError ErrorCode ) | ||
| 74 | : m_ErrorCode( ErrorCode ) | ||
| 75 | {} | ||
| 76 | }; | ||
| 77 | |||
| 78 | } // namespace LUrlParser | ||
diff --git a/externals/lurlparser/README.md b/externals/lurlparser/README.md deleted file mode 100644 index be7f0135a..000000000 --- a/externals/lurlparser/README.md +++ /dev/null | |||
| @@ -1,19 +0,0 @@ | |||
| 1 | From https://github.com/corporateshark/LUrlParser/commit/455d5e2d27e3946f11ad0328fee9ee2628e6a8e2 | ||
| 2 | |||
| 3 | MIT License | ||
| 4 | |||
| 5 | === | ||
| 6 | |||
| 7 | Lightweight URL & URI parser (RFC 1738, RFC 3986) | ||
| 8 | |||
| 9 | (C) Sergey Kosarevsky, 2015 | ||
| 10 | |||
| 11 | @corporateshark sk@linderdaum.com | ||
| 12 | |||
| 13 | http://www.linderdaum.com | ||
| 14 | |||
| 15 | http://blog.linderdaum.com | ||
| 16 | |||
| 17 | ============================= | ||
| 18 | |||
| 19 | A tiny and lightweight URL & URI parser (RFC 1738, RFC 3986) written in C++. | ||
diff --git a/src/tests/common/fibers.cpp b/src/tests/common/fibers.cpp index 4fd92428f..4757dd2b4 100644 --- a/src/tests/common/fibers.cpp +++ b/src/tests/common/fibers.cpp | |||
| @@ -6,18 +6,40 @@ | |||
| 6 | #include <cstdlib> | 6 | #include <cstdlib> |
| 7 | #include <functional> | 7 | #include <functional> |
| 8 | #include <memory> | 8 | #include <memory> |
| 9 | #include <mutex> | ||
| 10 | #include <stdexcept> | ||
| 9 | #include <thread> | 11 | #include <thread> |
| 10 | #include <unordered_map> | 12 | #include <unordered_map> |
| 11 | #include <vector> | 13 | #include <vector> |
| 12 | 14 | ||
| 13 | #include <catch2/catch.hpp> | 15 | #include <catch2/catch.hpp> |
| 14 | #include <math.h> | 16 | |
| 15 | #include "common/common_types.h" | 17 | #include "common/common_types.h" |
| 16 | #include "common/fiber.h" | 18 | #include "common/fiber.h" |
| 17 | #include "common/spin_lock.h" | ||
| 18 | 19 | ||
| 19 | namespace Common { | 20 | namespace Common { |
| 20 | 21 | ||
| 22 | class ThreadIds { | ||
| 23 | public: | ||
| 24 | void Register(u32 id) { | ||
| 25 | const auto thread_id = std::this_thread::get_id(); | ||
| 26 | std::scoped_lock lock{mutex}; | ||
| 27 | if (ids.contains(thread_id)) { | ||
| 28 | throw std::logic_error{"Registering the same thread twice"}; | ||
| 29 | } | ||
| 30 | ids.emplace(thread_id, id); | ||
| 31 | } | ||
| 32 | |||
| 33 | [[nodiscard]] u32 Get() const { | ||
| 34 | std::scoped_lock lock{mutex}; | ||
| 35 | return ids.at(std::this_thread::get_id()); | ||
| 36 | } | ||
| 37 | |||
| 38 | private: | ||
| 39 | mutable std::mutex mutex; | ||
| 40 | std::unordered_map<std::thread::id, u32> ids; | ||
| 41 | }; | ||
| 42 | |||
| 21 | class TestControl1 { | 43 | class TestControl1 { |
| 22 | public: | 44 | public: |
| 23 | TestControl1() = default; | 45 | TestControl1() = default; |
| @@ -26,7 +48,7 @@ public: | |||
| 26 | 48 | ||
| 27 | void ExecuteThread(u32 id); | 49 | void ExecuteThread(u32 id); |
| 28 | 50 | ||
| 29 | std::unordered_map<std::thread::id, u32> ids; | 51 | ThreadIds thread_ids; |
| 30 | std::vector<std::shared_ptr<Common::Fiber>> thread_fibers; | 52 | std::vector<std::shared_ptr<Common::Fiber>> thread_fibers; |
| 31 | std::vector<std::shared_ptr<Common::Fiber>> work_fibers; | 53 | std::vector<std::shared_ptr<Common::Fiber>> work_fibers; |
| 32 | std::vector<u32> items; | 54 | std::vector<u32> items; |
| @@ -39,8 +61,7 @@ static void WorkControl1(void* control) { | |||
| 39 | } | 61 | } |
| 40 | 62 | ||
| 41 | void TestControl1::DoWork() { | 63 | void TestControl1::DoWork() { |
| 42 | std::thread::id this_id = std::this_thread::get_id(); | 64 | const u32 id = thread_ids.Get(); |
| 43 | u32 id = ids[this_id]; | ||
| 44 | u32 value = items[id]; | 65 | u32 value = items[id]; |
| 45 | for (u32 i = 0; i < id; i++) { | 66 | for (u32 i = 0; i < id; i++) { |
| 46 | value++; | 67 | value++; |
| @@ -50,8 +71,7 @@ void TestControl1::DoWork() { | |||
| 50 | } | 71 | } |
| 51 | 72 | ||
| 52 | void TestControl1::ExecuteThread(u32 id) { | 73 | void TestControl1::ExecuteThread(u32 id) { |
| 53 | std::thread::id this_id = std::this_thread::get_id(); | 74 | thread_ids.Register(id); |
| 54 | ids[this_id] = id; | ||
| 55 | auto thread_fiber = Fiber::ThreadToFiber(); | 75 | auto thread_fiber = Fiber::ThreadToFiber(); |
| 56 | thread_fibers[id] = thread_fiber; | 76 | thread_fibers[id] = thread_fiber; |
| 57 | work_fibers[id] = std::make_shared<Fiber>(std::function<void(void*)>{WorkControl1}, this); | 77 | work_fibers[id] = std::make_shared<Fiber>(std::function<void(void*)>{WorkControl1}, this); |
| @@ -98,8 +118,7 @@ public: | |||
| 98 | value1 += i; | 118 | value1 += i; |
| 99 | } | 119 | } |
| 100 | Fiber::YieldTo(fiber1, fiber3); | 120 | Fiber::YieldTo(fiber1, fiber3); |
| 101 | std::thread::id this_id = std::this_thread::get_id(); | 121 | const u32 id = thread_ids.Get(); |
| 102 | u32 id = ids[this_id]; | ||
| 103 | assert1 = id == 1; | 122 | assert1 = id == 1; |
| 104 | value2 += 5000; | 123 | value2 += 5000; |
| 105 | Fiber::YieldTo(fiber1, thread_fibers[id]); | 124 | Fiber::YieldTo(fiber1, thread_fibers[id]); |
| @@ -115,8 +134,7 @@ public: | |||
| 115 | } | 134 | } |
| 116 | 135 | ||
| 117 | void DoWork3() { | 136 | void DoWork3() { |
| 118 | std::thread::id this_id = std::this_thread::get_id(); | 137 | const u32 id = thread_ids.Get(); |
| 119 | u32 id = ids[this_id]; | ||
| 120 | assert2 = id == 0; | 138 | assert2 = id == 0; |
| 121 | value1 += 1000; | 139 | value1 += 1000; |
| 122 | Fiber::YieldTo(fiber3, thread_fibers[id]); | 140 | Fiber::YieldTo(fiber3, thread_fibers[id]); |
| @@ -125,14 +143,12 @@ public: | |||
| 125 | void ExecuteThread(u32 id); | 143 | void ExecuteThread(u32 id); |
| 126 | 144 | ||
| 127 | void CallFiber1() { | 145 | void CallFiber1() { |
| 128 | std::thread::id this_id = std::this_thread::get_id(); | 146 | const u32 id = thread_ids.Get(); |
| 129 | u32 id = ids[this_id]; | ||
| 130 | Fiber::YieldTo(thread_fibers[id], fiber1); | 147 | Fiber::YieldTo(thread_fibers[id], fiber1); |
| 131 | } | 148 | } |
| 132 | 149 | ||
| 133 | void CallFiber2() { | 150 | void CallFiber2() { |
| 134 | std::thread::id this_id = std::this_thread::get_id(); | 151 | const u32 id = thread_ids.Get(); |
| 135 | u32 id = ids[this_id]; | ||
| 136 | Fiber::YieldTo(thread_fibers[id], fiber2); | 152 | Fiber::YieldTo(thread_fibers[id], fiber2); |
| 137 | } | 153 | } |
| 138 | 154 | ||
| @@ -145,7 +161,7 @@ public: | |||
| 145 | u32 value2{}; | 161 | u32 value2{}; |
| 146 | std::atomic<bool> trap{true}; | 162 | std::atomic<bool> trap{true}; |
| 147 | std::atomic<bool> trap2{true}; | 163 | std::atomic<bool> trap2{true}; |
| 148 | std::unordered_map<std::thread::id, u32> ids; | 164 | ThreadIds thread_ids; |
| 149 | std::vector<std::shared_ptr<Common::Fiber>> thread_fibers; | 165 | std::vector<std::shared_ptr<Common::Fiber>> thread_fibers; |
| 150 | std::shared_ptr<Common::Fiber> fiber1; | 166 | std::shared_ptr<Common::Fiber> fiber1; |
| 151 | std::shared_ptr<Common::Fiber> fiber2; | 167 | std::shared_ptr<Common::Fiber> fiber2; |
| @@ -168,15 +184,13 @@ static void WorkControl2_3(void* control) { | |||
| 168 | } | 184 | } |
| 169 | 185 | ||
| 170 | void TestControl2::ExecuteThread(u32 id) { | 186 | void TestControl2::ExecuteThread(u32 id) { |
| 171 | std::thread::id this_id = std::this_thread::get_id(); | 187 | thread_ids.Register(id); |
| 172 | ids[this_id] = id; | ||
| 173 | auto thread_fiber = Fiber::ThreadToFiber(); | 188 | auto thread_fiber = Fiber::ThreadToFiber(); |
| 174 | thread_fibers[id] = thread_fiber; | 189 | thread_fibers[id] = thread_fiber; |
| 175 | } | 190 | } |
| 176 | 191 | ||
| 177 | void TestControl2::Exit() { | 192 | void TestControl2::Exit() { |
| 178 | std::thread::id this_id = std::this_thread::get_id(); | 193 | const u32 id = thread_ids.Get(); |
| 179 | u32 id = ids[this_id]; | ||
| 180 | thread_fibers[id]->Exit(); | 194 | thread_fibers[id]->Exit(); |
| 181 | } | 195 | } |
| 182 | 196 | ||
| @@ -228,24 +242,21 @@ public: | |||
| 228 | void DoWork1() { | 242 | void DoWork1() { |
| 229 | value1 += 1; | 243 | value1 += 1; |
| 230 | Fiber::YieldTo(fiber1, fiber2); | 244 | Fiber::YieldTo(fiber1, fiber2); |
| 231 | std::thread::id this_id = std::this_thread::get_id(); | 245 | const u32 id = thread_ids.Get(); |
| 232 | u32 id = ids[this_id]; | ||
| 233 | value3 += 1; | 246 | value3 += 1; |
| 234 | Fiber::YieldTo(fiber1, thread_fibers[id]); | 247 | Fiber::YieldTo(fiber1, thread_fibers[id]); |
| 235 | } | 248 | } |
| 236 | 249 | ||
| 237 | void DoWork2() { | 250 | void DoWork2() { |
| 238 | value2 += 1; | 251 | value2 += 1; |
| 239 | std::thread::id this_id = std::this_thread::get_id(); | 252 | const u32 id = thread_ids.Get(); |
| 240 | u32 id = ids[this_id]; | ||
| 241 | Fiber::YieldTo(fiber2, thread_fibers[id]); | 253 | Fiber::YieldTo(fiber2, thread_fibers[id]); |
| 242 | } | 254 | } |
| 243 | 255 | ||
| 244 | void ExecuteThread(u32 id); | 256 | void ExecuteThread(u32 id); |
| 245 | 257 | ||
| 246 | void CallFiber1() { | 258 | void CallFiber1() { |
| 247 | std::thread::id this_id = std::this_thread::get_id(); | 259 | const u32 id = thread_ids.Get(); |
| 248 | u32 id = ids[this_id]; | ||
| 249 | Fiber::YieldTo(thread_fibers[id], fiber1); | 260 | Fiber::YieldTo(thread_fibers[id], fiber1); |
| 250 | } | 261 | } |
| 251 | 262 | ||
| @@ -254,7 +265,7 @@ public: | |||
| 254 | u32 value1{}; | 265 | u32 value1{}; |
| 255 | u32 value2{}; | 266 | u32 value2{}; |
| 256 | u32 value3{}; | 267 | u32 value3{}; |
| 257 | std::unordered_map<std::thread::id, u32> ids; | 268 | ThreadIds thread_ids; |
| 258 | std::vector<std::shared_ptr<Common::Fiber>> thread_fibers; | 269 | std::vector<std::shared_ptr<Common::Fiber>> thread_fibers; |
| 259 | std::shared_ptr<Common::Fiber> fiber1; | 270 | std::shared_ptr<Common::Fiber> fiber1; |
| 260 | std::shared_ptr<Common::Fiber> fiber2; | 271 | std::shared_ptr<Common::Fiber> fiber2; |
| @@ -271,15 +282,13 @@ static void WorkControl3_2(void* control) { | |||
| 271 | } | 282 | } |
| 272 | 283 | ||
| 273 | void TestControl3::ExecuteThread(u32 id) { | 284 | void TestControl3::ExecuteThread(u32 id) { |
| 274 | std::thread::id this_id = std::this_thread::get_id(); | 285 | thread_ids.Register(id); |
| 275 | ids[this_id] = id; | ||
| 276 | auto thread_fiber = Fiber::ThreadToFiber(); | 286 | auto thread_fiber = Fiber::ThreadToFiber(); |
| 277 | thread_fibers[id] = thread_fiber; | 287 | thread_fibers[id] = thread_fiber; |
| 278 | } | 288 | } |
| 279 | 289 | ||
| 280 | void TestControl3::Exit() { | 290 | void TestControl3::Exit() { |
| 281 | std::thread::id this_id = std::this_thread::get_id(); | 291 | const u32 id = thread_ids.Get(); |
| 282 | u32 id = ids[this_id]; | ||
| 283 | thread_fibers[id]->Exit(); | 292 | thread_fibers[id]->Exit(); |
| 284 | } | 293 | } |
| 285 | 294 | ||
diff --git a/src/video_core/CMakeLists.txt b/src/video_core/CMakeLists.txt index fdfc885fc..abcee2a1c 100644 --- a/src/video_core/CMakeLists.txt +++ b/src/video_core/CMakeLists.txt | |||
| @@ -302,7 +302,10 @@ else() | |||
| 302 | target_compile_options(video_core PRIVATE | 302 | target_compile_options(video_core PRIVATE |
| 303 | -Werror=conversion | 303 | -Werror=conversion |
| 304 | -Wno-error=sign-conversion | 304 | -Wno-error=sign-conversion |
| 305 | -Werror=pessimizing-move | ||
| 306 | -Werror=redundant-move | ||
| 305 | -Werror=switch | 307 | -Werror=switch |
| 308 | -Werror=type-limits | ||
| 306 | -Werror=unused-variable | 309 | -Werror=unused-variable |
| 307 | 310 | ||
| 308 | $<$<CXX_COMPILER_ID:GNU>:-Werror=class-memaccess> | 311 | $<$<CXX_COMPILER_ID:GNU>:-Werror=class-memaccess> |
diff --git a/src/video_core/command_classes/codecs/vp9.cpp b/src/video_core/command_classes/codecs/vp9.cpp index 3bae0bb5d..d205a8f5d 100644 --- a/src/video_core/command_classes/codecs/vp9.cpp +++ b/src/video_core/command_classes/codecs/vp9.cpp | |||
| @@ -366,7 +366,7 @@ Vp9PictureInfo VP9::GetVp9PictureInfo(const NvdecCommon::NvdecRegisters& state) | |||
| 366 | // to avoid buffering frame data needed for reference frame updating in the header composition. | 366 | // to avoid buffering frame data needed for reference frame updating in the header composition. |
| 367 | std::memcpy(vp9_info.frame_offsets.data(), state.surface_luma_offset.data(), 4 * sizeof(u64)); | 367 | std::memcpy(vp9_info.frame_offsets.data(), state.surface_luma_offset.data(), 4 * sizeof(u64)); |
| 368 | 368 | ||
| 369 | return std::move(vp9_info); | 369 | return vp9_info; |
| 370 | } | 370 | } |
| 371 | 371 | ||
| 372 | void VP9::InsertEntropy(u64 offset, Vp9EntropyProbs& dst) { | 372 | void VP9::InsertEntropy(u64 offset, Vp9EntropyProbs& dst) { |
| @@ -893,7 +893,7 @@ void VpxRangeEncoder::Write(bool bit, s32 probability) { | |||
| 893 | if (((low_value << (offset - 1)) >> 31) != 0) { | 893 | if (((low_value << (offset - 1)) >> 31) != 0) { |
| 894 | const s32 current_pos = static_cast<s32>(base_stream.GetPosition()); | 894 | const s32 current_pos = static_cast<s32>(base_stream.GetPosition()); |
| 895 | base_stream.Seek(-1, Common::SeekOrigin::FromCurrentPos); | 895 | base_stream.Seek(-1, Common::SeekOrigin::FromCurrentPos); |
| 896 | while (base_stream.GetPosition() >= 0 && PeekByte() == 0xff) { | 896 | while (PeekByte() == 0xff) { |
| 897 | base_stream.WriteByte(0); | 897 | base_stream.WriteByte(0); |
| 898 | 898 | ||
| 899 | base_stream.Seek(-2, Common::SeekOrigin::FromCurrentPos); | 899 | base_stream.Seek(-2, Common::SeekOrigin::FromCurrentPos); |
diff --git a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp index 166ee34e1..70dd0c3c6 100644 --- a/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp +++ b/src/video_core/renderer_opengl/gl_shader_disk_cache.cpp | |||
| @@ -317,8 +317,7 @@ std::optional<std::vector<ShaderDiskCachePrecompiled>> ShaderDiskCacheOpenGL::Lo | |||
| 317 | return std::nullopt; | 317 | return std::nullopt; |
| 318 | } | 318 | } |
| 319 | } | 319 | } |
| 320 | 320 | return entries; | |
| 321 | return std::move(entries); | ||
| 322 | } | 321 | } |
| 323 | 322 | ||
| 324 | void ShaderDiskCacheOpenGL::InvalidateTransferable() { | 323 | void ShaderDiskCacheOpenGL::InvalidateTransferable() { |
diff --git a/src/video_core/renderer_vulkan/wrapper.cpp b/src/video_core/renderer_vulkan/wrapper.cpp index c034558a3..4e83303d8 100644 --- a/src/video_core/renderer_vulkan/wrapper.cpp +++ b/src/video_core/renderer_vulkan/wrapper.cpp | |||
| @@ -844,7 +844,7 @@ std::optional<std::vector<VkExtensionProperties>> EnumerateInstanceExtensionProp | |||
| 844 | VK_SUCCESS) { | 844 | VK_SUCCESS) { |
| 845 | return std::nullopt; | 845 | return std::nullopt; |
| 846 | } | 846 | } |
| 847 | return std::move(properties); | 847 | return properties; |
| 848 | } | 848 | } |
| 849 | 849 | ||
| 850 | std::optional<std::vector<VkLayerProperties>> EnumerateInstanceLayerProperties( | 850 | std::optional<std::vector<VkLayerProperties>> EnumerateInstanceLayerProperties( |
diff --git a/src/web_service/CMakeLists.txt b/src/web_service/CMakeLists.txt index 7e484b906..ae85a72ea 100644 --- a/src/web_service/CMakeLists.txt +++ b/src/web_service/CMakeLists.txt | |||
| @@ -9,4 +9,4 @@ add_library(web_service STATIC | |||
| 9 | ) | 9 | ) |
| 10 | 10 | ||
| 11 | create_target_directory_groups(web_service) | 11 | create_target_directory_groups(web_service) |
| 12 | target_link_libraries(web_service PRIVATE common nlohmann_json::nlohmann_json httplib lurlparser) | 12 | target_link_libraries(web_service PRIVATE common nlohmann_json::nlohmann_json httplib) |
diff --git a/src/web_service/web_backend.cpp b/src/web_service/web_backend.cpp index 534960d09..c56cd7c71 100644 --- a/src/web_service/web_backend.cpp +++ b/src/web_service/web_backend.cpp | |||
| @@ -7,7 +7,6 @@ | |||
| 7 | #include <mutex> | 7 | #include <mutex> |
| 8 | #include <string> | 8 | #include <string> |
| 9 | 9 | ||
| 10 | #include <LUrlParser.h> | ||
| 11 | #include <fmt/format.h> | 10 | #include <fmt/format.h> |
| 12 | #include <httplib.h> | 11 | #include <httplib.h> |
| 13 | 12 | ||
| @@ -19,9 +18,6 @@ namespace WebService { | |||
| 19 | 18 | ||
| 20 | constexpr std::array<const char, 1> API_VERSION{'1'}; | 19 | constexpr std::array<const char, 1> API_VERSION{'1'}; |
| 21 | 20 | ||
| 22 | constexpr int HTTP_PORT = 80; | ||
| 23 | constexpr int HTTPS_PORT = 443; | ||
| 24 | |||
| 25 | constexpr std::size_t TIMEOUT_SECONDS = 30; | 21 | constexpr std::size_t TIMEOUT_SECONDS = 30; |
| 26 | 22 | ||
| 27 | struct Client::Impl { | 23 | struct Client::Impl { |
| @@ -67,21 +63,7 @@ struct Client::Impl { | |||
| 67 | const std::string& jwt = "", const std::string& username = "", | 63 | const std::string& jwt = "", const std::string& username = "", |
| 68 | const std::string& token = "") { | 64 | const std::string& token = "") { |
| 69 | if (cli == nullptr) { | 65 | if (cli == nullptr) { |
| 70 | const auto parsedUrl = LUrlParser::clParseURL::ParseURL(host); | 66 | cli = std::make_unique<httplib::Client>(host.c_str()); |
| 71 | int port{}; | ||
| 72 | if (parsedUrl.m_Scheme == "http") { | ||
| 73 | if (!parsedUrl.GetPort(&port)) { | ||
| 74 | port = HTTP_PORT; | ||
| 75 | } | ||
| 76 | } else if (parsedUrl.m_Scheme == "https") { | ||
| 77 | if (!parsedUrl.GetPort(&port)) { | ||
| 78 | port = HTTPS_PORT; | ||
| 79 | } | ||
| 80 | } else { | ||
| 81 | LOG_ERROR(WebService, "Bad URL scheme {}", parsedUrl.m_Scheme); | ||
| 82 | return WebResult{WebResult::Code::InvalidURL, "Bad URL scheme", ""}; | ||
| 83 | } | ||
| 84 | cli = std::make_unique<httplib::Client>(parsedUrl.m_Host.c_str(), port); | ||
| 85 | } | 67 | } |
| 86 | cli->set_connection_timeout(TIMEOUT_SECONDS); | 68 | cli->set_connection_timeout(TIMEOUT_SECONDS); |
| 87 | cli->set_read_timeout(TIMEOUT_SECONDS); | 69 | cli->set_read_timeout(TIMEOUT_SECONDS); |