{"id":376316,"date":"2024-05-21T06:47:34","date_gmt":"2024-05-21T06:47:34","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=376316"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T06:47:34","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=376316","title":{"rendered":"<span>\u041f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430 qdEngine, \u0447\u0430\u0441\u0442\u044c \u0442\u0440\u0435\u0442\u044c\u044f: \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0434\u0435\u0441\u044f\u0442\u043a\u0430 \u0431\u0430\u0433\u043e\u0432<\/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><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ii\/np\/tx\/iinptxtkd0nzigwueh7cvx9iztk.png\" alt=\"\u0427\u0430\u0441\u0442\u044c \u0442\u0440\u0435\u0442\u044c\u044f\" data-src=\"https:\/\/habrastorage.org\/webt\/ii\/np\/tx\/iinptxtkd0nzigwueh7cvx9iztk.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u043e qdEngine \u0431\u044b\u043b\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e 10 \u043e\u0448\u0438\u0431\u043e\u043a, \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u043c PVS-Studio. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u0435\u0449\u0451 10 \u0431\u0430\u0433\u043e\u0432, \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u043b\u0443\u0447\u0448\u0435 \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0447\u0443\u0436\u0438\u0445 \u043e\u0448\u0438\u0431\u043a\u0430\u0445. \u0417\u0430\u043e\u0434\u043d\u043e \u043e\u043d\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 PVS-Studio \u0432 \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u0435\u0439\u0448\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0445 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432.<\/p>\n<p><a name=\"habracut\"><\/a>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0441\u0442\u0430\u0442\u044c\u0438 \u043e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0435 \u0438\u0433\u0440\u043e\u0432\u043e\u0433\u043e \u0434\u0432\u0438\u0436\u043a\u0430 qdEngine:<\/p>\n<p>  <\/p>\n<ol>\n<li><a href=\"https:\/\/habr.com\/ru\/companies\/pvs-studio\/articles\/810987\/\">\u0422\u043e\u043f 10 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0439 PVS-Studio<\/a><\/li>\n<li><a href=\"https:\/\/habr.com\/ru\/companies\/pvs-studio\/articles\/812795\/\">\u0423\u043f\u0440\u043e\u0449\u0435\u043d\u0438\u0435 C++ \u043a\u043e\u0434\u0430<\/a><\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0411\u0435\u0437 \u0434\u043e\u043b\u0433\u0438\u0445 \u043f\u0440\u0435\u0434\u0438\u0441\u043b\u043e\u0432\u0438\u0439 \u043f\u0440\u0438\u0441\u0442\u0443\u043f\u0438\u043c \u043a \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044e \u0430\u0441\u0441\u043e\u0440\u0442\u0438 \u0438\u0437 \u0431\u0430\u0433\u043e\u0432 \ud83d\ude42<\/p>\n<p>  <\/p>\n<h2 id=\"preduprezhdenie-n1-oshibka-v-obrabotchike-oshibok\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N1: \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0435 \u043e\u0448\u0438\u0431\u043e\u043a<\/h2>\n<p>  <\/p>\n<p>\u041e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0445 \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u0439, \u043a\u0430\u043a \u043f\u0440\u0430\u0432\u0438\u043b\u043e, \u043d\u0435 \u0442\u0435\u0441\u0442\u0438\u0440\u0443\u044e\u0442\u0441\u044f. \u0414\u043b\u044f \u043d\u0438\u0445 \u0441\u043b\u043e\u0436\u043d\u043e \u0438 \u043d\u0435\u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0432\u0430\u0442\u044c \u044e\u043d\u0438\u0442-\u0442\u0435\u0441\u0442\u044b. \u0412 \u0440\u0435\u0436\u0438\u043c\u0435 \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0434\u043e \u043d\u0438\u0445 \u0441\u043b\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0440\u0430\u0442\u044c\u0441\u044f (\u0442.\u0435. \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0441\u0438\u0442\u0443\u0430\u0446\u0438\u044e, \u043a\u043e\u0433\u0434\u0430 \u0432 \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u0432\u043e\u0437\u043d\u0438\u043a\u043d\u0435\u0442 \u0441\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0443\u044e\u0449\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430).<\/p>\n<p>  <\/p>\n<p>\u0412 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043e\u0448\u0438\u0431\u043e\u043a \u0441\u0430\u043c\u0438 \u0447\u0430\u0441\u0442\u043e \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u0442 \u043e\u0448\u0438\u0431\u043a\u0438. \u041a\u0430\u043a-\u043d\u0438\u0431\u0443\u0434\u044c \u043d\u0430\u043f\u0438\u0448\u0443 \u043f\u0440\u043e \u044d\u0442\u043e \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e.<\/p>\n<p>  <\/p>\n<p>\u0417\u0434\u0435\u0441\u044c \u043d\u0430 \u043f\u043e\u043c\u043e\u0449\u044c \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0433\u043e \u0430\u043d\u0430\u043b\u0438\u0437\u0430 \u043a\u043e\u0434\u0430, \u0442\u0430\u043a\u0438\u0435 \u043a\u0430\u043a <a href=\"https:\/\/pvs-studio.ru\/ru\/pvs-studio\/\">PVS-Studio<\/a>. \u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u044e\u0442 \u043a\u043e\u0434 \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u043e (\u0441 \u043a\u0430\u043a\u043e\u0439 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u043e\u0441\u0442\u044c\u044e) \u043e\u043d \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u044b \u043c\u043e\u0433\u0443\u0442 \u043d\u0430\u0439\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u0440\u0435\u0434\u043a\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u043e\u043c \u043a\u043e\u0434\u0435. \u0420\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043a\u0430\u043a \u0440\u0430\u0437 \u0442\u0430\u043a\u043e\u0439 \u0441\u043b\u0443\u0447\u0430\u0439:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">class CAVIGenerator   {   ....   _bstr_t m_sFile;   .... };  HRESULT CAVIGenerator::InitEngine() {   ....   TCHAR szBuffer[1024];   ....   if (hr != AVIERR_OK)   {     _tprintf(szBuffer,              _T(\"AVI Engine failed to initialize. Check filename %s.\"),m_sFile);     m_sError=szBuffer;   .... };<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v510\/\">V510<\/a> The &#8216;printf&#8217; function is not expected to receive class-type variable as third actual argument. AVIGenerator.cpp 132<\/p>\n<p>  <\/p>\n<p>\u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e <em>m_sFile<\/em> \u2013 \u044d\u0442\u043e \u043a\u043b\u0430\u0441\u0441 \u0442\u0438\u043f\u0430 <em><a href=\"https:\/\/learn.microsoft.com\/en-us\/cpp\/cpp\/bstr-t-class?view=msvc-170\">_bstr_t<\/a><\/em>. \u041f\u043e\u043f\u044b\u0442\u043a\u0430 \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u043a\u043b\u0430\u0441\u0441\u0430 \u043a\u0430\u043a \u043e\u0431\u044b\u043a\u043d\u043e\u0432\u0435\u043d\u043d\u0443\u044e \u0441\u0442\u0440\u043e\u0447\u043a\u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e. \u041d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435, \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432\u043c\u0435\u0441\u0442\u043e \u0438\u043c\u0435\u043d\u0438 \u0444\u0430\u0439\u043b\u0430 \u0431\u0443\u0434\u0443\u0442 \u0440\u0430\u0441\u043f\u0435\u0447\u0430\u0442\u0430\u043d\u044b \u043c\u0443\u0441\u043e\u0440\u043d\u044b\u0435 \u0441\u0438\u043c\u0432\u043e\u043b\u044b. \u0415\u0441\u043b\u0438 \u043c\u0443\u0441\u043e\u0440\u043d\u044b\u0445 \u0441\u0438\u043c\u0432\u043e\u043b\u043e\u0432 \u0431\u0443\u0434\u0435\u0442 \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e, \u0442\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0438\u0442\u0441\u044f \u0431\u0443\u0444\u0435\u0440 <em>szBuffer[1024]<\/em>. \u041f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0431\u0443\u0444\u0435\u0440\u0430, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0442\u044c \u043a\u0430\u043a \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u0443\u044e \u0443\u044f\u0437\u0432\u0438\u043c\u043e\u0441\u0442\u044c. <\/p>\n<p>  <\/p>\n<p>\u0412 \u043e\u0431\u0449\u0435\u043c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0439\u0442\u0435 PVS-Studio \u0434\u043b\u044f \u043f\u0440\u043e\u0444\u0438\u043b\u0430\u043a\u0442\u0438\u043a\u0438 \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0445 \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u0431\u0430\u0433\u043e\u0432 \u0432 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430\u0445 \u043e\u0448\u0438\u0431\u043e\u043a.<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043f\u0435\u0440\u0435\u0433\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u044b \u043a\u043b\u0430\u0441\u0441\u0430 <em>_bstr_t<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">\/\/ Extract the pointers to the encapsulated Unicode or multibyte BSTR object. operator wchar_t* operator char*<\/code><\/pre>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">_tprintf(szBuffer,          _T(\"AVI Engine failed to initialize. Check filename %s.\"),          (LPCSTR)m_sFile);<\/code><\/pre>\n<p>  <\/p>\n<p>\u0422\u0438\u043f <em>LPCSTR<\/em> \u0440\u0430\u0437\u0432\u0435\u0440\u043d\u0451\u0442\u0441\u044f \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0435\u0436\u0438\u043c\u0430 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438 (UNICODE \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043d\u0435\u0442) \u0432 <em>const wchar_t*<\/em> \u0438\u043b\u0438 <em>const<\/em> <em>char*<\/em>.<\/p>\n<p>  <\/p>\n<h2 id=\"preduprezhdenie-n2-nedostizhimyy-kod\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N2: \u043d\u0435\u0434\u043e\u0441\u0442\u0438\u0436\u0438\u043c\u044b\u0439 \u043a\u043e\u0434<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool qdGameScene::follow_path_seek(qdGameObjectMoving* pObj,                                    bool lock_target) {   if (qdGameObjectMoving::FOLLOW_UPDATE_PATH == pObj->follow_condition())     selected_object_->set_grid_zone_attributes(sGridCell::CELL_SELECTED);    return pObj->move(selected_object_->last_move_order(), lock_target);    if (qdGameObjectMoving::FOLLOW_UPDATE_PATH == pObj->follow_condition())     selected_object_->drop_grid_zone_attributes(sGridCell::CELL_SELECTED); }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v779\/\">V779<\/a> Unreachable code detected. It is possible that an error is present. qd_game_scene.cpp 1245<\/p>\n<p>  <\/p>\n<p>\u041a\u043e\u0434 \u043f\u043e\u0441\u043b\u0435 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u0430 <em>return<\/em> \u043d\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f.<\/p>\n<p>  <\/p>\n<p>\u0411\u043b\u043e\u043a \u043d\u0435\u0434\u043e\u0441\u0442\u0438\u0436\u0438\u043c\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435, \u043a\u0430\u043a \u0438 \u043f\u0435\u0440\u0435\u0434 \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c <em>return<\/em>. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043f\u043e\u0432\u0442\u043e\u0440\u044f\u044e\u0449\u0438\u0439\u0441\u044f \u043a\u043e\u0434 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043d\u0435\u0430\u043a\u043a\u0443\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u043a\u043e\u0434\u0430 \u0438\u043b\u0438 \u0441\u043b\u0438\u044f\u043d\u0438\u044f \u0432\u0435\u0442\u043e\u043a. \u0414\u0443\u043c\u0430\u044e, \u043d\u0438\u0436\u043d\u044e\u044e \u0447\u0430\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c.<\/p>\n<p>  <\/p>\n<h2 id=\"preduprezhdenie-n3-new---delete\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N3: new [] \/ delete<\/h2>\n<p>  <\/p>\n<p>\u0412 \u0434\u0432\u0438\u0436\u043a\u0435 qdEngine \u043e\u0447\u0435\u043d\u044c \u043c\u043d\u043e\u0433\u043e \u0440\u0443\u0447\u043d\u043e\u0433\u043e \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043f\u0430\u043c\u044f\u0442\u044c\u044e. \u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0441\u0442\u0432\u0438\u0435, \u043c\u043d\u043e\u0433\u043e \u043e\u0448\u0438\u0431\u043e\u043a, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u044b\u0445 \u0441 \u0432\u044b\u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u0438 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u0435\u043c \u043f\u0430\u043c\u044f\u0442\u0438. \u0420\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u044e \u0442\u0435\u043c, \u043a\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0442\u044c \u044d\u0442\u043e\u0442 \u0434\u0432\u0438\u0436\u043e\u043a, \u043e\u0441\u043e\u0431\u043e\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0443\u0434\u0435\u043b\u0438\u0442\u044c \u043f\u0435\u0440\u0435\u0440\u0430\u0431\u043e\u0442\u043a\u0435 \u043a\u043e\u0434\u0430, \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u043e\u0433\u043e \u0441 \u0440\u0430\u0431\u043e\u0442\u043e\u0439 \u0441 \u043f\u0430\u043c\u044f\u0442\u044c\u044e.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool grFont::load_index(XStream&amp; fh) {   int buf_sz = fh.size();   char* buf = new char[buf_sz];   ....   delete buf;   return true; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v611\/\">V611<\/a> The memory was allocated using the &#8216;operator new[]&#8217; but was released using the &#8216;operator delete&#8217;. The &#8216;delete[] buf;&#8217; statement should be used instead. gr_font.cpp 72<\/p>\n<p>  <\/p>\n<p>\u0412\u044b\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0435\u043d\u0438\u044f \u0434\u043e\u043b\u0436\u0435\u043d \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043e\u043f\u0435\u0440\u0430\u0442\u043e\u0440 <em>delete[]<\/em>. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool grFont::load_index(XStream&amp; fh) {   int buf_sz = fh.size();   char* buf = new char[buf_sz];   ....   delete[] buf;   return true; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0425\u043e\u0442\u044f \u043d\u0435\u0442. \u042d\u0442\u043e \u0442\u043e\u0436\u0435 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u0439 \u043a\u043e\u0434. \u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e \u2014 \u044d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u043c\u043d\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool grFont::load_index(XStream&amp; fh) {   int buf_sz = fh.size();   auto buf = std::make_unique&lt;char[]>(buf_sz);   ....   return true; }<\/code><\/pre>\n<p>  <\/p>\n<p>P.S.: \u0415\u0449\u0451 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043c\u0435\u0441\u0442 \u0441 \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043e\u0448\u0438\u0431\u043a\u043e\u0439:<\/p>\n<p>  <\/p>\n<ul>\n<li>V611 The memory was allocated using the &#8216;operator new[]&#8217; but was released using the &#8216;operator delete&#8217;. The &#8216;delete[] buf;&#8217; statement should be used instead. gr_font.cpp 101<\/li>\n<li>V611 The memory was allocated using the &#8216;operator new[]&#8217; but was released using the &#8216;operator delete&#8217;. The &#8216;delete[] alpha_buffer_;&#8217; statement should be used instead. Check lines: 25, 168. gr_font.cpp 25<\/li>\n<li>V611 The memory was allocated using the &#8216;operator new[]&#8217; but was released using the &#8216;operator delete&#8217;. The &#8216;delete[] buffer;&#8217; statement should be used instead. qda_editor.cpp 1012<\/li>\n<\/ul>\n<p>  <\/p>\n<h2 id=\"preduprezhdenie-n4-funkciya-ne-vozvraschaet-znachenie\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N4: \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043d\u0435 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">class qdSound : public qdNamedObject, public qdResource {   ....   \/\/! \u0412\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u044c \u0437\u0432\u0443\u043a\u0430 \u0432 \u0441\u0435\u043a\u0443\u043d\u0434\u0430\u0445.   float length() const {  #ifndef __QD_SYSLIB__     return sound_.length();  #endif   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v591\/\">V591<\/a> Non-void function should return a value. qd_sound.h 70<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d \u043c\u0430\u043a\u0440\u043e\u0441 <em>__QD_SYSLIB__<\/em>, \u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em>length<\/em> \u0431\u0443\u0434\u0435\u0442 \u0443\u0441\u0442\u0440\u043e\u0435\u043d\u0430 \u0442\u0430\u043a:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">float length() const {  }<\/code><\/pre>\n<p>  <\/p>\n<p>\u0412\u044b\u0437\u043e\u0432 \u0442\u0430\u043a\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e.<\/p>\n<p>  <\/p>\n<p><strong>\u041f\u0440\u0438\u043c\u0435\u0447\u0430\u043d\u0438\u0435.<\/strong> \u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u044b \u0441\u0447\u0438\u0442\u0430\u044e\u0442, \u0447\u0442\u043e \u0432 \u0442\u0430\u043a\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u0441\u0432\u043e\u0434\u0438\u0442\u0441\u044f \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0441\u043b\u0443\u0447\u0430\u0439\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041d\u0435\u0442. \u041d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u0435 \u2014 \u044d\u0442\u043e \u0432\u0441\u0451, \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u044b\u0439 \u043f\u0440\u0438\u043c\u0435\u0440 \u0432 \u044d\u0442\u043e\u0439 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/0917\/\">\u0441\u0442\u0430\u0442\u044c\u0435<\/a>.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u044e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043a\u043e\u0434 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#ifndef __QD_SYSLIB__   float length() const {      return sound_.length();    } #endif<\/code><\/pre>\n<p>  <\/p>\n<p>\u042d\u0442\u043e \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0447\u0430\u0441\u0442\u044c \u0432\u043d\u0435\u0448\u043d\u0435\u0433\u043e \u043a\u043e\u0434\u0430 \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u043d\u0435\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c\u0441\u044f. \u0412\u043e\u0442 \u0438 \u043e\u0442\u043b\u0438\u0447\u043d\u043e. \u042d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0442\u043e\u0436\u0435 \u043d\u0430\u0434\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430, \u0440\u0430\u0437 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 &#171;\u043c\u0451\u0440\u0442\u0432\u0443\u044e&#187; \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>length<\/em>.<\/p>\n<p>  <\/p>\n<p>\u0415\u0441\u043b\u0438 \u0442\u0430\u043a\u043e\u0439 \u0440\u0430\u0434\u0438\u043a\u0430\u043b\u044c\u043d\u044b\u0439 \u043f\u043e\u0434\u0445\u043e\u0434 \u043f\u043e \u043a\u0430\u043a\u0438\u043c-\u0442\u043e \u043f\u0440\u0438\u0447\u0438\u043d\u0430\u043c \u043d\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0439\u0442\u0438 \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">#ifndef __QD_SYSLIB__   float length() const {      return sound_.length();    } #else   [[noreturn]] float length() const {      throw std::logic_error { \"Function not implemented\" };   } #endif<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"preduprezhdenie-n5-utechka-pamyati\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N5: \u0443\u0442\u0435\u0447\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">template&lt;class FilterClass> LineContribType* C2PassScale&lt;FilterClass>::AllocContributions(UINT uLineLength,                                                                UINT uWindowSize) {   static LineContribType line_ct;    LineContribType *res = new LineContribType;     line_ct.WindowSize = uWindowSize;    line_ct.LineLength = uLineLength;     if (contribution_buffer_.size() &lt; uLineLength)     contribution_buffer_.resize(uLineLength);    line_ct.ContribRow = &amp;*contribution_buffer_.begin();    if (weights_buffer_.size() &lt; uLineLength * uWindowSize)     weights_buffer_.resize(uLineLength * uWindowSize);    double* p = &amp;*weights_buffer_.begin();    for (UINT u = 0; u &lt; uLineLength; u++) {     line_ct.ContribRow[u].Weights = p;     p += uWindowSize;   }   return &amp;line_ct; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v773\/\">V773<\/a> The function was exited without releasing the &#8216;res&#8217; pointer. A memory leak is possible. 2PassScale.h 107<\/p>\n<p>  <\/p>\n<p>\u0412\u043e\u0442 \u044d\u0442\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0430 \u0432 \u043a\u043e\u0434\u0435 \u043b\u0438\u0448\u043d\u044f\u044f:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">LineContribType *res = new LineContribType;<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043e\u0437\u0434\u0430\u043d\u043d\u044b\u0439 \u043e\u0431\u044a\u0435\u043a\u0442 \u043d\u0438\u0433\u0434\u0435 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0438 \u043d\u0435 \u0443\u0434\u0430\u043b\u044f\u0435\u0442\u0441\u044f. \u0415\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u2014 \u0443\u0442\u0435\u0447\u043a\u0430 \u043f\u0430\u043c\u044f\u0442\u0438.<\/p>\n<p>  <\/p>\n<h2 id=\"preduprezhdenie-n6-oshibka-v-logike\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N6: \u043e\u0448\u0438\u0431\u043a\u0430 \u0432 \u043b\u043e\u0433\u0438\u043a\u0435<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool qdConditionGroup::remove_condition(int condition_id) {   ....   conditions_container_t::iterator it1 = std::find(conditions_.begin(),                                                    conditions_.end(),                                                    condition_id);   if (it1 != conditions_.end())     return false;    conditions_.erase(it1);   return true; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v783\/\">V783<\/a> Dereferencing of the invalid iterator &#8216;it1&#8217; might take place. qd_condition_group.cpp 58<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u043f\u044b\u0442\u043a\u0430 \u0443\u0434\u0430\u043b\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0435\u0433\u043e \u044d\u043b\u0435\u043c\u0435\u043d\u0442\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">conditions_.erase(conditions_.end());<\/code><\/pre>\n<p>  <\/p>\n<p>\u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u0432 \u0443\u0441\u043b\u043e\u0432\u0438\u0438 \u0434\u043e\u043f\u0443\u0449\u0435\u043d\u0430 \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430, \u0438 \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">if (it1 == conditions_.end())   return false;  conditions_.erase(it1);<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"preduprezhdenie-n7-opasnaya-rabota-s-tipom-hresult\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N7: \u043e\u043f\u0430\u0441\u043d\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430 \u0441 \u0442\u0438\u043f\u043e\u043c HRESULT<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">class winVideo {   ....   struct IGraphBuilder*  graph_builder_;   .... };  bool winVideo::open_file(const char *fname) {   ....   if (graph_builder_ -> RenderFile(wPath,NULL))   {     close_file(); return false;   }   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041d\u0430 \u043f\u0435\u0440\u0432\u044b\u0439 \u0432\u0437\u0433\u043b\u044f\u0434 \u043a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441 \u043a\u043e\u0434\u043e\u043c \u0432\u0441\u0451 \u0445\u043e\u0440\u043e\u0448\u043e. \u041d\u043e \u0434\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em>RenderFile<\/em> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0438\u043f <em><a href=\"https:\/\/en.wikipedia.org\/wiki\/HRESULT\">HRESULT<\/a><\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">HRESULT RenderFile(   [in] LPCWSTR lpcwstrFile,   [in] LPCWSTR lpcwstrPlayList );<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043d\u0435\u043d\u0430\u0434\u0451\u0436\u043d\u043e\u0439.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v545\/\">V545<\/a> Such conditional expression of &#8216;if&#8217; statement is incorrect for the HRESULT type value &#8216;graph_builder_->RenderFile(wPath, 0)&#8217;. The SUCCEEDED or FAILED macro should be used instead. WinVideo.cpp 139<\/p>\n<p>  <\/p>\n<p><em>HRESULT<\/em> \u2014 \u044d\u0442\u043e 32-\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0440\u0430\u0437\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u0435 \u043d\u0430 \u0442\u0440\u0438 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043e\u043b\u044f: \u043a\u043e\u0434 \u0441\u0435\u0440\u044c\u0451\u0437\u043d\u043e\u0441\u0442\u0438 \u043e\u0448\u0438\u0431\u043a\u0438, \u043a\u043e\u0434 \u0443\u0441\u0442\u0440\u043e\u0439\u0441\u0442\u0432\u0430 \u0438 \u043a\u043e\u0434 \u043e\u0448\u0438\u0431\u043a\u0438. \u0414\u043b\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0442\u0438\u043f\u0430 <em>HRESULT<\/em> \u043f\u0440\u0435\u0434\u043d\u0430\u0437\u043d\u0430\u0447\u0435\u043d\u044b \u0442\u0430\u043a\u0438\u0435 \u043c\u0430\u043a\u0440\u043e\u0441\u044b, \u043a\u0430\u043a <em>SUCCEEDED<\/em>, <em>FAILED<\/em>.<\/p>\n<p>  <\/p>\n<p>\u0422\u0438\u043f <em>HRESULT<\/em> \u0438\u043c\u0435\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0439. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c 0L (<em>S_OK<\/em>), 0x80000002L (Ran out of memory), 0x80004005L (unspecified failure) \u0438 \u0442. \u0434. \u041e\u0431\u0440\u0430\u0442\u0438\u0442\u0435 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435, \u0447\u0442\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u0435 <em>S_OK<\/em> \u043a\u043e\u0434\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a 0.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u043b\u044e\u0431\u043e\u0439 \u0441\u0442\u0430\u0442\u0443\u0441, \u043a\u0440\u043e\u043c\u0435 <em>S_OK<\/em>, \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u043c, \u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u0434\u043e\u0441\u0440\u043e\u0447\u043d\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0430\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0443. \u0412 \u0446\u0435\u043b\u043e\u043c, \u0432\u0438\u0434\u0438\u043c\u043e, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u0441\u0435\u0439\u0447\u0430\u0441 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u043e, \u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d \u043d\u0435\u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e. \u041d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0435\u0444\u0430\u043a\u0442\u043e\u0440\u0438\u043d\u0433 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043a\u0442\u043e-\u0442\u043e \u043f\u043e\u0434\u0443\u043c\u0430\u0435\u0442, \u0447\u0442\u043e \u0444\u0443\u043d\u043a\u0446\u0438\u044f <em>RenderFile<\/em> \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0442\u0438\u043f <em>bool<\/em>, \u043f\u0440\u0438\u0432\u0435\u0434\u0451\u0442 \u043a \u0431\u0430\u0433\u0443.<\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">if (FAILED(graph_builder_ -> RenderFile(wPath,NULL))) {   close_file(); return false; }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"preduprezhdenie-n8-false-vmesto-nullptr\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N8: false \u0432\u043c\u0435\u0441\u0442\u043e nullptr<\/h2>\n<p>  <\/p>\n<p>\u042d\u0442\u043e\u0442 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430, \u043a\u0430\u043a \u0438 \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043d\u044b\u0439 \u0432\u044b\u0448\u0435, \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u041d\u043e \u043d\u0430\u0437\u0432\u0430\u0442\u044c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0435\u0433\u043e \u043d\u0435\u043b\u044c\u0437\u044f.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">const char* qdInterfaceDispatcher::get_save_title() const {   if (!cur_screen_)     return false;   ....   return false; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u044f PVS-Studio \u043d\u0430 \u0441\u0442\u0440\u043e\u0447\u043a\u0438 &#171;return false&#187;:<\/p>\n<p>  <\/p>\n<ul>\n<li><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v601\/\">V601<\/a> The &#8216;false&#8217; value is implicitly cast to the pointer. qd_interface_dispatcher.cpp 772<\/li>\n<li>V601 The &#8216;false&#8217; value is implicitly cast to the pointer. qd_interface_dispatcher.cpp 783<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435 <em>false<\/em> \u043d\u0435\u044f\u0432\u043d\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u043a \u043d\u0443\u043b\u0435\u0432\u043e\u043c\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e, \u0438 \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043a\u0430\u043a \u0438 \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043e. \u0422\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435 \u0445\u043e\u0442\u044f \u0431\u044b \u0432\u043e \u0438\u043c\u044f \u043a\u0440\u0430\u0441\u043e\u0442\u044b \u0438 \u043f\u0440\u0438\u043b\u0438\u0447\u0438\u044f \u043d\u0430\u0434\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c <em>nullptr<\/em>:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">const char* qdInterfaceDispatcher::get_save_title() const {   if (!cur_screen_)     return nullptr;   ....   return nullptr; }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"preduprezhdenie-n9-chto-to-ne-tak-no-ne-znayu-chto\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N9: \u0447\u0442\u043e-\u0442\u043e \u043d\u0435 \u0442\u0430\u043a, \u043d\u043e \u043d\u0435 \u0437\u043d\u0430\u044e \u0447\u0442\u043e<\/h2>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0448\u0443 \u043f\u0440\u043e\u0449\u0435\u043d\u0438\u044f \u0437\u0430 \u0434\u043b\u0438\u043d\u043d\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u043a\u043e\u0434\u0430. \u042f \u043d\u0435 \u043f\u0440\u0438\u0434\u0443\u043c\u0430\u043b, \u043a\u0430\u043a \u0435\u0433\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c, \u043d\u0435 \u0441\u0434\u0435\u043b\u0430\u0432 \u0435\u0449\u0451 \u0431\u043e\u043b\u0435\u0435 \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u044b\u043c.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">Vect2s qdGameObjectMoving::get_nearest_walkable_point(const Vect2s&amp; target) const {   ....   \/\/ \u0418\u0434\u0435\u043c \u0441 \u043a\u043e\u043d\u0446\u0430. \u0415\u0441\u043b\u0438 \u043d\u0430\u0442\u044b\u043a\u0430\u0435\u043c\u0441\u044f \u043d\u0430 \u043f\u0440\u043e\u0445\u043e\u0434\u0438\u043c\u0443\u044e \u0442\u043e\u0447\u043a\u0443, \u043e\u0442\u043b\u0438\u0447\u043d\u0443\u044e \u043e\u0442 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0439   bool fir_step = true;   if (abs(x2 - x1) > abs(y2 - y1)) {     int dx = int(float(x2 - x1)\/dr.x);     do {       if (false == is_walkable(Vect2s(r.xi(),r.yi())))       {         \/\/ \u0415\u0441\u043b\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u0435\u0440\u0432\u044b\u0439 \u0448\u0430\u0433, \u0442\u043e \u043d\u0435\u0443\u0434\u0430\u0447\u0430         if (fir_step) return Vect2s(-1, -1);         r -= dr;         return Vect2s(r.xi(),r.yi());       }        fir_step = false;       r += dr;     } while (--dx >= 0);   }   else {     int dy = int(float(y2 - y1)\/dr.y);     do {       if (false == is_walkable(Vect2s(r.xi(),r.yi())))       {         if (fir_step) return Vect2s(-1, -1);         r -= dr;         return Vect2s(r.xi(),r.yi());       }        fir_step = false;       r += dr;     } while (--dy >= 0);   }    \/\/ \u0415\u0441\u043b\u0438 \u0448\u0430\u0433 \u0442\u0430\u043a \u0438 \u043d\u0435 \u0431\u044b\u043b \u0441\u0434\u0435\u043b\u0430\u043d   if (fir_step) return trg;   .... }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0448\u0443 \u0438\u0437\u0443\u0447\u0438\u0442\u044c \u0446\u0438\u043a\u043b\u044b. \u0415\u0441\u043b\u0438 \u043e\u043d\u0438 \u043d\u0435 \u0437\u0430\u043a\u0430\u043d\u0447\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u044b\u0445\u043e\u0434\u043e\u043c \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0442\u043e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>fir_step<\/em> \u043f\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e \u0446\u0438\u043a\u043b\u043e\u0432 \u0432\u0441\u0435\u0433\u0434\u0430 \u0440\u0430\u0432\u043d\u0430 <em>false<\/em>.<\/p>\n<p>  <\/p>\n<p>\u0421\u043e\u043e\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u044d\u0442\u043e\u0442 \u043a\u043e\u0434 \u043d\u0435 \u0438\u043c\u0435\u0435\u0442 \u0441\u043c\u044b\u0441\u043b\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">\/\/ \u0415\u0441\u043b\u0438 \u0448\u0430\u0433 \u0442\u0430\u043a \u0438 \u043d\u0435 \u0431\u044b\u043b \u0441\u0434\u0435\u043b\u0430\u043d if (fir_step) return trg;<\/code><\/pre>\n<p>  <\/p>\n<p>\u041e\u0431 \u044d\u0442\u043e\u043c \u0438 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v547\/\">V547<\/a> Expression &#8216;fir_step&#8217; is always false. qd_game_object_moving.cpp 1724<\/p>\n<p>  <\/p>\n<p>\u0421\u0442\u0440\u043e\u0447\u043a\u0430 \u0441 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043b\u0438\u0448\u043d\u0435\u0439, \u0438\u043b\u0438 \u0432 \u0446\u0438\u043a\u043b\u0430\u0445 \u0438\u043c\u0435\u0435\u0442\u0441\u044f \u043b\u043e\u0433\u0438\u0447\u0435\u0441\u043a\u0430\u044f \u043e\u0448\u0438\u0431\u043a\u0430. \u041a \u0441\u043e\u0436\u0430\u043b\u0435\u043d\u0438\u044e, \u044f \u043d\u0435 \u043c\u043e\u0433\u0443 \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u0435\u0435, \u0442\u0430\u043a \u043a\u0430\u043a \u043d\u0435 \u0437\u043d\u0430\u043a\u043e\u043c \u0441 \u043a\u043e\u0434\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0430.<\/p>\n<p>  <\/p>\n<h2 id=\"preduprezhdenie-n10-strictly-aligned\">\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 N10: strictly aligned<\/h2>\n<p>  <\/p>\n<pre><code class=\"cpp\">bool zipContainer::find_index() {   const int buf_sz = 1024;   char buf[buf_sz];    stream_.seek(0,XS_END);    while (stream_.tell() >= buf_sz) {     stream_.seek(-buf_sz,XS_CUR);     stream_.read(buf,buf_sz);      const unsigned long idx_signature = 0x06054b50L;      for (int i = 0; i &lt; buf_sz - sizeof(long) * 3; i++) {       if (*((unsigned long*)(buf + i)) == idx_signature) {         XBuffer xbuf(buf + i + sizeof(long) + sizeof(unsigned short) * 4,                      sizeof(long) * 2);         xbuf > index_size_ > index_offset_;         return true;       }     }   }    return false; }<\/code><\/pre>\n<p>  <\/p>\n<p>\u041f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 PVS-Studio: <a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v1032\/\">V1032<\/a> The pointer &#8216;buf&#8217; is cast to a more strictly aligned pointer type. zip_container.cpp 237<\/p>\n<p>  <\/p>\n<p>\u0412 \u0431\u0430\u0439\u0442\u043e\u0432\u043e\u043c \u0431\u0443\u0444\u0435\u0440\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u043f\u043e\u0438\u0441\u043a \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b <em>0x06054b50L<\/em>. \u042d\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043d\u0435\u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0438\u043c\u044b\u043c, \u043e\u043f\u0430\u0441\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>  <\/p>\n<p>\u041d\u0430\u0447\u043d\u0451\u043c \u0441 \u0442\u043e\u0433\u043e, \u0447\u0442\u043e \u043d\u0435\u043f\u043e\u043d\u044f\u0442\u043d\u043e, \u043a\u0430\u043a\u0430\u044f \u0438\u043c\u0435\u043d\u043d\u043e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u0438\u0449\u0435\u0442\u0441\u044f. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0438\u043f <em>long<\/em> \u0438\u043c\u0435\u0435\u0442 <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/terms\/0012\/\">\u0440\u0430\u0437\u043d\u044b\u0439 \u0440\u0430\u0437\u043c\u0435\u0440<\/a> \u043d\u0430 \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u0445. \u0427\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e <em>long<\/em> \u0431\u044b\u0432\u0430\u0435\u0442 32-\u0431\u0438\u0442\u043d\u044b\u043c \u0438 64-\u0431\u0438\u0442\u043d\u044b\u043c. \u0412 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043a\u0430\u0442\u044c\u0441\u044f:<\/p>\n<p>  <\/p>\n<ul>\n<li>\u0421\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u0438\u0437 4 \u0431\u0430\u0439\u0442 0x06054b50;<\/li>\n<li>\u0418\u043b\u0438 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u0438\u0437 8 \u0431\u0430\u0439\u0442 0x0000000006054b50.<\/li>\n<\/ul>\n<p>  <\/p>\n<p>\u0412\u0440\u044f\u0434 \u043b\u0438 \u043f\u0440\u0435\u0434\u043f\u043e\u043b\u0430\u0433\u0430\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0440\u0430\u0437\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430. \u0421\u043a\u043e\u0440\u0435\u0435 \u0432\u0441\u0435\u0433\u043e, \u043e\u043d\u0430 \u0432\u0441\u0435\u0433\u0434\u0430 4-\u0431\u0430\u0439\u0442\u043e\u0432\u0430\u044f. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0435\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0442\u0438\u043f \u0444\u0438\u043a\u0441\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 <em>uint32_t<\/em>.<\/p>\n<p>  <\/p>\n<p>\u041e\u0434\u043d\u0430\u043a\u043e \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0435\u043d\u0438\u0435 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043f\u0440\u043e \u0438\u043d\u043e\u0435. \u0414\u0435\u043b\u043e \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0442\u0438\u043f\u0430 <em>char*.<\/em> \u0427\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0441\u0442\u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0430\u0434\u0440\u0435\u0441 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f (<em>char *<\/em>) \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043a\u0430\u043a \u0431\u043b\u043e\u043a \u0438\u0437 4\/8 \u0431\u0430\u0439\u0442 (<em>unsigned long *<\/em>). \u041a\u0430\u0440\u0442\u0438\u043d\u043a\u0430 \u0434\u043b\u044f \u043f\u043e\u044f\u0441\u043d\u0435\u043d\u0438\u044f:<\/p>\n<p>  <\/p>\n<p><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/cg\/j3\/ir\/cgj3ir2tc9ehgvpokw2nviakjfy.png\" alt=\"\u041f\u043e\u0438\u0441\u043a \u0441\u0438\u0433\u043d\u0430\u0442\u0443\u0440\u044b \u0432 \u043f\u0430\u043c\u044f\u0442\u0438\" data-src=\"https:\/\/habrastorage.org\/webt\/cg\/j3\/ir\/cgj3ir2tc9ehgvpokw2nviakjfy.png\"\/><\/p>\n<p>  <\/p>\n<p>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u043d\u0438\u0435. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0442\u0438\u043f\u0430 <em>unsigned long<\/em> \u0434\u043e\u043b\u0436\u043d\u044b \u043b\u0435\u0436\u0430\u0442\u044c \u043f\u043e \u0430\u0434\u0440\u0435\u0441\u0430\u043c, \u043a\u0440\u0430\u0442\u043d\u044b\u043c 4 \u0438\u043b\u0438 8 \u0431\u0430\u0439\u0442\u0430\u043c (\u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e, \u0432 \u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u0442 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b).<\/p>\n<p>  <\/p>\n<p>\u0414\u043e\u0441\u0442\u0443\u043f \u043f\u043e \u043d\u0435\u0432\u044b\u0440\u043e\u0432\u043d\u0435\u043d\u043d\u043e\u043c\u0443 \u0430\u0434\u0440\u0435\u0441\u0443 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u043d\u0435\u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0451\u043d\u043d\u043e\u043c\u0443 \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044e. \u041a\u0430\u043a \u043e\u043d\u043e \u0441\u0435\u0431\u044f \u043f\u0440\u043e\u044f\u0432\u0438\u0442, \u043f\u0440\u0435\u0434\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0438 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u044d\u0442\u043e \u043e\u0442 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u044b \u043c\u0438\u043a\u0440\u043e\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440\u0430. \u041d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0440\u043e\u044f\u0442\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438:<\/p>\n<p>  <\/p>\n<ol>\n<li>\u041f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0430\u0432\u0430\u0440\u0438\u0439\u043d\u043e\u0435 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b.<\/li>\n<li>\u0411\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u043d\u043e \u043d\u0435\u0432\u0435\u0440\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0433\u0443\u0442 \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c\u0441\u044f \u0434\u0432\u0430 \u043c\u043b\u0430\u0434\u0448\u0438\u0445 \u0431\u0438\u0442\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0438 \u0447\u0442\u0435\u043d\u0438\u0435 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u0441\u044f \u043f\u043e \u0433\u0440\u0430\u043d\u0438\u0446\u0430\u043c, \u043a\u0440\u0430\u0442\u043d\u044b\u043c 4 \u0431\u0430\u0439\u0442\u0430\u043c.<\/li>\n<li>\u0427\u0442\u0435\u043d\u0438\u0435 \u0434\u0430\u043d\u043d\u044b\u0445 \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0442\u044c\u0441\u044f \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0443 \u043f\u0440\u0438\u0434\u0451\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438.<\/li>\n<li>\u0412\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u043e, \u043f\u043e \u043a\u0440\u0430\u0439\u043d\u0435\u0439 \u043c\u0435\u0440\u0435 \u043f\u043e\u043a\u0430 \ud83d\ude42<\/li>\n<\/ol>\n<p>  <\/p>\n<p>\u0418\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u0440\u0430\u0437\u043d\u044b\u043c\u0438 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u0430\u043c\u0438. \u0421\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u2014 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>memcmp<\/em>, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u043c\u0430\u0441\u0441\u0438\u0432\u0430 \u0431\u0430\u0439\u0442.<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">if (memcmp(buf + i, &amp;idx_signature, sizeof(idx_signature)) == 0)<\/code><\/pre>\n<p>  <\/p>\n<p>\u0410 \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043a\u043e\u0434 \u043d\u0430 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u043c C++, \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u0444\u0443\u043d\u043a\u0446\u0438\u044e <em>memcmp<\/em> \u0438\u0437 \u043c\u0438\u0440\u0430 C?<\/p>\n<p>  <\/p>\n<p>\u041c\u043e\u0436\u043d\u043e, \u043d\u043e, \u0435\u0441\u043b\u0438 \u0447\u0435\u0441\u0442\u043d\u043e, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0434\u043b\u0438\u043d\u043d\u0435\u0435. \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043f\u0440\u0438\u0432\u0435\u0434\u0443 \u0442\u0430\u043a\u043e\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0438\u0437 \u0441\u043f\u043e\u0440\u0442\u0438\u0432\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0430:<\/p>\n<p>  <\/p>\n<pre><code class=\"cpp\">const uint32_t idx_sig = 0x06054b50L;  const std::ranges::subrange   haystack { buf, buf + buf_sz - sizeof(idx_sig) * 3 }; const auto needle = std::bit_cast&lt;std::array&lt;char, sizeof(idx_sig)>>(idx_sig);  if (auto res = std::ranges::search(haystack, needle); !std::empty(res)) {   XBuffer xbuf(it + sizeof(uint32_t) + sizeof(uint16_t) * 4,                sizeof(uint32_t) * 2);   xbuf > index_size_ > index_offset_;   return true; }<\/code><\/pre>\n<p>  <\/p>\n<h2 id=\"eschyo-chto-to-ostalos\">\u0415\u0449\u0451 \u0447\u0442\u043e-\u0442\u043e \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c?<\/h2>\n<p>  <\/p>\n<p>\u0415\u0441\u0442\u044c \u0435\u0449\u0451 \u043e\u0434\u043d\u0430 \u043e\u0448\u0438\u0431\u043a\u0430, \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0449\u0430\u044f \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f. \u041e\u043d\u0430 \u0441\u0432\u044f\u0437\u0430\u043d\u043d\u0430 \u0441 \u043e\u0431\u044a\u0435\u043a\u0442\u043d\u043e-\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u043c \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435\u043c \u0438 \u043f\u043e\u0442\u0440\u0435\u0431\u0443\u0435\u0442 \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u043e\u0433\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u044f \u0432\u044b\u043d\u0435\u0441\u0443 \u0435\u0451 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e, \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044e\u044e \u0441\u0442\u0430\u0442\u044c\u044e.<\/p>\n<p>  <\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e \u0437\u0430 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435. \u041f\u043e\u0434\u043f\u0438\u0441\u044b\u0432\u0430\u0439\u0442\u0435\u0441\u044c \u043d\u0430 \u0435\u0436\u0435\u043c\u0435\u0441\u044f\u0447\u043d\u044b\u0439 <a href=\"https:\/\/pvs-studio.ru\/ru\/subscribe\/\">\u0434\u0430\u0439\u0434\u0436\u0435\u0441\u0442 \u0441\u0442\u0430\u0442\u0435\u0439<\/a>, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e\u0435.<\/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: Andrey Karpov. <a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/1123\/\">Let&#8217;s check the qdEngine game engine, part three: 10 more bugs<\/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\/814821\/\"> https:\/\/habr.com\/ru\/articles\/814821\/<\/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><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ii\/np\/tx\/iinptxtkd0nzigwueh7cvx9iztk.png\" alt=\"\u0427\u0430\u0441\u0442\u044c \u0442\u0440\u0435\u0442\u044c\u044f\" data-src=\"https:\/\/habrastorage.org\/webt\/ii\/np\/tx\/iinptxtkd0nzigwueh7cvx9iztk.png\"\/><\/p>\n<p>  <\/p>\n<p>\u0412 \u043f\u0435\u0440\u0432\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u043f\u0440\u043e qdEngine \u0431\u044b\u043b\u043e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u043e 10 \u043e\u0448\u0438\u0431\u043e\u043a, \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u044b\u0445 \u043f\u043b\u0430\u0433\u0438\u043d\u043e\u043c PVS-Studio. \u041e\u0434\u043d\u0430\u043a\u043e \u0435\u0441\u0442\u044c \u0435\u0449\u0451 10 \u0431\u0430\u0433\u043e\u0432, \u0437\u0430\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u044e\u0449\u0438\u0445 \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u044f. \u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u043b\u0443\u0447\u0448\u0435 \u0443\u0447\u0438\u0442\u044c\u0441\u044f \u043d\u0430 \u0447\u0443\u0436\u0438\u0445 \u043e\u0448\u0438\u0431\u043a\u0430\u0445. \u0417\u0430\u043e\u0434\u043d\u043e \u043e\u043d\u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0438\u0440\u0443\u044e\u0442 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 PVS-Studio \u0432 \u0432\u044b\u044f\u0432\u043b\u0435\u043d\u0438\u0438 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u0435\u0439\u0448\u0438\u0445 \u043e\u0448\u0438\u0431\u043e\u0447\u043d\u044b\u0445 \u043f\u0430\u0442\u0442\u0435\u0440\u043d\u043e\u0432.<\/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-376316","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/376316","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=376316"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/376316\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=376316"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=376316"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=376316"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}