{"id":360486,"date":"2024-05-21T00:54:18","date_gmt":"2024-05-21T00:54:18","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=360486"},"modified":"-0001-11-30T00:00:00","modified_gmt":"2024-05-21T00:54:18","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=360486","title":{"rendered":"<span>\u0418\u0433\u043e\u0440\u044b! \u041a\u0430\u043a \u043f\u0438\u0448\u0443\u0442 \u043a\u043e\u0434 \u0434\u043b\u044f SDL (+ \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u0441 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u043c)<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u0436\u0435\u043a \u041b\u043e\u043d\u0434\u043e\u043d \u043a\u0430\u043a-\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b: &#171;\u041d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0436\u0434\u0430\u0442\u044c \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f, \u0437\u0430 \u043d\u0438\u043c \u043d\u0430\u0434\u043e \u0433\u043e\u043d\u044f\u0442\u044c\u0441\u044f \u0441 \u0434\u0443\u0431\u0438\u043d\u043a\u043e\u0439&#187;. \u0415\u0441\u043b\u0438 \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438\u0433\u0440, \u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 SDL \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0434\u0443\u0431\u0438\u043d\u043a\u043e\u0439. \u041d\u043e \u043a\u0430\u043a \u043e\u043d \u0441\u0434\u0435\u043b\u0430\u043d \u0441\u0430\u043c?<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/302\/ead\/50e\/302ead50e42f645bca84f20cd5916a91.png\" width=\"1600\" height=\"902\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/302\/ead\/50e\/302ead50e42f645bca84f20cd5916a91.png\"\/><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043a\u043e\u0433\u0434\u0430-\u043b\u0438\u0431\u043e \u0445\u043e\u0442\u0435\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0438\u0433\u0440\u0443, \u0432\u0430\u043c \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430\u0441\u044c SDL. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0448\u0442\u0443\u043a\u0438 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0431\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0441\u043c\u0441, \u0432\u0430\u043c \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430\u0441\u044c SDL. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c OpenGL, \u0442\u043e \u0432\u0430\u043c \u0442\u043e\u0447\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430\u0441\u044c SDL.<\/p>\n<p>\u0410 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430\u0441\u044c, \u0442\u043e \u043c\u044b \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438 \u0438 \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0441 \u043d\u0435\u0439 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f! \u0412\u0435\u0434\u044c SDL \u2014 \u044d\u0442\u043e \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0430\u0443\u0434\u0438\u043e, \u0438\u043d\u043f\u0443\u0442\u043e\u0432 \u0438 \u0432\u0441\u0435\u0433\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u0436\u0435, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u0432\u043e\u044e \u0438\u0433\u0440\u0443!<\/p>\n<p>\u0421\u0440\u0435\u0434\u0438 \u0438\u0433\u0440, \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 SDL, \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0438\u0441\u044c \u0442\u0430\u043a\u0438\u0435 \u0442\u0430\u0439\u0442\u043b\u044b, \u043a\u0430\u043a Neverwinter Nights, Dwarf Fortress, Amnesia, VVVVVV (\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/0707\/\">\u0441\u0445\u043e\u0436\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a>) \u0438 \u0432\u0435\u043b\u0438\u043a\u0430\u044f \u0438 \u0443\u0436\u0430\u0441\u043d\u0430\u044f Teeworlds (\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0412\u0441\u0435\u0433\u0434\u0430 \u0412\u0430\u0448 \u043f\u0440\u043e\u0432\u0451\u043b \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0445\u0443\u043a\u0443\u044f \u0442\u0443\u0434\u0430-\u0441\u044e\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0435\u043c\u0443 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u0440\u0438\u0437\u043d\u0430\u0432\u0430\u0442\u044c).<\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u0432 \u0445\u043e\u0434\u0443 \u0443\u0436\u0435 \u043d\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u0434\u0435\u0441\u044f\u0442\u043e\u043a \u043b\u0435\u0442 \u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0438 \u0435\u0433\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u043c. \u0422\u0430\u043a \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u0437\u043d\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0438 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0441 \u0444\u043e\u043d\u0430\u0440\u0438\u043a\u043e\u043c \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0430!<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0432\u0437\u044f\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u0443 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u0430\u0441, \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u041d\u0443 \u0447\u0442\u043e, \u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0442\u0435\u0440\u044f\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u0432\u043f\u0435\u0440\u0451\u0434!<\/p>\n<blockquote>\n<p>\u041f\u043e \u0445\u043e\u0434\u0443 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430. \u041f\u043e\u043c\u0435\u0442\u043a\u0438 \u0432 \u043d\u0438\u0445, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u043a\u0430\u043a \u043c\u043d\u043e\u0433\u043e\u0442\u043e\u0447\u0438\u0435 &#171;&#8230;.&#187;, \u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0430\u0432\u0442\u043e\u0440\u043e\u043c \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u0421\u0430\u043c\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/libsdl-org\/SDL\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c GitHub libsdl<\/a>. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0441\u043d\u0430\u0431\u0436\u0451\u043d \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>\u041a \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u043c\u0435\u0441\u0442\u0430 \u0443\u0436\u0435 \u043f\u043e\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u043d\u0430\u043c\u0438 issues (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/libsdl-org\/SDL\/issues\/8287\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0438 <a href=\"https:\/\/github.com\/libsdl-org\/SDL\/issues\/8289\">\u0442\u0430\u043c<\/a>), \u043d\u043e \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u041d\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0440\u043c\u043e\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u043d\u043e \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0445 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435!<\/p>\n<\/blockquote>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/a52\/781\/81a\/a5278181a750f848803b7c2113e69672.png\" width=\"1600\" height=\"2334\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/a52\/781\/81a\/a5278181a750f848803b7c2113e69672.png\"\/><\/figure>\n<h3>\u0414\u043e\u0432\u0435\u0440\u044f\u0439, \u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439<\/h3>\n<p>\u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0432\u044b \u0434\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u044f\u0437\u044b\u043a\u0430 \u0421? \u0425\u043e\u0442\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u043d\u0430\u0448\u0435\u043c\u0443 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e \u0442\u043e\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0434\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0435 \u0441\u0430\u043c\u0438\u043c \u0441\u0435\u0431\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f? \u041a\u0430\u043a \u0432\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043d\u0438\u0436\u0435?<\/p>\n<p>\u0424\u0430\u0439\u043b: SDL\/src\/stdlib\/SDL_iconv.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/bac7eeaaae00b929808ed8efe1a76e45a4e2c54b\/src\/stdlib\/SDL_iconv.c#L789\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">char *SDL_iconv_string(const char *tocode, const char *fromcode,                        const char *inbuf, size_t inbytesleft) {   SDL_iconv_t cd;   ....    cd = SDL_iconv_open(tocode, fromcode);   if (cd == (SDL_iconv_t)-1) {     \/* See if we can recover here (fixes iconv on Solaris 11) *\/     if (tocode == NULL || !*tocode) {       tocode = \"UTF-8\";     }     if (fromcode == NULL || !*fromcode) {       fromcode = \"UTF-8\";     }     cd = SDL_iconv_open(tocode, fromcode);   }   .... }<\/code><\/pre>\n<p>&#171;\u042f, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u0438 \u0441\u043a\u0430\u0437\u0430\u043b \u0431\u044b, \u2014 \u0432\u043e\u0437\u0440\u0430\u0437\u0438\u0442 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438 \u0447\u0443\u0442\u043a\u0438\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u2014 \u0441\u043a\u0430\u0437\u0430\u043b, \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0438\u043c\u0435\u043b\u0438 \u0434\u0435\u043b\u043e \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <em>iconv_open<\/em>. \u041d\u043e \u0442\u0443\u0442 \u0436\u0435 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043c\u0435\u0441\u0442\u043d\u0430\u044f \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f <em>SDL_iconv_open<\/em>!&#187;. \u041e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435! \u0412\u043e\u0442 \u043a\u0430\u043a \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/p>\n<p>\u0424\u0430\u0439\u043b:  SDL\/src\/stdlib\/SDL_iconv.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/bac7eeaaae00b929808ed8efe1a76e45a4e2c54b\/src\/stdlib\/SDL_iconv.c#L35\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode) {   return (SDL_iconv_t)((uintptr_t)iconv_open(tocode, fromcode)); }<\/code><\/pre>\n<p>\u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0432\u0448\u0438\u0441\u044c \u0441 \u044d\u0442\u0438\u043c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0435\u0451 \u043e\u043a\u0440\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438. \u041a\u043e\u0434 \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435 \u0434\u0430\u0451\u0442 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043d\u0430 \u0432\u0445\u043e\u0434 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u043d\u0443\u043b\u0435\u0432\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445 <em>tocode<\/em> \u0438 <em>fromcode<\/em>. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u043d\u0438 \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0441 \u0432\u0435\u0442\u0435\u0440\u043a\u043e\u043c \u043f\u043e\u043b\u0435\u0442\u044f\u0442 \u0438 \u0432 \u0441\u0430\u043c\u0443 <em>iconv_open<\/em>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 <em>man<\/em> \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/www.gnu.org\/software\/libiconv\/documentation\/libiconv-1.13\/iconv_open.3.html\">GNU<\/a>, \u0442\u043e \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u043c \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e <em>NULL<\/em> \u0442\u043e\u043b\u043a\u0430\u0442\u044c \u0432 \u043d\u0435\u0451 \u043d\u0435\u043b\u044c\u0437\u044f. &#171;\u0414\u0435\u043b\u043e \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u043e!&#187; \u2014 \u0441\u043a\u0430\u0436\u0435\u0442 \u043c\u043e\u043b\u043e\u0434\u043e\u0439 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u044b\u0441\u043a\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0441\u0442\u0432\u0430, \u043d\u043e \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u0430 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0451\u0448\u044c! \u041e\u043d \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043b\u044e\u0431\u0438\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0421\u0438\u0448\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0432\u0435\u0434\u044c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0421\u0438\u0448\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u2014 \u0432\u0435\u0441\u0435\u043b\u043e! <a href=\"https:\/\/github.com\/lattera\/glibc\/blob\/895ef79e04a953cac1493863bcae29ad85657ee1\/iconv\/iconv_open.c#L32\">\u0423\u0437\u0440\u0438\u0442\u0435<\/a> \u0438 \u0432\u044b!<\/p>\n<p>\u041d\u0443&#8230; \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043d\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 <em>strlen<\/em> \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 <em>NULL<\/em>. \u0412\u0441\u0435 \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e <em>strlen<\/em> \u0434\u0435\u043b\u0430\u0435\u0442 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0438 \u043c\u0430\u043b\u043e \u043a\u043e\u043c\u0443 \u044d\u0442\u043e \u043f\u043e \u0434\u0443\u0448\u0435!<\/p>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f, \u0442\u043e \u043f\u043e\u0441\u043f\u0435\u0448\u0438\u043c \u0432\u0430\u0441 \u0443\u0431\u0435\u0434\u0438\u0442\u044c \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u2014 <a href=\"https:\/\/github.com\/freebsd\/freebsd-src\/blob\/366ef17bb6ce008f79a283ff5dc5e87ab13dbdb3\/sys\/libkern\/iconv.c#L248\">BSD<\/a> \u0438 <a href=\"https:\/\/github.com\/kraj\/musl\/blob\/2e6edc1b699851fcbe9f7ab0fbd724624adde88a\/src\/locale\/iconv.c#L145\">Musl<\/a> \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u0440\u0430\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0431\u0435\u0437\u043e\u0431\u0438\u0434\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0435\u0441\u0442\u044c! \u041d\u043e \u0441\u0432\u043e\u0435\u0433\u043e \u0434\u0438\u043b\u0435\u0440\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0432 \u043b\u0438\u0446\u043e! \u041a\u0441\u0442\u0430\u0442\u0438, \u0430 \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u043e \u0432\u0430\u043c, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c\u0438 \u0412\u0430\u0448\u0435\u0433\u043e \u0432\u0435\u043d\u0434\u043e\u0440\u0430? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043e\u0431\u0449\u0430\u0435\u043c\u0441\u044f \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445!<\/p>\n<p>\u041d\u0443 \u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u043b \u0451\u043c\u043a\u043e\u0435:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v595\/\"><strong>V595<\/strong><\/a><strong> The &#8216;tocode&#8217; pointer was utilized before it was verified against nullptr. Check lines: 37, 789, 792. SDL\/src\/stdlib\/SDL_iconv.c:792:1<\/strong><\/p>\n<h3>\u041a\u0430\u0440\u0433\u043e \u043a\u0443\u043b\u044c\u0442<\/h3>\n<p>\u0421\u043a\u0430\u0436\u0438\u0442\u0435, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0443 \u0432\u0430\u0441 \u0442\u0430\u043a\u0438\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u0440\u0438\u0442\u0443\u0430\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0434\u043e \u0441\u043e\u0431\u043b\u044e\u0441\u0442\u0438 \u2014 \u0438\u043d\u0430\u0447\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u041f\u043e\u0433\u043b\u0430\u0434\u0438\u0442\u044c \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u0443\u044e \u0443\u0442\u043e\u0447\u043a\u0443, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c\u0438 \u0442\u0440\u0438 \u0440\u0430\u0437\u0430 \u043f\u043e\u0434\u0440\u044f\u0434? \u041d\u0438\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0445\u043e\u0436\u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f:<\/p>\n<p>\u0424\u0430\u0439\u043b: SDL\/src\/events\/SDL_mouse.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/4c3e84897fdf483394cf48c05df6d544afbe83ec\/src\/events\/SDL_mouse.c#L1372\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">SDL_Cursor *SDL_GetCursor(void) {   SDL_Mouse *mouse = SDL_GetMouse();   if (mouse == NULL) {     return NULL;   }   return mouse->cur_cursor; }<\/code><\/pre>\n<p>&#171;\u0427\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441-\u0442\u043e \u043d\u0435 \u0442\u0430\u043a?&#187; \u2014 \u0432\u0441\u043a\u0440\u0438\u043a\u043d\u0435\u0442 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c. \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u2014 \u0432\u0441\u0451 \u0447\u0435\u0441\u0442\u043d\u043e! \u041f\u043e\u043d\u0438\u043c\u0430\u0435\u043c, \u043c\u044b \u0436\u0435, \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432, \u0441\u0430\u043c\u0438 \u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u044b\u0448\u0435, \u0447\u0442\u043e \u0442\u0430\u043a \u0438 \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c! \u041d\u043e \u043f\u0440\u0438\u0437\u044b\u0432\u0430\u044e \u0432\u0430\u0441 \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u0443\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043e\u0442\u043a\u0443\u0434\u0430 \u043e\u043d \u0431\u0435\u0440\u0451\u0442\u0441\u044f.<\/p>\n<p>\u0424\u0430\u0439\u043b:  SDL\/src\/events\/SDL_mouse.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/4c3e84897fdf483394cf48c05df6d544afbe83ec\/src\/events\/SDL_mouse.c#L270\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">SDL_Mouse *SDL_GetMouse(void) {   return &amp;SDL_mouse; }<\/code><\/pre>\n<p>\u0422\u0430\u043a-\u0442\u0430\u043a, \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0430\u043a\u0430\u044f? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0437\u043d\u0430\u0435\u043c!<\/p>\n<p>\u0424\u0430\u0439\u043b: SDL\/src\/events\/SDL_mouse.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/4c3e84897fdf483394cf48c05df6d544afbe83ec\/src\/events\/SDL_mouse.c#L35\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">static SDL_Mouse SDL_mouse;<\/code><\/pre>\n<p>\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f! \u0422\u043e \u0435\u0441\u0442\u044c <em>NULL<\/em> \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u043e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u0442\u044c\u0441\u044f, \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c.<\/p>\n<p>\u0427\u0442\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0443, \u043a\u0440\u043e\u043c\u0435 \u0451\u043c\u043a\u043e\u0433\u043e:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v547\/\"><strong>V547<\/strong><\/a><strong> Expression &#8216;mouse == NULL&#8217; is always false. SDL\/src\/events\/SDL_mouse.c:1376:1<\/strong><\/p>\n<p><em>P.S. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u044f \u0432\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435, \u0442\u0435\u043b\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/em><\/p>\n<pre><code class=\"cpp\">return SDL_GetMouse()->cur_cursor;<\/code><\/pre>\n<p><em>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0444\u0430\u043a\u0442. \u041f\u0440\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u044e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 NULL \u0441\u044b\u0433\u0440\u0430\u0435\u0442 \u0437\u043b\u0443\u044e \u0448\u0443\u0442\u043a\u0443. \u041c\u044b \u0441\u043f\u0435\u0448\u0438\u043c \u0443\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c \u2013 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u044e\u0431\u043e\u0439 \u0443\u0432\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u0441\u0435\u0431\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0435\u0442, \u0447\u0442\u043e \u043d\u0430 NULL \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0438 \u0441\u043b\u043e\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, \u0438 \u043d\u0435\u0440\u0432\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430.<\/em><\/p>\n<p><em>\u041f\u0440\u043e\u0441\u0438\u043c \u0438 \u0442\u0435\u0445 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u0437\u0430\u043c\u0435\u0442\u044f\u0442, \u0447\u0442\u043e &#171;\u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0438 \u043d\u0430 \u0447\u0442\u043e&#187; \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430\u043c \u0432 \u0434\u043e\u043b\u0433 \u0442\u043e\u043b\u0438\u043a\u0443 \u0442\u0435\u0440\u043f\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u2013 \u043e\u0431\u0435\u0449\u0430\u0435\u043c, \u043d\u0438\u0436\u0435 \u043c\u044b \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435 \u0441 \u0435\u0449\u0451 \u043e\u0434\u043d\u0438\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c!<\/em><\/p>\n<h3>\u041b\u0438\u0431\u043e \u0434\u0435\u043b\u0430\u0439, \u043b\u0438\u0431\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0439<\/h3>\n<p>\u0410 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u043b\u044c\u0446\u0435\u0432 \u0443 \u043c\u0430\u0433\u0438\u0441\u0442\u0440\u0430 \u0419\u043e\u0434\u044b \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0442 \u0444\u0438\u043b\u044c\u043c\u0430 \u043a \u0444\u0438\u043b\u044c\u043c\u0443? \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u2014 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043a \u044f\u0437\u044b\u043a\u0443 \u0421! \u0415\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430:<\/p>\n<p>\u0424\u0430\u0439\u043b: \/SDL\/src\/render\/SDL_yuv_sw_c.h (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/6a381567b0412603054e3ecd77916085edffe94a\/src\/render\/SDL_yuv_sw.c#L124\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">struct SDL_SW_YUVTexture {   ....   int w, h;   .... };    typedef struct SDL_SW_YUVTexture SDL_SW_YUVTexture;<\/code><\/pre>\n<p>\u041a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u0435\u0441\u0442\u0435:<\/p>\n<p>\u0424\u0430\u0439\u043b: \/SDL\/src\/render\/SDL_yuv_sw.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/6a381567b0412603054e3ecd77916085edffe94a\/src\/render\/SDL_yuv_sw_c.h#L29\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture *swdata, const SDL_Rect *rect,                             const void *pixels, int pitch {   ....   SDL_memcpy(swdata->pixels, pixels,        (size_t)(swdata->h * swdata->w) +              2 * ((swdata->h + 1) \/ 2) * ((swdata->w + 1) \/ 2));   .... }<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0433\u043e\u0432\u043e\u0440\u044f\u0442, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0435, \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043d\u0435 \u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u043f\u0440\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0442\u0438\u043f\u043e\u0432 \u0432 \u044f\u0437\u044b\u043a\u0435 \u0421. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>swdata->h * swdata->w<\/em>, \u043f\u043e\u0442\u043e\u043c \u043d\u0430 \u0442\u0438\u043f\u044b \u0435\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432 \u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043d\u0430 \u0442\u0438\u043f, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043e\u043d\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f. \u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0431\u044b\u043b\u043e \u0431\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0435\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u044b, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0443\u0436\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>\u0410\u0432\u0442\u043e\u0440\u0443 \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0435\u0431\u0435, \u043a\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u0435\u0451 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0438 \u043f\u0440\u0438\u0432\u0435\u043b\u0438 \u0431\u044b \u043a \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e. \u041d\u043e \u0432 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u0412\u0441\u0435\u0433\u0434\u0430 \u0412\u0430\u0448 \u0432\u0437\u044f\u043b \u0431\u044b \u043d\u0430 \u0441\u0435\u0431\u044f \u0441\u043c\u0435\u043b\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 <a href=\"https:\/\/blog.research.google\/2006\/06\/extra-extra-read-all-about-it-nearly.html\">\u0442\u0430\u043a\u0443\u044e \u0432\u043e\u0442 \u0441\u0442\u0430\u0442\u044c\u044e<\/a> \u043e\u0442 \u0431\u044b\u0432\u0448\u0435\u0433\u043e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430  Google \u0438 \u0430\u0432\u0442\u043e\u0440\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 Java. \u0412 \u043d\u0435\u0439 \u043e\u043d \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e\u0439 <em>mergesort<\/em> \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u0438\u0445 \u043b\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u0433 \u0441 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043c\u043e\u0433 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c, \u043d\u043e \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0434\u043e\u0436\u0434\u0430\u043b\u0441\u044f \u0441\u0432\u043e\u0435\u0433\u043e.<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0436\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v1028\/\"><strong>V1028<\/strong><\/a><strong> Possible overflow. Consider casting operands of the &#8216;swdata->h * swdata->w&#8217; operator to the &#8216;size_t&#8217; type, not the result. SDL\/src\/render\/SDL_yuv_sw.c:125:1<\/strong><\/p>\n<p><em>P.S. \u041a\u043e\u0434 \u043f\u043e\u0434 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/em><\/p>\n<pre><code class=\"cpp\">(size_t)(swdata->h) * (size_t)(swdata->w) +   (2 * (((size_t)(swdata->h) + 1) \/ 2)) *   (((size_t)(swdata->w) + 1) \/ 2);<\/code><\/pre>\n<p><em>\u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0437\u0430\u0447\u0435\u043c \u043f\u043b\u0430\u0442\u0438\u0442\u044c \u0437\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u0434\u0430? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/em><\/p>\n<pre><code class=\"cpp\">const size_t h = swdata->h; const size_t w = swdata->w; SDL_memcpy(swdata->pixels, pixels,            h * w + 2 * ((h + 1) \/ 2) * ((w + 1) \/ 2));<\/code><\/pre>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/49e\/3a0\/e86\/49e3a0e865bdeac24968e6555dc89153.png\" alt=\"1081_SDL_ru\/image2.png\" title=\"\" width=\"1600\" height=\"902\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/49e\/3a0\/e86\/49e3a0e865bdeac24968e6555dc89153.png\"\/><\/figure>\n<h3>\u0422\u0435\u043d\u044c \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u044f<\/h3>\n<p>\u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u0410\u043b\u044c\u0444\u0440\u0435\u0434 \u0425\u0438\u0447\u043a\u043e\u043a: &#171;\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0440\u043e\u0434\u043d\u0438 \u0436\u0435\u043d\u0449\u0438\u043d\u0435 \u2014 \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u043e\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u0448\u044c, \u0442\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u044d\u043c\u043e\u0446\u0438\u0438&#187;. \u041a\u0430\u043a\u0438\u0435 \u044d\u043c\u043e\u0446\u0438\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0443 \u0432\u0430\u0441, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442?<\/p>\n<p>\u0424\u0430\u0439\u043b: SDL\/src\/joystick\/linux\/SDL_sysjoystick.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/4c3e84897fdf483394cf48c05df6d544afbe83ec\/src\/joystick\/linux\/SDL_sysjoystick.c#L1011\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">static SDL_JoystickGUID LINUX_JoystickGetDeviceGUID(int device_index) {   return GetJoystickByDevIndex(device_index)->guid; }<\/code><\/pre>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0441\u0430\u0441\u043f\u0435\u043d\u0441 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0437\u0430\u0440\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0443\u0436\u0435 \u043e\u0442 \u0441\u0430\u043c\u043e\u0433\u043e \u0444\u0430\u043a\u0442\u0430 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043f\u043e \u043d\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u043c\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e. \u041d\u043e, \u043c\u043e\u0436\u0435\u0442, <em>GetJoystickByDevIndex<\/em> \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c:<\/p>\n<p>\u0424\u0430\u0439\u043b: SDL\/src\/joystick\/linux\/SDL_sysjoystick.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/4c3e84897fdf483394cf48c05df6d544afbe83ec\/src\/joystick\/linux\/SDL_sysjoystick.c#L975\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">static SDL_joylist_item *GetJoystickByDevIndex(int device_index) {   ....   if ((device_index &lt; 0) || (device_index >= numjoysticks)) {     return NULL;   }   .... }<\/code><\/pre>\n<p><em>NULL<\/em>, \u0432\u043e\u0442 \u043c\u044b \u0438 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0438\u0441\u044c \u0441\u043d\u043e\u0432\u0430!<\/p>\n<p>&#171;\u0412\u043e \u0432\u0437\u0440\u044b\u0432\u0435 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e. \u0422\u043e \u043b\u0438 \u0434\u0435\u043b\u043e \u2014 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0432\u0437\u0440\u044b\u0432\u0430!&#187; \u2014 \u0441\u043a\u0430\u0437\u0430\u043b \u043a\u0430\u043a-\u0442\u043e \u043c\u044d\u0442\u0440. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u0437\u0440\u044b\u0432 \u0432\u0435\u0434\u0451\u0442 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0430 \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f!<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043e\u0433\u043b\u0430\u0448\u0430\u0435\u0442\u0441\u044f:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v522\/\"><strong>V522<\/strong><\/a><strong> There might be dereferencing of a potential null pointer &#8216;GetJoystickByDevIndex(device_index)&#8217;. SDL\/src\/joystick\/linux\/SDL_sysjoystick.c:1013:1<\/strong><\/p>\n<p><em>P.S. \u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043c\u0435\u0442\u0438\u0442, \u0447\u0442\u043e \u0432 \u0441\u0435\u043a\u0446\u0438\u0438 &#171;\u041a\u0430\u0440\u0433\u043e \u043a\u0443\u043b\u044c\u0442&#187; \u0432\u044b\u0448\u0435 \u043c\u044b \u0441\u0430\u043c\u0438 \u043f\u0440\u044f\u043c\u043e \u0441\u043e\u0432\u0435\u0442\u043e\u0432\u0430\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u044d\u0442\u043e\u043c \u0442\u0440\u0435\u0431\u0443\u0435\u043c \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c. \u0421\u0442\u043e\u0438\u0442 \u0441\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0434\u0435\u043d\u0442\u0438\u0447\u043d\u044b\u0439 \u043a\u043e\u0434 \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u0438 \u043d\u0435\u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u044b\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0434\u0435\u0437\u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u044e\u0449\u0438\u043c.<\/em><\/p>\n<p><em>\u0412 \u0442\u043e\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u0435 \u0432\u044b\u0448\u0435 \u043c\u044b \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0438 \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0438\u0441\u0430\u0442\u044c \u0442\u043e\u0447\u043d\u043e \u0442\u0430\u043a\u043e\u0439 \u0436\u0435 \u043a\u043e\u0434 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0435\u0442, \u0435\u0441\u043b\u0438 \u0444\u0443\u043d\u043a\u0446\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u0434\u0435\u043b\u043a\u0438 \u043a\u043e\u0434\u0430 \u0432\u0434\u0440\u0443\u0433 \u0441\u043c\u043e\u0436\u0435\u0442 \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0442\u044c NULL. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043c\u044b \u043f\u043e\u0434\u0440\u0430\u0437\u0443\u043c\u0435\u0432\u0430\u043b\u0438, \u0447\u0442\u043e \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u044d\u0442\u0430 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u043c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u043e\u043c, \u0430 \u044d\u0442\u043e \u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043f\u0440\u044f\u043c\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u043f\u043e\u043b\u043e\u0436\u043d\u043e\u0435 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0438\u0438 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f (defensive programming). \u041f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u043f\u0440\u0438\u0433\u043b\u0430\u0441\u0438\u0442\u044c \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u0434\u043b\u044f \u0441\u0432\u043e\u0435\u0433\u043e \u0440\u043e\u0434\u0430 \u0444\u0438\u043b\u043e\u0441\u043e\u0444\u0441\u043a\u043e\u0439 \u0431\u0435\u0441\u0435\u0434\u044b: \u043a\u0430\u043a \u0432\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435, \u0430 \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u043b\u0435\u0437\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442\u044b \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043c\u043e\u0433\u0443\u0442 \u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0432\u043b\u0438\u044f\u0442\u044c \u043d\u0430 \u0441\u0442\u0438\u043b\u044c \u043a\u043e\u0434\u0430?<\/em><\/p>\n<h3>\u0421\u0440\u0435\u0434\u0438 \u0442\u0440\u0451\u0445 \u0431\u0435\u0440\u0451\u0437<\/h3>\n<p>\u0410 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442\u0435 \u043f\u0440\u0435\u0434\u043b\u0430\u0433\u0430\u0435\u043c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a\u0430\u043a \u043c\u043e\u0436\u043d\u043e \u043d\u0430 \u0440\u043e\u0432\u043d\u043e\u043c \u043c\u0435\u0441\u0442\u0435 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c \u0441\u0435\u0431\u0435 \u0432 \u043d\u043e\u0433\u0443:<\/p>\n<p>\u0424\u0430\u0439\u043b: \/SDL\/src\/libm\/e_exp.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/6a381567b0412603054e3ecd77916085edffe94a\/src\/libm\/e_exp.c#L156\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">double __ieee754_exp(double x) {   int32_t k=0;   ....    if(k >= -1021) {     u_int32_t hy;     GET_HIGH_WORD(hy,y);     SET_HIGH_WORD(y,hy+(k&lt;&lt;20));    \/* add k to y's exponent *\/     return y;   }   .... }<\/code><\/pre>\n<p>\u041f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>k<\/em> \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c\u0438 \u043e\u043d\u0430 \u043f\u043e\u0442\u043e\u043c, \u0432\u0435\u0441\u0435\u043b\u043e \u043a\u0440\u0438\u0447\u0430 \u0438 \u0443\u043b\u044e\u043b\u044e\u043a\u0430\u044f, \u0441\u0434\u0432\u0438\u043d\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0432\u0430\u0434\u0446\u0430\u0442\u044c \u0431\u0438\u0442\u043e\u0432 \u0432\u043b\u0435\u0432\u043e.<\/p>\n<p>\u0412\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0430, \u043a\u043e\u0433\u0434\u0430 \u043f\u043e \u0437\u0435\u043c\u043b\u0435 \u0445\u043e\u0434\u0438\u043b\u0438 \u0434\u0438\u043d\u043e\u0437\u0430\u0432\u0440\u044b \u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u043b\u0438 \u043a\u043e\u0434 \u0411\u043e\u0440\u043b\u0430\u043d\u0434\u043e\u043c, \u0432 \u0445\u043e\u0434\u0443 (\u0433\u043e\u0432\u043e\u0440\u044f\u0442!) \u0431\u044b\u043b\u0438 \u0440\u0430\u0437\u043d\u044b\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043c\u043e\u0433\u043b\u0438 \u0438 \u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0434\u043e \u0434\u0432\u0443\u0445 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b. \u041a\u043e\u0433\u0434\u0430 \u044f\u0437\u044b\u043a \u0421 \u0431\u044b\u043b \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u043a\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u043e\u0432\u0430\u043d, \u043e\u043d \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u043b \u044d\u0442\u043e \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435. \u0410 \u0435\u0441\u043b\u0438 \u043d\u0443\u0436\u043d\u043e \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u044b \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u0430 \u0441\u0442\u043e\u0440\u043e\u043d, \u0437\u043d\u0430\u0447\u0438\u0442, \u0438 \u0441\u0442\u0440\u043e\u0433\u0438\u0435 \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0438 \u043f\u043e \u0440\u044f\u0434\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0434\u0430\u0442\u044c \u0441\u0442\u0430\u043d\u0435\u0442 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0437\u0430\u0442\u0440\u0443\u0434\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u041f\u043e\u0434\u043e\u0431\u043d\u0430\u044f \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0433\u043e \u0441\u0434\u0432\u0438\u0433\u0430 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0432\u0430\u0442\u044c \u0432\u043c\u0435\u043d\u044f\u0435\u043c\u043e\u0433\u043e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u043e\u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e\u0433\u043e \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0432 \u0441\u043b\u0443\u0447\u0430\u0435, \u0435\u0441\u043b\u0438 \u043b\u0435\u0432\u044b\u0439 \u043e\u043f\u0435\u0440\u0430\u043d\u0434 \u2014 \u043d\u0435\u0433\u0430\u0442\u0438\u0432\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e. \u041e\u0442\u0442\u043e\u0433\u043e \u0438 UB!<\/p>\n<p>\u041c\u0435\u0436\u0434\u0443 \u0442\u0435\u043c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0432 \u0440\u044f\u0434\u0430\u0445 \u043d\u0430\u0448\u0438\u0445 \u0443\u0432\u0430\u0436\u0430\u0435\u043c\u044b\u0445 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439 \u0442\u0430\u043a\u0438\u0435, \u043a\u043e\u043c\u0443 \u0438 \u0441\u0435\u0439\u0447\u0430\u0441 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0441 &#171;\u043d\u0435\u043e\u0440\u0442\u043e\u0434\u043e\u043a\u0441\u0430\u043b\u044c\u043d\u044b\u043c\u0438&#187; \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0430\u043c\u0438? \u041f\u0440\u043e\u0448\u0443, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u0438 \u2014 \u044d\u0442\u043e \u043e\u0447\u0435\u043d\u044c \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e!<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0433\u043e\u0432\u043e\u0440\u0438\u0442:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v610\/\"><strong>V610<\/strong><\/a><strong> Undefined behavior. Check the shift operator &#8216;&lt;&lt;&#8216;. The left operand is negative (&#8216;k&#8217; = [-1021..2147483647]). SDL\/src\/libm\/e_exp.c:159:1<\/strong><\/p>\n<p>\u041d\u0430\u043c\u043d\u043e\u0433\u043e \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u0435\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u0445\u043e\u0436\u0438\u0439 \u043c\u043e\u043c\u0435\u043d\u0442, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0432\u0438\u0434\u0438\u043c\u0430\u044f \u0441\u043b\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043a\u043e\u0434\u0430 \u0441\u044b\u0433\u0440\u0430\u043b\u0430 \u0441\u0432\u043e\u044e \u0437\u043b\u0443\u044e \u0448\u0443\u0442\u043a\u0443 \u0438 \u0437\u0430\u043c\u0430\u0441\u043a\u0438\u0440\u043e\u0432\u0430\u043b\u0430 \u0438\u0441\u0442\u043e\u0447\u043d\u0438\u043a \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b:<\/p>\n<p>\u0424\u0430\u0439\u043b:  \/SDL\/src\/libm\/e_rem_pio2.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/6a381567b0412603054e3ecd77916085edffe94a\/src\/libm\/e_rem_pio2.c#L151\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">int32_t attribute_hidden __ieee754_rem_pio2(double x, double *y) {   int32_t e0,i,j,nx,n,ix,hx;   GET_HIGH_WORD(hx,x);         \/* high word of x *\/   ix = hx&amp;0x7fffffff;   ....   if(ix&lt;=0x413921fb) {     ....     if(hx&lt;0) {y[0] = -y[0]; y[1] = -y[1]; return -n;}     else     return n;   }   ....   if(ix>=0x7ff00000) {        \/* x is inf or NaN *\/     y[0]=y[1]=x-x; return 0;   }   ....   e0  = (ix>>20)-1046;        \/* e0 = ilogb(z)-23; *\/    SET_HIGH_WORD(z, ix - ((int32_t)(e0&lt;&lt;20))); }<\/code><\/pre>\n<p>&#171;\u0427\u0442\u043e-\u0442\u043e \u0442\u0430\u043c \u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u0442\u0443\u0434\u043e\u0432\u0430-\u0441\u044e\u0434\u043e\u0432\u0430&#187;, \u2014 \u0432\u043e\u0441\u043a\u043b\u0438\u043a\u043d\u0443\u043b \u0412\u0441\u0435\u0433\u0434\u0430 \u0412\u0430\u0448, \u043a\u043e\u0433\u0434\u0430 \u0432\u043f\u0435\u0440\u0432\u044b\u0435 \u0443\u0432\u0438\u0434\u0435\u043b \u0434\u0430\u043d\u043d\u044b\u0439 \u043a\u043e\u0434. \u0410 \u0434\u0432\u0438\u0433\u0430\u0435\u0442\u0441\u044f \u043e\u043d\u043e \u0432 \u0441\u0442\u043e\u0440\u043e\u043d\u0443 UB, \u043d\u0435 \u043f\u043e\u0432\u0435\u0440\u0438\u0442\u0435! \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0432\u044b\u0434\u0430\u0447\u0443 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0430 \u043d\u0438\u0436\u0435 \u2014 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f <em>e0<\/em> \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u044f\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435! \u041f\u043e\u0441\u0443\u0434\u0438\u0442\u0435 \u0441\u0430\u043c\u0438, \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0434\u043b\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 <em>ix<\/em>, \u043f\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043d\u0435 \u043f\u0440\u043e\u0438\u0437\u043e\u0439\u0434\u0451\u0442 \u0440\u0430\u043d\u043d\u0435\u0433\u043e \u0432\u044b\u0445\u043e\u0434\u0430 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u2014 <em>0x413921fb + 1<\/em>. \u0414\u0432\u0438\u0433\u0430\u0435\u043c \u0435\u0433\u043e \u0432\u043f\u0440\u0430\u0432\u043e \u043d\u0430 20 \u0431\u0438\u0442\u043e\u0432, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c <em>1043<\/em>. \u041e\u0442\u043d\u0438\u043c\u0438\u0442\u0435 <em>1046<\/em> \u0438 \u0440\u0430\u0441\u043f\u0438\u0448\u0438\u0442\u0435\u0441\u044c \u0432 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0438 \u0438\u0441\u043a\u043e\u043c\u043e\u0433\u043e UB \u043f\u0440\u0438 \u0441\u0434\u0432\u0438\u0433\u0435 \u0432\u043b\u0435\u0432\u043e. \u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u043b\u0430 \u043c\u043e\u044f \u043c\u0430\u043c\u0430 \u0432 \u0434\u0435\u0442\u0441\u0442\u0432\u0435: &#171;\u041d\u0435 \u0438\u0433\u0440\u0430\u0439\u0441\u044f \u0441 \u0445\u0435\u043a\u0441\u0430\u043c\u0438, \u0432\u0441\u0451 \u0432\u0437\u043e\u0440\u0432\u0451\u0448\u044c!&#187;<\/p>\n<p>\u0421\u043f\u0430\u0441\u0438\u0431\u043e, \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v610\/\"><strong>V610<\/strong><\/a><strong> Undefined behavior. Check the shift operator &#8216;&lt;&lt;&#8216;. The left operand is negative (&#8216;e0&#8217; = [-3..1000]). SDL\/src\/libm\/e_rem_pio2.c:151:1<\/strong><\/p>\n<p><em>P.S. \u041c\u044b \u043e\u0431\u044f\u0437\u0430\u043d\u044b \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0438 \u0442\u0430\u043a\u043e\u0435 \u0443\u0442\u043e\u0447\u043d\u0435\u043d\u0438\u0435: \u0435\u0441\u043b\u0438 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u043c\u0430\u0448\u0438\u043d\u0443 \u0441 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u043e\u0439, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0434\u043e \u0434\u0432\u0443\u0445 \u0434\u043b\u044f \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b, \u044d\u0442\u043e \u0432\u043e\u0432\u0441\u0435 \u043d\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u043a\u043e\u0434 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u043c \u0432\u0430\u043c\u0438 \u043e\u0431\u0440\u0430\u0437\u043e\u043c. \u0421\u0434\u0432\u0438\u0433 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0447\u0438\u0441\u0435\u043b \u0432\u043b\u0435\u0432\u043e \u2014 \u0432\u0441\u0435\u0433\u0434\u0430 UB. \u0412\u0441\u0435 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d\u0438\u044f \u043e UB \u0438 \u043e \u0442\u043e\u043c, \u043a\u0430\u043a \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0431\u0443\u0434\u0435\u0442 \u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u043a\u043e\u0434, \u044f\u0432\u043b\u044f\u044e\u0442\u0441\u044f \u043a\u0430\u043a \u043c\u0438\u043d\u0438\u043c\u0443\u043c \u0440\u0438\u0441\u043a\u043e\u0432\u0430\u043d\u043d\u044b\u043c\u0438, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0441\u043a\u0430\u0437\u0430\u0442\u044c, \u0447\u0442\u043e \u0432\u043e\u0432\u0441\u0435 \u043d\u0435\u0432\u0435\u0440\u043d\u044b\u043c\u0438.<\/em><\/p>\n<h3>\u0421\u0430\u043c\u044b\u0439 \u0431\u044b\u0441\u0442\u0440\u044b\u0439 \u043a\u043e\u0432\u0431\u043e\u0439 \u043d\u0430 \u0414\u0438\u043a\u043e\u043c \u0417\u0430\u043f\u0430\u0434\u0435<\/h3>\n<p>\u041a\u0430\u043a \u0433\u043e\u0432\u0430\u0440\u0438\u0432\u0430\u043b\u0430 \u043c\u043e\u044f \u0431\u0430\u0431\u0443\u043b\u044f: &#171;\u0411\u044b\u0441\u0442\u0440\u044b\u043c \u043d\u0430\u0434\u043e \u0431\u044b\u0442\u044c \u043f\u0440\u0438 \u043b\u043e\u0432\u043b\u0435 \u0431\u0430\u0433\u043e\u0432!&#187;. &#171;\u0410 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043a\u043e\u0434\u0430 \u0438\u0445 \u043b\u0443\u0447\u0448\u0435 \u0438\u0437\u0431\u0435\u0433\u0430\u0442\u044c&#187;, \u2014 \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u0412\u0441\u0435\u0433\u0434\u0430 \u0412\u0430\u0448 \u0441\u043b\u0435\u0434\u043e\u043c. \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043e\u0431\u0440\u0430\u0442\u0438\u043c\u0441\u044f \u043a \u043a\u043e\u0434\u0443 \u043d\u0438\u0436\u0435:<\/p>\n<p>\u0424\u0430\u0439\u043b: \/SDL\/src\/joystick\/linux\/SDL_sysjoystick.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/6a381567b0412603054e3ecd77916085edffe94a\/src\/joystick\/linux\/SDL_sysjoystick.c#L2085C1\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">static SDL_bool LINUX_JoystickGetGamepadMapping(     int device_index, SDL_GamepadMapping *out) {   ....   joystick = (SDL_Joystick *)SDL_calloc(sizeof(*joystick), 1);   joystick->magic = &amp;SDL_joystick_magic;    if (joystick == NULL) {     SDL_OutOfMemory();     return SDL_FALSE;   }   .... }<\/code><\/pre>\n<p>\u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043d\u0430\u043c \u043d\u0435 \u0442\u043e \u0447\u0442\u043e\u0431\u044b \u0432\u0430\u0436\u043d\u043e, \u0447\u0442\u043e \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 <em>joystick<\/em>. \u0412\u0430\u0436\u043d\u043e \u0442\u043e, \u0447\u0442\u043e \u043a \u043d\u0435\u0439 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0431\u0440\u0430\u0449\u0430\u044e\u0442\u0441\u044f, \u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u044d\u0442\u043e\u0433\u043e \u0441\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u044e\u0442, \u0430 \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u044d\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435-\u0442\u043e \u0434\u0435\u043b\u0430\u0442\u044c. \u0414\u0435\u0439\u0441\u0442\u0432\u0438\u0442\u0435\u043b\u044c\u043d\u043e, \u043c\u043e\u0436\u043d\u043e \u043b\u0438 \u043d\u0430\u0439\u0442\u0438 \u043b\u0443\u0447\u0448\u0435\u0435 \u043c\u0435\u0441\u0442\u043e \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435 \u0434\u043b\u044f \u0441\u0430\u043c\u043e\u0439 \u0446\u0430\u0440\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0439 \u0438\u0437 \u043f\u043e\u0433\u043e\u0432\u043e\u0440\u043e\u043a \u2014 <em>Festina lente!<\/em><\/p>\n<p>\u0410 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0436\u0435 \u0446\u0438\u0442\u0438\u0440\u0443\u0435\u0442 \u0442\u0430\u043a:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v595\/\"><strong>V595<\/strong><\/a><strong> The &#8216;joystick&#8217; pointer was utilized before it was verified against nullptr. Check lines: 2119, 2120. SDL\/src\/joystick\/linux\/SDL_sysjoystick.c:2120:1<\/strong><\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/55e\/b9a\/d63\/55eb9ad6386c8a1cda538b9d61fbc13b.png\" width=\"1600\" height=\"1824\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/55e\/b9a\/d63\/55eb9ad6386c8a1cda538b9d61fbc13b.png\"\/><\/figure>\n<h3>\u0422\u0430\u043a \u0438 \u0431\u044b\u043b\u043e \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043e!<\/h3>\n<p>\u041f\u043e\u0434\u0445\u043e\u0434\u044f \u043a \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u044e \u0440\u0430\u0441\u0441\u043c\u043e\u0442\u0440\u0435\u043d\u0438\u044f \u043d\u0430\u0448\u0435\u0439 \u0441\u0435\u0433\u043e\u0434\u043d\u044f\u0448\u043d\u0435\u0439 \u043a\u043e\u043b\u043b\u0435\u043a\u0446\u0438\u0438, \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043d\u0430\u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u0448\u0438\u0431\u043a\u0438 \u0432 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0435 \u043c\u043e\u0433\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0442\u044c \u0438 \u0438\u0437 \u043f\u0440\u043e\u0441\u0442\u043e\u0433\u043e \u0436\u0435\u043b\u0430\u043d\u0438\u044f \u043e\u0442\u043b\u043e\u0436\u0438\u0442\u044c \u043f\u0440\u0430\u0432\u043a\u0443 \u043d\u0430 \u043f\u043e\u0442\u043e\u043c:<\/p>\n<p>\u0424\u0430\u0439\u043b:  SDL\/src\/render\/software\/SDL_triangle.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/bac7eeaaae00b929808ed8efe1a76e45a4e2c54b\/src\/render\/software\/SDL_triangle.c#L341\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">int SDL_SW_FillTriangle(SDL_Surface *dst,                          SDL_Point *d0, SDL_Point *d1, SDL_Point *d2,                         SDL_BlendMode blend,                          SDL_Color c0, SDL_Color c1, SDL_Color c2) {   ....   if (dst->format->Amask) {     color = SDL_MapRGBA(tmp->format, c0.r, c0.g, c0.b, c0.a);   } else {     \/\/ color = SDL_MapRGB(tmp->format, c0.r, c0.g, c0.b);     color = SDL_MapRGBA(tmp->format, c0.r, c0.g, c0.b, c0.a);   }   .... }<\/code><\/pre>\n<p>&#171;\u041c\u043e\u0436\u0435\u0442, \u0442\u0430\u043a \u0438 \u0431\u044b\u043b\u043e \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043e?&#187; \u2014 \u0441\u043f\u0440\u043e\u0441\u0438\u0442 \u043f\u044b\u0442\u043b\u0438\u0432\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c. \u041d\u043e \u0435\u0441\u043b\u0438 \u0442\u0430\u043a \u0438 \u0431\u044b\u043b\u043e \u0437\u0430\u0434\u0443\u043c\u0430\u043d\u043e, \u0442\u043e \u0437\u0430\u0447\u0435\u043c \u0437\u0434\u0435\u0441\u044c \u0443\u0441\u043b\u043e\u0432\u0438\u0435?<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0437\u0430\u0434\u0430\u0451\u0442\u0441\u044f \u0442\u0430\u043a\u0438\u043c \u0436\u0435 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v523\/\"><strong>V523<\/strong><\/a><strong> The &#8216;then&#8217; statement is equivalent to the &#8216;else&#8217; statement. SDL\/src\/render\/software\/SDL_triangle.c:341:1<\/strong><\/p>\n<h3>\u0418\u043d\u0442\u0435\u0440\u0432\u044c\u044e<\/h3>\n<p>\u041f\u043e\u043c\u043d\u0438\u0442\u0435, \u0447\u0442\u043e \u0412\u0441\u0435\u0433\u0434\u0430 \u0412\u0430\u0448 \u043f\u0438\u0441\u0430\u043b \u043f\u0440\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u0441 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u043c SDL \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u0441\u0442\u0430\u0442\u044c\u0438? \u041d\u0430\u043c \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u0432 \u0421\u044d\u043c\u0443 \u041b\u0430\u043d\u0442\u0438\u043d\u0433\u0435 \u2014 \u0431\u0435\u0437 \u043c\u0430\u043b\u043e\u0433\u043e \u043f\u0440\u0430\u0440\u043e\u0434\u0438\u0442\u0435\u043b\u044e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u0438 \u0435\u0433\u043e \u0433\u043b\u0430\u0432\u043d\u043e\u043c\u0443 \u043c\u0435\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u0443. \u0410 \u043e\u043d, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u043d\u0430 \u043d\u0438\u0445 \u043e\u0442\u0432\u0435\u0442\u0438\u043b, \u0437\u0430 \u0447\u0442\u043e \u043c\u044b \u0435\u043c\u0443 \u043e\u0447\u0435\u043d\u044c \u0431\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u043d\u044b! \u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0434\u043b\u044f \u0432\u0430\u0441, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0431\u0443\u0434\u0435\u0442 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u0435\u043d \u0438 \u0442\u0430\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442. \u041f\u0440\u043e\u0448\u0443, \u043d\u0430\u043f\u0438\u0448\u0438\u0442\u0435 \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445, \u0445\u043e\u0442\u0435\u043b\u0438 \u0431\u044b \u0432\u044b \u0432\u0438\u0434\u0435\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0435 \u043a\u043e\u043b\u043b\u0430\u0431\u043e\u0440\u0430\u0446\u0438\u0438 \u0438 \u0434\u0430\u043b\u0435\u0435?<\/p>\n<figure class=\"\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/getpro\/habr\/upload_files\/675\/dca\/bff\/675dcabff130f01f524f2364a8c7948e.png\" alt=\"1081_SDL_ru\/image4.png\" title=\"\u0424\u043e\u0442\u043e \u0421\u044d\u043c\u0430 \u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u044c\" width=\"400\" height=\"398\" data-src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/675\/dca\/bff\/675dcabff130f01f524f2364a8c7948e.png\"\/><\/p>\n<div><figcaption>\u0424\u043e\u0442\u043e \u0421\u044d\u043c\u0430 \u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u044c<\/figcaption><\/div>\n<\/figure>\n<p><strong>\u041a\u0430\u0436\u0435\u0442\u0441\u044f, \u0447\u0442\u043e \u0434\u043b\u044f \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0430\u0434 \u043f\u0440\u043e\u0435\u043a\u0442\u043e\u043c \u0443\u0440\u043e\u0432\u043d\u044f SDL \u0442\u0440\u0435\u0431\u0443\u0435\u0442\u0441\u044f \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0432\u044b\u0441\u043e\u043a\u0438\u0439 \u0443\u0440\u043e\u0432\u0435\u043d\u044c \u043a\u0432\u0430\u043b\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u0438. \u0420\u0430\u0441\u0441\u043a\u0430\u0436\u0438\u0442\u0435, \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432 \u0432 \u043d\u0451\u043c \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u043e?<\/strong><\/p>\n<p>\u041e\u043a\u043e\u043b\u043e \u0434\u0435\u0441\u044f\u0442\u043a\u0430 \u0447\u0435\u043b\u043e\u0432\u0435\u043a \u0440\u0435\u0433\u0443\u043b\u044f\u0440\u043d\u043e \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u043d\u0430\u0434 \u043d\u043e\u0432\u043e\u0432\u0432\u0435\u0434\u0435\u043d\u0438\u044f\u043c\u0438 \u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c\u0438, \u0430 \u0442\u0430\u043a\u0436\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u044e\u0442 \u0437\u0430\u044f\u0432\u043a\u0438, \u043f\u043e\u0441\u0442\u0443\u043f\u0430\u044e\u0449\u0438\u0435 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u043e\u0432. \u0418, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u043e\u0433\u0440\u043e\u043c\u043d\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043b\u044e\u0434\u0435\u0439 \u043f\u0440\u043e\u0441\u044f\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0435 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044e\u0442 \u0437\u0430\u043f\u0440\u043e\u0441\u044b \u043d\u0430 \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u041d\u0430\u0448 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 GitHub \u043d\u0430\u0441\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u0442 \u0431\u043e\u043b\u0435\u0435 400 \u0443\u0447\u0430\u0441\u0442\u043d\u0438\u043a\u043e\u0432, \u0438 \u043c\u044b \u043e\u0447\u0435\u043d\u044c \u0446\u0435\u043d\u0438\u043c \u0438\u0445 \u043f\u043e\u043c\u043e\u0449\u044c!<\/p>\n<p><strong>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0432 SDL \u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442 \u0441 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u043d\u0438\u0437\u043a\u043e\u0443\u0440\u043e\u0432\u043d\u0435\u0432\u044b\u043c\u0438 \u0432\u0435\u0449\u0430\u043c\u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0441 \u044d\u043a\u0441\u043f\u043e\u043d\u0435\u043d\u0442\u043e\u0439 \u0432 ieee754_exp. \u0412\u0441\u0442\u0440\u0435\u0447\u0430\u044e\u0442\u0441\u044f \u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u043e\u0441\u043e\u0431\u044b\u0435 \u0442\u0440\u0443\u0434\u043d\u043e\u0441\u0442\u0438 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0438 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430?<\/strong><\/p>\n<p>\u0414\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0446\u0435\u043b\u0435\u0439 \u043c\u044b \u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u0436\u0435 \u043d\u0430\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0432 \u043e\u0442\u043a\u0440\u044b\u0442\u043e\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u0435 \u0438 \u0445\u043e\u0440\u043e\u0448\u043e \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d. \u041e\u0434\u043d\u0430\u043a\u043e \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u0442\u0430\u043a\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u043e\u0442\u0438\u0432\u043e\u0440\u0435\u0447\u0438\u0442\u044c \u043b\u0438\u0446\u0435\u043d\u0437\u0438\u0438 SDL. \u0412 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043b\u0438 \u043c\u0430\u0442\u0435\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0438\u0437 uClibc. \u0410 \u043f\u0440\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u043d\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u043c\u043e\u0433\u0430\u044e\u0442 \u043c\u043d\u043e\u0433\u043e\u043b\u0435\u0442\u043d\u0438\u0439 \u043e\u043f\u044b\u0442 \u0438 \u0443\u0432\u043b\u0435\u0447\u0451\u043d\u043d\u044b\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0433\u043e\u0442\u043e\u0432\u044b \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0432\u043d\u0435\u0441\u0451\u043d\u043d\u044b\u0435 \u043d\u0430\u043c\u0438 \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f.<\/p>\n<p><strong>SDL \u0435\u0441\u0442\u044c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0432\u0435\u0437\u0434\u0435. \u0412 \u043c\u043e\u0435\u043c \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u0435 Arch \u043e\u043d \u0434\u0430\u0436\u0435 \u0431\u044b\u043b \u043f\u0440\u0435\u0434\u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d (\u0447\u0435\u043c\u0443 \u044f \u0431\u044b\u043b \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e \u0440\u0430\u0434). \u041c\u043e\u0436\u0435\u0442\u0435 \u0440\u0430\u0441\u0441\u043a\u0430\u0437\u0430\u0442\u044c \u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0434\u043e\u0441\u0442\u0430\u0432\u043a\u0438 \u043a\u043e\u0434\u0430 \u0438\u0437 \u0440\u0435\u0434\u0430\u043a\u0442\u043e\u0440\u0430 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0430 \u043d\u0430 \u0442\u0430\u043a\u043e\u0435 \u0440\u0430\u0437\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u0438\u0435 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c \u0438 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0435\u0432?<\/strong><\/p>\n<p>\u0420\u0430\u043d\u044c\u0448\u0435 \u043c\u044b \u043f\u0440\u043e\u0441\u0442\u043e \u0440\u0430\u0437\u043c\u0435\u0449\u0430\u043b\u0438 \u043f\u043e\u0434\u043f\u0438\u0441\u0430\u043d\u043d\u044b\u0439 \u0438\u0441\u0445\u043e\u0434\u043d\u044b\u0439 \u043a\u043e\u0434 \u043d\u0430 \u043d\u0430\u0448\u0435\u043c \u0441\u0430\u0439\u0442\u0435, \u0430 \u0441\u043f\u0435\u0446\u0438\u0430\u043b\u0438\u0441\u0442\u044b, \u043e\u0442\u0432\u0435\u0447\u0430\u044e\u0449\u0438\u0435 \u0437\u0430 \u043e\u0431\u0441\u043b\u0443\u0436\u0438\u0432\u0430\u043d\u0438\u0435 \u0434\u0438\u0441\u0442\u0440\u0438\u0431\u0443\u0442\u0438\u0432\u043e\u0432, \u0432\u043a\u043b\u044e\u0447\u0430\u043b\u0438 \u0440\u0435\u043b\u0438\u0437\u044b SDL \u0432 \u043e\u0431\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u041e\u0421. \u0412 \u043d\u0430\u0441\u0442\u043e\u044f\u0449\u0435\u0435 \u0432\u0440\u0435\u043c\u044f \u043d\u0430\u0448\u0438 \u0440\u0435\u043b\u0438\u0437\u044b \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b \u043d\u0430 GitHub, \u0430 \u0434\u043b\u044f \u043c\u0435\u0439\u043d\u0442\u0435\u0439\u043d\u0435\u0440\u043e\u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u043c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043f\u0440\u0435\u0436\u043d\u0438\u043c. \u0412 \u0440\u0430\u043c\u043a\u0430\u0445 \u0440\u0435\u043b\u0438\u0437\u0430 \u043c\u044b \u0432\u044b\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0431\u0438\u043d\u0430\u0440\u043d\u0438\u043a\u0438 \u0434\u043b\u044f Windows \u0438 Apple \u2014 \u044d\u0442\u043e \u043e\u0431\u043b\u0435\u0433\u0447\u0430\u0435\u0442 \u0437\u0430\u0434\u0430\u0447\u0443 \u0442\u0435\u043c, \u043a\u0442\u043e \u0445\u043e\u0447\u0435\u0442 \u0432\u043d\u0435\u0434\u0440\u0438\u0442\u044c \u043d\u043e\u0432\u044b\u0439 SDL \u0432 \u0443\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0439 \u043f\u0440\u043e\u0434\u0443\u043a\u0442 \u0438 \u0438\u043c\u0435\u0442\u044c \u0434\u043e\u0441\u0442\u0443\u043f \u043a\u043e \u0432\u0441\u0435\u043c \u0438\u0441\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u044f\u043c \u0438 \u0443\u043b\u0443\u0447\u0448\u0435\u043d\u0438\u044f\u043c.<\/p>\n<p><strong>SDL \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u0442 \u043c\u043d\u043e\u0436\u0435\u0441\u0442\u0432\u043e \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c. \u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0443 \u0434\u043b\u044f \u043a\u0430\u043a\u043e\u0439 \u0438\u0437 \u043d\u0438\u0445 \u0431\u044b\u043b\u043e \u0442\u0440\u0443\u0434\u043d\u0435\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c?<\/strong><\/p>\n<p>Android \u0438 iOS \u043e\u043a\u0430\u0437\u0430\u043b\u0438\u0441\u044c \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c\u0438, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043c\u043e\u0434\u0435\u043b\u044c \u043f\u0440\u0438\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 API \u0441\u0438\u043b\u044c\u043d\u043e \u043e\u0442\u043b\u0438\u0447\u0430\u044e\u0442\u0441\u044f \u043e\u0442 \u0434\u0435\u0441\u043a\u0442\u043e\u043f\u043d\u044b\u0445 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c.<\/p>\n<p><strong>\u041a\u0430\u043a \u0441\u043b\u0435\u0434\u0438\u0442\u0435 \u0437\u0430 \u0442\u0435\u043c, \u0447\u0442\u043e\u0431\u044b \u0432\u044b \u0438\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u0447\u0438\u043a\u0438 \u043d\u0435 \u0441\u043b\u043e\u043c\u0430\u043b\u0438 \u043d\u0438\u0447\u0435\u0433\u043e \u0432 SDL \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u043a\u043e\u0434\u0430 \u0438\u043b\u0438 \u0440\u0435\u0434\u0430\u043a\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0440\u043e\u0433\u043e?<\/strong><\/p>\n<p>\u0423 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0445\u0432\u0430\u0442\u044b\u0432\u0430\u044e\u0442 \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u043e\u0431\u044a\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b\u0430 SDL. \u0412 \u0446\u0435\u043b\u043e\u043c, \u043c\u044b \u0437\u043d\u0430\u0435\u043c \u0438\u0437 \u0441\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e\u0433\u043e \u043e\u043f\u044b\u0442\u0430, \u043a \u0447\u0435\u043c\u0443 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u0435 \u043a \u0442\u043e\u0439 \u0438\u043b\u0438 \u0438\u043d\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u043a\u043e\u0434\u0430. \u0415\u0441\u043b\u0438 \u043a\u0430\u043a\u0438\u0435-\u0442\u043e \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u043d\u0435\u0441\u0443\u0442 \u0440\u0438\u0441\u043a\u0438, \u043c\u044b \u0432\u043d\u043e\u0441\u0438\u043c \u0438\u0445 \u0432 \u0441\u0430\u043c\u043e\u043c \u043d\u0430\u0447\u0430\u043b\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u044d\u0442\u0430\u043f\u0430 \u0440\u0430\u0431\u043e\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u043a\u0430\u043a \u0441\u043b\u0435\u0434\u0443\u0435\u0442 \u043f\u0440\u043e\u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u0434 \u0440\u0435\u043b\u0438\u0437\u043e\u043c.<\/p>\n<p><strong>\u0422\u0435\u0441\u0442\u0438\u0440\u0443\u0435\u0442\u0435 \u043b\u0438 \u0432\u044b SDL \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u044b \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e?<\/strong><\/p>\n<p>\u0414\u0430.<\/p>\n<p><strong>\u041d\u0435 \u043f\u043e\u0434\u0435\u043b\u0438\u0442\u0435\u0441\u044c \u0441\u0442\u0435\u043a\u043e\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f?<\/strong><\/p>\n<p>\u041c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0435 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u044b, \u0432\u043a\u043b\u044e\u0447\u0451\u043d\u043d\u044b\u0435 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 SDL. \u041c\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0438\u0445 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e GitHub Actions \u0432 \u043e\u0442\u0432\u0435\u0442 \u043d\u0430 \u043a\u043e\u043c\u043c\u0438\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u043e\u043d\u0438 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c. \u041e\u0434\u043d\u0430 \u0438\u0437 \u0441\u0430\u043c\u044b\u0445 \u043f\u0440\u0438\u044f\u0442\u043d\u044b\u0445 \u043e\u0441\u043e\u0431\u0435\u043d\u043d\u043e\u0441\u0442\u0435\u0439 \u044d\u043a\u043e\u0441\u0438\u0441\u0442\u0435\u043c\u044b GitHub \u0437\u0430\u043a\u043b\u044e\u0447\u0430\u0435\u0442\u0441\u044f \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0442\u0435\u0441\u0442\u044b SDL \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u044e\u0442\u0441\u044f \u043d\u0430 \u043e\u0441\u043d\u043e\u0432\u0435 \u0437\u0430\u043f\u0440\u043e\u0441\u043e\u0432 \u043e\u0442 \u0434\u0440\u0443\u0433\u0438\u0445 \u043b\u044e\u0434\u0435\u0439. \u0422\u0430\u043a \u043e\u043d\u0438 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u0443\u0432\u0435\u0440\u0435\u043d\u044b, \u0447\u0442\u043e \u0438\u0445 \u043a\u043e\u0434 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u0445\u043e\u0440\u043e\u0448\u043e, \u043f\u0440\u0435\u0436\u0434\u0435 \u0447\u0435\u043c \u043c\u044b \u0437\u0430\u043b\u044c\u0451\u043c \u0435\u0433\u043e \u0432 \u043e\u0441\u043d\u043e\u0432\u043d\u043e\u0439 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439.<\/p>\n<h3>\u0417\u0430\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435<\/h3>\n<p>\u041e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u0432\u044b\u0434\u0430\u043b\u043e\u0441\u044c \u043f\u0440\u0438\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0435! \u0418\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u043f\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u043e\u0444\u0435\u0441\u0441\u0438\u043e\u043d\u0430\u043b\u044b \u0441\u0432\u043e\u0435\u0433\u043e \u0434\u0435\u043b\u0430 \u043f\u0438\u0441\u0430\u043b\u0438 \u043d\u0435 \u043e\u0434\u043d\u043e \u0434\u0435\u0441\u044f\u0442\u0438\u043b\u0435\u0442\u0438\u0435 \u2014 \u0431\u0435\u0441\u0446\u0435\u043d\u043d\u043e, \u0440\u0430\u0432\u043d\u043e \u043a\u0430\u043a \u0438 \u0432\u043d\u0435\u0441\u0442\u0438 \u0441\u0432\u043e\u0439 \u0441\u043a\u0440\u043e\u043c\u043d\u044b\u0439 \u0432\u043a\u043b\u0430\u0434 \u0432 \u0435\u0433\u043e \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u0435.<\/p>\n<p>\u041d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0438 \u0432\u0430\u043c \u0431\u044b\u043b\u043e \u0442\u0430\u043a \u0436\u0435 \u0438\u043d\u0442\u0435\u0440\u0435\u0441\u043d\u043e \u0447\u0438\u0442\u0430\u0442\u044c \u044d\u0442\u0443 \u0441\u0442\u0430\u0442\u044c\u044e, \u043a\u0430\u043a \u0438 \u0435\u0451 \u0430\u0432\u0442\u043e\u0440\u0443 \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442! \u041a\u0430\u043a \u043e\u0431\u044b\u0447\u043d\u043e, \u0412\u0441\u0435\u0433\u0434\u0430 \u0412\u0430\u0448 \u043d\u0430\u0434\u0435\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0447\u0438\u0442\u0430\u0442\u044c \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445 \u0432\u0430\u0448\u0438 \u043c\u044b\u0441\u043b\u0438, \u043f\u043e\u0436\u0435\u043b\u0430\u043d\u0438\u044f \u0438 \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0430\u0446\u0438\u0438.<\/p>\n<p>\u0418, \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0436\u0435, \u0441\u043f\u0430\u0441\u0438\u0431\u043e, \u0413\u043b\u0430\u0432\u0430 \u0440\u044b\u0446\u0430\u0440\u0435\u0439 \u041b\u0430\u043d\u0442\u0438\u043d\u0433\u0430!<\/p>\n<p>\u0411\u043b\u0430\u0433\u043e\u0434\u0430\u0440\u0438\u043c, \u0447\u0442\u043e \u0434\u043e\u0448\u043b\u0438 \u0434\u043e \u043a\u043e\u043d\u0446\u0430! <em>El Psy Kongroo<\/em>.<\/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: Anton Tretyakov. <a href=\"https:\/\/pvs-studio.com\/en\/blog\/posts\/cpp\/1081\/\">Games! How they write code for SDL (+ interview with the creator)<\/a>.<\/p>\n<\/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\/774674\/\"> https:\/\/habr.com\/ru\/articles\/774674\/<\/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-2\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">\n<p>\u0414\u0436\u0435\u043a \u041b\u043e\u043d\u0434\u043e\u043d \u043a\u0430\u043a-\u0442\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043b: &#171;\u041d\u0435 \u0441\u0442\u043e\u0438\u0442 \u0436\u0434\u0430\u0442\u044c \u0432\u0434\u043e\u0445\u043d\u043e\u0432\u0435\u043d\u0438\u044f, \u0437\u0430 \u043d\u0438\u043c \u043d\u0430\u0434\u043e \u0433\u043e\u043d\u044f\u0442\u044c\u0441\u044f \u0441 \u0434\u0443\u0431\u0438\u043d\u043a\u043e\u0439&#187;. \u0415\u0441\u043b\u0438 \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043e \u0441\u043e\u0437\u0434\u0430\u043d\u0438\u0438 \u0438\u0433\u0440, \u0442\u043e \u043f\u0440\u043e\u0435\u043a\u0442 SDL \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u0441\u043b\u0443\u0436\u0438\u0442\u044c \u0442\u0430\u043a\u043e\u0439 \u0434\u0443\u0431\u0438\u043d\u043a\u043e\u0439. \u041d\u043e \u043a\u0430\u043a \u043e\u043d \u0441\u0434\u0435\u043b\u0430\u043d \u0441\u0430\u043c?<\/p>\n<figure class=\"full-width\"><\/figure>\n<p>\u0415\u0441\u043b\u0438 \u0432\u044b \u043a\u043e\u0433\u0434\u0430-\u043b\u0438\u0431\u043e \u0445\u043e\u0442\u0435\u043b\u0438 \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441\u0432\u043e\u044e \u0438\u0433\u0440\u0443, \u0432\u0430\u043c \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430\u0441\u044c SDL. \u0415\u0441\u043b\u0438 \u0432\u044b \u0445\u043e\u0442\u0435\u043b\u0438 \u043d\u0430\u0443\u0447\u0438\u0442\u044c\u0441\u044f \u0440\u0438\u0441\u043e\u0432\u0430\u0442\u044c \u0448\u0442\u0443\u043a\u0438 \u043d\u0430 \u044d\u043a\u0440\u0430\u043d\u0435 \u0431\u0435\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u0438 \u0441\u043c\u0441, \u0432\u0430\u043c \u043d\u0430\u0432\u0435\u0440\u043d\u044f\u043a\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430\u0441\u044c SDL. \u0415\u0441\u043b\u0438 \u0432\u0430\u043c \u043d\u0430\u0434\u043e \u0431\u044b\u043b\u043e \u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c OpenGL, \u0442\u043e \u0432\u0430\u043c \u0442\u043e\u0447\u043d\u043e \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430\u0441\u044c SDL.<\/p>\n<p>\u0410 \u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0430\u0441\u044c, \u0442\u043e \u043c\u044b \u0432\u0441\u044f\u0447\u0435\u0441\u043a\u0438 \u0438 \u043d\u0430\u0441\u0442\u043e\u044f\u0442\u0435\u043b\u044c\u043d\u043e \u0440\u0435\u043a\u043e\u043c\u0435\u043d\u0434\u0443\u0435\u043c \u0441 \u043d\u0435\u0439 \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f! \u0412\u0435\u0434\u044c SDL \u2014 \u044d\u0442\u043e \u043a\u0440\u043e\u0441\u0441\u043f\u043b\u0430\u0442\u0444\u043e\u0440\u043c\u0435\u043d\u043d\u0430\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0430 \u0434\u043b\u044f \u0433\u0440\u0430\u0444\u0438\u043a\u0438, \u0430\u0443\u0434\u0438\u043e, \u0438\u043d\u043f\u0443\u0442\u043e\u0432 \u0438 \u0432\u0441\u0435\u0433\u043e, \u0447\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0443\u0436\u0435, \u043d\u0430\u043a\u043e\u043d\u0435\u0446, \u0441\u0432\u043e\u044e \u0438\u0433\u0440\u0443!<\/p>\n<p>\u0421\u0440\u0435\u0434\u0438 \u0438\u0433\u0440, \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0449\u0438\u0445 SDL, \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u043b\u0438\u0441\u044c \u0442\u0430\u043a\u0438\u0435 \u0442\u0430\u0439\u0442\u043b\u044b, \u043a\u0430\u043a Neverwinter Nights, Dwarf Fortress, Amnesia, VVVVVV (\u043e \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c <a href=\"https:\/\/pvs-studio.ru\/ru\/blog\/posts\/cpp\/0707\/\">\u0441\u0445\u043e\u0436\u0430\u044f \u0441\u0442\u0430\u0442\u044c\u044f<\/a>) \u0438 \u0432\u0435\u043b\u0438\u043a\u0430\u044f \u0438 \u0443\u0436\u0430\u0441\u043d\u0430\u044f Teeworlds (\u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0412\u0441\u0435\u0433\u0434\u0430 \u0412\u0430\u0448 \u043f\u0440\u043e\u0432\u0451\u043b \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0445\u0443\u043a\u0443\u044f \u0442\u0443\u0434\u0430-\u0441\u044e\u0434\u0430 \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0435\u043c\u0443 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b \u043f\u0440\u0438\u0437\u043d\u0430\u0432\u0430\u0442\u044c).<\/p>\n<p>\u041f\u0440\u043e\u0435\u043a\u0442 \u0432 \u0445\u043e\u0434\u0443 \u0443\u0436\u0435 \u043d\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u0434\u0435\u0441\u044f\u0442\u043e\u043a \u043b\u0435\u0442 \u0438 \u0430\u043a\u0442\u0438\u0432\u043d\u043e \u0440\u0430\u0437\u0432\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0441\u043e\u043e\u0431\u0449\u0435\u0441\u0442\u0432\u043e\u043c \u0438 \u0435\u0433\u043e \u0438\u0437\u043d\u0430\u0447\u0430\u043b\u044c\u043d\u044b\u043c \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u043c. \u0422\u0430\u043a \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u0442\u0430\u043a\u043e\u0439 \u043f\u0440\u0435\u043a\u0440\u0430\u0441\u043d\u043e\u0439 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c\u044e \u0443\u0437\u043d\u0430\u0442\u044c \u0447\u0442\u043e-\u0442\u043e \u043d\u043e\u0432\u043e\u0435 \u0438 \u0437\u0430\u0433\u043b\u044f\u043d\u0443\u0442\u044c \u0441 \u0444\u043e\u043d\u0430\u0440\u0438\u043a\u043e\u043c \u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442 \u043f\u0440\u043e\u0435\u043a\u0442\u0430!<\/p>\n<p>\u0411\u043e\u043b\u0435\u0435 \u0442\u043e\u0433\u043e, \u0432 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u043c\u044b \u0440\u0435\u0448\u0438\u043b\u0438 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043f\u043e\u044d\u043a\u0441\u043f\u0435\u0440\u0438\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 \u0432\u0437\u044f\u0442\u044c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0435 \u0438\u043d\u0442\u0435\u0440\u0432\u044c\u044e \u0443 \u0441\u043e\u0437\u0434\u0430\u0442\u0435\u043b\u0435\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0441 \u043a\u043e\u0442\u043e\u0440\u044b\u043c \u0432\u0430\u0441, \u0434\u043e\u0440\u043e\u0433\u043e\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0438 \u043f\u0440\u0438\u0433\u043b\u0430\u0448\u0430\u0435\u043c \u043e\u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u041d\u0443 \u0447\u0442\u043e, \u0445\u0432\u0430\u0442\u0438\u0442\u044c \u0442\u0435\u0440\u044f\u0442\u044c \u0432\u0440\u0435\u043c\u044f, \u0432\u043f\u0435\u0440\u0451\u0434!<\/p>\n<blockquote>\n<p>\u041f\u043e \u0445\u043e\u0434\u0443 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u044b \u043a\u043e\u0434\u0430. \u041f\u043e\u043c\u0435\u0442\u043a\u0438 \u0432 \u043d\u0438\u0445, \u043e\u0431\u043e\u0437\u043d\u0430\u0447\u0435\u043d\u043d\u044b\u0435 \u043a\u0430\u043a \u043c\u043d\u043e\u0433\u043e\u0442\u043e\u0447\u0438\u0435 &#171;&#8230;.&#187;, \u0431\u044b\u043b\u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0430\u0432\u0442\u043e\u0440\u043e\u043c \u0441\u0442\u0430\u0442\u044c\u0438.<\/p>\n<p>\u0421\u0430\u043c\u0438 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0439\u0442\u0438 \u043d\u0430 <a href=\"https:\/\/github.com\/libsdl-org\/SDL\">\u043e\u0444\u0438\u0446\u0438\u0430\u043b\u044c\u043d\u043e\u043c GitHub libsdl<\/a>. \u041f\u043e\u043c\u0438\u043c\u043e \u044d\u0442\u043e\u0433\u043e, \u043a\u0430\u0436\u0434\u044b\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442 \u0441\u043d\u0430\u0431\u0436\u0451\u043d \u0441\u0441\u044b\u043b\u043a\u043e\u0439 \u043d\u0430 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e \u0432 \u043a\u043e\u0434\u0435.<\/p>\n<p>\u041a \u043c\u043e\u043c\u0435\u043d\u0442\u0443 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0438 \u043c\u043d\u043e\u0433\u0438\u0435 \u043c\u0435\u0441\u0442\u0430 \u0443\u0436\u0435 \u043f\u043e\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u044b \u043f\u043e\u0441\u043b\u0435 \u043e\u0442\u043a\u0440\u044b\u0442\u044b\u0445 \u043d\u0430\u043c\u0438 issues (\u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, <a href=\"https:\/\/github.com\/libsdl-org\/SDL\/issues\/8287\">\u0437\u0434\u0435\u0441\u044c<\/a> \u0438 <a href=\"https:\/\/github.com\/libsdl-org\/SDL\/issues\/8289\">\u0442\u0430\u043c<\/a>), \u043d\u043e \u0441\u0441\u044b\u043b\u043a\u0438 \u0432 \u043f\u0440\u0438\u043c\u0435\u0440\u0430\u0445 \u0443\u043a\u0430\u0437\u044b\u0432\u0430\u044e\u0442 \u0438\u043c\u0435\u043d\u043d\u043e \u043d\u0430 \u043a\u043e\u0434, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b \u0432\u0441\u0442\u0440\u0435\u0447\u0430\u0435\u0442\u0435 \u0432 \u044d\u0442\u043e\u0439 \u0441\u0442\u0430\u0442\u044c\u0435. \u041d\u0430\u043c \u043e\u0447\u0435\u043d\u044c \u043f\u0440\u0438\u044f\u0442\u043d\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0442\u043e\u0440\u043c\u043e\u0448\u0438\u0442\u044c \u043f\u0440\u043e\u0435\u043a\u0442\u044b, \u043d\u043e \u0438 \u0434\u0435\u043b\u0430\u0442\u044c \u0438\u0445 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043b\u0443\u0447\u0448\u0435!<\/p>\n<\/blockquote>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0414\u043e\u0432\u0435\u0440\u044f\u0439, \u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0439<\/h3>\n<p>\u041d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0432\u044b \u0434\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0435 \u0434\u043e\u043a\u0443\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u044f\u0437\u044b\u043a\u0430 \u0421? \u0425\u043e\u0442\u044f \u0431\u043e\u043b\u0435\u0435 \u043f\u043e\u0434\u0445\u043e\u0434\u044f\u0449\u0438\u043c \u043d\u0430\u0448\u0435\u043c\u0443 \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u044e\u0449\u0435\u043c\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u0443 \u0431\u0443\u0434\u0435\u0442 \u0441\u043a\u043e\u0440\u0435\u0435 \u0432\u043e\u043f\u0440\u043e\u0441 \u043e \u0442\u043e\u043c, \u043d\u0430\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0432\u044b \u0434\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0435 \u0441\u0430\u043c\u0438\u043c \u0441\u0435\u0431\u0435 \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0435\u0451 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f? \u041a\u0430\u043a \u0432\u044b \u0434\u0443\u043c\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u043d\u0435 \u0442\u0430\u043a \u0441 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c \u043d\u0438\u0436\u0435?<\/p>\n<p>\u0424\u0430\u0439\u043b: SDL\/src\/stdlib\/SDL_iconv.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/bac7eeaaae00b929808ed8efe1a76e45a4e2c54b\/src\/stdlib\/SDL_iconv.c#L789\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">char *SDL_iconv_string(const char *tocode, const char *fromcode,                        const char *inbuf, size_t inbytesleft) {   SDL_iconv_t cd;   ....    cd = SDL_iconv_open(tocode, fromcode);   if (cd == (SDL_iconv_t)-1) {     \/* See if we can recover here (fixes iconv on Solaris 11) *\/     if (tocode == NULL || !*tocode) {       tocode = \"UTF-8\";     }     if (fromcode == NULL || !*fromcode) {       fromcode = \"UTF-8\";     }     cd = SDL_iconv_open(tocode, fromcode);   }   .... }<\/code><\/pre>\n<p>&#171;\u042f, \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c, \u0438 \u0441\u043a\u0430\u0437\u0430\u043b \u0431\u044b, \u2014 \u0432\u043e\u0437\u0440\u0430\u0437\u0438\u0442 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0438 \u0447\u0443\u0442\u043a\u0438\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u2014 \u0441\u043a\u0430\u0437\u0430\u043b, \u0435\u0441\u043b\u0438 \u0431\u044b \u043c\u044b \u0438\u043c\u0435\u043b\u0438 \u0434\u0435\u043b\u043e \u0441\u043e \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0435\u0439 <em>iconv_open<\/em>. \u041d\u043e \u0442\u0443\u0442 \u0436\u0435 \u043a\u0430\u043a\u0430\u044f-\u0442\u043e \u043c\u0435\u0441\u0442\u043d\u0430\u044f \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u044f <em>SDL_iconv_open<\/em>!&#187;. \u041e\u0442\u043b\u0438\u0447\u043d\u043e\u0435 \u0437\u0430\u043c\u0435\u0447\u0430\u043d\u0438\u0435! \u0412\u043e\u0442 \u043a\u0430\u043a \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0430 \u044d\u0442\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f:<\/p>\n<p>\u0424\u0430\u0439\u043b:  SDL\/src\/stdlib\/SDL_iconv.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/bac7eeaaae00b929808ed8efe1a76e45a4e2c54b\/src\/stdlib\/SDL_iconv.c#L35\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">SDL_iconv_t SDL_iconv_open(const char *tocode, const char *fromcode) {   return (SDL_iconv_t)((uintptr_t)iconv_open(tocode, fromcode)); }<\/code><\/pre>\n<p>\u0420\u0430\u0437\u043e\u0431\u0440\u0430\u0432\u0448\u0438\u0441\u044c \u0441 \u044d\u0442\u0438\u043c, \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0435\u0451 \u043e\u043a\u0440\u0435\u0441\u0442\u043d\u043e\u0441\u0442\u0438. \u041a\u043e\u0434 \u0447\u0443\u0442\u044c \u043d\u0438\u0436\u0435 \u0434\u0430\u0451\u0442 \u043f\u043e\u043d\u044f\u0442\u044c, \u0447\u0442\u043e \u043d\u0430 \u0432\u0445\u043e\u0434 \u0432\u043f\u043e\u043b\u043d\u0435 \u043c\u043e\u0433\u0443\u0442 \u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u0434\u0430\u043d\u044b \u043d\u0443\u043b\u0435\u0432\u044b\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u0438 \u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430\u0445 <em>tocode<\/em> \u0438 <em>fromcode<\/em>. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u044d\u0442\u043e\u0433\u043e \u043e\u043d\u0438 \u043f\u0435\u0440\u0435\u0434 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u043e\u0439 \u0441 \u0432\u0435\u0442\u0435\u0440\u043a\u043e\u043c \u043f\u043e\u043b\u0435\u0442\u044f\u0442 \u0438 \u0432 \u0441\u0430\u043c\u0443 <em>iconv_open<\/em>.<\/p>\n<p>\u0415\u0441\u043b\u0438 \u043c\u044b \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0432 <em>man<\/em> \u0441\u0442\u0440\u0430\u043d\u0438\u0446\u0443 \u0434\u0430\u043d\u043d\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/www.gnu.org\/software\/libiconv\/documentation\/libiconv-1.13\/iconv_open.3.html\">GNU<\/a>, \u0442\u043e \u043d\u0435 \u0443\u0432\u0438\u0434\u0438\u043c \u043d\u0438\u043a\u0430\u043a\u043e\u0433\u043e \u0443\u043f\u043e\u043c\u0438\u043d\u0430\u043d\u0438\u044f \u043e \u0442\u043e\u043c, \u0447\u0442\u043e <em>NULL<\/em> \u0442\u043e\u043b\u043a\u0430\u0442\u044c \u0432 \u043d\u0435\u0451 \u043d\u0435\u043b\u044c\u0437\u044f. &#171;\u0414\u0435\u043b\u043e \u0440\u0430\u0441\u043a\u0440\u044b\u0442\u043e!&#187; \u2014 \u0441\u043a\u0430\u0436\u0435\u0442 \u043c\u043e\u043b\u043e\u0434\u043e\u0439 \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a \u043d\u0430\u0448\u0435\u0433\u043e \u0441\u044b\u0441\u043a\u043d\u043e\u0433\u043e \u0430\u0433\u0435\u043d\u0442\u0441\u0442\u0432\u0430, \u043d\u043e \u0434\u0435\u0442\u0435\u043a\u0442\u0438\u0432\u0430 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0434\u0451\u0448\u044c! \u041e\u043d \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043b\u044e\u0431\u0438\u0442 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0421\u0438\u0448\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u0432\u0435\u0434\u044c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438 \u0421\u0438\u0448\u043d\u043e\u0439 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u2014 \u0432\u0435\u0441\u0435\u043b\u043e! <a href=\"https:\/\/github.com\/lattera\/glibc\/blob\/895ef79e04a953cac1493863bcae29ad85657ee1\/iconv\/iconv_open.c#L32\">\u0423\u0437\u0440\u0438\u0442\u0435<\/a> \u0438 \u0432\u044b!<\/p>\n<p>\u041d\u0443&#8230; \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043f\u043e \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u043d\u0435 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442, \u043d\u043e \u0432\u043f\u043e\u043b\u043d\u0435 \u0441\u0435\u0431\u0435 \u043f\u0440\u0438\u0441\u0443\u0442\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u044b\u0437\u043e\u0432 <em>strlen<\/em> \u0431\u0435\u0437 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 <em>NULL<\/em>. \u0412\u0441\u0435 \u043c\u044b \u0437\u043d\u0430\u0435\u043c, \u0447\u0442\u043e <em>strlen<\/em> \u0434\u0435\u043b\u0430\u0435\u0442 \u0432 \u044d\u0442\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u0438 \u043c\u0430\u043b\u043e \u043a\u043e\u043c\u0443 \u044d\u0442\u043e \u043f\u043e \u0434\u0443\u0448\u0435!<\/p>\n<p>\u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u044b, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0440\u0435\u0448\u0438\u043b\u0438, \u0447\u0442\u043e \u043d\u0430 \u043e\u0434\u043d\u043e\u0439 \u0438\u043c\u043f\u043b\u0435\u043c\u0435\u043d\u0442\u0430\u0446\u0438\u0438 \u043c\u044b \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u0438\u043c\u0441\u044f, \u0442\u043e \u043f\u043e\u0441\u043f\u0435\u0448\u0438\u043c \u0432\u0430\u0441 \u0443\u0431\u0435\u0434\u0438\u0442\u044c \u0432 \u043e\u0431\u0440\u0430\u0442\u043d\u043e\u043c \u2014 <a href=\"https:\/\/github.com\/freebsd\/freebsd-src\/blob\/366ef17bb6ce008f79a283ff5dc5e87ab13dbdb3\/sys\/libkern\/iconv.c#L248\">BSD<\/a> \u0438 <a href=\"https:\/\/github.com\/kraj\/musl\/blob\/2e6edc1b699851fcbe9f7ab0fbd724624adde88a\/src\/locale\/iconv.c#L145\">Musl<\/a> \u0432\u0435\u0434\u0443\u0442 \u0441\u0435\u0431\u044f \u0440\u0430\u0432\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c.<\/p>\n<p>\u041a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0431\u0435\u0437\u043e\u0431\u0438\u0434\u043d\u043e\u0435 \u043c\u0435\u0441\u0442\u043e, \u0434\u0430\u0436\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0430, \u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u0431\u044b, \u0435\u0441\u0442\u044c! \u041d\u043e \u0441\u0432\u043e\u0435\u0433\u043e \u0434\u0438\u043b\u0435\u0440\u0430 \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438 \u0432\u0441\u0435\u0433\u0434\u0430 \u043d\u0443\u0436\u043d\u043e \u0437\u043d\u0430\u0442\u044c \u0432 \u043b\u0438\u0446\u043e! \u041a\u0441\u0442\u0430\u0442\u0438, \u0430 \u043a\u0430\u043a \u0447\u0430\u0441\u0442\u043e \u0432\u0430\u043c, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u043d\u0430\u043a\u043e\u043c\u0438\u0442\u044c\u0441\u044f \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c\u0438 \u0412\u0430\u0448\u0435\u0433\u043e \u0432\u0435\u043d\u0434\u043e\u0440\u0430? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u043e\u0431\u0449\u0430\u0435\u043c\u0441\u044f \u0432 \u043a\u043e\u043c\u043c\u0435\u043d\u0442\u0430\u0440\u0438\u044f\u0445!<\/p>\n<p>\u041d\u0443 \u0430 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0432\u044b\u0434\u0430\u043b \u0451\u043c\u043a\u043e\u0435:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v595\/\"><strong>V595<\/strong><\/a><strong> The &#8216;tocode&#8217; pointer was utilized before it was verified against nullptr. Check lines: 37, 789, 792. SDL\/src\/stdlib\/SDL_iconv.c:792:1<\/strong><\/p>\n<h3>\u041a\u0430\u0440\u0433\u043e \u043a\u0443\u043b\u044c\u0442<\/h3>\n<p>\u0421\u043a\u0430\u0436\u0438\u0442\u0435, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0435\u0441\u0442\u044c \u043b\u0438 \u0443 \u0432\u0430\u0441 \u0442\u0430\u043a\u0438\u0435 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0435 \u0440\u0438\u0442\u0443\u0430\u043b\u044b, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u043d\u0430\u0434\u043e \u0441\u043e\u0431\u043b\u044e\u0441\u0442\u0438 \u2014 \u0438\u043d\u0430\u0447\u0435 \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0437\u0430\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442? \u041f\u043e\u0433\u043b\u0430\u0434\u0438\u0442\u044c \u0440\u0435\u0437\u0438\u043d\u043e\u0432\u0443\u044e \u0443\u0442\u043e\u0447\u043a\u0443, \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u0430\u0439\u043b \u0441 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0430\u043c\u0438 \u0442\u0440\u0438 \u0440\u0430\u0437\u0430 \u043f\u043e\u0434\u0440\u044f\u0434? \u041d\u0438\u0436\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u043f\u0440\u0438\u043c\u0435\u0440 \u0441\u0445\u043e\u0436\u0435\u0433\u043e \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0438\u044f:<\/p>\n<p>\u0424\u0430\u0439\u043b: SDL\/src\/events\/SDL_mouse.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/4c3e84897fdf483394cf48c05df6d544afbe83ec\/src\/events\/SDL_mouse.c#L1372\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">SDL_Cursor *SDL_GetCursor(void) {   SDL_Mouse *mouse = SDL_GetMouse();   if (mouse == NULL) {     return NULL;   }   return mouse->cur_cursor; }<\/code><\/pre>\n<p>&#171;\u0427\u0442\u043e \u0441\u0435\u0439\u0447\u0430\u0441-\u0442\u043e \u043d\u0435 \u0442\u0430\u043a?&#187; \u2014 \u0432\u0441\u043a\u0440\u0438\u043a\u043d\u0435\u0442 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c. \u0423\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043f\u0440\u0430\u0448\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u0442\u0441\u044f \u2014 \u0432\u0441\u0451 \u0447\u0435\u0441\u0442\u043d\u043e! \u041f\u043e\u043d\u0438\u043c\u0430\u0435\u043c, \u043c\u044b \u0436\u0435, \u0432 \u043a\u043e\u043d\u0446\u0435 \u043a\u043e\u043d\u0446\u043e\u0432, \u0441\u0430\u043c\u0438 \u043f\u0438\u0441\u0430\u043b\u0438 \u0432\u044b\u0448\u0435, \u0447\u0442\u043e \u0442\u0430\u043a \u0438 \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c! \u041d\u043e \u043f\u0440\u0438\u0437\u044b\u0432\u0430\u044e \u0432\u0430\u0441 \u043f\u0440\u0438\u0434\u0435\u0440\u0436\u0430\u0442\u044c \u0432\u043e\u0437\u043c\u0443\u0449\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043e\u0442\u043a\u0443\u0434\u0430 \u043e\u043d \u0431\u0435\u0440\u0451\u0442\u0441\u044f.<\/p>\n<p>\u0424\u0430\u0439\u043b:  SDL\/src\/events\/SDL_mouse.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/4c3e84897fdf483394cf48c05df6d544afbe83ec\/src\/events\/SDL_mouse.c#L270\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">SDL_Mouse *SDL_GetMouse(void) {   return &amp;SDL_mouse; }<\/code><\/pre>\n<p>\u0422\u0430\u043a-\u0442\u0430\u043a, \u0447\u0442\u043e \u044d\u0442\u043e \u0437\u0430 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0442\u0430\u043a\u0430\u044f? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u0443\u0437\u043d\u0430\u0435\u043c!<\/p>\n<p>\u0424\u0430\u0439\u043b: SDL\/src\/events\/SDL_mouse.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/4c3e84897fdf483394cf48c05df6d544afbe83ec\/src\/events\/SDL_mouse.c#L35\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">static SDL_Mouse SDL_mouse;<\/code><\/pre>\n<p>\u0413\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f! \u0422\u043e \u0435\u0441\u0442\u044c <em>NULL<\/em> \u0437\u0434\u0435\u0441\u044c \u043d\u0435\u043e\u0442\u043a\u0443\u0434\u0430 \u0432\u0437\u044f\u0442\u044c\u0441\u044f, \u0433\u043b\u043e\u0431\u0430\u043b\u044c\u043d\u0430\u044f \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0430\u044f \u0432\u0441\u0435\u0433\u0434\u0430 \u043b\u0435\u0436\u0438\u0442 \u0432 \u043f\u0430\u043c\u044f\u0442\u0438 \u0441 \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u044b\u043c \u0430\u0434\u0440\u0435\u0441\u043e\u043c.<\/p>\n<p>\u0427\u0442\u043e \u0441\u043a\u0430\u0437\u0430\u0442\u044c \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440\u0443, \u043a\u0440\u043e\u043c\u0435 \u0451\u043c\u043a\u043e\u0433\u043e:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v547\/\"><strong>V547<\/strong><\/a><strong> Expression &#8216;mouse == NULL&#8217; is always false. SDL\/src\/events\/SDL_mouse.c:1376:1<\/strong><\/p>\n<p><em>P.S. \u041f\u0440\u0438\u043d\u0438\u043c\u0430\u044f \u0432\u043e \u0432\u043d\u0438\u043c\u0430\u043d\u0438\u0435 \u0441\u043a\u0430\u0437\u0430\u043d\u043d\u043e\u0435 \u0432\u044b\u0448\u0435, \u0442\u0435\u043b\u043e \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0441\u0430\u0442\u044c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/em><\/p>\n<pre><code class=\"cpp\">return SDL_GetMouse()->cur_cursor;<\/code><\/pre>\n<p><em>\u041d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0438 \u043c\u043e\u0433\u0443\u0442 \u043e\u0431\u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c \u043e\u0434\u0438\u043d \u0444\u0430\u043a\u0442. \u041f\u0440\u0438 \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0439 \u0437\u0430\u043c\u0435\u043d\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u043e\u0439 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043d\u0430 \u0430\u043b\u043b\u043e\u043a\u0430\u0446\u0438\u044e \u043e\u0442\u0441\u0443\u0442\u0441\u0442\u0432\u0438\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0438 \u043d\u0430 NULL \u0441\u044b\u0433\u0440\u0430\u0435\u0442 \u0437\u043b\u0443\u044e \u0448\u0443\u0442\u043a\u0443. \u041c\u044b \u0441\u043f\u0435\u0448\u0438\u043c \u0443\u0441\u043f\u043e\u043a\u043e\u0438\u0442\u044c \u2013 \u0432 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u044e\u0431\u043e\u0439 \u0443\u0432\u0430\u0436\u0430\u044e\u0449\u0438\u0439 \u0441\u0435\u0431\u044f \u0441\u0442\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0439 \u0430\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u043f\u043e\u0434\u0441\u043a\u0430\u0436\u0435\u0442, \u0447\u0442\u043e \u043d\u0430 NULL \u043d\u0443\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c. \u0422\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c, \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u0441\u044f \u0438 \u0441\u043b\u043e\u0439 \u0430\u0431\u0441\u0442\u0440\u0430\u043a\u0446\u0438\u0438, \u0438 \u043d\u0435\u0440\u0432\u044b \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u0438\u0441\u0442\u0430.<\/em><\/p>\n<p><em>\u041f\u0440\u043e\u0441\u0438\u043c \u0438 \u0442\u0435\u0445 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u0435\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0441\u043f\u0440\u0430\u0432\u0435\u0434\u043b\u0438\u0432\u043e \u0437\u0430\u043c\u0435\u0442\u044f\u0442, \u0447\u0442\u043e &#171;\u043a\u0430\u0436\u0434\u044b\u0439 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044c, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u044b\u0439 \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0435\u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0438 \u043d\u0430 \u0447\u0442\u043e&#187; \u0432\u044b\u0434\u0435\u043b\u0438\u0442\u044c \u043d\u0430\u043c \u0432 \u0434\u043e\u043b\u0433 \u0442\u043e\u043b\u0438\u043a\u0443 \u0442\u0435\u0440\u043f\u0435\u043d\u0438\u044f \u0438 \u043f\u043e\u0434\u043e\u0436\u0434\u0430\u0442\u044c \u043f\u0430\u0440\u0443 \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u0432 \u2013 \u043e\u0431\u0435\u0449\u0430\u0435\u043c, \u043d\u0438\u0436\u0435 \u043c\u044b \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0432\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u044d\u0442\u043e\u0439 \u0442\u0435\u043c\u0435 \u0441 \u0435\u0449\u0451 \u043e\u0434\u043d\u0438\u043c \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u043c \u043f\u0440\u0438\u043c\u0435\u0440\u043e\u043c!<\/em><\/p>\n<h3>\u041b\u0438\u0431\u043e \u0434\u0435\u043b\u0430\u0439, \u043b\u0438\u0431\u043e \u043d\u0435 \u0434\u0435\u043b\u0430\u0439<\/h3>\n<p>\u0410 \u0432\u044b \u0437\u043d\u0430\u0435\u0442\u0435, \u0447\u0442\u043e \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u0430\u043b\u044c\u0446\u0435\u0432 \u0443 \u043c\u0430\u0433\u0438\u0441\u0442\u0440\u0430 \u0419\u043e\u0434\u044b \u043c\u0435\u043d\u044f\u0435\u0442\u0441\u044f \u043e\u0442 \u0444\u0438\u043b\u044c\u043c\u0430 \u043a \u0444\u0438\u043b\u044c\u043c\u0443? \u0410 \u0442\u0435\u043f\u0435\u0440\u044c \u2014 \u043e\u0431\u0440\u0430\u0442\u043d\u043e \u043a \u044f\u0437\u044b\u043a\u0443 \u0421! \u0415\u0441\u0442\u044c \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0430:<\/p>\n<p>\u0424\u0430\u0439\u043b: \/SDL\/src\/render\/SDL_yuv_sw_c.h (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/6a381567b0412603054e3ecd77916085edffe94a\/src\/render\/SDL_yuv_sw.c#L124\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">struct SDL_SW_YUVTexture {   ....   int w, h;   .... };    typedef struct SDL_SW_YUVTexture SDL_SW_YUVTexture;<\/code><\/pre>\n<p>\u041a\u043e\u0442\u043e\u0440\u0430\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442\u0441\u044f \u0432 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043c\u0435\u0441\u0442\u0435:<\/p>\n<p>\u0424\u0430\u0439\u043b: \/SDL\/src\/render\/SDL_yuv_sw.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/6a381567b0412603054e3ecd77916085edffe94a\/src\/render\/SDL_yuv_sw_c.h#L29\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">int SDL_SW_UpdateYUVTexture(SDL_SW_YUVTexture *swdata, const SDL_Rect *rect,                             const void *pixels, int pitch {   ....   SDL_memcpy(swdata->pixels, pixels,        (size_t)(swdata->h * swdata->w) +              2 * ((swdata->h + 1) \/ 2) * ((swdata->w + 1) \/ 2));   .... }<\/code><\/pre>\n<p>\u041a\u043e\u0433\u0434\u0430 \u0433\u043e\u0432\u043e\u0440\u044f\u0442, \u0447\u0442\u043e \u043d\u0443\u0436\u043d\u043e \u043f\u0435\u0440\u0438\u043e\u0434\u0438\u0447\u0435\u0441\u043a\u0438 \u043e\u0431\u0440\u0430\u0449\u0430\u0442\u044c\u0441\u044f \u043a \u043a\u043b\u0430\u0441\u0441\u0438\u043a\u0435, \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u0440\u0435\u0447\u044c \u0438\u0434\u0451\u0442 \u043d\u0435 \u043e \u043a\u043b\u0430\u0441\u0441\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u0448\u0438\u0431\u043a\u0430\u0445 \u043f\u0440\u0438 \u043a\u043e\u043d\u0432\u0435\u0440\u0442\u0430\u0446\u0438\u0438 \u0442\u0438\u043f\u043e\u0432 \u0432 \u044f\u0437\u044b\u043a\u0435 \u0421. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u0442\u0435 \u043d\u0430 \u0432\u044b\u0440\u0430\u0436\u0435\u043d\u0438\u0435 <em>swdata->h * swdata->w<\/em>, \u043f\u043e\u0442\u043e\u043c \u043d\u0430 \u0442\u0438\u043f\u044b \u0435\u0433\u043e \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u043e\u0432 \u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043d\u0430 \u0442\u0438\u043f, \u043a \u043a\u043e\u0442\u043e\u0440\u043e\u043c\u0443 \u043e\u043d\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u0441\u044f. \u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0431\u044b\u043b\u043e \u0431\u044b \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u043d\u0435\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u043d\u0434\u044b, \u043f\u043e\u0441\u043b\u0435 \u0447\u0435\u0433\u043e \u0443\u0436\u0435 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c\u0441\u044f \u0438\u0445 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c.<\/p>\n<p>\u0410\u0432\u0442\u043e\u0440\u0443 \u0441\u0442\u0430\u0442\u044c\u0438, \u043a\u043e\u043d\u0435\u0447\u043d\u043e, \u0441\u0442\u043e\u0438\u0442 \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043e\u043d \u043d\u0435 \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u0442 \u0441\u0435\u0431\u0435, \u043a\u0430\u043a\u043e\u0433\u043e \u0440\u0430\u0437\u043c\u0435\u0440\u0430 \u0434\u043e\u043b\u0436\u043d\u0430 \u0431\u044b\u0442\u044c \u0442\u0435\u043a\u0441\u0442\u0443\u0440\u0430, \u0447\u0442\u043e\u0431\u044b \u0435\u0451 \u0441\u0442\u043e\u0440\u043e\u043d\u044b \u043f\u0440\u0438 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0438 \u043f\u0440\u0438\u0432\u0435\u043b\u0438 \u0431\u044b \u043a \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044e. \u041d\u043e \u0432 \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0435 \u044d\u0442\u043e\u0433\u043e \u0440\u0430\u0437\u0434\u0435\u043b\u0430 \u0412\u0441\u0435\u0433\u0434\u0430 \u0412\u0430\u0448 \u0432\u0437\u044f\u043b \u0431\u044b \u043d\u0430 \u0441\u0435\u0431\u044f \u0441\u043c\u0435\u043b\u043e\u0441\u0442\u044c \u0440\u0435\u0430\u043d\u0438\u043c\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438 <a href=\"https:\/\/blog.research.google\/2006\/06\/extra-extra-read-all-about-it-nearly.html\">\u0442\u0430\u043a\u0443\u044e \u0432\u043e\u0442 \u0441\u0442\u0430\u0442\u044c\u044e<\/a> \u043e\u0442 \u0431\u044b\u0432\u0448\u0435\u0433\u043e \u0441\u043e\u0442\u0440\u0443\u0434\u043d\u0438\u043a\u0430  Google \u0438 \u0430\u0432\u0442\u043e\u0440\u0430 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u044b\u0445 \u0447\u0430\u0441\u0442\u0435\u0439 Java. \u0412 \u043d\u0435\u0439 \u043e\u043d \u043e\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u0442, \u043a\u0430\u043a \u043f\u0440\u043e\u0441\u0442\u043e\u0439 <em>mergesort<\/em> \u0432 \u0442\u0435\u0447\u0435\u043d\u0438\u0435 \u043c\u043d\u043e\u0433\u0438\u0445 \u043b\u0435\u0442 \u0441\u043e\u0434\u0435\u0440\u0436\u0430\u043b \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u044b\u0439 \u0431\u0430\u0433 \u0441 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435\u043c, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0434\u043e\u043b\u0433\u043e\u0435 \u0432\u0440\u0435\u043c\u044f \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u043c\u043e\u0433 \u0432\u044b\u0441\u0442\u0440\u0435\u043b\u0438\u0442\u044c, \u043d\u043e \u0432\u0441\u0451-\u0442\u0430\u043a\u0438 \u0434\u043e\u0436\u0434\u0430\u043b\u0441\u044f \u0441\u0432\u043e\u0435\u0433\u043e.<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0436\u0435 \u043f\u0440\u0435\u0434\u0443\u043f\u0440\u0435\u0436\u0434\u0430\u0435\u0442:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v1028\/\"><strong>V1028<\/strong><\/a><strong> Possible overflow. Consider casting operands of the &#8216;swdata->h * swdata->w&#8217; operator to the &#8216;size_t&#8217; type, not the result. SDL\/src\/render\/SDL_yuv_sw.c:125:1<\/strong><\/p>\n<p><em>P.S. \u041a\u043e\u0434 \u043f\u043e\u0434 \u0432\u043e\u043f\u0440\u043e\u0441\u043e\u043c, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u0437\u0430\u043c\u0435\u043d\u0438\u0442\u044c \u0442\u0430\u043a\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/em><\/p>\n<pre><code class=\"cpp\">(size_t)(swdata->h) * (size_t)(swdata->w) +   (2 * (((size_t)(swdata->h) + 1) \/ 2)) *   (((size_t)(swdata->w) + 1) \/ 2);<\/code><\/pre>\n<p><em>\u0412\u043f\u0440\u043e\u0447\u0435\u043c, \u0437\u0430\u0447\u0435\u043c \u043f\u043b\u0430\u0442\u0438\u0442\u044c \u0437\u0430 \u0431\u0435\u0437\u043e\u043f\u0430\u0441\u043d\u043e\u0441\u0442\u044c \u0447\u0438\u0442\u0430\u0435\u043c\u043e\u0441\u0442\u044c\u044e \u043a\u043e\u0434\u0430? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0435\u0433\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c:<\/em><\/p>\n<pre><code class=\"cpp\">const size_t h = swdata->h; const size_t w = swdata->w; SDL_memcpy(swdata->pixels, pixels,            h * w + 2 * ((h + 1) \/ 2) * ((w + 1) \/ 2));<\/code><\/pre>\n<figure class=\"full-width\"><\/figure>\n<h3>\u0422\u0435\u043d\u044c \u0441\u043e\u043c\u043d\u0435\u043d\u0438\u044f<\/h3>\n<p>\u041a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u043b \u0410\u043b\u044c\u0444\u0440\u0435\u0434 \u0425\u0438\u0447\u043a\u043e\u043a: &#171;\u041f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u0435 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u0438\u0437 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 \u0441\u0440\u043e\u0434\u043d\u0438 \u0436\u0435\u043d\u0449\u0438\u043d\u0435 \u2014 \u0447\u0435\u043c \u0431\u043e\u043b\u044c\u0448\u0435 \u0434\u043e\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u0448\u044c, \u0442\u0435\u043c \u0441\u0438\u043b\u044c\u043d\u0435\u0435 \u044d\u043c\u043e\u0446\u0438\u0438&#187;. \u041a\u0430\u043a\u0438\u0435 \u044d\u043c\u043e\u0446\u0438\u0438 \u0432\u044b\u0437\u044b\u0432\u0430\u0435\u0442 \u0443 \u0432\u0430\u0441, \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c, \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0444\u0440\u0430\u0433\u043c\u0435\u043d\u0442?<\/p>\n<p>\u0424\u0430\u0439\u043b: SDL\/src\/joystick\/linux\/SDL_sysjoystick.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/4c3e84897fdf483394cf48c05df6d544afbe83ec\/src\/joystick\/linux\/SDL_sysjoystick.c#L1011\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">static SDL_JoystickGUID LINUX_JoystickGetDeviceGUID(int device_index) {   return GetJoystickByDevIndex(device_index)->guid; }<\/code><\/pre>\n<p>\u0421\u043e\u0433\u043b\u0430\u0441\u0438\u0442\u0435\u0441\u044c, \u0441\u0430\u0441\u043f\u0435\u043d\u0441 \u043d\u0430\u0447\u0438\u043d\u0430\u0435\u0442 \u0437\u0430\u0440\u043e\u0436\u0434\u0430\u0442\u044c\u0441\u044f \u0443\u0436\u0435 \u043e\u0442 \u0441\u0430\u043c\u043e\u0433\u043e \u0444\u0430\u043a\u0442\u0430 \u043e\u0431\u0440\u0430\u0449\u0435\u043d\u0438\u044f \u043f\u043e \u043d\u0435\u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u043d\u043e\u043c\u0443 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044e. \u041d\u043e, \u043c\u043e\u0436\u0435\u0442, <em>GetJoystickByDevIndex<\/em> \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0432\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0438\u0447\u0435\u0433\u043e \u0442\u0430\u043a\u043e\u0433\u043e? \u0414\u0430\u0432\u0430\u0439\u0442\u0435 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c:<\/p>\n<p>\u0424\u0430\u0439\u043b: SDL\/src\/joystick\/linux\/SDL_sysjoystick.c (<a href=\"https:\/\/github.com\/libsdl-org\/SDL\/blob\/4c3e84897fdf483394cf48c05df6d544afbe83ec\/src\/joystick\/linux\/SDL_sysjoystick.c#L975\">GitHub permalink<\/a>)<\/p>\n<pre><code class=\"cpp\">static SDL_joylist_item *GetJoystickByDevIndex(int device_index) {   ....   if ((device_index &lt; 0) || (device_index >= numjoysticks)) {     return NULL;   }   .... }<\/code><\/pre>\n<p><em>NULL<\/em>, \u0432\u043e\u0442 \u043c\u044b \u0438 \u0432\u0441\u0442\u0440\u0435\u0442\u0438\u043b\u0438\u0441\u044c \u0441\u043d\u043e\u0432\u0430!<\/p>\n<p>&#171;\u0412\u043e \u0432\u0437\u0440\u044b\u0432\u0435 \u043d\u0435\u0442 \u043d\u0438\u0447\u0435\u0433\u043e \u0441\u0442\u0440\u0430\u0448\u043d\u043e\u0433\u043e. \u0422\u043e \u043b\u0438 \u0434\u0435\u043b\u043e \u2014 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u0435 \u0432\u0437\u0440\u044b\u0432\u0430!&#187; \u2014 \u0441\u043a\u0430\u0437\u0430\u043b \u043a\u0430\u043a-\u0442\u043e \u043c\u044d\u0442\u0440. \u041d\u043e \u0435\u0441\u043b\u0438 \u0432\u0437\u0440\u044b\u0432 \u0432\u0435\u0434\u0451\u0442 \u043a \u0437\u0430\u043f\u0443\u0441\u043a\u0443 \u043e\u0442\u043b\u0430\u0434\u0447\u0438\u043a\u0430 \u2014 \u044d\u0442\u043e \u0443\u0436\u0435 \u0441\u043e\u0432\u0441\u0435\u043c \u0434\u0440\u0443\u0433\u0430\u044f \u0438\u0441\u0442\u043e\u0440\u0438\u044f!<\/p>\n<p>\u0410\u043d\u0430\u043b\u0438\u0437\u0430\u0442\u043e\u0440 \u0441\u043e\u0433\u043b\u0430\u0448\u0430\u0435\u0442\u0441\u044f:<\/p>\n<p><a href=\"https:\/\/pvs-studio.ru\/ru\/docs\/warnings\/v522\/\"><strong>V522<\/strong><\/a><strong> There might be dereferencing of a potential null pointer &#8216;GetJoystickByDevIndex(device_index)&#8217;. SDL\/src\/joystick\/linux\/SDL_sysjoystick.c:1013:1<\/strong><\/p>\n<p><em>P.S. \u0412\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0447\u0438\u0442\u0430\u0442\u0435\u043b\u044c \u0437\u0430\u043c\u0435\u0442\u0438\u0442, \u0447\u0442\u043e \u0432 <\/em><\/p>\n<\/div>\n<\/div>\n<\/div>\n<\/div>\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-360486","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/360486","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=360486"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/360486\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=360486"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=360486"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=360486"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}