{"id":387053,"date":"2024-06-29T07:05:43","date_gmt":"2024-06-29T07:05:43","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=387053"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=387053","title":{"rendered":"<span>PVS-Studio \u0438\u0449\u0435\u0442 \u0431\u0430\u0433\u0438 \u0432 \u043f\u0440\u043e\u0435\u043a\u0442\u0435 DuckStation<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041c\u044b \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0435\u0442\u0440\u043e-\u0438\u0433\u0440\u044b. \u041c\u043d\u043e\u0433\u0438\u0435 \u043d\u0430\u0448\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438 \u043d\u043e\u0441\u0442\u0430\u043b\u044c\u0433\u0438\u0440\u0443\u044e\u0442 \u043f\u0440\u0438 \u0438\u0445 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438. \u041e\u0434\u043d\u0430\u043a\u043e, \u0440\u0435\u0442\u0440\u043e-\u0438\u0433\u0440\u044b \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u0447\u0451\u043c-\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c. \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b\u0438 \u043f\u0440\u043e\u0435\u043a\u0442, \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0438\u0433\u0440\u044b \u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0436\u0435\u043b\u0435\u0437\u0435.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/7ff\/1b0\/555\/7ff1b055557aee2c93500ac374a8c1f4.png\" alt=\"0881_duckstation_ru\/image1.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7ff\/1b0\/555\/7ff1b055557aee2c93500ac374a8c1f4.png\"\/><\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<h2 id=\"vvedenie\">\u0412\u0432\u0435\u0434\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>DuckStation \u2013 \u044d\u0442\u043e \u044d\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 Sony PlayStation. \u041a\u0430\u043a \u0432\u0438\u0434\u043d\u043e \u043f\u043e \u0441\u0430\u0439\u0442\u0443, \u043e\u043d \u0438\u043c\u0435\u0435\u0442 \u0432\u0435\u0440\u0441\u0438\u044e \u043a\u0430\u043a \u0434\u043b\u044f Windows \u0438 Linux, \u0442\u0430\u043a \u0438 \u0434\u043b\u044f \u0441\u043c\u0430\u0440\u0442\u0444\u043e\u043d\u043e\u0432 \u043d\u0430 Android. \u0410 \u043d\u0435\u0434\u0430\u0432\u043d\u043e \u0435\u0433\u043e \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u043d\u0430 Xbox Series X \u0438 S. \u0421\u0430\u043c \u043f\u0440\u043e\u0435\u043a\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u0442 \u0447\u0443\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 \u043c\u0438\u043b\u043b\u0438\u043e\u043d\u0430 \u0441\u0442\u0440\u043e\u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430 \u044f\u0437\u044b\u043a\u0430\u0445 \u0421 \u0438 \u0421++. \u0423 DuckStation \u043d\u0435\u0442 \u0440\u0435\u043b\u0438\u0437\u043e\u0432, \u0432 \u043d\u0435\u0433\u043e \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043a\u043e\u043c\u043c\u0438\u0442\u044f\u0442 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043f\u0440\u0438\u0448\u043b\u043e\u0441\u044c \u0437\u0430\u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c SHA \u043a\u043e\u043c\u043c\u0438\u0442\u0430: <em><a href=\"https:\/\/github.com\/stenzek\/duckstation\/tree\/13c5ee8bfb4f0f8fc40f76b39de58b5d9b473dc3\">13c5ee8<\/a><\/em>.<\/p>\n<p>  <\/p>\n<p>\u041c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b\u0438 \u043f\u0440\u043e\u0435\u043a\u0442 \u0438 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b\u0438 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 (170 \u0443\u0440\u043e\u0432\u043d\u044f High \u0438 434 \u0443\u0440\u043e\u0432\u043d\u044f Medium). \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c 10 \u0441\u0430\u043c\u044b\u0445 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0438\u0437 \u043d\u0438\u0445.<\/p>\n<p>  <\/p>\n<h2 id=\"rezultaty-proverki\">\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438<\/h2>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N1<\/strong><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v726\/\">V726<\/a> An attempt to free memory containing the &#8216;wbuf&#8217; array by using the &#8216;free&#8217; function. This is incorrect as &#8216;wbuf&#8217; was created on stack. log.cpp 216<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">template&lt;typename T> static ALWAYS_INLINE void FormatLogMessageAndPrintW(....) {   ....   wchar_t wbuf[512];   wchar_t* wmessage_buf = wbuf;   ....   if (wmessage_buf != wbuf)   {     std::free(wbuf);   }   if (message_buf != buf)   {     std::free(message_buf);   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0438\u043b \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u0434, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043c\u0430\u0441\u0441\u0438\u0432\u0430<em>, \u0432<\/em>\u044b\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u0433\u043e \u043d\u0430 \u0441\u0442\u0435\u043a\u0435. \u0422\u0430\u043a \u043a\u0430\u043a \u043f\u0430\u043c\u044f\u0442\u044c \u043d\u0435 \u0431\u044b\u043b\u0430 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0430 \u043d\u0430 \u043a\u0443\u0447\u0435, \u043d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0442\u0430\u043a\u0436\u0435 \u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u0442\u0430\u043a\u0438\u0445 \u043a\u0430\u043a s<em>td::free<\/em> \u0434\u043b\u044f \u0435\u0451 \u043e\u0447\u0438\u0441\u0442\u043a\u0438 \u2013 \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u0438 \u0443\u043d\u0438\u0447\u0442\u043e\u0436\u0435\u043d\u0438\u0438 \u043e\u0431\u044a\u0435\u043a\u0442\u0430.<\/p>\n<p>  <\/p>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u043b\u043b\u0435\u0433\u0430, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b \u0435\u0451, \u043f\u043e\u0441\u0447\u0438\u0442\u0430\u043b \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0435 \u043b\u043e\u0436\u043d\u044b\u043c. \u042d\u0442\u043e\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u044f \u043e\u043f\u0438\u0441\u0430\u043b \u0432 \u0432\u0438\u0434\u0435 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438, \u0441 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u044e \u0432\u0430\u0441 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f, \u043e\u043d\u0430 \u0442\u0430\u043a \u0438 \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f: <em><a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0880\/\">\u0418\u0441\u0442\u043e\u0440\u0438\u044f \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043e\u0434\u0438\u043d \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a \u0437\u0430\u0449\u0438\u0449\u0430\u043b \u0431\u0430\u0433 \u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043e\u0442 \u0434\u0440\u0443\u0433\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 PVS-Studio<\/a><\/em>.<\/p>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N2<\/strong><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v547\/\">V547<\/a> Expression &#8216;i &lt; pathLength&#8217; is always true. file_system.cpp 454<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">void CanonicalizePath(const char *Path, ....) {   ....   u32 pathLength = static_cast&lt;u32>(std::strlen(Path));   ....   for (i = 0; i &lt; pathLength;)   {     ....     char nextCh = (i &lt; pathLength) ? Path[i + 1] : '\\0';     ....   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u043d\u0434\u0443\u043a\u0442\u0438\u0432\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>i<\/em> \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0443\u0436\u0435 \u043f\u043e\u0441\u043b\u0435 \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 <em>nextCh<\/em>. \u0421\u0443\u0434\u044f \u043f\u043e \u0442\u043e\u043c\u0443, \u0447\u0442\u043e, \u0434\u043b\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0434\u043b\u0438\u043d\u044b \u0441\u0442\u0440\u043e\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em>strlen<\/em>, \u0441\u0442\u0440\u043e\u043a\u0430 <em>Path<\/em> <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/terms\/0088\/\">\u043d\u0443\u043b\u044c-\u0442\u0435\u0440\u043c\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u043d\u0430<\/a>. \u0422\u043e\u0433\u0434\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 <em>i &lt; pathLength<\/em> \u044f\u0432\u043d\u043e \u043b\u0438\u0448\u043d\u044f\u044f, \u0438 \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0431\u0443\u0434\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430 \u0432\u0435\u0440\u043d\u044b\u043c. \u041d\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0446\u0438\u043a\u043b\u0430 \u043c\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u043c \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0441\u0438\u043c\u0432\u043e\u043b \u0438 \u0431\u0435\u0437 \u043d\u0435\u0451. \u0422\u043e\u0433\u0434\u0430 \u043a\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">char nextCh = (i &lt; pathLength) ? Path[i + 1] : '\\0';<\/code><\/pre>\n<p>  <\/p>\n<p>\u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">char nextCh = Path[i + 1];<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e, \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0431\u044b \u0441\u0442\u0440\u043e\u043a\u0430 \u043d\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u043b\u0430\u0441\u044c \u0442\u0435\u0440\u043c\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u043c \u043d\u0443\u043b\u0451\u043c, \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0431\u044b\u043b\u0430 \u0431\u044b \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0439. \u041d\u0430 \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u044e\u0449\u0435\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0446\u0438\u043a\u043b\u0430 \u043f\u0440\u0438 \u043f\u043e\u043f\u044b\u0442\u043a\u0435 \u0432\u0437\u044f\u0442\u044c \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0441\u0438\u043c\u0432\u043e\u043b <em>Path[i + 1]<\/em> \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0435\u0442 \u0432\u044b\u0445\u043e\u0434 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u0443 \u043c\u0430\u0441\u0441\u0438\u0432\u0430. \u0412 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">char nextCh = ((i + 1) &lt; pathLength) ? Path[i + 1] : '\\0';<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f N3, N4<\/strong><\/p>\n<p>  <\/p>\n<p>\u041d\u0430 \u0434\u0430\u043d\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u043b \u0441\u0440\u0430\u0437\u0443 \u0434\u0432\u0430 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v547\/\">V547<\/a> Expression &#8216;m_value.wSecond &lt;= other.m_value.wSecond&#8217; is always true. timestamp.cpp 311<\/li>\n<li><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v779\/\">V779<\/a> Unreachable code detected. It is possible that an error is present. timestamp.cpp 314<\/li>\n<\/ul>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool Timestamp::operator&lt;=(const Timestamp&amp; other) const {   ....   if (m_value.wYear > other.m_value.wYear)     return false;   else if (m_value.wYear &lt; other.m_value.wYear)     return true;   if (m_value.wMonth > other.m_value.wMonth)     return false;   else if (m_value.wMonth &lt; other.m_value.wMonth)     return true;   if (m_value.wDay > other.m_value.wDay)     return false;   else if (m_value.wDay &lt; other.m_value.wDay)     return true;   if (m_value.wHour > other.m_value.wHour)     return false;   else if (m_value.wHour &lt; other.m_value.wHour)     return true;   if (m_value.wMinute > other.m_value.wMinute)     return false;   else if (m_value.wMinute &lt; other.m_value.wMinute)     return true;   if (m_value.wSecond > other.m_value.wSecond)     return false;   else if (m_value.wSecond &lt;= other.m_value.wSecond) \/\/ &lt;=     return true;   if (m_value.wMilliseconds > other.m_value.wMilliseconds)     return false;   else if (m_value.wMilliseconds &lt; other.m_value.wMilliseconds)     return true;    return false; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u044d\u0442\u043e\u043c \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u043e\u0442 \u0433\u043e\u0434\u0430 \u0434\u043e \u043c\u0438\u043b\u043b\u0438\u0441\u0435\u043a\u0443\u043d\u0434, \u043d\u043e \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043a\u043e\u0434\u0435 \u0432\u0438\u0434\u0438\u043c\u043e \u043e\u0441\u0442\u0430\u043b\u0430\u0441\u044c \u0435\u0449\u0451 \u0441 \u0442\u043e\u0433\u043e \u043c\u043e\u043c\u0435\u043d\u0442\u0430, \u043a\u043e\u0433\u0434\u0430 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u043b\u043e\u0441\u044c \u043d\u0430 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445. \u0417\u0430\u0431\u044b\u0442\u043e\u0435 (\u0438\u043b\u0438 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u043f\u043e\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u043d\u043e\u0435) <em>&lt;=<\/em> \u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0441\u0435\u043a\u0443\u043d\u0434 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043b\u0438 \u043d\u0435\u0434\u043e\u0441\u0442\u0438\u0436\u0438\u043c\u044b\u043c\u0438.<\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e \u0434\u0430\u043d\u043d\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430 \u0431\u044b\u043b\u0430 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0430 \u0435\u0449\u0451 \u0440\u0430\u0437. \u0412\u043e \u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0430\u0437 \u044d\u0442\u043e \u0431\u044b\u043b \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 <em>operator >=<\/em>. \u041d\u0430 \u043d\u0435\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0442\u043e\u0436\u0435 \u0432\u044b\u0434\u0430\u043b \u0434\u0432\u0430 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v547\/\">V547<\/a> Expression &#8216;m_value.wSecond >= other.m_value.wSecond&#8217; is always true. timestamp.cpp 427<\/li>\n<li><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v779\/\">V779<\/a> Unreachable code detected. It is possible that an error is present. timestamp.cpp 430<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u041d\u0430 \u0442\u0435\u043c\u0443 \u0444\u0443\u043d\u043a\u0446\u0438\u0439 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f, \u043a\u0441\u0442\u0430\u0442\u0438, \u0435\u0441\u0442\u044c \u043e\u0442\u043b\u0438\u0447\u043d\u0430\u044f <a href=\"https:\/\/pvs-studio.com\/ru\/blog\/posts\/cpp\/0509\/\">\u0441\u0442\u0430\u0442\u044c\u044f<\/a> \u043c\u043e\u0435\u0433\u043e \u043a\u043e\u043b\u043b\u0435\u0433\u0438, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u043e\u043d \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u044b \u043e\u0448\u0438\u0431\u043e\u043a \u0442\u0430\u043a\u043e\u0433\u043e \u0442\u0438\u043f\u0430.<\/p>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N5<\/strong><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v583\/\">V583<\/a> The &#8216;?:&#8217; operator, regardless of its conditional expression, always returns one and the same value. gamelistmodel.cpp 415<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool GameListModel::lessThan(...., int column, bool ascending) const {   ....   const GameListEntry&amp; left  = m_game_list->GetEntries()[left_row];   const GameListEntry&amp; right = m_game_list->GetEntries()[right_row];   ....   switch(column)   {     case Column_Type:     {       ....       return ascending ?               (static_cast&lt;int>(left.type)             &lt;  static_cast&lt;int>(right.type))             :              (static_cast&lt;int>(right.type)             >  static_cast&lt;int>(left.type));     }   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0434\u0432\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044f. \u041e\u043f\u0435\u0440\u0430\u043d\u0434\u044b \u0443\u0441\u043b\u043e\u0432\u043d\u043e\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430, \u043d\u0430\u0445\u043e\u0434\u044f\u0449\u0438\u0435\u0441\u044f \u043f\u043e \u043e\u0431\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043e\u0442 \u0437\u043d\u0430\u043a\u043e\u0432 \u0431\u043e\u043b\u044c\u0448\u0435 \u0438 \u043c\u0435\u043d\u044c\u0448\u0435, \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043c\u0435\u043d\u0435\u043d\u044b \u043c\u0435\u0441\u0442\u0430\u043c\u0438 \u0432 \u0434\u0432\u0443\u0445 \u0435\u0433\u043e \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u044f\u0445. \u041f\u043e \u0441\u0443\u0442\u0438, \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u0432 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0435 <em>return<\/em> \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u0435\u043d:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">return ascending ?               (static_cast&lt;int>(left.type)             &lt;  static_cast&lt;int>(right.type))             :              (static_cast&lt;int>(left.type)             &lt;  static_cast&lt;int>(right.type));<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0431\u044b\u043b \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">return ascending ?               (static_cast&lt;int>(left.type)             &lt;  static_cast&lt;int>(right.type))            :              (static_cast&lt;int>(right.type)             &lt;  static_cast&lt;int>(left.type));<\/code><\/pre>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f N6, N7, N8<\/strong><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v501\/\">V501<\/a> There are identical sub-expressions &#8216;c != &#8216; &#187; to the left and to the right of the &#8216;&amp;&amp;&#8217; operator. file_system.cpp 560<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">static inline bool FileSystemCharacterIsSane(char c, ....) {   if    (!(c >= 'a' &amp;&amp; c &lt;= 'z')       &amp;&amp; !(c >= 'A' &amp;&amp; c &lt;= 'Z')       &amp;&amp; !(c >= '0' &amp;&amp; c &lt;= '9')       &amp;&amp;   c != ' '       &amp;&amp;   c != ' '       &amp;&amp;   c != '_'       &amp;&amp;   c != '-'       &amp;&amp;   c != '.')   {     ....   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0434\u0432\u0430 \u0440\u0430\u0437\u0430 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043b\u0438\u0448\u043d\u044f\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u043d\u0430 \u043f\u0440\u043e\u0431\u0435\u043b. \u0422\u0430\u043a\u0436\u0435, \u0431\u044b\u043b\u043e \u043e\u0431\u043d\u0430\u0440\u0443\u0436\u0435\u043d\u043e \u0435\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439:<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v501\/\">V501<\/a> There are identical sub-expressions to the left and to the right of the &#8216;|&#8217; operator: KMOD_LCTRL | KMOD_LCTRL sdl_key_names.h 271<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">typedef enum {   KMOD_NONE   = 0x0000,   KMOD_LSHIFT = 0x0001,   KMOD_RSHIFT = 0x0002,   KMOD_LCTRL  = 0x0040,   .... } .... static const std::array&lt;SDLKeyModifierEntry, 4> s_sdl_key_modifiers =  {   {{KMOD_LSHIFT, static_cast&lt;SDL_Keymod>(KMOD_LSHIFT | KMOD_RSHIFT),     SDLK_LSHIFT, SDLK_RSHIFT, \"Shift\"},   {KMOD_LCTRL, static_cast&lt;SDL_Keymod>(KMOD_LCTRL | KMOD_LCTRL), \/\/ &lt;=     SDLK_LCTRL, SDLK_RCTRL, \"Control\"},   {KMOD_LALT, static_cast&lt;SDL_Keymod>(KMOD_LALT | KMOD_RALT),     SDLK_LALT, SDLK_RALT, \"Alt\"},   {KMOD_LGUI, static_cast&lt;SDL_Keymod>(KMOD_LGUI | KMOD_RGUI),     SDLK_LGUI, SDLK_RGUI, \"Meta\"}} };<\/code><\/pre>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c, \u043f\u043e \u043e\u0431\u0435 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043e\u0442 \u0437\u043d\u0430\u043a\u0430 <em>|<\/em> \u0441\u0442\u043e\u0438\u0442 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>KMOD_LCTRL<\/em>, \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u043e\u0434\u043e\u0437\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e.<\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v501\/\">V501<\/a> There are identical sub-expressions &#8216;TokenMatch(command, &#171;CATALOG&#187;)&#8217; to the left and to the right of the &#8216;||&#8217; operator. cue_parser.cpp 196<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool File::ParseLine(const char* line, ....) {   const std::string_view command(GetToken(line));   ....   if (   TokenMatch(command, \"CATALOG\") \/\/ &lt;=       || TokenMatch(command, \"CDTEXTFILE\")        || TokenMatch(command, \"CATALOG\") \/\/ &lt;=       || TokenMatch(command, \"ISRC\")        || TokenMatch(\"command\", \"TRACK_ISRC\")        || TokenMatch(command, \"TITLE\")       ||  ....)   {     ....   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0443\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0434\u0432\u0430 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0445 \u0432\u044b\u0437\u043e\u0432\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <em>TokenMatch<\/em>.<\/p>\n<p>  <\/p>\n<p>\u0418\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e, \u0447\u0442\u043e, \u0432 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u043d\u0438\u0436\u0435, \u0442\u0430\u043a\u0436\u0435 \u0435\u0441\u0442\u044c \u043e\u0448\u0438\u0431\u043a\u0430: <em>command<\/em> \u0437\u0430\u043f\u0438\u0441\u0430\u043d \u043a\u0430\u043a \u0441\u0442\u0440\u043e\u043a\u043e\u0432\u044b\u0439 \u043b\u0438\u0442\u0435\u0440\u0430\u043b \u0432\u043c\u0435\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u041a\u0441\u0442\u0430\u0442\u0438, \u043c\u044b \u0434\u0430\u0432\u043d\u043e \u0441\u043e\u0431\u0438\u0440\u0430\u043b\u0438\u0441\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0435 \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u0438\u0442 \u043e\u0442\u0441\u043b\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u0442\u0430\u043a\u0438\u0435 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0438, \u0430 \u044d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430 \u2013 \u043e\u0434\u0438\u043d \u0438\u0437 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0435\u0439, \u0447\u0442\u043e \u043e\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u043b\u0435\u0437\u043d\u043e.<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u043d\u0430 \u043c\u0435\u0441\u0442\u0435 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u0445 \u043f\u0440\u043e\u0432\u0435\u0440\u043e\u043a, \u0432\u043e \u0432\u0441\u0435\u0445 \u044d\u0442\u0438\u0445 \u0441\u043b\u0443\u0447\u0430\u044f\u0445, \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u043b\u0438 \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0438 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u044b \u043a\u043e\u0434\u0430 \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0442\u0430\u043a, \u043a\u0430\u043a \u043e\u0436\u0438\u0434\u0430\u044e\u0442 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b, \u043d\u0430\u043f\u0438\u0441\u0430\u0432\u0448\u0438\u0435 \u0438\u0445.<\/p>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N9<\/strong><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v1065\/\">V1065<\/a> Expression can be simplified, check &#8216;m_display_texture_height&#8217; and similar operands. host_display.cpp 549<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">.... s32 m_display_texture_height = ....; s32 m_display_texture_view_y = ....; .... bool HostDisplay::WriteDisplayTextureToFile(....) {   s32 read_y = m_display_texture_view_y;   s32 read_height = m_display_texture_view_height;    ....   read_y = (m_display_texture_height - read_height) \u2013            (m_display_texture_height - m_display_texture_view_y);   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0430, \u0442\u0443\u0442 \u043d\u0435\u0442 \u043e\u0448\u0438\u0431\u043a\u0438, \u043f\u0440\u043e\u0441\u0442\u043e \u043a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c, \u0443\u043f\u0440\u043e\u0441\u0442\u0438\u0432 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">read_y = m_display_texture_view_y - read_height;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043a\u0430\u0437\u0430\u0442\u044c \u043f\u043e \u043f\u0440\u0430\u0432\u0434\u0435, \u044d\u0442\u043e \u043d\u0435 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u043e\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0438 \u0435\u0433\u043e \u043d\u0435 \u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043b\u043e \u0431\u044b \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0441\u0442\u0430\u0442\u044c\u044e. \u041e\u0434\u043d\u0430\u043a\u043e, \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b, \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e, \u044d\u0442\u043e \u043c\u043e\u044f \u0434\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430 \u0438 \u043c\u043d\u0435 \u043f\u0440\u0438\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u043e\u043d\u0430 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430:)<\/p>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N10<\/strong><\/p>\n<p>  <\/p>\n<p><a href=\"https:\/\/pvs-studio.com\/ru\/w\/v614\/\">V614<\/a> The &#8216;host_interface&#8217; smart pointer is utilized immediately after being declared or reset. It is suspicious that no value was assigned to it. main.cpp 45<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">static std::unique_ptr&lt;NoGUIHostInterface> CreateHostInterface() {   const char* platform = std::getenv(\"DUCKSTATION_NOGUI_PLATFORM\");   std::unique_ptr&lt;NoGUIHostInterface> host_interface;  #ifdef WITH_SDL2   if (   !host_interface &amp;&amp; (!platform        || StringUtil::Strcasecmp(platform, \"sdl\") == 0)        &amp;&amp; IsSDLHostInterfaceAvailable())   {     host_interface = SDLHostInterface::Create();   }   } #endif  #ifdef WITH_VTY   if (  !host_interface &amp;&amp; (!platform        || StringUtil::Strcasecmp(platform, \"vty\") == 0))   {     host_interface = VTYHostInterface::Create();   } #endif  #ifdef _WIN32   if (  !host_interface &amp;&amp; (!platform        || StringUtil::Strcasecmp(platform, \"win32\") == 0))   {     host_interface = Win32HostInterface::Create();   }  #endif    return host_interface; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0414\u0438\u0430\u0433\u043d\u043e\u0441\u0442\u0438\u043a\u0430 \u0433\u043e\u0432\u043e\u0440\u0438\u0442 \u043e\u0431 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0438 \u043d\u0435\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439. \u0417\u0434\u0435\u0441\u044c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0431\u0435\u0441\u0441\u043c\u044b\u0441\u043b\u0435\u043d\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0443\u043c\u043d\u043e\u0433\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f. \u041f\u0435\u0440\u0432\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430: <em>!host_interface<\/em> \u0432\u0441\u0435\u0433\u0434\u0430 \u0431\u0443\u0434\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c <em>true<\/em>. <\/p>\n<p>  <\/p>\n<p>\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u043e\u0448\u0438\u0431\u043a\u0430 \u043d\u0435 \u043e\u0447\u0435\u043d\u044c \u043a\u0440\u0438\u0442\u0438\u0447\u043d\u0430\u044f \u0438 \u0438\u0437\u0431\u044b\u0442\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u0434\u043b\u044f \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0430\u043d\u0438\u044f \u043e\u0431\u0449\u0435\u0439 \u0441\u0442\u0438\u043b\u0438\u0441\u0442\u0438\u043a\u0438, \u043e\u0434\u043d\u0430\u043a\u043e \u0435\u0433\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431 \u043e\u043d \u0441\u0442\u0430\u043b \u0435\u0449\u0451 \u0447\u0438\u0442\u0430\u0431\u0435\u043b\u044c\u043d\u0435\u0435:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">static std::unique_ptr&lt;NoGUIHostInterface> CreateHostInterface() {   const char* platform = std::getenv(\"DUCKSTATION_NOGUI_PLATFORM\"); #ifdef WITH_SDL2   if (   (!platform        || StringUtil::Strcasecmp(platform, \"sdl\") == 0)        &amp;&amp; IsSDLHostInterfaceAvailable())   {     return SDLHostInterface::Create();   } #endif  #ifdef WITH_VTY   if (   !platform        || StringUtil::Strcasecmp(platform, \"vty\") == 0)   {     return VTYHostInterface::Create();   } #endif  #ifdef _WIN32   if (   !platform        || StringUtil::Strcasecmp(platform, \"win32\") == 0)   {     return Win32HostInterface::Create();   } #endif    return {}; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u043c\u044b \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u043b\u0438 \u043e\u0434\u0438\u043d <em>return<\/em> \u0432 \u0447\u0435\u0442\u044b\u0440\u0435 \u0438 \u043a\u043e\u0434 \u0434\u043e\u043b\u0436\u0435\u043d \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u0435\u0435, \u043e\u0434\u043d\u0430\u043a\u043e \u044f \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043f\u043e\u0445\u043e\u0436\u0438\u0439 \u0441\u0438\u043d\u0442\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 <a href=\"https:\/\/godbolt.org\/z\/PWPT6P4ve\">\u043f\u0440\u0438\u043c\u0435\u0440<\/a>. \u041a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u0432\u0438\u0434\u0435\u0442\u044c, \u043f\u043e\u0434 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u044f\u043c\u0438 <em>O2 <\/em>\u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u044b <em>\u0421lang 13<\/em> \u0438 <em>GCC<\/em> <em>11.2<\/em> \u0433\u0435\u043d\u0435\u0440\u0438\u0440\u0443\u044e\u0442 \u043c\u0435\u043d\u044c\u0448\u0435 \u0430\u0441\u0441\u0435\u043c\u0431\u043b\u0435\u0440\u043d\u044b\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0434\u043b\u044f \u0432\u0442\u043e\u0440\u043e\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u0440\u0430 (\u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u0432\u0438\u0434\u043d\u043e \u0434\u043b\u044f <em>GCC<\/em>).<\/p>\n<p>  <\/p>\n<h2 id=\"zaklyuchenie\">\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<p>\u041d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u043c\u044b \u0441\u043c\u043e\u0433\u043b\u0438 \u043d\u0430\u0439\u0442\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0445 \u0441\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u043d\u0438\u0439. \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u044f \u0441\u0442\u0430\u0442\u044c\u0435, \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 DuckStation \u0441\u043c\u043e\u0433\u0443\u0442 \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043d\u0435\u0434\u043e\u0447\u0451\u0442\u044b, \u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0437\u0430\u0445\u043e\u0442\u044f\u0442 \u0441\u0430\u043c\u043e\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0441\u0432\u043e\u044e \u043a\u043e\u0434\u043e\u0432\u0443\u044e \u0431\u0430\u0437\u0443 PVS-Studio.<\/p>\n<p>  <\/p>\n<p>\u0410 \u0435\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c PVS-Studio \u043d\u0430 \u0441\u0432\u043e\u0451\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435, \u0442\u043e \u0432\u044b \u043c\u043e\u0436\u0435\u0442\u0435 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e, \u0441\u043a\u0430\u0447\u0430\u0432 \u0435\u0433\u043e <a href=\"https:\/\/pvs-studio.com\/ru\/pvs-studio\/download\/\">\u0437\u0434\u0435\u0441\u044c<\/a>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0445\u043e\u0442\u0438\u0442\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u044c\u0441\u044f \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435\u0439 \u0441 \u0430\u043d\u0433\u043b\u043e\u044f\u0437\u044b\u0447\u043d\u043e\u0439 \u0430\u0443\u0434\u0438\u0442\u043e\u0440\u0438\u0435\u0439, \u0442\u043e \u043f\u0440\u043e\u0448\u0443 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0441\u0441\u044b\u043b\u043a\u0443 \u043d\u0430 \u043f\u0435\u0440\u0435\u0432\u043e\u0434: Vladislav Stolyarov. <a href=\"https:\/\/habr.com\/en\/company\/pvs-studio\/blog\/587238\/\">How a PVS-Studio developer defended a bug in a checked project<\/a>.<\/p>\n<\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/587242\/\"> https:\/\/habr.com\/ru\/articles\/587242\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u041c\u044b \u0447\u0430\u0441\u0442\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u0440\u0435\u0442\u0440\u043e-\u0438\u0433\u0440\u044b. \u041c\u043d\u043e\u0433\u0438\u0435 \u043d\u0430\u0448\u0438 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0430\u0445\u043e\u0434\u044f\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0435 \u0434\u043b\u044f \u0441\u0435\u0431\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u0438 \u043d\u043e\u0441\u0442\u0430\u043b\u044c\u0433\u0438\u0440\u0443\u044e\u0442 \u043f\u0440\u0438 \u0438\u0445 \u0438\u0437\u0443\u0447\u0435\u043d\u0438\u0438. \u041e\u0434\u043d\u0430\u043a\u043e, \u0440\u0435\u0442\u0440\u043e-\u0438\u0433\u0440\u044b \u043d\u0443\u0436\u043d\u043e \u043d\u0430 \u0447\u0451\u043c-\u0442\u043e \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c. \u0412 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043b\u0438 \u043f\u0440\u043e\u0435\u043a\u0442, \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0449\u0438\u0439 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0435 \u0438\u0433\u0440\u044b \u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c \u0436\u0435\u043b\u0435\u0437\u0435.<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/post_images\/7ff\/1b0\/555\/7ff1b055557aee2c93500ac374a8c1f4.png\" alt=\"0881_duckstation_ru\/image1.png\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/post_images\/7ff\/1b0\/555\/7ff1b055557aee2c93500ac374a8c1f4.png\"\/><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-387053","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/387053","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=387053"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/387053\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=387053"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=387053"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=387053"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}