forked from colobot/colobot
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
An ~advanced~ static analysis technique helped me find many places, where we convert std::string to std::filesystem::path without going through StrUtils::ToString(). Most of this are bugs: std::filesystem::path interprets string in the "native narrow encoding" instead of utf-8. Here is my technique: ```diff *** /usr/include/c++/14/bits/fs_path.h.backup Thu Aug 22 08:31:54 2024 --- /usr/include/c++/14/bits/fs_path.h Thu Aug 22 09:36:18 2024 *************** *** 321,326 **** --- 321,330 ---- _M_cmpts(std::move(__p._M_cmpts)) { __p.clear(); } + [[deprecated]] + path(const string_type& __source, format = auto_format) {} + + [[deprecated]] path(string_type&& __source, format = auto_format) : _M_pathname(std::move(__source)) { _M_split_cmpts(); } *************** *** 358,363 **** --- 362,369 ---- path& operator=(const path&); path& operator=(path&&) noexcept; + + [[deprecated]] path& operator=(string_type&& __source); path& assign(string_type&& __source); *************** *** 380,385 **** --- 386,394 ---- path& operator/=(const path& __p); + [[deprecated]] + path& operator/=(const string_type& __p) {} + template<typename _Source> __detail::_Path<_Source>& operator/=(_Source const& __source) *************** *** 407,415 **** --- 416,428 ---- // concatenation path& operator+=(const path& __x); + + [[deprecated]] path& operator+=(const string_type& __x); path& operator+=(const value_type* __x); path& operator+=(value_type __x); + + [[deprecated]] path& operator+=(basic_string_view<value_type> __x); template<typename _Source> *************** *** 451,456 **** --- 464,471 ---- const string_type& native() const noexcept { return _M_pathname; } const value_type* c_str() const noexcept { return _M_pathname.c_str(); } + + [[deprecated]] operator string_type() const { return _M_pathname; } template<typename _CharT, typename _Traits = std::char_traits<_CharT>, ```
- Loading branch information
1 parent
172be45
commit 02492ff
Showing
18 changed files
with
67 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.