Merge remote-tracking branch 'origin/5.4' into 5.5
Change-Id: I004854a25ebbf12b1fda88900162fe7878716c58
This commit is contained in:
commit
605617b5dc
@ -13,12 +13,12 @@ HTML.footer += \
|
|||||||
" <nav class=\"footer-nav clearfix\">\n" \
|
" <nav class=\"footer-nav clearfix\">\n" \
|
||||||
" <div class=\"menu-footer-menu-container\"><ul id=\"menu-footer-menu\" class=\"menu\"><li id=\"menu-item-1350\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1350\"><a href=\"http://qt.io/about-us/\">About us</a>\n" \
|
" <div class=\"menu-footer-menu-container\"><ul id=\"menu-footer-menu\" class=\"menu\"><li id=\"menu-item-1350\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1350\"><a href=\"http://qt.io/about-us/\">About us</a>\n" \
|
||||||
"<ul class=\"sub-menu\">\n" \
|
"<ul class=\"sub-menu\">\n" \
|
||||||
" <li id=\"menu-item-1353\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1353\"><a href=\"http://qt.io/events/\">Events</a></li>\n" \
|
" <li id=\"menu-item-1353\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1353\"><a href=\"http://qt.io/events/\">Training & Events</a></li>\n" \
|
||||||
" <li id=\"menu-item-1596\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1596\"><a href=\"http://qt.io/news/\">News</a></li>\n" \
|
" <li id=\"menu-item-1596\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1596\"><a href=\"http://qt.io/news/\">News</a></li>\n" \
|
||||||
" <li id=\"menu-item-1354\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1354\"><a href=\"http://qt.io/resource-center/\">Resource Center</a></li>\n" \
|
" <li id=\"menu-item-1354\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1354\"><a href=\"http://qt.io/resource-center/\">Resource Center</a></li>\n" \
|
||||||
" <li id=\"menu-item-1352\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1352\"><a href=\"http://qt.io/partners/\">Partners</a></li>\n" \
|
" <li id=\"menu-item-1352\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1352\"><a href=\"http://qt.io/partners/\">Partners</a></li>\n" \
|
||||||
" <li id=\"menu-item-1349\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1349\"><a href=\"http://qt.io/careers/\">Careers</a></li>\n" \
|
" <li id=\"menu-item-1349\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1349\"><a href=\"http://qt.io/careers/\">Careers</a></li>\n" \
|
||||||
" <li id=\"menu-item-1415\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1415\"><a href=\"http://qt.io/terms-conditions/\">Terms & Conditions</a></li>\n" \
|
" <li id=\"menu-item-11676\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-11676\"><a href=\"http://qt.io/locations/\">Locations</a></li>\n" \
|
||||||
"</ul>\n" \
|
"</ul>\n" \
|
||||||
"</li>\n" \
|
"</li>\n" \
|
||||||
"<li id=\"menu-item-1355\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1355\"><a href=\"http://qt.io/product/\">Product</a>\n" \
|
"<li id=\"menu-item-1355\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1355\"><a href=\"http://qt.io/product/\">Product</a>\n" \
|
||||||
@ -28,7 +28,7 @@ HTML.footer += \
|
|||||||
" <li id=\"menu-item-1359\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1359\"><a href=\"http://qt.io/qt-quick/\">Qt Quick</a></li>\n" \
|
" <li id=\"menu-item-1359\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1359\"><a href=\"http://qt.io/qt-quick/\">Qt Quick</a></li>\n" \
|
||||||
" <li id=\"menu-item-1357\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1357\"><a href=\"http://qt.io/qt-for-device-creation/\">Qt for Device Creation</a></li>\n" \
|
" <li id=\"menu-item-1357\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1357\"><a href=\"http://qt.io/qt-for-device-creation/\">Qt for Device Creation</a></li>\n" \
|
||||||
" <li id=\"menu-item-10159\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-10159\"><a href=\"http://qt.io/mobile-app-development/\">Qt for Mobile Apps</a></li>\n" \
|
" <li id=\"menu-item-10159\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-10159\"><a href=\"http://qt.io/mobile-app-development/\">Qt for Mobile Apps</a></li>\n" \
|
||||||
" <li id=\"menu-item-1366\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-1366\"><a href=\"http://showroom.qt-project.org/\">Showroom</a></li>\n" \
|
" <li id=\"menu-item-12576\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-12576\"><a href=\"http://qt.io/qt-in-use/\">Qt in Use</a></li>\n" \
|
||||||
"</ul>\n" \
|
"</ul>\n" \
|
||||||
"</li>\n" \
|
"</li>\n" \
|
||||||
"<li id=\"menu-item-33\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-33\"><a href=\"http://qt.io/developers/\">Developers</a>\n" \
|
"<li id=\"menu-item-33\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-33\"><a href=\"http://qt.io/developers/\">Developers</a>\n" \
|
||||||
@ -53,18 +53,19 @@ HTML.footer += \
|
|||||||
"</li>\n" \
|
"</li>\n" \
|
||||||
"<li id=\"menu-item-1403\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1403\"><a href=\"http://qt.io/download/\">Download</a>\n" \
|
"<li id=\"menu-item-1403\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-has-children menu-item-1403\"><a href=\"http://qt.io/download/\">Download</a>\n" \
|
||||||
"<ul class=\"sub-menu\">\n" \
|
"<ul class=\"sub-menu\">\n" \
|
||||||
" <li id=\"menu-item-1985\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1985\"><a title=\"Professional\" href=\"http://qt.io/buy/\">Professional</a></li>\n" \
|
" <li id=\"menu-item-11677\" class=\"menu-item menu-item-type-custom menu-item-object-custom menu-item-11677\"><a href=\"http://qt.io/download/\">Free 30-Day Trial</a></li>\n" \
|
||||||
" <li id=\"menu-item-3346\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-3346\"><a title=\"Indie Mobile\" href=\"http://qt.io/download-mobile/\">Indie Mobile</a></li>\n" \
|
" <li id=\"menu-item-1982\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1982\"><a href=\"http://qt.io/buy-enterprise-step-2/\">Enterprise</a></li>\n" \
|
||||||
" <li id=\"menu-item-1982\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1982\"><a title=\"Enterprise\" href=\"http://qt.io/download-enterprise-step-2/\">Enterprise</a></li>\n" \
|
" <li id=\"menu-item-1985\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1985\"><a href=\"http://qt.io/buy-professional-step-2/\">Professional</a></li>\n" \
|
||||||
" <li id=\"menu-item-3013\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-3013\"><a title=\"Evaluation\" href=\"http://qt.io/download-eval-step-2/\">Evaluation</a></li>\n" \
|
" <li id=\"menu-item-3346\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-3346\"><a href=\"http://qt.io/buy-indiemobile-step-2/\">Indie Mobile</a></li>\n" \
|
||||||
" <li id=\"menu-item-3343\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-3343\"><a href=\"http://qt.io/download-open-source/\">Community</a></li>\n" \
|
" <li id=\"menu-item-3343\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-3343\"><a href=\"http://qt.io/download-open-source/\">Community</a></li>\n" \
|
||||||
|
" <li id=\"menu-item-1415\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1415\"><a href=\"http://qt.io/terms-conditions/\">Legal | Terms & Conditions</a></li>\n" \
|
||||||
"</ul>\n" \
|
"</ul>\n" \
|
||||||
"</li>\n" \
|
"</li>\n" \
|
||||||
"</ul></div></nav>\n" \
|
"</ul></div></nav>\n" \
|
||||||
"<a href=\"http://qt.io/about-us/\" target=\"_blank\" class=\"theqtcompany\"></a>\n" \
|
"<a href=\"http://qt.io/about-us/\" target=\"_blank\" class=\"theqtcompany\"></a>\n" \
|
||||||
" <div class=\"footer-social clearfix\">\n" \
|
" <div class=\"footer-social clearfix\">\n" \
|
||||||
" <div class=\"facebook\">\n" \
|
" <div class=\"facebook\">\n" \
|
||||||
" <iframe scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" src=\"//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fqtbydigia&width&layout=button_count&action=like&show_faces=true&share=false&height=21\" style=\"border:none;overflow:hidden;height:21px;\"></iframe>\n" \
|
" <iframe scrolling=\"no\" frameborder=\"0\" allowTransparency=\"true\" src=\"//www.facebook.com/plugins/like.php?href=https%3A%2F%2Fwww.facebook.com%2Fqt&width&layout=button_count&action=like&show_faces=true&share=false&height=21\" style=\"border:none;overflow:hidden;height:21px;\"></iframe>\n" \
|
||||||
" </div>\n" \
|
" </div>\n" \
|
||||||
" <div class=\"twitter\">\n" \
|
" <div class=\"twitter\">\n" \
|
||||||
" <iframe id=\"twitter-widget-0\" scrolling=\"no\" frameborder=\"0\" allowtransparency=\"true\" src=\"http://platform.twitter.com/widgets/follow_button.33b190ea0cba008796487b65df7f6d8e.en.html#_=1414403615717&id=twitter-widget-0&lang=en&screen_name=qtproject&show_count=true&show_screen_name=false&size=m\" class=\"twitter-follow-button twitter-follow-button\" title=\"Twitter Follow Button\" data-twttr-rendered=\"true\" style=\"width: 160px; height: 20px;\"></iframe>\n" \
|
" <iframe id=\"twitter-widget-0\" scrolling=\"no\" frameborder=\"0\" allowtransparency=\"true\" src=\"http://platform.twitter.com/widgets/follow_button.33b190ea0cba008796487b65df7f6d8e.en.html#_=1414403615717&id=twitter-widget-0&lang=en&screen_name=qtproject&show_count=true&show_screen_name=false&size=m\" class=\"twitter-follow-button twitter-follow-button\" title=\"Twitter Follow Button\" data-twttr-rendered=\"true\" style=\"width: 160px; height: 20px;\"></iframe>\n" \
|
||||||
|
@ -29,7 +29,7 @@ HTML.headerstyles = \
|
|||||||
|
|
||||||
HTML.headerscripts = \
|
HTML.headerscripts = \
|
||||||
" <script type=\"text/javascript\"> wpThemeFolder = \'http://qt.io/wp-content/themes/oneqt\'; </script>\n" \
|
" <script type=\"text/javascript\"> wpThemeFolder = \'http://qt.io/wp-content/themes/oneqt\'; </script>\n" \
|
||||||
" <script type=\"text/javascript\" src=\"http://d3hp9ud7yvwzy0.cloudfront.net/wp-content/themes/oneqt/js/combo.js.gzip\"></script>\n" \
|
" <script type=\"text/javascript\" src=\"//d3hp9ud7yvwzy0.cloudfront.net/wp-content/themes/oneqt/js/combo.js.gzip\"></script>\n" \
|
||||||
" <script type=\"text/javascript\" src=\"scripts/main.js\"></script>\n" \
|
" <script type=\"text/javascript\" src=\"scripts/main.js\"></script>\n" \
|
||||||
" <script type=\"text/javascript\" src=\"scripts/extras.js\"></script>\n" \
|
" <script type=\"text/javascript\" src=\"scripts/extras.js\"></script>\n" \
|
||||||
" <script type=\"text/javascript\">\n" \
|
" <script type=\"text/javascript\">\n" \
|
||||||
@ -62,7 +62,7 @@ HTML.postheader = \
|
|||||||
"<header id=\"navbar\" class=\"\">\n" \
|
"<header id=\"navbar\" class=\"\">\n" \
|
||||||
" <div class=\"cookies_yum\">\n" \
|
" <div class=\"cookies_yum\">\n" \
|
||||||
" <div>\n" \
|
" <div>\n" \
|
||||||
" <img src=\"http://qt.io/wp-content/themes/oneqt/assets/images/cookie_small.png\" align=\"left\">\n" \
|
" <img src=\"//d3hp9ud7yvwzy0.cloudfront.net/wp-content/themes/oneqt/assets/images/cookie_small.png\" align=\"left\">\n" \
|
||||||
" <p class=\"close_button\">\n" \
|
" <p class=\"close_button\">\n" \
|
||||||
" We bake cookies in your browser for a better experience. Using this site means that you consent. <a href=\"//qt.io/terms-conditions/\">Read More</a>\n" \
|
" We bake cookies in your browser for a better experience. Using this site means that you consent. <a href=\"//qt.io/terms-conditions/\">Read More</a>\n" \
|
||||||
" </p>\n" \
|
" </p>\n" \
|
||||||
@ -95,12 +95,11 @@ HTML.postheader = \
|
|||||||
" <a href=\"http://qt.io/\" class=\"navbar-oneQt retina\" data-icon=\"\">\n" \
|
" <a href=\"http://qt.io/\" class=\"navbar-oneQt retina\" data-icon=\"\">\n" \
|
||||||
" </a>\n" \
|
" </a>\n" \
|
||||||
" <nav class=\"navbar-menu clearfix\" role=\"navigation\">\n" \
|
" <nav class=\"navbar-menu clearfix\" role=\"navigation\">\n" \
|
||||||
" <ul id=\"mainmenu\" class=\"menu\"><li id=\"menu-item-21\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-21\"><a href=\"http://qt.io/product/\">Product</a></li>\n" \
|
" <ul id=\"mainmenu\" class=\"menu\"><li id=\"menu-item-18\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-18\"><a href=\"http://qt.io/download/\">Download</a></li>\n" \
|
||||||
"<li id=\"menu-item-1381\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1381\"><a href=\"http://qt.io/services/\">Services</a></li>\n" \
|
"<li id=\"menu-item-12207\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-12207\"><a href=\"http://www.qt.io/qt-for-device-creation/\">Device Creation</a></li>\n" \
|
||||||
"<li id=\"menu-item-22\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-22\"><a href=\"http://qt.io/qt-in-use/\">Qt in Use</a></li>\n" \
|
"<li id=\"menu-item-12208\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-12208\"><a href=\"http://www.qt.io/application-development/\">Application Development</a></li>\n" \
|
||||||
"<li id=\"menu-item-20\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-20\"><a href=\"http://qt.io/developers/\">Developers</a></li>\n" \
|
"<li id=\"menu-item-1381\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-1381\"><a href=\"http://www.qt.io/services/\">Services</a></li>\n" \
|
||||||
"<li id=\"menu-item-4466\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-4466\"><a href=\"http://qt.io/licensing/\">Licensing</a></li>\n" \
|
"<li id=\"menu-item-20\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-20\"><a href=\"http://www.qt.io/developers/\">Developers</a></li>\n" \
|
||||||
"<li id=\"menu-item-18\" class=\"menu-item menu-item-type-post_type menu-item-object-page menu-item-18\"><a href=\"http://qt.io/download/\">Download</a></li>\n" \
|
|
||||||
"</ul> <ul class=\"menuextraslanguages\">\n" \
|
"</ul> <ul class=\"menuextraslanguages\">\n" \
|
||||||
" <li class=\"active dark\"><a class=\"dark\" href=\"http://qt.io/support/\">EN</a></li><li class=\"dark\"><a class=\"dark\" href=\"http://qt.io/ru/\">RU</a></li><li class=\"dark\"><a class=\"dark\" href=\"http://qt.io/zh-hans/\">ZH</a></li></ul>\n" \
|
" <li class=\"active dark\"><a class=\"dark\" href=\"http://qt.io/support/\">EN</a></li><li class=\"dark\"><a class=\"dark\" href=\"http://qt.io/ru/\">RU</a></li><li class=\"dark\"><a class=\"dark\" href=\"http://qt.io/zh-hans/\">ZH</a></li></ul>\n" \
|
||||||
" </nav>\n" \
|
" </nav>\n" \
|
||||||
|
@ -4,7 +4,7 @@ $(function () {
|
|||||||
$('a[href*=#]:not([href=#])').on('click', function (e) {
|
$('a[href*=#]:not([href=#])').on('click', function (e) {
|
||||||
if (e.which == 2)
|
if (e.which == 2)
|
||||||
return true;
|
return true;
|
||||||
var target = $(this.hash);
|
var target = $(this.hash.replace(/(\.)/g, "\\$1"));
|
||||||
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
|
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
|
||||||
if (target.length) {
|
if (target.length) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
@ -15,10 +15,10 @@ $(function () {
|
|||||||
|
|
||||||
$(window).load(function () {
|
$(window).load(function () {
|
||||||
var h = window.location.hash;
|
var h = window.location.hash;
|
||||||
var re = /[^a-z0-9_\#\-]/i
|
var re = /[^a-z0-9_\.\#\-]/i
|
||||||
if (h.length > 1 && !re.test(h)) {
|
if (h.length > 1 && !re.test(h)) {
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
$(window).scrollTop($(h).offset().top - vOffset);
|
$(window).scrollTop($(h.replace(/(\.)/g, "\\$1")).offset().top - vOffset);
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -36,7 +36,7 @@ function load_sdk(s, id, src) {
|
|||||||
fjs.parentNode.insertBefore(js, fjs);
|
fjs.parentNode.insertBefore(js, fjs);
|
||||||
}
|
}
|
||||||
$(document).ready(function($) {
|
$(document).ready(function($) {
|
||||||
if (document.documentElement.clientWidth < 1220) {
|
if (document.documentElement.clientWidth < 1280) {
|
||||||
oneQt.extraLinksToMain();
|
oneQt.extraLinksToMain();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,7 +76,7 @@ $(document).ready(function($) {
|
|||||||
$(window).resize(function() {
|
$(window).resize(function() {
|
||||||
oneQt.stickySidebar();
|
oneQt.stickySidebar();
|
||||||
oneQt.footerPosition();
|
oneQt.footerPosition();
|
||||||
if (document.documentElement.clientWidth < 1220) {
|
if (document.documentElement.clientWidth < 1280) {
|
||||||
oneQt.extraLinksToMain();
|
oneQt.extraLinksToMain();
|
||||||
} else {
|
} else {
|
||||||
oneQt.mainLinkstoExtra();
|
oneQt.mainLinkstoExtra();
|
||||||
@ -216,7 +216,7 @@ var oneQt = {
|
|||||||
var extramenuLinks = $('#menuextras').find('li');
|
var extramenuLinks = $('#menuextras').find('li');
|
||||||
var mainmenu = $('#mainmenu');
|
var mainmenu = $('#mainmenu');
|
||||||
var count = 0;
|
var count = 0;
|
||||||
if ($(extramenuLinks).length > 3) {
|
if ($(extramenuLinks).length > 2) {
|
||||||
$(extramenuLinks).each(function() {
|
$(extramenuLinks).each(function() {
|
||||||
if (count < 3) {
|
if (count < 3) {
|
||||||
var newLink = $(this);
|
var newLink = $(this);
|
||||||
|
@ -25,7 +25,9 @@
|
|||||||
min-width:95px;
|
min-width:95px;
|
||||||
position:relative;
|
position:relative;
|
||||||
text-align:center;
|
text-align:center;
|
||||||
margin:10px 0 0 0
|
border-left:1px solid #eee;
|
||||||
|
border-right:1px solid #eee;
|
||||||
|
padding:10px 0 10px 0
|
||||||
}
|
}
|
||||||
#navbar .navbar-toggle:hover figure {
|
#navbar .navbar-toggle:hover figure {
|
||||||
background:#5caa15
|
background:#5caa15
|
||||||
@ -873,13 +875,13 @@ body.qt-account #navbar .navbar-oneQt h2 {
|
|||||||
.clearfix .right {
|
.clearfix .right {
|
||||||
float:right
|
float:right
|
||||||
}
|
}
|
||||||
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
|
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
|
||||||
margin:0;
|
margin:0;
|
||||||
padding:0;
|
padding:0;
|
||||||
border:0;
|
border:0;
|
||||||
font-size:100%
|
font-size:100%
|
||||||
}
|
}
|
||||||
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,caption,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
|
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,caption,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video {
|
||||||
vertical-align:baseline
|
vertical-align:baseline
|
||||||
}
|
}
|
||||||
body {
|
body {
|
||||||
|
@ -19,3 +19,17 @@ dumpcpp_impl.name = CPP
|
|||||||
dumpcpp_impl.depends = ${QMAKE_FILE_BASE}.h
|
dumpcpp_impl.depends = ${QMAKE_FILE_BASE}.h
|
||||||
|
|
||||||
QMAKE_EXTRA_COMPILERS += dumpcpp_impl
|
QMAKE_EXTRA_COMPILERS += dumpcpp_impl
|
||||||
|
|
||||||
|
|
||||||
|
# Create dependencies from every object file to our generated header files.
|
||||||
|
if(isEmpty(BUILDS)|build_pass):have_target:!contains(TEMPLATE, vc.*) {
|
||||||
|
for(tlb, TYPELIBS) {
|
||||||
|
hdr = $$basename(tlb)
|
||||||
|
hdr = $$section(hdr, ., 0, -2).h
|
||||||
|
TYPELIB_HEADERS += $$hdr
|
||||||
|
}
|
||||||
|
|
||||||
|
objtgt.target = $(OBJECTS)
|
||||||
|
objtgt.depends = $$TYPELIB_HEADERS
|
||||||
|
QMAKE_EXTRA_TARGETS += objtgt
|
||||||
|
}
|
||||||
|
1
src/3rdparty/libpng.pri
vendored
1
src/3rdparty/libpng.pri
vendored
@ -1,4 +1,5 @@
|
|||||||
DEFINES *= QT_USE_BUNDLED_LIBPNG
|
DEFINES *= QT_USE_BUNDLED_LIBPNG
|
||||||
|
DEFINES += PNG_ARM_NEON_OPT=0
|
||||||
INCLUDEPATH += $$PWD/libpng
|
INCLUDEPATH += $$PWD/libpng
|
||||||
SOURCES += $$PWD/libpng/png.c \
|
SOURCES += $$PWD/libpng/png.c \
|
||||||
$$PWD/libpng/pngerror.c \
|
$$PWD/libpng/pngerror.c \
|
||||||
|
86
src/3rdparty/libpng/ANNOUNCE
vendored
86
src/3rdparty/libpng/ANNOUNCE
vendored
@ -1,5 +1,4 @@
|
|||||||
|
Libpng 1.6.17 - March 26, 2015
|
||||||
Libpng 1.5.10 - March 29, 2012
|
|
||||||
|
|
||||||
This is a public release of libpng, intended for use in production codes.
|
This is a public release of libpng, intended for use in production codes.
|
||||||
|
|
||||||
@ -8,52 +7,61 @@ Files available for download:
|
|||||||
Source files with LF line endings (for Unix/Linux) and with a
|
Source files with LF line endings (for Unix/Linux) and with a
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
libpng-1.5.10.tar.xz (LZMA-compressed, recommended)
|
libpng-1.6.17.tar.xz (LZMA-compressed, recommended)
|
||||||
libpng-1.5.10.tar.gz
|
libpng-1.6.17.tar.gz
|
||||||
libpng-1.5.10.tar.bz2
|
|
||||||
|
|
||||||
Source files with CRLF line endings (for Windows), without the
|
Source files with CRLF line endings (for Windows), without the
|
||||||
"configure" script
|
"configure" script
|
||||||
|
|
||||||
lpng1510.7z (LZMA-compressed, recommended)
|
lpng1617.7z (LZMA-compressed, recommended)
|
||||||
lpng1510.zip
|
lpng1617.zip
|
||||||
|
|
||||||
Other information:
|
Other information:
|
||||||
|
|
||||||
libpng-1.5.10-README.txt
|
libpng-1.6.17-README.txt
|
||||||
libpng-1.5.10-LICENSE.txt
|
libpng-1.6.17-LICENSE.txt
|
||||||
|
libpng-1.6.17-*.asc (armored detached GPG signatures)
|
||||||
|
|
||||||
Changes since the last public release (1.5.9):
|
Changes since the last public release (1.6.16):
|
||||||
|
|
||||||
Removed two useless #ifdef directives from pngread.c and one from pngrutil.c
|
Removed duplicate PNG_SAFE_LIMITS_SUPPORTED handling from pngconf.h
|
||||||
Always put the CMAKE_LIBRARY in "lib" (removed special WIN32 case).
|
Corrected the width limit calculation in png_check_IHDR().
|
||||||
Removed empty vstudio/pngstest directory (Clifford Yapp).
|
Removed user limits from pngfix. Also pass NULL pointers to
|
||||||
Eliminated redundant png_push_read_tEXt|zTXt|iTXt|unknown code from
|
png_read_row to skip the unnecessary row de-interlace stuff.
|
||||||
pngpread.c and use the sequential png_handle_tEXt, etc., in pngrutil.c;
|
Added testing of png_set_packing() to pngvalid.c
|
||||||
now that png_ptr->buffer is inaccessible to applications, the special
|
Regenerated configure scripts in the *.tar distributions with libtool-2.4.4
|
||||||
handling is no longer useful.
|
Implement previously untested cases of libpng transforms in pngvalid.c
|
||||||
Fixed bug with png_handle_hIST with odd chunk length (Frank Busse).
|
Fixed byte order in 2-byte filler, in png_do_read_filler().
|
||||||
Added PNG_SAFE_LIMITS feature to pnglibconf.dfa and code in pngconf.h
|
Made the check for out-of-range values in png_set_tRNS() detect
|
||||||
to reset the user limits to safe ones if PNG_SAFE_LIMITS is defined.
|
values that are exactly 2^bit_depth, and work on 16-bit platforms.
|
||||||
To enable, use "CPPFLAGS=-DPNG_SAFE_LIMITS_SUPPORTED" on the configure
|
Merged some parts of libpng-1.6.17beta01 and libpng-1.7.0beta47.
|
||||||
command or put "#define PNG_SAFE_LIMITS_SUPPORTED" in pnglibconf.h.
|
Added #ifndef __COVERITY__ where needed in png.c, pngrutil.c and
|
||||||
Revised the SAFE_LIMITS feature to be the same as the feature in libpng16.
|
pngset.c to avoid warnings about dead code.
|
||||||
Added information about the new limits in the manual.
|
Do not build png_product2() when it is unused.
|
||||||
Updated Makefile.in
|
Display user limits in the output from pngtest.
|
||||||
Removed unused "current_text" members of png_struct and the png_free()
|
Eliminated the PNG_SAFE_LIMITS macro and restored the 1-million-column
|
||||||
of png_ptr->current_text from pngread.c
|
and 1-million-row default limits in pnglibconf.dfa, that can be reset
|
||||||
Fixed PNG_LIBPNG_BUILD_BASE_TYPE definition.
|
by the user at build time or run time. This provides a more robust
|
||||||
Fixed CMF optimization of non-IDAT compressed chunks, which was added at
|
defense against DOS and as-yet undiscovered overflows.
|
||||||
libpng-1.5.4. It sometimes produced too small of a window.
|
Added PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED macro, on by default.
|
||||||
Reject all iCCP chunks after the first, even if the first one is invalid.
|
Allow user to call png_get_IHDR() with NULL arguments (Reuben Hawkins).
|
||||||
Added palette-index checking. Issue a png_benign_error() if an invalid
|
Rebuilt configure scripts with automake-1.15 and libtool-2.4.6
|
||||||
index is found.
|
Moved png_set_filter() prototype into a PNG_WRITE_SUPPORTED block
|
||||||
Revised example.c to put text strings in a temporary character array
|
of png.h.
|
||||||
instead of directly assigning string constants to png_textp members.
|
Avoid runtime checks when converting integer to png_byte with
|
||||||
This avoids compiler warnings when -Wwrite-strings is enabled.
|
Visual Studio (Sergey Kosarevsky)
|
||||||
Prevent PNG_EXPAND+PNG_SHIFT doing the shift twice.
|
Removed some comments that the configure script did not handle
|
||||||
Revised png_set_text_2() to avoid potential memory corruption (fixes
|
properly from scripts/pnglibconf.dfa and pnglibconf.h.prebuilt.
|
||||||
CVE-2011-3048).
|
Free the unknown_chunks structure even when it contains no data.
|
||||||
|
Updated CMakeLists.txt to add OSX framework, change YES/NO to ON/OFF
|
||||||
|
for consistency, and remove some useless tests (Alexey Petruchik).
|
||||||
|
Remove pnglibconf.h, pnglibconf.c, pnglibconf.pre, pnglibconf.dfn,
|
||||||
|
and pnglibconf.out instead of pnglibconf.* in "make clean" (Cosmin).
|
||||||
|
Fixed simplified 8-bit-linear to sRGB alpha. The calculated alpha
|
||||||
|
value was wrong. It's not clear if this affected the final stored
|
||||||
|
value; in the obvious code path the upper and lower 8-bits of the
|
||||||
|
alpha value were identical and the alpha was truncated to 8-bits
|
||||||
|
rather than dividing by 257 (John Bowler).
|
||||||
|
|
||||||
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
Send comments/corrections/commendations to png-mng-implement at lists.sf.net
|
||||||
(subscription required; visit
|
(subscription required; visit
|
||||||
|
1438
src/3rdparty/libpng/CHANGES
vendored
1438
src/3rdparty/libpng/CHANGES
vendored
File diff suppressed because it is too large
Load Diff
314
src/3rdparty/libpng/INSTALL
vendored
314
src/3rdparty/libpng/INSTALL
vendored
@ -1,32 +1,69 @@
|
|||||||
|
|
||||||
Installing libpng
|
Installing libpng
|
||||||
|
|
||||||
|
Contents
|
||||||
|
|
||||||
|
I. Simple installation
|
||||||
|
II. Rebuilding the configure scripts
|
||||||
|
III. Using scripts/makefile*
|
||||||
|
IV. Using cmake
|
||||||
|
V. Directory structure
|
||||||
|
VI. Building with project files
|
||||||
|
VII. Building with makefiles
|
||||||
|
VIII. Configuring libpng for 16-bit platforms
|
||||||
|
IX. Configuring for DOS
|
||||||
|
X. Configuring for Medium Model
|
||||||
|
XI. Prepending a prefix to exported symbols
|
||||||
|
XII. Configuring for compiler xxx:
|
||||||
|
XIII. Removing unwanted object code
|
||||||
|
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||||
|
XV. Setjmp/longjmp issues
|
||||||
|
XVI. Other sources of information about libpng
|
||||||
|
|
||||||
|
I. Simple installation
|
||||||
|
|
||||||
On Unix/Linux and similar systems, you can simply type
|
On Unix/Linux and similar systems, you can simply type
|
||||||
|
|
||||||
./configure [--prefix=/path]
|
./configure [--prefix=/path]
|
||||||
make check
|
make check
|
||||||
make install
|
make install
|
||||||
|
|
||||||
and ignore the rest of this document.
|
and ignore the rest of this document. "/path" is the path to the directory
|
||||||
|
where you want to install the libpng "lib", "include", and "bin"
|
||||||
|
subdirectories.
|
||||||
|
|
||||||
If configure does not work on your system and you have a reasonably
|
If you downloaded a GIT clone, you will need to run ./autogen.sh before
|
||||||
up-to-date set of tools, running ./autogen.sh before running ./configure
|
running ./configure, to create "configure" and "Makefile.in" which are
|
||||||
may fix the problem. You can also run the individual commands in
|
not included in the GIT repository.
|
||||||
autogen.sh with the --force option, if supported by your version of
|
|
||||||
the tools. To be really sure that you aren't using any of the included
|
Note that "configure" is only included in the "*.tar" distributions and not
|
||||||
pre-built scripts, you can do this:
|
in the "*.zip" or "*.7z" distributions. If you downloaded one of those
|
||||||
|
distributions, see "Building with project files" or "Building with makefiles",
|
||||||
|
below.
|
||||||
|
|
||||||
|
II. Rebuilding the configure scripts
|
||||||
|
|
||||||
|
If configure does not work on your system, or if you have a need to
|
||||||
|
change configure.ac or Makefile.am, and you have a reasonably
|
||||||
|
up-to-date set of tools, running ./autogen.sh in a git clone before
|
||||||
|
running ./configure may fix the problem. To be really sure that you
|
||||||
|
aren't using any of the included pre-built scripts, you can do this:
|
||||||
|
|
||||||
./configure --enable-maintainer-mode
|
./configure --enable-maintainer-mode
|
||||||
make maintainer-clean
|
make maintainer-clean
|
||||||
./autogen.sh
|
./autogen.sh --maintainer --clean
|
||||||
|
./autogen.sh --maintainer
|
||||||
./configure [--prefix=/path] [other options]
|
./configure [--prefix=/path] [other options]
|
||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
make check
|
make check
|
||||||
|
|
||||||
|
III. Using scripts/makefile*
|
||||||
|
|
||||||
Instead, you can use one of the custom-built makefiles in the
|
Instead, you can use one of the custom-built makefiles in the
|
||||||
"scripts" directory
|
"scripts" directory
|
||||||
|
|
||||||
|
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
|
||||||
cp scripts/makefile.system makefile
|
cp scripts/makefile.system makefile
|
||||||
make test
|
make test
|
||||||
make install
|
make install
|
||||||
@ -38,8 +75,28 @@ Or you can use one of the "projects" in the "projects" directory.
|
|||||||
|
|
||||||
Before installing libpng, you must first install zlib, if it
|
Before installing libpng, you must first install zlib, if it
|
||||||
is not already on your system. zlib can usually be found
|
is not already on your system. zlib can usually be found
|
||||||
wherever you got libpng. zlib can be placed in another directory,
|
wherever you got libpng; otherwise go to http://zlib.net. You can place
|
||||||
at the same level as libpng.
|
zlib in in the same directory as libpng or in another directory.
|
||||||
|
|
||||||
|
If your system already has a preinstalled zlib you will still need
|
||||||
|
to have access to the zlib.h and zconf.h include files that
|
||||||
|
correspond to the version of zlib that's installed.
|
||||||
|
|
||||||
|
If you wish to test with a particular zlib that is not first in the
|
||||||
|
standard library search path, put ZLIBLIB, ZLIBINC, CPPFLAGS, LDFLAGS,
|
||||||
|
and LD_LIBRARY_PATH in your environment before running "make test"
|
||||||
|
or "make distcheck":
|
||||||
|
|
||||||
|
ZLIBLIB=/path/to/lib export ZLIBLIB
|
||||||
|
ZLIBINC=/path/to/include export ZLIBINC
|
||||||
|
CPPFLAGS="-I$ZLIBINC" export CPPFLAGS
|
||||||
|
LDFLAGS="-L$ZLIBLIB" export LDFLAGS
|
||||||
|
LD_LIBRARY_PATH="$ZLIBLIB:$LD_LIBRARY_PATH" export LD_LIBRARY_PATH
|
||||||
|
|
||||||
|
If you are using one of the makefile scripts, put ZLIBLIB and ZLIBINC
|
||||||
|
in your environment and type "make ZLIBLIB=$ZLIBLIB ZLIBINC=$ZLIBINC test".
|
||||||
|
|
||||||
|
IV. Using cmake
|
||||||
|
|
||||||
If you want to use "cmake" (see www.cmake.org), type
|
If you want to use "cmake" (see www.cmake.org), type
|
||||||
|
|
||||||
@ -47,13 +104,15 @@ If you want to use "cmake" (see www.cmake.org), type
|
|||||||
make
|
make
|
||||||
make install
|
make install
|
||||||
|
|
||||||
If your system already has a preinstalled zlib you will still need
|
As when using the simple configure method described above, "/path" points to
|
||||||
to have access to the zlib.h and zconf.h include files that
|
the installation directory where you want to put the libpng "lib", "include",
|
||||||
correspond to the version of zlib that's installed.
|
and "bin" subdirectories.
|
||||||
|
|
||||||
|
V. Directory structure
|
||||||
|
|
||||||
You can rename the directories that you downloaded (they
|
You can rename the directories that you downloaded (they
|
||||||
might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.5"
|
might be called "libpng-x.y.z" or "libpngNN" and "zlib-1.2.8"
|
||||||
or "zlib125") so that you have directories called "zlib" and "libpng".
|
or "zlib128") so that you have directories called "zlib" and "libpng".
|
||||||
|
|
||||||
Your directory structure should look like this:
|
Your directory structure should look like this:
|
||||||
|
|
||||||
@ -61,8 +120,7 @@ Your directory structure should look like this:
|
|||||||
libpng (this directory)
|
libpng (this directory)
|
||||||
INSTALL (this file)
|
INSTALL (this file)
|
||||||
README
|
README
|
||||||
*.h
|
*.h, *.c => libpng source files
|
||||||
*.c
|
|
||||||
CMakeLists.txt => "cmake" script
|
CMakeLists.txt => "cmake" script
|
||||||
configuration files:
|
configuration files:
|
||||||
configure.ac, configure, Makefile.am, Makefile.in,
|
configure.ac, configure, Makefile.am, Makefile.in,
|
||||||
@ -70,14 +128,10 @@ Your directory structure should look like this:
|
|||||||
libpng-config.in, aclocal.m4, config.h.in, config.sub,
|
libpng-config.in, aclocal.m4, config.h.in, config.sub,
|
||||||
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
|
depcomp, install-sh, mkinstalldirs, test-pngtest.sh
|
||||||
contrib
|
contrib
|
||||||
gregbook
|
arm-neon, conftest, examples, gregbook, libtests, pngminim,
|
||||||
pngminim
|
pngminus, pngsuite, tools, visupng
|
||||||
pngminus
|
|
||||||
pngsuite
|
|
||||||
visupng
|
|
||||||
projects
|
projects
|
||||||
visualc71
|
cbuilder5, owatcom, visualc71, vstudio, xcode
|
||||||
vstudio
|
|
||||||
scripts
|
scripts
|
||||||
makefile.*
|
makefile.*
|
||||||
*.def (module definition files)
|
*.def (module definition files)
|
||||||
@ -85,29 +139,31 @@ Your directory structure should look like this:
|
|||||||
pngtest.png
|
pngtest.png
|
||||||
etc.
|
etc.
|
||||||
zlib
|
zlib
|
||||||
README
|
README, *.h, *.c contrib, etc.
|
||||||
*.h
|
|
||||||
*.c
|
|
||||||
contrib
|
|
||||||
etc.
|
|
||||||
|
|
||||||
If the line endings in the files look funny, you may wish to get the other
|
If the line endings in the files look funny, you may wish to get the other
|
||||||
distribution of libpng. It is available in both tar.gz (UNIX style line
|
distribution of libpng. It is available in both tar.gz (UNIX style line
|
||||||
endings) and zip (DOS style line endings) formats.
|
endings) and zip (DOS style line endings) formats.
|
||||||
|
|
||||||
|
VI. Building with project files
|
||||||
|
|
||||||
If you are building libpng with MSVC, you can enter the
|
If you are building libpng with MSVC, you can enter the
|
||||||
libpng projects\visualc6 or visualc71 directory and follow the instructions
|
libpng projects\visualc71 or vstudio directory and follow the instructions
|
||||||
in README.txt.
|
in README.txt.
|
||||||
|
|
||||||
Otherwise enter the zlib directory and follow the instructions in zlib/README,
|
Otherwise enter the zlib directory and follow the instructions in zlib/README,
|
||||||
then come back here and run "configure" or choose the appropriate
|
then come back here and run "configure" or choose the appropriate
|
||||||
makefile.sys in the scripts directory.
|
makefile.sys in the scripts directory.
|
||||||
|
|
||||||
|
VII. Building with makefiles
|
||||||
|
|
||||||
Copy the file (or files) that you need from the
|
Copy the file (or files) that you need from the
|
||||||
scripts directory into this directory, for example
|
scripts directory into this directory, for example
|
||||||
|
|
||||||
MSDOS example: copy scripts\makefile.msc makefile
|
MSDOS example: copy scripts\makefile.msc makefile
|
||||||
|
copy scripts\pnglibconf.h.prebuilt pnglibconf.h
|
||||||
UNIX example: cp scripts/makefile.std makefile
|
UNIX example: cp scripts/makefile.std makefile
|
||||||
|
cp scripts/pnglibconf.h.prebuilt pnglibconf.h
|
||||||
|
|
||||||
Read the makefile to see if you need to change any source or
|
Read the makefile to see if you need to change any source or
|
||||||
target directories to match your preferences.
|
target directories to match your preferences.
|
||||||
@ -130,6 +186,202 @@ do that, run "make install" in the zlib directory first if necessary).
|
|||||||
Some also allow you to run "make test-installed" after you have
|
Some also allow you to run "make test-installed" after you have
|
||||||
run "make install".
|
run "make install".
|
||||||
|
|
||||||
|
VIII. Configuring libpng for 16-bit platforms
|
||||||
|
|
||||||
|
You will want to look into zconf.h to tell zlib (and thus libpng) that
|
||||||
|
it cannot allocate more than 64K at a time. Even if you can, the memory
|
||||||
|
won't be accessible. So limit zlib and libpng to 64K by defining MAXSEG_64K.
|
||||||
|
|
||||||
|
IX. Configuring for DOS
|
||||||
|
|
||||||
|
For DOS users who only have access to the lower 640K, you will
|
||||||
|
have to limit zlib's memory usage via a png_set_compression_mem_level()
|
||||||
|
call. See zlib.h or zconf.h in the zlib library for more information.
|
||||||
|
|
||||||
|
X. Configuring for Medium Model
|
||||||
|
|
||||||
|
Libpng's support for medium model has been tested on most of the popular
|
||||||
|
compilers. Make sure MAXSEG_64K gets defined, USE_FAR_KEYWORD gets
|
||||||
|
defined, and FAR gets defined to far in pngconf.h, and you should be
|
||||||
|
all set. Everything in the library (except for zlib's structure) is
|
||||||
|
expecting far data. You must use the typedefs with the p or pp on
|
||||||
|
the end for pointers (or at least look at them and be careful). Make
|
||||||
|
note that the rows of data are defined as png_bytepp, which is
|
||||||
|
an "unsigned char far * far *".
|
||||||
|
|
||||||
|
XI. Prepending a prefix to exported symbols
|
||||||
|
|
||||||
|
Starting with libpng-1.6.0, you can configure libpng (when using the
|
||||||
|
"configure" script) to prefix all exported symbols by means of the
|
||||||
|
configuration option "--with-libpng-prefix=FOO_", where FOO_ can be any
|
||||||
|
string beginning with a letter and containing only uppercase
|
||||||
|
and lowercase letters, digits, and the underscore (i.e., a C language
|
||||||
|
identifier). This creates a set of macros in pnglibconf.h, so this is
|
||||||
|
transparent to applications; their function calls get transformed by
|
||||||
|
the macros to use the modified names.
|
||||||
|
|
||||||
|
XII. Configuring for compiler xxx:
|
||||||
|
|
||||||
|
All includes for libpng are in pngconf.h. If you need to add, change
|
||||||
|
or delete an include, this is the place to do it.
|
||||||
|
The includes that are not needed outside libpng are placed in pngpriv.h,
|
||||||
|
which is only used by the routines inside libpng itself.
|
||||||
|
The files in libpng proper only include pngpriv.h and png.h, which
|
||||||
|
in turn includes pngconf.h and, as of libpng-1.5.0, pnglibconf.h.
|
||||||
|
As of libpng-1.5.0, pngpriv.h also includes three other private header
|
||||||
|
files, pngstruct.h, pnginfo.h, and pngdebug.h, which contain material
|
||||||
|
that previously appeared in the public headers.
|
||||||
|
|
||||||
|
XIII. Removing unwanted object code
|
||||||
|
|
||||||
|
There are a bunch of #define's in pngconf.h that control what parts of
|
||||||
|
libpng are compiled. All the defines end in _SUPPORTED. If you are
|
||||||
|
never going to use a capability, you can change the #define to #undef
|
||||||
|
before recompiling libpng and save yourself code and data space, or
|
||||||
|
you can turn off individual capabilities with defines that begin with
|
||||||
|
PNG_NO_.
|
||||||
|
|
||||||
|
In libpng-1.5.0 and later, the #define's are in pnglibconf.h instead.
|
||||||
|
|
||||||
|
You can also turn all of the transforms and ancillary chunk capabilities
|
||||||
|
off en masse with compiler directives that define
|
||||||
|
PNG_NO_READ[or WRITE]_TRANSFORMS, or PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS,
|
||||||
|
or all four, along with directives to turn on any of the capabilities that
|
||||||
|
you do want. The PNG_NO_READ[or WRITE]_TRANSFORMS directives disable the
|
||||||
|
extra transformations but still leave the library fully capable of reading
|
||||||
|
and writing PNG files with all known public chunks. Use of the
|
||||||
|
PNG_NO_READ[or WRITE]_ANCILLARY_CHUNKS directive produces a library
|
||||||
|
that is incapable of reading or writing ancillary chunks. If you are
|
||||||
|
not using the progressive reading capability, you can turn that off
|
||||||
|
with PNG_NO_PROGRESSIVE_READ (don't confuse this with the INTERLACING
|
||||||
|
capability, which you'll still have).
|
||||||
|
|
||||||
|
All the reading and writing specific code are in separate files, so the
|
||||||
|
linker should only grab the files it needs. However, if you want to
|
||||||
|
make sure, or if you are building a stand alone library, all the
|
||||||
|
reading files start with "pngr" and all the writing files start with "pngw".
|
||||||
|
The files that don't match either (like png.c, pngtrans.c, etc.)
|
||||||
|
are used for both reading and writing, and always need to be included.
|
||||||
|
The progressive reader is in pngpread.c
|
||||||
|
|
||||||
|
If you are creating or distributing a dynamically linked library (a .so
|
||||||
|
or DLL file), you should not remove or disable any parts of the library,
|
||||||
|
as this will cause applications linked with different versions of the
|
||||||
|
library to fail if they call functions not available in your library.
|
||||||
|
The size of the library itself should not be an issue, because only
|
||||||
|
those sections that are actually used will be loaded into memory.
|
||||||
|
|
||||||
|
XIV. Changes to the build and configuration of libpng in libpng-1.5.x
|
||||||
|
|
||||||
|
Details of internal changes to the library code can be found in the CHANGES
|
||||||
|
file and in the GIT repository logs. These will be of no concern to the vast
|
||||||
|
majority of library users or builders; however, the few who configure libpng
|
||||||
|
to a non-default feature set may need to change how this is done.
|
||||||
|
|
||||||
|
There should be no need for library builders to alter build scripts if
|
||||||
|
these use the distributed build support - configure or the makefiles -
|
||||||
|
however, users of the makefiles may care to update their build scripts
|
||||||
|
to build pnglibconf.h where the corresponding makefile does not do so.
|
||||||
|
|
||||||
|
Building libpng with a non-default configuration has changed completely.
|
||||||
|
The old method using pngusr.h should still work correctly even though the
|
||||||
|
way pngusr.h is used in the build has been changed; however, library
|
||||||
|
builders will probably want to examine the changes to take advantage of
|
||||||
|
new capabilities and to simplify their build system.
|
||||||
|
|
||||||
|
A. Specific changes to library configuration capabilities
|
||||||
|
|
||||||
|
The exact mechanism used to control attributes of API functions has
|
||||||
|
changed. A single set of operating system independent macro definitions
|
||||||
|
is used and operating system specific directives are defined in
|
||||||
|
pnglibconf.h
|
||||||
|
|
||||||
|
As part of this the mechanism used to choose procedure call standards on
|
||||||
|
those systems that allow a choice has been changed. At present this only
|
||||||
|
affects certain Microsoft (DOS, Windows) and IBM (OS/2) operating systems
|
||||||
|
running on Intel processors. As before, PNGAPI is defined where required
|
||||||
|
to control the exported API functions; however, two new macros, PNGCBAPI
|
||||||
|
and PNGCAPI, are used instead for callback functions (PNGCBAPI) and
|
||||||
|
(PNGCAPI) for functions that must match a C library prototype (currently
|
||||||
|
only png_longjmp_ptr, which must match the C longjmp function.) The new
|
||||||
|
approach is documented in pngconf.h
|
||||||
|
|
||||||
|
Despite these changes, libpng 1.5.0 only supports the native C function
|
||||||
|
calling standard on those platforms tested so far (__cdecl on Microsoft
|
||||||
|
Windows). This is because the support requirements for alternative
|
||||||
|
calling conventions seem to no longer exist. Developers who find it
|
||||||
|
necessary to set PNG_API_RULE to 1 should advise the mailing list
|
||||||
|
(png-mng-implement) of this and library builders who use Openwatcom and
|
||||||
|
therefore set PNG_API_RULE to 2 should also contact the mailing list.
|
||||||
|
|
||||||
|
B. Changes to the configuration mechanism
|
||||||
|
|
||||||
|
Prior to libpng-1.5.0 library builders who needed to configure libpng
|
||||||
|
had either to modify the exported pngconf.h header file to add system
|
||||||
|
specific configuration or had to write feature selection macros into
|
||||||
|
pngusr.h and cause this to be included into pngconf.h by defining
|
||||||
|
PNG_USER_CONFIG. The latter mechanism had the disadvantage that an
|
||||||
|
application built without PNG_USER_CONFIG defined would see the
|
||||||
|
unmodified, default, libpng API and thus would probably fail to link.
|
||||||
|
|
||||||
|
These mechanisms still work in the configure build and in any makefile
|
||||||
|
build that builds pnglibconf.h, although the feature selection macros
|
||||||
|
have changed somewhat as described above. In 1.5.0, however, pngusr.h is
|
||||||
|
processed only once, at the time the exported header file pnglibconf.h is
|
||||||
|
built. pngconf.h no longer includes pngusr.h; therefore, pngusr.h is ignored
|
||||||
|
after the build of pnglibconf.h and it is never included in an application
|
||||||
|
build.
|
||||||
|
|
||||||
|
The formerly used alternative of adding a list of feature macros to the
|
||||||
|
CPPFLAGS setting in the build also still works; however, the macros will be
|
||||||
|
copied to pnglibconf.h and this may produce macro redefinition warnings
|
||||||
|
when the individual C files are compiled.
|
||||||
|
|
||||||
|
All configuration now only works if pnglibconf.h is built from
|
||||||
|
scripts/pnglibconf.dfa. This requires the program awk. Brian Kernighan
|
||||||
|
(the original author of awk) maintains C source code of that awk and this
|
||||||
|
and all known later implementations (often called by subtly different
|
||||||
|
names - nawk and gawk for example) are adequate to build pnglibconf.h.
|
||||||
|
The Sun Microsystems (now Oracle) program 'awk' is an earlier version
|
||||||
|
and does not work; this may also apply to other systems that have a
|
||||||
|
functioning awk called 'nawk'.
|
||||||
|
|
||||||
|
Configuration options are now documented in scripts/pnglibconf.dfa. This
|
||||||
|
file also includes dependency information that ensures a configuration is
|
||||||
|
consistent; that is, if a feature is switched off, dependent features are
|
||||||
|
also switched off. As a recommended alternative to using feature macros in
|
||||||
|
pngusr.h a system builder may also define equivalent options in pngusr.dfa
|
||||||
|
(or, indeed, any file) and add that to the configuration by setting
|
||||||
|
DFA_XTRA to the file name. The makefiles in contrib/pngminim illustrate
|
||||||
|
how to do this, and also illustrate a case where pngusr.h is still required.
|
||||||
|
|
||||||
|
After you have built libpng, the definitions that were recorded in
|
||||||
|
pnglibconf.h are available to your application (pnglibconf.h is included
|
||||||
|
in png.h and gets installed alongside png.h and pngconf.h in your
|
||||||
|
$PREFIX/include directory). Do not edit pnglibconf.h after you have built
|
||||||
|
libpng, because than the settings would not accurately reflect the settings
|
||||||
|
that were used to build libpng.
|
||||||
|
|
||||||
|
XV. Setjmp/longjmp issues
|
||||||
|
|
||||||
|
Libpng uses setjmp()/longjmp() for error handling. Unfortunately setjmp()
|
||||||
|
is known to be not thread-safe on some platforms and we don't know of
|
||||||
|
any platform where it is guaranteed to be thread-safe. Therefore, if
|
||||||
|
your application is going to be using multiple threads, you should
|
||||||
|
configure libpng with PNG_NO_SETJMP in your pngusr.dfa file, with
|
||||||
|
-DPNG_NO_SETJMP on your compile line, or with
|
||||||
|
|
||||||
|
#undef PNG_SETJMP_SUPPORTED
|
||||||
|
|
||||||
|
in your pnglibconf.h or pngusr.h.
|
||||||
|
|
||||||
|
Starting with libpng-1.6.0, the library included a "simplified API".
|
||||||
|
This requires setjmp/longjmp, so you must either build the library
|
||||||
|
with PNG_SETJMP_SUPPORTED defined, or with PNG_SIMPLIFIED_READ_SUPPORTED
|
||||||
|
and PNG_SIMPLIFIED_WRITE_SUPPORTED undefined.
|
||||||
|
|
||||||
|
XVI. Other sources of information about libpng:
|
||||||
|
|
||||||
Further information can be found in the README and libpng-manual.txt
|
Further information can be found in the README and libpng-manual.txt
|
||||||
files, in the individual makefiles, in png.h, and the manual pages
|
files, in the individual makefiles, in png.h, and the manual pages
|
||||||
libpng.3 and png.5.
|
libpng.3 and png.5.
|
||||||
@ -147,7 +399,7 @@ CFLAGS="-Wall -O -funroll-loops \
|
|||||||
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
|
--with-pkgconfigdir=/usr/lib/pkgconfig --includedir=/usr/include
|
||||||
|
|
||||||
You can alternatively specify --includedir=/usr/include, /usr/local/include,
|
You can alternatively specify --includedir=/usr/include, /usr/local/include,
|
||||||
/usr/include/libpng%NN%, or whatever.
|
/usr/include/libpng16, or whatever.
|
||||||
|
|
||||||
If you find that the configure script is out-of-date or is not supporting
|
If you find that the configure script is out-of-date or is not supporting
|
||||||
your platform properly, try running autogen.sh to regenerate "configure",
|
your platform properly, try running autogen.sh to regenerate "configure",
|
||||||
|
6
src/3rdparty/libpng/LICENSE
vendored
6
src/3rdparty/libpng/LICENSE
vendored
@ -10,8 +10,8 @@ this sentence.
|
|||||||
|
|
||||||
This code is released under the libpng license.
|
This code is released under the libpng license.
|
||||||
|
|
||||||
libpng versions 1.2.6, August 15, 2004, through 1.5.10, March 29, 2012, are
|
libpng versions 1.2.6, August 15, 2004, through 1.6.17, March 26, 2015, are
|
||||||
Copyright (c) 2004, 2006-2011 Glenn Randers-Pehrson, and are
|
Copyright (c) 2004, 2006-2015 Glenn Randers-Pehrson, and are
|
||||||
distributed according to the same disclaimer and license as libpng-1.2.5
|
distributed according to the same disclaimer and license as libpng-1.2.5
|
||||||
with the following individual added to the list of Contributing Authors
|
with the following individual added to the list of Contributing Authors
|
||||||
|
|
||||||
@ -108,4 +108,4 @@ certification mark of the Open Source Initiative.
|
|||||||
|
|
||||||
Glenn Randers-Pehrson
|
Glenn Randers-Pehrson
|
||||||
glennrp at users.sourceforge.net
|
glennrp at users.sourceforge.net
|
||||||
March 29, 2012
|
March 26, 2015
|
||||||
|
55
src/3rdparty/libpng/README
vendored
55
src/3rdparty/libpng/README
vendored
@ -1,11 +1,11 @@
|
|||||||
README for libpng version 1.5.10 - March 29, 2012 (shared library 15.0)
|
README for libpng version 1.6.17 - March 26, 2015 (shared library 16.0)
|
||||||
See the note about version numbers near the top of png.h
|
See the note about version numbers near the top of png.h
|
||||||
|
|
||||||
See INSTALL for instructions on how to install libpng.
|
See INSTALL for instructions on how to install libpng.
|
||||||
|
|
||||||
Libpng comes in several distribution formats. Get libpng-*.tar.gz,
|
Libpng comes in several distribution formats. Get libpng-*.tar.gz or
|
||||||
libpng-*.tar.xz or libpng-*.tar.bz2 if you want UNIX-style line endings
|
libpng-*.tar.xz or if you want UNIX-style line endings in the text files,
|
||||||
in the text files, or lpng*.zip if you want DOS-style line endings.
|
or lpng*.7z or lpng*.zip if you want DOS-style line endings.
|
||||||
|
|
||||||
Version 0.89 was the first official release of libpng. Don't let the
|
Version 0.89 was the first official release of libpng. Don't let the
|
||||||
fact that it's the first release fool you. The libpng library has been in
|
fact that it's the first release fool you. The libpng library has been in
|
||||||
@ -23,18 +23,25 @@ earlier versions if you are using a shared library. The type of the
|
|||||||
png_uint_32, which will affect shared-library applications that use
|
png_uint_32, which will affect shared-library applications that use
|
||||||
this function.
|
this function.
|
||||||
|
|
||||||
To avoid problems with changes to the internals of png_info_struct,
|
To avoid problems with changes to the internals of png info_struct,
|
||||||
new APIs have been made available in 0.95 to avoid direct application
|
new APIs have been made available in 0.95 to avoid direct application
|
||||||
access to info_ptr. These functions are the png_set_<chunk> and
|
access to info_ptr. These functions are the png_set_<chunk> and
|
||||||
png_get_<chunk> functions. These functions should be used when
|
png_get_<chunk> functions. These functions should be used when
|
||||||
accessing/storing the info_struct data, rather than manipulating it
|
accessing/storing the info_struct data, rather than manipulating it
|
||||||
directly, to avoid such problems in the future.
|
directly, to avoid such problems in the future.
|
||||||
|
|
||||||
It is important to note that the APIs do not make current programs
|
It is important to note that the APIs did not make current programs
|
||||||
that access the info struct directly incompatible with the new
|
that access the info struct directly incompatible with the new
|
||||||
library. However, it is strongly suggested that new programs use
|
library, through libpng-1.2.x. In libpng-1.4.x, which was meant to
|
||||||
the new APIs (as shown in example.c and pngtest.c), and older programs
|
be a transitional release, members of the png_struct and the
|
||||||
be converted to the new format, to facilitate upgrades in the future.
|
info_struct can still be accessed, but the compiler will issue a
|
||||||
|
warning about deprecated usage. Since libpng-1.5.0, direct access
|
||||||
|
to these structs is not allowed, and the definitions of the structs
|
||||||
|
reside in private pngstruct.h and pnginfo.h header files that are not
|
||||||
|
accessible to applications. It is strongly suggested that new
|
||||||
|
programs use the new APIs (as shown in example.c and pngtest.c), and
|
||||||
|
older programs be converted to the new format, to facilitate upgrades
|
||||||
|
in the future.
|
||||||
****
|
****
|
||||||
|
|
||||||
Additions since 0.90 include the ability to compile libpng as a
|
Additions since 0.90 include the ability to compile libpng as a
|
||||||
@ -77,17 +84,21 @@ compression library that is useful for more things than just PNG files.
|
|||||||
You can use zlib as a drop-in replacement for fread() and fwrite() if
|
You can use zlib as a drop-in replacement for fread() and fwrite() if
|
||||||
you are so inclined.
|
you are so inclined.
|
||||||
|
|
||||||
zlib should be available at the same place that libpng is, or at.
|
zlib should be available at the same place that libpng is, or at zlib.net.
|
||||||
ftp://ftp.info-zip.org/pub/infozip/zlib
|
|
||||||
|
|
||||||
You may also want a copy of the PNG specification. It is available
|
You may also want a copy of the PNG specification. It is available
|
||||||
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
as an RFC, a W3C Recommendation, and an ISO/IEC Standard. You can find
|
||||||
these at http://www.libpng.org/pub/png/documents/
|
these at http://www.libpng.org/pub/png/documents/
|
||||||
|
|
||||||
This code is currently being archived at libpng.sf.net in the
|
This code is currently being archived at libpng.sf.net in the
|
||||||
[DOWNLOAD] area, and on CompuServe, Lib 20 (PNG SUPPORT)
|
[DOWNLOAD] area, and at ftp://ftp.simplesystems.org. If you can't find it
|
||||||
at GO GRAPHSUP. If you can't find it in any of those places,
|
in any of those places, e-mail me, and I'll help you find it.
|
||||||
e-mail me, and I'll help you find it.
|
|
||||||
|
I am not a lawyer, but I believe that the Export Control Classification
|
||||||
|
Number (ECCN) for libpng is EAR99, which means not subject to export
|
||||||
|
controls or International Traffic in Arms Regulations (ITAR) because it
|
||||||
|
is open source, publicly available software, that does not contain any
|
||||||
|
encryption software. See the EAR, paragraphs 734.3(b)(3) and 734.7(b).
|
||||||
|
|
||||||
If you have any code changes, requests, problems, etc., please e-mail
|
If you have any code changes, requests, problems, etc., please e-mail
|
||||||
them to me. Also, I'd appreciate any make files or project files,
|
them to me. Also, I'd appreciate any make files or project files,
|
||||||
@ -123,7 +134,7 @@ and ...". If in doubt, send questions to me. I'll bounce them
|
|||||||
to others, if necessary.
|
to others, if necessary.
|
||||||
|
|
||||||
Please do not send suggestions on how to change PNG. We have
|
Please do not send suggestions on how to change PNG. We have
|
||||||
been discussing PNG for sixteen years now, and it is official and
|
been discussing PNG for nineteen years now, and it is official and
|
||||||
finished. If you have suggestions for libpng, however, I'll
|
finished. If you have suggestions for libpng, however, I'll
|
||||||
gladly listen. Even if your suggestion is not used immediately,
|
gladly listen. Even if your suggestion is not used immediately,
|
||||||
it may be used later.
|
it may be used later.
|
||||||
@ -167,23 +178,25 @@ Files in this distribution:
|
|||||||
pngwrite.c => High-level write functions
|
pngwrite.c => High-level write functions
|
||||||
pngwtran.c => Write data transformations
|
pngwtran.c => Write data transformations
|
||||||
pngwutil.c => Write utility functions
|
pngwutil.c => Write utility functions
|
||||||
|
arm => Contains optimized code for the ARM platform
|
||||||
contrib => Contributions
|
contrib => Contributions
|
||||||
|
examples => Example programs
|
||||||
gregbook => source code for PNG reading and writing, from
|
gregbook => source code for PNG reading and writing, from
|
||||||
Greg Roelofs' "PNG: The Definitive Guide",
|
Greg Roelofs' "PNG: The Definitive Guide",
|
||||||
O'Reilly, 1999
|
O'Reilly, 1999
|
||||||
msvctest => Builds and runs pngtest using a MSVC workspace
|
libtests => Test programs
|
||||||
|
pngminim => Minimal decoder, encoder, and progressive decoder
|
||||||
|
programs demonstrating use of pngusr.dfa
|
||||||
pngminus => Simple pnm2png and png2pnm programs
|
pngminus => Simple pnm2png and png2pnm programs
|
||||||
pngsuite => Test images
|
pngsuite => Test images
|
||||||
|
tools => Various tools
|
||||||
visupng => Contains a MSVC workspace for VisualPng
|
visupng => Contains a MSVC workspace for VisualPng
|
||||||
projects => Contains project files and workspaces for
|
projects => Contains project files and workspaces for
|
||||||
building a DLL
|
building a DLL
|
||||||
cbuilder5 => Contains a Borland workspace for building
|
owatcom => Contains a WATCOM project for building libpng
|
||||||
libpng and zlib
|
|
||||||
visualc6 => Contains a Microsoft Visual C++ (MSVC)
|
|
||||||
workspace for building libpng and zlib
|
|
||||||
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
visualc71 => Contains a Microsoft Visual C++ (MSVC)
|
||||||
workspace for building libpng and zlib
|
workspace for building libpng and zlib
|
||||||
xcode => Contains an Apple xcode
|
vstudio => Contains a Microsoft Visual C++ (MSVC)
|
||||||
workspace for building libpng and zlib
|
workspace for building libpng and zlib
|
||||||
scripts => Directory containing scripts for building libpng:
|
scripts => Directory containing scripts for building libpng:
|
||||||
(see scripts/README.txt for the list of scripts)
|
(see scripts/README.txt for the list of scripts)
|
||||||
|
1375
src/3rdparty/libpng/libpng-manual.txt
vendored
1375
src/3rdparty/libpng/libpng-manual.txt
vendored
File diff suppressed because it is too large
Load Diff
2670
src/3rdparty/libpng/png.c
vendored
2670
src/3rdparty/libpng/png.c
vendored
File diff suppressed because it is too large
Load Diff
1884
src/3rdparty/libpng/png.h
vendored
1884
src/3rdparty/libpng/png.h
vendored
File diff suppressed because it is too large
Load Diff
440
src/3rdparty/libpng/pngconf.h
vendored
440
src/3rdparty/libpng/pngconf.h
vendored
@ -1,9 +1,9 @@
|
|||||||
|
|
||||||
/* pngconf.h - machine configurable file for libpng
|
/* pngconf.h - machine configurable file for libpng
|
||||||
*
|
*
|
||||||
* libpng version 1.5.10 - March 29, 2012
|
* libpng version 1.6.17, March 26, 2015
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -11,9 +11,7 @@
|
|||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
*
|
*
|
||||||
*/
|
* Any machine specific code is near the front of this file, so if you
|
||||||
|
|
||||||
/* Any machine specific code is near the front of this file, so if you
|
|
||||||
* are configuring libpng for a machine, you may want to read the section
|
* are configuring libpng for a machine, you may want to read the section
|
||||||
* starting here down to where it starts to typedef png_color, png_text,
|
* starting here down to where it starts to typedef png_color, png_text,
|
||||||
* and png_info.
|
* and png_info.
|
||||||
@ -22,33 +20,49 @@
|
|||||||
#ifndef PNGCONF_H
|
#ifndef PNGCONF_H
|
||||||
#define PNGCONF_H
|
#define PNGCONF_H
|
||||||
|
|
||||||
#ifndef PNG_BUILDING_SYMBOL_TABLE
|
#ifndef PNG_BUILDING_SYMBOL_TABLE /* else includes may cause problems */
|
||||||
/* PNG_NO_LIMITS_H may be used to turn off the use of the standard C
|
|
||||||
* definition file for machine specific limits, this may impact the
|
/* From libpng 1.6.0 libpng requires an ANSI X3.159-1989 ("ISOC90") compliant C
|
||||||
* correctness of the definitons below (see uses of INT_MAX).
|
* compiler for correct compilation. The following header files are required by
|
||||||
|
* the standard. If your compiler doesn't provide these header files, or they
|
||||||
|
* do not match the standard, you will need to provide/improve them.
|
||||||
*/
|
*/
|
||||||
# ifndef PNG_NO_LIMITS_H
|
|
||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
# endif
|
#include <stddef.h>
|
||||||
|
|
||||||
/* For the memory copy APIs (i.e. the standard definitions of these),
|
/* Library header files. These header files are all defined by ISOC90; libpng
|
||||||
* because this file defines png_memcpy and so on the base APIs must
|
* expects conformant implementations, however, an ISOC90 conformant system need
|
||||||
* be defined here.
|
* not provide these header files if the functionality cannot be implemented.
|
||||||
|
* In this case it will be necessary to disable the relevant parts of libpng in
|
||||||
|
* the build of pnglibconf.h.
|
||||||
|
*
|
||||||
|
* Prior to 1.6.0 string.h was included here; the API changes in 1.6.0 to not
|
||||||
|
* include this unnecessary header file.
|
||||||
*/
|
*/
|
||||||
# if defined(BSD) && !defined(VXWORKS)
|
|
||||||
# include <strings.h>
|
|
||||||
# else
|
|
||||||
# include <string.h>
|
|
||||||
# endif
|
|
||||||
|
|
||||||
/* For png_FILE_p - this provides the standard definition of a
|
|
||||||
* FILE
|
|
||||||
*/
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
|
/* Required for the definition of FILE: */
|
||||||
# include <stdio.h>
|
# include <stdio.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
|
/* Required for the definition of jmp_buf and the declaration of longjmp: */
|
||||||
|
# include <setjmp.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_CONVERT_tIME_SUPPORTED
|
||||||
|
/* Required for struct tm: */
|
||||||
|
# include <time.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* PNG_BUILDING_SYMBOL_TABLE */
|
||||||
|
|
||||||
|
/* Prior to 1.6.0 it was possible to turn off 'const' in declarations using
|
||||||
|
* PNG_NO_CONST; this is no longer supported except for data declarations which
|
||||||
|
* apparently still cause problems in 2011 on some compilers.
|
||||||
|
*/
|
||||||
|
#define PNG_CONST const /* backward compatibility only */
|
||||||
|
|
||||||
/* This controls optimization of the reading of 16 and 32 bit values
|
/* This controls optimization of the reading of 16 and 32 bit values
|
||||||
* from PNG files. It can be set on a per-app-file basis - it
|
* from PNG files. It can be set on a per-app-file basis - it
|
||||||
* just changes whether a macro is used when the function is called.
|
* just changes whether a macro is used when the function is called.
|
||||||
@ -72,28 +86,13 @@
|
|||||||
* may be changed on a per-file basis when compiling against libpng.
|
* may be changed on a per-file basis when compiling against libpng.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* The PNGARG macro protects us against machines that don't have function
|
/* The PNGARG macro was used in versions of libpng prior to 1.6.0 to protect
|
||||||
* prototypes (ie K&R style headers). If your compiler does not handle
|
* against legacy (pre ISOC90) compilers that did not understand function
|
||||||
* function prototypes, define this macro and use the included ansi2knr.
|
* prototypes. It is not required for modern C compilers.
|
||||||
* I've always been able to use _NO_PROTO as the indicator, but you may
|
|
||||||
* need to drag the empty declaration out in front of here, or change the
|
|
||||||
* ifdef to suit your own needs.
|
|
||||||
*/
|
*/
|
||||||
#ifndef PNGARG
|
#ifndef PNGARG
|
||||||
|
|
||||||
# ifdef OF /* zlib prototype munger */
|
|
||||||
# define PNGARG(arglist) OF(arglist)
|
|
||||||
# else
|
|
||||||
|
|
||||||
# ifdef _NO_PROTO
|
|
||||||
# define PNGARG(arglist) ()
|
|
||||||
# else
|
|
||||||
# define PNGARG(arglist) arglist
|
# define PNGARG(arglist) arglist
|
||||||
# endif /* _NO_PROTO */
|
#endif
|
||||||
|
|
||||||
# endif /* OF */
|
|
||||||
|
|
||||||
#endif /* PNGARG */
|
|
||||||
|
|
||||||
/* Function calling conventions.
|
/* Function calling conventions.
|
||||||
* =============================
|
* =============================
|
||||||
@ -177,18 +176,16 @@
|
|||||||
* ==========================
|
* ==========================
|
||||||
* This code is used at build time to find PNG_IMPEXP, the API settings
|
* This code is used at build time to find PNG_IMPEXP, the API settings
|
||||||
* and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL
|
* and PNG_EXPORT_TYPE(), it may also set a macro to indicate the DLL
|
||||||
* import processing is possible. On Windows/x86 systems it also sets
|
* import processing is possible. On Windows systems it also sets
|
||||||
* compiler-specific macros to the values required to change the calling
|
* compiler-specific macros to the values required to change the calling
|
||||||
* conventions of the various functions.
|
* conventions of the various functions.
|
||||||
*/
|
*/
|
||||||
#if ( defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
|
#if defined(_Windows) || defined(_WINDOWS) || defined(WIN32) ||\
|
||||||
defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__) ) &&\
|
defined(_WIN32) || defined(__WIN32__) || defined(__CYGWIN__)
|
||||||
( defined(_X86_) || defined(_X64_) || defined(_M_IX86) ||\
|
/* Windows system (DOS doesn't support DLLs). Includes builds under Cygwin or
|
||||||
defined(_M_X64) || defined(_M_IA64) )
|
* MinGW on any architecture currently supported by Windows. Also includes
|
||||||
/* Windows system (DOS doesn't support DLLs) running on x86/x64. Includes
|
* Watcom builds but these need special treatment because they are not
|
||||||
* builds under Cygwin or MinGW. Also includes Watcom builds but these need
|
* compatible with GCC or Visual C because of different calling conventions.
|
||||||
* special treatment because they are not compatible with GCC or Visual C
|
|
||||||
* because of different calling conventions.
|
|
||||||
*/
|
*/
|
||||||
# if PNG_API_RULE == 2
|
# if PNG_API_RULE == 2
|
||||||
/* If this line results in an error, either because __watcall is not
|
/* If this line results in an error, either because __watcall is not
|
||||||
@ -202,6 +199,9 @@
|
|||||||
# if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800))
|
# if defined(__GNUC__) || (defined(_MSC_VER) && (_MSC_VER >= 800))
|
||||||
# define PNGCAPI __cdecl
|
# define PNGCAPI __cdecl
|
||||||
# if PNG_API_RULE == 1
|
# if PNG_API_RULE == 1
|
||||||
|
/* If this line results in an error __stdcall is not understood and
|
||||||
|
* PNG_API_RULE should not have been set to '1'.
|
||||||
|
*/
|
||||||
# define PNGAPI __stdcall
|
# define PNGAPI __stdcall
|
||||||
# endif
|
# endif
|
||||||
# else
|
# else
|
||||||
@ -216,10 +216,11 @@
|
|||||||
# define PNGAPI _stdcall
|
# define PNGAPI _stdcall
|
||||||
# endif
|
# endif
|
||||||
# endif /* compiler/api */
|
# endif /* compiler/api */
|
||||||
|
|
||||||
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
|
/* NOTE: PNGCBAPI always defaults to PNGCAPI. */
|
||||||
|
|
||||||
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
|
# if defined(PNGAPI) && !defined(PNG_USER_PRIVATEBUILD)
|
||||||
ERROR: PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed
|
# error "PNG_USER_PRIVATEBUILD must be defined if PNGAPI is changed"
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\
|
# if (defined(_MSC_VER) && _MSC_VER < 800) ||\
|
||||||
@ -239,7 +240,7 @@
|
|||||||
# endif
|
# endif
|
||||||
# endif /* compiler */
|
# endif /* compiler */
|
||||||
|
|
||||||
#else /* !Windows/x86 */
|
#else /* !Windows */
|
||||||
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
|
# if (defined(__IBMC__) || defined(__IBMCPP__)) && defined(__OS2__)
|
||||||
# define PNGAPI _System
|
# define PNGAPI _System
|
||||||
# else /* !Windows/x86 && !OS/2 */
|
# else /* !Windows/x86 && !OS/2 */
|
||||||
@ -333,17 +334,45 @@
|
|||||||
|
|
||||||
#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
|
#ifdef PNG_PEDANTIC_WARNINGS_SUPPORTED
|
||||||
/* Support for compiler specific function attributes. These are used
|
/* Support for compiler specific function attributes. These are used
|
||||||
* so that where compiler support is available incorrect use of API
|
* so that where compiler support is available, incorrect use of API
|
||||||
* functions in png.h will generate compiler warnings. Added at libpng
|
* functions in png.h will generate compiler warnings. Added at libpng
|
||||||
* version 1.2.41.
|
* version 1.2.41. Disabling these removes the warnings but may also produce
|
||||||
|
* less efficient code.
|
||||||
*/
|
*/
|
||||||
# if defined(__GNUC__)
|
# if defined(__clang__) && defined(__has_attribute)
|
||||||
|
/* Clang defines both __clang__ and __GNUC__. Check __clang__ first. */
|
||||||
|
# if !defined(PNG_USE_RESULT) && __has_attribute(__warn_unused_result__)
|
||||||
|
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
|
||||||
|
# endif
|
||||||
|
# if !defined(PNG_NORETURN) && __has_attribute(__noreturn__)
|
||||||
|
# define PNG_NORETURN __attribute__((__noreturn__))
|
||||||
|
# endif
|
||||||
|
# if !defined(PNG_ALLOCATED) && __has_attribute(__malloc__)
|
||||||
|
# define PNG_ALLOCATED __attribute__((__malloc__))
|
||||||
|
# endif
|
||||||
|
# if !defined(PNG_DEPRECATED) && __has_attribute(__deprecated__)
|
||||||
|
# define PNG_DEPRECATED __attribute__((__deprecated__))
|
||||||
|
# endif
|
||||||
|
# if !defined(PNG_PRIVATE)
|
||||||
|
# ifdef __has_extension
|
||||||
|
# if __has_extension(attribute_unavailable_with_message)
|
||||||
|
# define PNG_PRIVATE __attribute__((__unavailable__(\
|
||||||
|
"This function is not exported by libpng.")))
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
# ifndef PNG_RESTRICT
|
||||||
|
# define PNG_RESTRICT __restrict
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# elif defined(__GNUC__)
|
||||||
# ifndef PNG_USE_RESULT
|
# ifndef PNG_USE_RESULT
|
||||||
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
|
# define PNG_USE_RESULT __attribute__((__warn_unused_result__))
|
||||||
# endif
|
# endif
|
||||||
# ifndef PNG_NORETURN
|
# ifndef PNG_NORETURN
|
||||||
# define PNG_NORETURN __attribute__((__noreturn__))
|
# define PNG_NORETURN __attribute__((__noreturn__))
|
||||||
# endif
|
# endif
|
||||||
|
# if __GNUC__ >= 3
|
||||||
# ifndef PNG_ALLOCATED
|
# ifndef PNG_ALLOCATED
|
||||||
# define PNG_ALLOCATED __attribute__((__malloc__))
|
# define PNG_ALLOCATED __attribute__((__malloc__))
|
||||||
# endif
|
# endif
|
||||||
@ -359,9 +388,14 @@
|
|||||||
__attribute__((__deprecated__))
|
__attribute__((__deprecated__))
|
||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# endif /* __GNUC__ */
|
# if ((__GNUC__ > 3) || !defined(__GNUC_MINOR__) || (__GNUC_MINOR__ >= 1))
|
||||||
|
# ifndef PNG_RESTRICT
|
||||||
|
# define PNG_RESTRICT __restrict
|
||||||
|
# endif
|
||||||
|
# endif /* __GNUC__.__GNUC_MINOR__ > 3.0 */
|
||||||
|
# endif /* __GNUC__ >= 3 */
|
||||||
|
|
||||||
# if defined(_MSC_VER) && (_MSC_VER >= 1300)
|
# elif defined(_MSC_VER) && (_MSC_VER >= 1300)
|
||||||
# ifndef PNG_USE_RESULT
|
# ifndef PNG_USE_RESULT
|
||||||
# define PNG_USE_RESULT /* not supported */
|
# define PNG_USE_RESULT /* not supported */
|
||||||
# endif
|
# endif
|
||||||
@ -379,7 +413,17 @@
|
|||||||
# ifndef PNG_PRIVATE
|
# ifndef PNG_PRIVATE
|
||||||
# define PNG_PRIVATE __declspec(deprecated)
|
# define PNG_PRIVATE __declspec(deprecated)
|
||||||
# endif
|
# endif
|
||||||
# endif /* _MSC_VER */
|
# ifndef PNG_RESTRICT
|
||||||
|
# if (_MSC_VER >= 1400)
|
||||||
|
# define PNG_RESTRICT __restrict
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# elif defined(__WATCOMC__)
|
||||||
|
# ifndef PNG_RESTRICT
|
||||||
|
# define PNG_RESTRICT __restrict
|
||||||
|
# endif
|
||||||
|
# endif
|
||||||
#endif /* PNG_PEDANTIC_WARNINGS */
|
#endif /* PNG_PEDANTIC_WARNINGS */
|
||||||
|
|
||||||
#ifndef PNG_DEPRECATED
|
#ifndef PNG_DEPRECATED
|
||||||
@ -397,10 +441,14 @@
|
|||||||
#ifndef PNG_PRIVATE
|
#ifndef PNG_PRIVATE
|
||||||
# define PNG_PRIVATE /* This is a private libpng function */
|
# define PNG_PRIVATE /* This is a private libpng function */
|
||||||
#endif
|
#endif
|
||||||
|
#ifndef PNG_RESTRICT
|
||||||
|
# define PNG_RESTRICT /* The C99 "restrict" feature */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef PNG_FP_EXPORT /* A floating point API. */
|
#ifndef PNG_FP_EXPORT /* A floating point API. */
|
||||||
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
# ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
# define PNG_FP_EXPORT(ordinal, type, name, args)\
|
# define PNG_FP_EXPORT(ordinal, type, name, args)\
|
||||||
PNG_EXPORT(ordinal, type, name, args)
|
PNG_EXPORT(ordinal, type, name, args);
|
||||||
# else /* No floating point APIs */
|
# else /* No floating point APIs */
|
||||||
# define PNG_FP_EXPORT(ordinal, type, name, args)
|
# define PNG_FP_EXPORT(ordinal, type, name, args)
|
||||||
# endif
|
# endif
|
||||||
@ -408,189 +456,167 @@
|
|||||||
#ifndef PNG_FIXED_EXPORT /* A fixed point API. */
|
#ifndef PNG_FIXED_EXPORT /* A fixed point API. */
|
||||||
# ifdef PNG_FIXED_POINT_SUPPORTED
|
# ifdef PNG_FIXED_POINT_SUPPORTED
|
||||||
# define PNG_FIXED_EXPORT(ordinal, type, name, args)\
|
# define PNG_FIXED_EXPORT(ordinal, type, name, args)\
|
||||||
PNG_EXPORT(ordinal, type, name, args)
|
PNG_EXPORT(ordinal, type, name, args);
|
||||||
# else /* No fixed point APIs */
|
# else /* No fixed point APIs */
|
||||||
# define PNG_FIXED_EXPORT(ordinal, type, name, args)
|
# define PNG_FIXED_EXPORT(ordinal, type, name, args)
|
||||||
# endif
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The following uses const char * instead of char * for error
|
#ifndef PNG_BUILDING_SYMBOL_TABLE
|
||||||
* and warning message functions, so some compilers won't complain.
|
/* Some typedefs to get us started. These should be safe on most of the common
|
||||||
* If you do not want to use const, define PNG_NO_CONST here.
|
* platforms.
|
||||||
*
|
*
|
||||||
* This should not change how the APIs are called, so it can be done
|
* png_uint_32 and png_int_32 may, currently, be larger than required to hold a
|
||||||
* on a per-file basis in the application.
|
* 32-bit value however this is not normally advisable.
|
||||||
|
*
|
||||||
|
* png_uint_16 and png_int_16 should always be two bytes in size - this is
|
||||||
|
* verified at library build time.
|
||||||
|
*
|
||||||
|
* png_byte must always be one byte in size.
|
||||||
|
*
|
||||||
|
* The checks below use constants from limits.h, as defined by the ISOC90
|
||||||
|
* standard.
|
||||||
*/
|
*/
|
||||||
#ifndef PNG_CONST
|
#if CHAR_BIT == 8 && UCHAR_MAX == 255
|
||||||
# ifndef PNG_NO_CONST
|
|
||||||
# define PNG_CONST const
|
|
||||||
# else
|
|
||||||
# define PNG_CONST
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Some typedefs to get us started. These should be safe on most of the
|
|
||||||
* common platforms. The typedefs should be at least as large as the
|
|
||||||
* numbers suggest (a png_uint_32 must be at least 32 bits long), but they
|
|
||||||
* don't have to be exactly that size. Some compilers dislike passing
|
|
||||||
* unsigned shorts as function parameters, so you may be better off using
|
|
||||||
* unsigned int for png_uint_16.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#if defined(INT_MAX) && (INT_MAX > 0x7ffffffeL)
|
|
||||||
typedef unsigned int png_uint_32;
|
|
||||||
typedef int png_int_32;
|
|
||||||
#else
|
|
||||||
typedef unsigned long png_uint_32;
|
|
||||||
typedef long png_int_32;
|
|
||||||
#endif
|
|
||||||
typedef unsigned short png_uint_16;
|
|
||||||
typedef short png_int_16;
|
|
||||||
typedef unsigned char png_byte;
|
typedef unsigned char png_byte;
|
||||||
|
|
||||||
#ifdef PNG_NO_SIZE_T
|
|
||||||
typedef unsigned int png_size_t;
|
|
||||||
#else
|
#else
|
||||||
|
# error "libpng requires 8 bit bytes"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if INT_MIN == -32768 && INT_MAX == 32767
|
||||||
|
typedef int png_int_16;
|
||||||
|
#elif SHRT_MIN == -32768 && SHRT_MAX == 32767
|
||||||
|
typedef short png_int_16;
|
||||||
|
#else
|
||||||
|
# error "libpng requires a signed 16 bit type"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UINT_MAX == 65535
|
||||||
|
typedef unsigned int png_uint_16;
|
||||||
|
#elif USHRT_MAX == 65535
|
||||||
|
typedef unsigned short png_uint_16;
|
||||||
|
#else
|
||||||
|
# error "libpng requires an unsigned 16 bit type"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if INT_MIN < -2147483646 && INT_MAX > 2147483646
|
||||||
|
typedef int png_int_32;
|
||||||
|
#elif LONG_MIN < -2147483646 && LONG_MAX > 2147483646
|
||||||
|
typedef long int png_int_32;
|
||||||
|
#else
|
||||||
|
# error "libpng requires a signed 32 bit (or more) type"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if UINT_MAX > 4294967294
|
||||||
|
typedef unsigned int png_uint_32;
|
||||||
|
#elif ULONG_MAX > 4294967294
|
||||||
|
typedef unsigned long int png_uint_32;
|
||||||
|
#else
|
||||||
|
# error "libpng requires an unsigned 32 bit (or more) type"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Prior to 1.6.0 it was possible to disable the use of size_t, 1.6.0, however,
|
||||||
|
* requires an ISOC90 compiler and relies on consistent behavior of sizeof.
|
||||||
|
*/
|
||||||
typedef size_t png_size_t;
|
typedef size_t png_size_t;
|
||||||
|
typedef ptrdiff_t png_ptrdiff_t;
|
||||||
|
|
||||||
|
/* libpng needs to know the maximum value of 'size_t' and this controls the
|
||||||
|
* definition of png_alloc_size_t, below. This maximum value of size_t limits
|
||||||
|
* but does not control the maximum allocations the library makes - there is
|
||||||
|
* direct application control of this through png_set_user_limits().
|
||||||
|
*/
|
||||||
|
#ifndef PNG_SMALL_SIZE_T
|
||||||
|
/* Compiler specific tests for systems where size_t is known to be less than
|
||||||
|
* 32 bits (some of these systems may no longer work because of the lack of
|
||||||
|
* 'far' support; see above.)
|
||||||
|
*/
|
||||||
|
# if (defined(__TURBOC__) && !defined(__FLAT__)) ||\
|
||||||
|
(defined(_MSC_VER) && defined(MAXSEG_64K))
|
||||||
|
# define PNG_SMALL_SIZE_T
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
#define png_sizeof(x) (sizeof (x))
|
|
||||||
|
|
||||||
/* The following is needed for medium model support. It cannot be in the
|
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t, and no
|
||||||
* pngpriv.h header. Needs modification for other compilers besides
|
* smaller than png_uint_32. Casts from png_size_t or png_uint_32 to
|
||||||
* MSC. Model independent support declares all arrays and pointers to be
|
* png_alloc_size_t are not necessary; in fact, it is recommended not to use
|
||||||
* large using the far keyword. The zlib version used must also support
|
* them at all so that the compiler can complain when something turns out to be
|
||||||
* model independent data. As of version zlib 1.0.4, the necessary changes
|
* problematic.
|
||||||
* have been made in zlib. The USE_FAR_KEYWORD define triggers other
|
*
|
||||||
* changes that are needed. (Tim Wegner)
|
* Casts in the other direction (from png_alloc_size_t to png_size_t or
|
||||||
|
* png_uint_32) should be explicitly applied; however, we do not expect to
|
||||||
|
* encounter practical situations that require such conversions.
|
||||||
|
*
|
||||||
|
* PNG_SMALL_SIZE_T must be defined if the maximum value of size_t is less than
|
||||||
|
* 4294967295 - i.e. less than the maximum value of png_uint_32.
|
||||||
*/
|
*/
|
||||||
|
#ifdef PNG_SMALL_SIZE_T
|
||||||
/* Separate compiler dependencies (problem here is that zlib.h always
|
typedef png_uint_32 png_alloc_size_t;
|
||||||
* defines FAR. (SJT)
|
|
||||||
*/
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
# if defined(__LARGE__) || defined(__HUGE__) || defined(__COMPACT__)
|
|
||||||
# define LDATA 1
|
|
||||||
#else
|
#else
|
||||||
# define LDATA 0
|
typedef png_size_t png_alloc_size_t;
|
||||||
#endif
|
#endif
|
||||||
/* GRR: why is Cygwin in here? Cygwin is not Borland C... */
|
|
||||||
# if !defined(__WIN32__) && !defined(__FLAT__) && !defined(__CYGWIN__)
|
|
||||||
# define PNG_MAX_MALLOC_64K /* only used in build */
|
|
||||||
# if (LDATA != 1)
|
|
||||||
# ifndef FAR
|
|
||||||
# define FAR __far
|
|
||||||
# endif
|
|
||||||
# define USE_FAR_KEYWORD
|
|
||||||
# endif /* LDATA != 1 */
|
|
||||||
/* Possibly useful for moving data out of default segment.
|
|
||||||
* Uncomment it if you want. Could also define FARDATA as
|
|
||||||
* const if your compiler supports it. (SJT)
|
|
||||||
# define FARDATA FAR
|
|
||||||
*/
|
|
||||||
# endif /* __WIN32__, __FLAT__, __CYGWIN__ */
|
|
||||||
#endif /* __BORLANDC__ */
|
|
||||||
|
|
||||||
|
/* Prior to 1.6.0 libpng offered limited support for Microsoft C compiler
|
||||||
/* Suggest testing for specific compiler first before testing for
|
* implementations of Intel CPU specific support of user-mode segmented address
|
||||||
* FAR. The Watcom compiler defines both __MEDIUM__ and M_I86MM,
|
* spaces, where 16-bit pointers address more than 65536 bytes of memory using
|
||||||
* making reliance oncertain keywords suspect. (SJT)
|
* separate 'segment' registers. The implementation requires two different
|
||||||
|
* types of pointer (only one of which includes the segment value.)
|
||||||
|
*
|
||||||
|
* If required this support is available in version 1.2 of libpng and may be
|
||||||
|
* available in versions through 1.5, although the correctness of the code has
|
||||||
|
* not been verified recently.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* MSC Medium model */
|
/* Typedef for floating-point numbers that are converted to fixed-point with a
|
||||||
#ifdef FAR
|
* multiple of 100,000, e.g., gamma
|
||||||
# ifdef M_I86MM
|
|
||||||
# define USE_FAR_KEYWORD
|
|
||||||
# define FARDATA FAR
|
|
||||||
# include <dos.h>
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* SJT: default case */
|
|
||||||
#ifndef FAR
|
|
||||||
# define FAR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* At this point FAR is always defined */
|
|
||||||
#ifndef FARDATA
|
|
||||||
# define FARDATA
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* Typedef for floating-point numbers that are converted
|
|
||||||
* to fixed-point with a multiple of 100,000, e.g., gamma
|
|
||||||
*/
|
*/
|
||||||
typedef png_int_32 png_fixed_point;
|
typedef png_int_32 png_fixed_point;
|
||||||
|
|
||||||
/* Add typedefs for pointers */
|
/* Add typedefs for pointers */
|
||||||
typedef void FAR * png_voidp;
|
typedef void * png_voidp;
|
||||||
typedef PNG_CONST void FAR * png_const_voidp;
|
typedef const void * png_const_voidp;
|
||||||
typedef png_byte FAR * png_bytep;
|
typedef png_byte * png_bytep;
|
||||||
typedef PNG_CONST png_byte FAR * png_const_bytep;
|
typedef const png_byte * png_const_bytep;
|
||||||
typedef png_uint_32 FAR * png_uint_32p;
|
typedef png_uint_32 * png_uint_32p;
|
||||||
typedef PNG_CONST png_uint_32 FAR * png_const_uint_32p;
|
typedef const png_uint_32 * png_const_uint_32p;
|
||||||
typedef png_int_32 FAR * png_int_32p;
|
typedef png_int_32 * png_int_32p;
|
||||||
typedef PNG_CONST png_int_32 FAR * png_const_int_32p;
|
typedef const png_int_32 * png_const_int_32p;
|
||||||
typedef png_uint_16 FAR * png_uint_16p;
|
typedef png_uint_16 * png_uint_16p;
|
||||||
typedef PNG_CONST png_uint_16 FAR * png_const_uint_16p;
|
typedef const png_uint_16 * png_const_uint_16p;
|
||||||
typedef png_int_16 FAR * png_int_16p;
|
typedef png_int_16 * png_int_16p;
|
||||||
typedef PNG_CONST png_int_16 FAR * png_const_int_16p;
|
typedef const png_int_16 * png_const_int_16p;
|
||||||
typedef char FAR * png_charp;
|
typedef char * png_charp;
|
||||||
typedef PNG_CONST char FAR * png_const_charp;
|
typedef const char * png_const_charp;
|
||||||
typedef png_fixed_point FAR * png_fixed_point_p;
|
typedef png_fixed_point * png_fixed_point_p;
|
||||||
typedef PNG_CONST png_fixed_point FAR * png_const_fixed_point_p;
|
typedef const png_fixed_point * png_const_fixed_point_p;
|
||||||
typedef png_size_t FAR * png_size_tp;
|
typedef png_size_t * png_size_tp;
|
||||||
typedef PNG_CONST png_size_t FAR * png_const_size_tp;
|
typedef const png_size_t * png_const_size_tp;
|
||||||
|
|
||||||
#ifdef PNG_STDIO_SUPPORTED
|
#ifdef PNG_STDIO_SUPPORTED
|
||||||
typedef FILE * png_FILE_p;
|
typedef FILE * png_FILE_p;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
typedef double FAR * png_doublep;
|
typedef double * png_doublep;
|
||||||
typedef PNG_CONST double FAR * png_const_doublep;
|
typedef const double * png_const_doublep;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Pointers to pointers; i.e. arrays */
|
/* Pointers to pointers; i.e. arrays */
|
||||||
typedef png_byte FAR * FAR * png_bytepp;
|
typedef png_byte * * png_bytepp;
|
||||||
typedef png_uint_32 FAR * FAR * png_uint_32pp;
|
typedef png_uint_32 * * png_uint_32pp;
|
||||||
typedef png_int_32 FAR * FAR * png_int_32pp;
|
typedef png_int_32 * * png_int_32pp;
|
||||||
typedef png_uint_16 FAR * FAR * png_uint_16pp;
|
typedef png_uint_16 * * png_uint_16pp;
|
||||||
typedef png_int_16 FAR * FAR * png_int_16pp;
|
typedef png_int_16 * * png_int_16pp;
|
||||||
typedef PNG_CONST char FAR * FAR * png_const_charpp;
|
typedef const char * * png_const_charpp;
|
||||||
typedef char FAR * FAR * png_charpp;
|
typedef char * * png_charpp;
|
||||||
typedef png_fixed_point FAR * FAR * png_fixed_point_pp;
|
typedef png_fixed_point * * png_fixed_point_pp;
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
typedef double FAR * FAR * png_doublepp;
|
typedef double * * png_doublepp;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* Pointers to pointers to pointers; i.e., pointer to array */
|
/* Pointers to pointers to pointers; i.e., pointer to array */
|
||||||
typedef char FAR * FAR * FAR * png_charppp;
|
typedef char * * * png_charppp;
|
||||||
|
|
||||||
/* png_alloc_size_t is guaranteed to be no smaller than png_size_t,
|
#endif /* PNG_BUILDING_SYMBOL_TABLE */
|
||||||
* and no smaller than png_uint_32. Casts from png_size_t or png_uint_32
|
|
||||||
* to png_alloc_size_t are not necessary; in fact, it is recommended
|
|
||||||
* not to use them at all so that the compiler can complain when something
|
|
||||||
* turns out to be problematic.
|
|
||||||
* Casts in the other direction (from png_alloc_size_t to png_size_t or
|
|
||||||
* png_uint_32) should be explicitly applied; however, we do not expect
|
|
||||||
* to encounter practical situations that require such conversions.
|
|
||||||
*/
|
|
||||||
#if defined(__TURBOC__) && !defined(__FLAT__)
|
|
||||||
typedef unsigned long png_alloc_size_t;
|
|
||||||
#else
|
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
|
||||||
typedef unsigned long png_alloc_size_t;
|
|
||||||
# else
|
|
||||||
/* This is an attempt to detect an old Windows system where (int) is
|
|
||||||
* actually 16 bits, in that case png_malloc must have an argument with a
|
|
||||||
* bigger size to accomodate the requirements of the library.
|
|
||||||
*/
|
|
||||||
# if (defined(_Windows) || defined(_WINDOWS) || defined(_WINDOWS_)) && \
|
|
||||||
(!defined(INT_MAX) || INT_MAX <= 0x7ffffffeL)
|
|
||||||
typedef DWORD png_alloc_size_t;
|
|
||||||
# else
|
|
||||||
typedef png_size_t png_alloc_size_t;
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#endif /* PNGCONF_H */
|
#endif /* PNGCONF_H */
|
||||||
|
22
src/3rdparty/libpng/pngdebug.h
vendored
22
src/3rdparty/libpng/pngdebug.h
vendored
@ -1,12 +1,11 @@
|
|||||||
|
|
||||||
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
|
/* pngdebug.h - Debugging macros for libpng, also used in pngtest.c
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Last changed in libpng 1.6.8 [December 19, 2013]
|
||||||
|
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.0 [January 6, 2011]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
@ -25,7 +24,7 @@
|
|||||||
* (actually ((void)0)).
|
* (actually ((void)0)).
|
||||||
*
|
*
|
||||||
* level: level of detail of message, starting at 0. A level 'n'
|
* level: level of detail of message, starting at 0. A level 'n'
|
||||||
* message is preceded by 'n' tab characters (not implemented
|
* message is preceded by 'n' 3-space indentations (not implemented
|
||||||
* on Microsoft compilers unless PNG_DEBUG_FILE is also
|
* on Microsoft compilers unless PNG_DEBUG_FILE is also
|
||||||
* defined, to allow debug DLL compilation with no standard IO).
|
* defined, to allow debug DLL compilation with no standard IO).
|
||||||
* message: a printf(3) style text string. A trailing '\n' is added
|
* message: a printf(3) style text string. A trailing '\n' is added
|
||||||
@ -77,32 +76,29 @@
|
|||||||
# endif /* PNG_DEBUG_FILE */
|
# endif /* PNG_DEBUG_FILE */
|
||||||
|
|
||||||
# if (PNG_DEBUG > 1)
|
# if (PNG_DEBUG > 1)
|
||||||
/* Note: ["%s"m PNG_STRING_NEWLINE] probably does not work on
|
|
||||||
* non-ISO compilers
|
|
||||||
*/
|
|
||||||
# ifdef __STDC__
|
# ifdef __STDC__
|
||||||
# ifndef png_debug
|
# ifndef png_debug
|
||||||
# define png_debug(l,m) \
|
# define png_debug(l,m) \
|
||||||
do { \
|
do { \
|
||||||
int num_tabs=l; \
|
int num_tabs=l; \
|
||||||
fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
|
||||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":"")))); \
|
(num_tabs==2 ? " " : (num_tabs>2 ? " " : "")))); \
|
||||||
} while (0)
|
} while (0)
|
||||||
# endif
|
# endif
|
||||||
# ifndef png_debug1
|
# ifndef png_debug1
|
||||||
# define png_debug1(l,m,p1) \
|
# define png_debug1(l,m,p1) \
|
||||||
do { \
|
do { \
|
||||||
int num_tabs=l; \
|
int num_tabs=l; \
|
||||||
fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
|
||||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1); \
|
(num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1); \
|
||||||
} while (0)
|
} while (0)
|
||||||
# endif
|
# endif
|
||||||
# ifndef png_debug2
|
# ifndef png_debug2
|
||||||
# define png_debug2(l,m,p1,p2) \
|
# define png_debug2(l,m,p1,p2) \
|
||||||
do { \
|
do { \
|
||||||
int num_tabs=l; \
|
int num_tabs=l; \
|
||||||
fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? "\t" : \
|
fprintf(PNG_DEBUG_FILE,"%s" m PNG_STRING_NEWLINE,(num_tabs==1 ? " " : \
|
||||||
(num_tabs==2 ? "\t\t":(num_tabs>2 ? "\t\t\t":""))),p1,p2); \
|
(num_tabs==2 ? " " : (num_tabs>2 ? " " : ""))),p1,p2);\
|
||||||
} while (0)
|
} while (0)
|
||||||
# endif
|
# endif
|
||||||
# else /* __STDC __ */
|
# else /* __STDC __ */
|
||||||
|
426
src/3rdparty/libpng/pngerror.c
vendored
426
src/3rdparty/libpng/pngerror.c
vendored
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngerror.c - stub functions for i/o and memory allocation
|
/* pngerror.c - stub functions for i/o and memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.8 [February 1, 2011]
|
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -20,14 +20,14 @@
|
|||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
|
|
||||||
static PNG_FUNCTION(void, png_default_error,PNGARG((png_structp png_ptr,
|
static PNG_FUNCTION(void, png_default_error,PNGARG((png_const_structrp png_ptr,
|
||||||
png_const_charp error_message)),PNG_NORETURN);
|
png_const_charp error_message)),PNG_NORETURN);
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_default_warning PNGARG((png_structp png_ptr,
|
png_default_warning PNGARG((png_const_structrp png_ptr,
|
||||||
png_const_charp warning_message));
|
png_const_charp warning_message));
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* WARNINGS */
|
||||||
|
|
||||||
/* This function is called whenever there is a fatal error. This function
|
/* This function is called whenever there is a fatal error. This function
|
||||||
* should not be changed. If there is a need to handle errors differently,
|
* should not be changed. If there is a need to handle errors differently,
|
||||||
@ -36,14 +36,15 @@ png_default_warning PNGARG((png_structp png_ptr,
|
|||||||
*/
|
*/
|
||||||
#ifdef PNG_ERROR_TEXT_SUPPORTED
|
#ifdef PNG_ERROR_TEXT_SUPPORTED
|
||||||
PNG_FUNCTION(void,PNGAPI
|
PNG_FUNCTION(void,PNGAPI
|
||||||
png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
|
png_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
||||||
|
PNG_NORETURN)
|
||||||
{
|
{
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
char msg[16];
|
char msg[16];
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
if (png_ptr->flags&
|
if ((png_ptr->flags &
|
||||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0
|
||||||
{
|
{
|
||||||
if (*error_message == PNG_LITERAL_SHARP)
|
if (*error_message == PNG_LITERAL_SHARP)
|
||||||
{
|
{
|
||||||
@ -53,7 +54,7 @@ png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
|
|||||||
if (error_message[offset] == ' ')
|
if (error_message[offset] == ' ')
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < offset - 1; i++)
|
for (i = 0; i < offset - 1; i++)
|
||||||
@ -68,7 +69,7 @@ png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
|
|||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (png_ptr->flags&PNG_FLAG_STRIP_ERROR_TEXT)
|
if ((png_ptr->flags & PNG_FLAG_STRIP_ERROR_TEXT) != 0)
|
||||||
{
|
{
|
||||||
msg[0] = '0';
|
msg[0] = '0';
|
||||||
msg[1] = '\0';
|
msg[1] = '\0';
|
||||||
@ -79,7 +80,8 @@ png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
||||||
(*(png_ptr->error_fn))(png_ptr, error_message);
|
(*(png_ptr->error_fn))(png_constcast(png_structrp,png_ptr),
|
||||||
|
error_message);
|
||||||
|
|
||||||
/* If the custom handler doesn't exist, or if it returns,
|
/* If the custom handler doesn't exist, or if it returns,
|
||||||
use the default handler, which will not return. */
|
use the default handler, which will not return. */
|
||||||
@ -87,7 +89,7 @@ png_error,(png_structp png_ptr, png_const_charp error_message),PNG_NORETURN)
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
PNG_FUNCTION(void,PNGAPI
|
PNG_FUNCTION(void,PNGAPI
|
||||||
png_err,(png_structp png_ptr),PNG_NORETURN)
|
png_err,(png_const_structrp png_ptr),PNG_NORETURN)
|
||||||
{
|
{
|
||||||
/* Prior to 1.5.2 the error_fn received a NULL pointer, expressed
|
/* Prior to 1.5.2 the error_fn received a NULL pointer, expressed
|
||||||
* erroneously as '\0', instead of the empty string "". This was
|
* erroneously as '\0', instead of the empty string "". This was
|
||||||
@ -95,13 +97,13 @@ png_err,(png_structp png_ptr),PNG_NORETURN)
|
|||||||
* will crash in this case.
|
* will crash in this case.
|
||||||
*/
|
*/
|
||||||
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
if (png_ptr != NULL && png_ptr->error_fn != NULL)
|
||||||
(*(png_ptr->error_fn))(png_ptr, "");
|
(*(png_ptr->error_fn))(png_constcast(png_structrp,png_ptr), "");
|
||||||
|
|
||||||
/* If the custom handler doesn't exist, or if it returns,
|
/* If the custom handler doesn't exist, or if it returns,
|
||||||
use the default handler, which will not return. */
|
use the default handler, which will not return. */
|
||||||
png_default_error(png_ptr, "");
|
png_default_error(png_ptr, "");
|
||||||
}
|
}
|
||||||
#endif /* PNG_ERROR_TEXT_SUPPORTED */
|
#endif /* ERROR_TEXT */
|
||||||
|
|
||||||
/* Utility to safely appends strings to a buffer. This never errors out so
|
/* Utility to safely appends strings to a buffer. This never errors out so
|
||||||
* error checking is not required in the caller.
|
* error checking is not required in the caller.
|
||||||
@ -150,7 +152,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
|||||||
case PNG_NUMBER_FORMAT_fixed:
|
case PNG_NUMBER_FORMAT_fixed:
|
||||||
/* Needs five digits (the fraction) */
|
/* Needs five digits (the fraction) */
|
||||||
mincount = 5;
|
mincount = 5;
|
||||||
if (output || number % 10 != 0)
|
if (output != 0 || number % 10 != 0)
|
||||||
{
|
{
|
||||||
*--end = digits[number % 10];
|
*--end = digits[number % 10];
|
||||||
output = 1;
|
output = 1;
|
||||||
@ -161,7 +163,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
|||||||
case PNG_NUMBER_FORMAT_02u:
|
case PNG_NUMBER_FORMAT_02u:
|
||||||
/* Expects at least 2 digits. */
|
/* Expects at least 2 digits. */
|
||||||
mincount = 2;
|
mincount = 2;
|
||||||
/* fall through */
|
/* FALL THROUGH */
|
||||||
|
|
||||||
case PNG_NUMBER_FORMAT_u:
|
case PNG_NUMBER_FORMAT_u:
|
||||||
*--end = digits[number % 10];
|
*--end = digits[number % 10];
|
||||||
@ -171,7 +173,7 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
|||||||
case PNG_NUMBER_FORMAT_02x:
|
case PNG_NUMBER_FORMAT_02x:
|
||||||
/* This format expects at least two digits */
|
/* This format expects at least two digits */
|
||||||
mincount = 2;
|
mincount = 2;
|
||||||
/* fall through */
|
/* FALL THROUGH */
|
||||||
|
|
||||||
case PNG_NUMBER_FORMAT_x:
|
case PNG_NUMBER_FORMAT_x:
|
||||||
*--end = digits[number & 0xf];
|
*--end = digits[number & 0xf];
|
||||||
@ -187,13 +189,13 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
|||||||
++count;
|
++count;
|
||||||
|
|
||||||
/* Float a fixed number here: */
|
/* Float a fixed number here: */
|
||||||
if (format == PNG_NUMBER_FORMAT_fixed) if (count == 5) if (end > start)
|
if ((format == PNG_NUMBER_FORMAT_fixed) && (count == 5) && (end > start))
|
||||||
{
|
{
|
||||||
/* End of the fraction, but maybe nothing was output? In that case
|
/* End of the fraction, but maybe nothing was output? In that case
|
||||||
* drop the decimal point. If the number is a true zero handle that
|
* drop the decimal point. If the number is a true zero handle that
|
||||||
* here.
|
* here.
|
||||||
*/
|
*/
|
||||||
if (output)
|
if (output != 0)
|
||||||
*--end = '.';
|
*--end = '.';
|
||||||
else if (number == 0) /* and !output */
|
else if (number == 0) /* and !output */
|
||||||
*--end = '0';
|
*--end = '0';
|
||||||
@ -211,14 +213,14 @@ png_format_number(png_const_charp start, png_charp end, int format,
|
|||||||
* png_set_error_fn() to replace the warning function at run-time.
|
* png_set_error_fn() to replace the warning function at run-time.
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_warning(png_structp png_ptr, png_const_charp warning_message)
|
png_warning(png_const_structrp png_ptr, png_const_charp warning_message)
|
||||||
{
|
{
|
||||||
int offset = 0;
|
int offset = 0;
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
if (png_ptr->flags&
|
if ((png_ptr->flags &
|
||||||
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT))
|
(PNG_FLAG_STRIP_ERROR_NUMBERS|PNG_FLAG_STRIP_ERROR_TEXT)) != 0)
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (*warning_message == PNG_LITERAL_SHARP)
|
if (*warning_message == PNG_LITERAL_SHARP)
|
||||||
@ -230,7 +232,8 @@ png_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
if (png_ptr != NULL && png_ptr->warning_fn != NULL)
|
||||||
(*(png_ptr->warning_fn))(png_ptr, warning_message + offset);
|
(*(png_ptr->warning_fn))(png_constcast(png_structrp,png_ptr),
|
||||||
|
warning_message + offset);
|
||||||
else
|
else
|
||||||
png_default_warning(png_ptr, warning_message + offset);
|
png_default_warning(png_ptr, warning_message + offset);
|
||||||
}
|
}
|
||||||
@ -278,7 +281,7 @@ png_warning_parameter_signed(png_warning_parameters p, int number, int format,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
png_formatted_warning(png_structp png_ptr, png_warning_parameters p,
|
png_formatted_warning(png_const_structrp png_ptr, png_warning_parameters p,
|
||||||
png_const_charp message)
|
png_const_charp message)
|
||||||
{
|
{
|
||||||
/* The internal buffer is just 192 bytes - enough for all our messages,
|
/* The internal buffer is just 192 bytes - enough for all our messages,
|
||||||
@ -346,29 +349,79 @@ png_formatted_warning(png_structp png_ptr, png_warning_parameters p,
|
|||||||
/* i is always less than (sizeof msg), so: */
|
/* i is always less than (sizeof msg), so: */
|
||||||
msg[i] = '\0';
|
msg[i] = '\0';
|
||||||
|
|
||||||
/* And this is the formatted message, it may be larger than
|
/* And this is the formatted message. It may be larger than
|
||||||
* PNG_MAX_ERROR_TEXT, but that is only used for 'chunk' errors and these are
|
* PNG_MAX_ERROR_TEXT, but that is only used for 'chunk' errors and these
|
||||||
* not (currently) formatted.
|
* are not (currently) formatted.
|
||||||
*/
|
*/
|
||||||
png_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* WARNINGS */
|
||||||
|
|
||||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_benign_error(png_structp png_ptr, png_const_charp error_message)
|
png_benign_error(png_const_structrp png_ptr, png_const_charp error_message)
|
||||||
{
|
{
|
||||||
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
|
||||||
|
{
|
||||||
|
# ifdef PNG_READ_SUPPORTED
|
||||||
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
|
||||||
|
png_ptr->chunk_name != 0)
|
||||||
|
png_chunk_warning(png_ptr, error_message);
|
||||||
|
else
|
||||||
|
# endif
|
||||||
|
png_warning(png_ptr, error_message);
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
# ifdef PNG_READ_SUPPORTED
|
||||||
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
|
||||||
|
png_ptr->chunk_name != 0)
|
||||||
|
png_chunk_error(png_ptr, error_message);
|
||||||
|
else
|
||||||
|
# endif
|
||||||
|
png_error(png_ptr, error_message);
|
||||||
|
}
|
||||||
|
|
||||||
|
# ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
PNG_UNUSED(error_message)
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void /* PRIVATE */
|
||||||
|
png_app_warning(png_const_structrp png_ptr, png_const_charp error_message)
|
||||||
|
{
|
||||||
|
if ((png_ptr->flags & PNG_FLAG_APP_WARNINGS_WARN) != 0)
|
||||||
png_warning(png_ptr, error_message);
|
png_warning(png_ptr, error_message);
|
||||||
else
|
else
|
||||||
png_error(png_ptr, error_message);
|
png_error(png_ptr, error_message);
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
|
# ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
PNG_UNUSED(error_message)
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
void /* PRIVATE */
|
||||||
|
png_app_error(png_const_structrp png_ptr, png_const_charp error_message)
|
||||||
|
{
|
||||||
|
if ((png_ptr->flags & PNG_FLAG_APP_ERRORS_WARN) != 0)
|
||||||
|
png_warning(png_ptr, error_message);
|
||||||
|
else
|
||||||
|
png_error(png_ptr, error_message);
|
||||||
|
|
||||||
|
# ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
PNG_UNUSED(error_message)
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
#endif /* BENIGN_ERRORS */
|
||||||
|
|
||||||
|
#define PNG_MAX_ERROR_TEXT 196 /* Currently limited by profile_error in png.c */
|
||||||
|
#if defined(PNG_WARNINGS_SUPPORTED) || \
|
||||||
|
(defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED))
|
||||||
/* These utilities are used internally to build an error message that relates
|
/* These utilities are used internally to build an error message that relates
|
||||||
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
* to the current chunk. The chunk name comes from png_ptr->chunk_name,
|
||||||
* this is used to prefix the message. The message is limited in length
|
* which is used to prefix the message. The message is limited in length
|
||||||
* to 63 bytes, the name characters are output as hex digits wrapped in []
|
* to 63 bytes. The name characters are output as hex digits wrapped in []
|
||||||
* if the character is invalid.
|
* if the character is invalid.
|
||||||
*/
|
*/
|
||||||
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
#define isnonalpha(c) ((c) < 65 || (c) > 122 || ((c) > 90 && (c) < 97))
|
||||||
@ -377,10 +430,8 @@ static PNG_CONST char png_digit[16] = {
|
|||||||
'A', 'B', 'C', 'D', 'E', 'F'
|
'A', 'B', 'C', 'D', 'E', 'F'
|
||||||
};
|
};
|
||||||
|
|
||||||
#define PNG_MAX_ERROR_TEXT 64
|
|
||||||
#if defined(PNG_WARNINGS_SUPPORTED) || defined(PNG_ERROR_TEXT_SUPPORTED)
|
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
png_format_buffer(png_const_structrp png_ptr, png_charp buffer, png_const_charp
|
||||||
error_message)
|
error_message)
|
||||||
{
|
{
|
||||||
png_uint_32 chunk_name = png_ptr->chunk_name;
|
png_uint_32 chunk_name = png_ptr->chunk_name;
|
||||||
@ -391,7 +442,7 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
|||||||
int c = (int)(chunk_name >> ishift) & 0xff;
|
int c = (int)(chunk_name >> ishift) & 0xff;
|
||||||
|
|
||||||
ishift -= 8;
|
ishift -= 8;
|
||||||
if (isnonalpha(c))
|
if (isnonalpha(c) != 0)
|
||||||
{
|
{
|
||||||
buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
|
buffer[iout++] = PNG_LITERAL_LEFT_SQUARE_BRACKET;
|
||||||
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
buffer[iout++] = png_digit[(c & 0xf0) >> 4];
|
||||||
@ -422,11 +473,11 @@ png_format_buffer(png_structp png_ptr, png_charp buffer, png_const_charp
|
|||||||
buffer[iout] = '\0';
|
buffer[iout] = '\0';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED || PNG_ERROR_TEXT_SUPPORTED */
|
#endif /* WARNINGS || ERROR_TEXT */
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) && defined(PNG_ERROR_TEXT_SUPPORTED)
|
||||||
PNG_FUNCTION(void,PNGAPI
|
PNG_FUNCTION(void,PNGAPI
|
||||||
png_chunk_error,(png_structp png_ptr, png_const_charp error_message),
|
png_chunk_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
||||||
PNG_NORETURN)
|
PNG_NORETURN)
|
||||||
{
|
{
|
||||||
char msg[18+PNG_MAX_ERROR_TEXT];
|
char msg[18+PNG_MAX_ERROR_TEXT];
|
||||||
@ -439,11 +490,11 @@ png_chunk_error,(png_structp png_ptr, png_const_charp error_message),
|
|||||||
png_error(png_ptr, msg);
|
png_error(png_ptr, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_SUPPORTED && PNG_ERROR_TEXT_SUPPORTED */
|
#endif /* READ && ERROR_TEXT */
|
||||||
|
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
png_chunk_warning(png_const_structrp png_ptr, png_const_charp warning_message)
|
||||||
{
|
{
|
||||||
char msg[18+PNG_MAX_ERROR_TEXT];
|
char msg[18+PNG_MAX_ERROR_TEXT];
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
@ -455,34 +506,79 @@ png_chunk_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
png_warning(png_ptr, msg);
|
png_warning(png_ptr, msg);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* WARNINGS */
|
||||||
|
|
||||||
#ifdef PNG_READ_SUPPORTED
|
#ifdef PNG_READ_SUPPORTED
|
||||||
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
#ifdef PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_chunk_benign_error(png_structp png_ptr, png_const_charp error_message)
|
png_chunk_benign_error(png_const_structrp png_ptr, png_const_charp
|
||||||
|
error_message)
|
||||||
{
|
{
|
||||||
if (png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN)
|
if ((png_ptr->flags & PNG_FLAG_BENIGN_ERRORS_WARN) != 0)
|
||||||
png_chunk_warning(png_ptr, error_message);
|
png_chunk_warning(png_ptr, error_message);
|
||||||
|
|
||||||
else
|
else
|
||||||
png_chunk_error(png_ptr, error_message);
|
png_chunk_error(png_ptr, error_message);
|
||||||
|
|
||||||
|
# ifndef PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
PNG_UNUSED(error_message)
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* READ */
|
||||||
|
|
||||||
|
void /* PRIVATE */
|
||||||
|
png_chunk_report(png_const_structrp png_ptr, png_const_charp message, int error)
|
||||||
|
{
|
||||||
|
# ifndef PNG_WARNINGS_SUPPORTED
|
||||||
|
PNG_UNUSED(message)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
/* This is always supported, but for just read or just write it
|
||||||
|
* unconditionally does the right thing.
|
||||||
|
*/
|
||||||
|
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
|
||||||
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef PNG_READ_SUPPORTED
|
||||||
|
{
|
||||||
|
if (error < PNG_CHUNK_ERROR)
|
||||||
|
png_chunk_warning(png_ptr, message);
|
||||||
|
|
||||||
|
else
|
||||||
|
png_chunk_benign_error(png_ptr, message);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# if defined(PNG_READ_SUPPORTED) && defined(PNG_WRITE_SUPPORTED)
|
||||||
|
else if ((png_ptr->mode & PNG_IS_READ_STRUCT) == 0)
|
||||||
|
# endif
|
||||||
|
|
||||||
|
# ifdef PNG_WRITE_SUPPORTED
|
||||||
|
{
|
||||||
|
if (error < PNG_CHUNK_WRITE_ERROR)
|
||||||
|
png_app_warning(png_ptr, message);
|
||||||
|
|
||||||
|
else
|
||||||
|
png_app_error(png_ptr, message);
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef PNG_ERROR_TEXT_SUPPORTED
|
#ifdef PNG_ERROR_TEXT_SUPPORTED
|
||||||
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
#ifdef PNG_FLOATING_POINT_SUPPORTED
|
||||||
PNG_FUNCTION(void,
|
PNG_FUNCTION(void,
|
||||||
png_fixed_error,(png_structp png_ptr, png_const_charp name),PNG_NORETURN)
|
png_fixed_error,(png_const_structrp png_ptr, png_const_charp name),PNG_NORETURN)
|
||||||
{
|
{
|
||||||
# define fixed_message "fixed point overflow in "
|
# define fixed_message "fixed point overflow in "
|
||||||
# define fixed_message_ln ((sizeof fixed_message)-1)
|
# define fixed_message_ln ((sizeof fixed_message)-1)
|
||||||
int iin;
|
int iin;
|
||||||
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
|
char msg[fixed_message_ln+PNG_MAX_ERROR_TEXT];
|
||||||
png_memcpy(msg, fixed_message, fixed_message_ln);
|
memcpy(msg, fixed_message, fixed_message_ln);
|
||||||
iin = 0;
|
iin = 0;
|
||||||
if (name != NULL) while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
|
if (name != NULL)
|
||||||
|
while (iin < (PNG_MAX_ERROR_TEXT-1) && name[iin] != 0)
|
||||||
{
|
{
|
||||||
msg[fixed_message_ln + iin] = name[iin];
|
msg[fixed_message_ln + iin] = name[iin];
|
||||||
++iin;
|
++iin;
|
||||||
@ -498,14 +594,111 @@ png_fixed_error,(png_structp png_ptr, png_const_charp name),PNG_NORETURN)
|
|||||||
* otherwise it is necessary for png_default_error to be overridden.
|
* otherwise it is necessary for png_default_error to be overridden.
|
||||||
*/
|
*/
|
||||||
jmp_buf* PNGAPI
|
jmp_buf* PNGAPI
|
||||||
png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
|
png_set_longjmp_fn(png_structrp png_ptr, png_longjmp_ptr longjmp_fn,
|
||||||
size_t jmp_buf_size)
|
size_t jmp_buf_size)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || jmp_buf_size != png_sizeof(jmp_buf))
|
/* From libpng 1.6.0 the app gets one chance to set a 'jmpbuf_size' value
|
||||||
|
* and it must not change after that. Libpng doesn't care how big the
|
||||||
|
* buffer is, just that it doesn't change.
|
||||||
|
*
|
||||||
|
* If the buffer size is no *larger* than the size of jmp_buf when libpng is
|
||||||
|
* compiled a built in jmp_buf is returned; this preserves the pre-1.6.0
|
||||||
|
* semantics that this call will not fail. If the size is larger, however,
|
||||||
|
* the buffer is allocated and this may fail, causing the function to return
|
||||||
|
* NULL.
|
||||||
|
*/
|
||||||
|
if (png_ptr == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
|
if (png_ptr->jmp_buf_ptr == NULL)
|
||||||
|
{
|
||||||
|
png_ptr->jmp_buf_size = 0; /* not allocated */
|
||||||
|
|
||||||
|
if (jmp_buf_size <= (sizeof png_ptr->jmp_buf_local))
|
||||||
|
png_ptr->jmp_buf_ptr = &png_ptr->jmp_buf_local;
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
png_ptr->jmp_buf_ptr = png_voidcast(jmp_buf *,
|
||||||
|
png_malloc_warn(png_ptr, jmp_buf_size));
|
||||||
|
|
||||||
|
if (png_ptr->jmp_buf_ptr == NULL)
|
||||||
|
return NULL; /* new NULL return on OOM */
|
||||||
|
|
||||||
|
png_ptr->jmp_buf_size = jmp_buf_size;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
else /* Already allocated: check the size */
|
||||||
|
{
|
||||||
|
size_t size = png_ptr->jmp_buf_size;
|
||||||
|
|
||||||
|
if (size == 0)
|
||||||
|
{
|
||||||
|
size = (sizeof png_ptr->jmp_buf_local);
|
||||||
|
if (png_ptr->jmp_buf_ptr != &png_ptr->jmp_buf_local)
|
||||||
|
{
|
||||||
|
/* This is an internal error in libpng: somehow we have been left
|
||||||
|
* with a stack allocated jmp_buf when the application regained
|
||||||
|
* control. It's always possible to fix this up, but for the moment
|
||||||
|
* this is a png_error because that makes it easy to detect.
|
||||||
|
*/
|
||||||
|
png_error(png_ptr, "Libpng jmp_buf still allocated");
|
||||||
|
/* png_ptr->jmp_buf_ptr = &png_ptr->jmp_buf_local; */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (size != jmp_buf_size)
|
||||||
|
{
|
||||||
|
png_warning(png_ptr, "Application jmp_buf size changed");
|
||||||
|
return NULL; /* caller will probably crash: no choice here */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Finally fill in the function, now we have a satisfactory buffer. It is
|
||||||
|
* valid to change the function on every call.
|
||||||
|
*/
|
||||||
png_ptr->longjmp_fn = longjmp_fn;
|
png_ptr->longjmp_fn = longjmp_fn;
|
||||||
return &png_ptr->longjmp_buffer;
|
return png_ptr->jmp_buf_ptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void /* PRIVATE */
|
||||||
|
png_free_jmpbuf(png_structrp png_ptr)
|
||||||
|
{
|
||||||
|
if (png_ptr != NULL)
|
||||||
|
{
|
||||||
|
jmp_buf *jb = png_ptr->jmp_buf_ptr;
|
||||||
|
|
||||||
|
/* A size of 0 is used to indicate a local, stack, allocation of the
|
||||||
|
* pointer; used here and in png.c
|
||||||
|
*/
|
||||||
|
if (jb != NULL && png_ptr->jmp_buf_size > 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
/* This stuff is so that a failure to free the error control structure
|
||||||
|
* does not leave libpng in a state with no valid error handling: the
|
||||||
|
* free always succeeds, if there is an error it gets ignored.
|
||||||
|
*/
|
||||||
|
if (jb != &png_ptr->jmp_buf_local)
|
||||||
|
{
|
||||||
|
/* Make an internal, libpng, jmp_buf to return here */
|
||||||
|
jmp_buf free_jmp_buf;
|
||||||
|
|
||||||
|
if (!setjmp(free_jmp_buf))
|
||||||
|
{
|
||||||
|
png_ptr->jmp_buf_ptr = &free_jmp_buf; /* come back here */
|
||||||
|
png_ptr->jmp_buf_size = 0; /* stack allocation */
|
||||||
|
png_ptr->longjmp_fn = longjmp;
|
||||||
|
png_free(png_ptr, jb); /* Return to setjmp on error */
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* *Always* cancel everything out: */
|
||||||
|
png_ptr->jmp_buf_size = 0;
|
||||||
|
png_ptr->jmp_buf_ptr = NULL;
|
||||||
|
png_ptr->longjmp_fn = 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -515,7 +708,7 @@ png_set_longjmp_fn(png_structp png_ptr, png_longjmp_ptr longjmp_fn,
|
|||||||
* error function pointer in png_set_error_fn().
|
* error function pointer in png_set_error_fn().
|
||||||
*/
|
*/
|
||||||
static PNG_FUNCTION(void /* PRIVATE */,
|
static PNG_FUNCTION(void /* PRIVATE */,
|
||||||
png_default_error,(png_structp png_ptr, png_const_charp error_message),
|
png_default_error,(png_const_structrp png_ptr, png_const_charp error_message),
|
||||||
PNG_NORETURN)
|
PNG_NORETURN)
|
||||||
{
|
{
|
||||||
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
||||||
@ -562,24 +755,23 @@ png_default_error,(png_structp png_ptr, png_const_charp error_message),
|
|||||||
}
|
}
|
||||||
|
|
||||||
PNG_FUNCTION(void,PNGAPI
|
PNG_FUNCTION(void,PNGAPI
|
||||||
png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN)
|
png_longjmp,(png_const_structrp png_ptr, int val),PNG_NORETURN)
|
||||||
{
|
{
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
if (png_ptr && png_ptr->longjmp_fn)
|
if (png_ptr != NULL && png_ptr->longjmp_fn != NULL &&
|
||||||
{
|
png_ptr->jmp_buf_ptr != NULL)
|
||||||
# ifdef USE_FAR_KEYWORD
|
png_ptr->longjmp_fn(*png_ptr->jmp_buf_ptr, val);
|
||||||
{
|
|
||||||
jmp_buf tmp_jmpbuf;
|
|
||||||
png_memcpy(tmp_jmpbuf, png_ptr->longjmp_buffer, png_sizeof(jmp_buf));
|
|
||||||
png_ptr->longjmp_fn(tmp_jmpbuf, val);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else
|
#else
|
||||||
png_ptr->longjmp_fn(png_ptr->longjmp_buffer, val);
|
PNG_UNUSED(png_ptr)
|
||||||
|
PNG_UNUSED(val)
|
||||||
#endif
|
#endif
|
||||||
}
|
|
||||||
#endif
|
/* If control reaches this point, png_longjmp() must not return. The only
|
||||||
/* Here if not setjmp support or if png_ptr is null. */
|
* choice is to terminate the whole process (or maybe the thread); to do
|
||||||
|
* this the ANSI-C abort() function is used unless a different method is
|
||||||
|
* implemented by overriding the default configuration setting for
|
||||||
|
* PNG_ABORT().
|
||||||
|
*/
|
||||||
PNG_ABORT();
|
PNG_ABORT();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -590,7 +782,7 @@ png_longjmp,(png_structp png_ptr, int val),PNG_NORETURN)
|
|||||||
* not used, but it is passed in case it may be useful.
|
* not used, but it is passed in case it may be useful.
|
||||||
*/
|
*/
|
||||||
static void /* PRIVATE */
|
static void /* PRIVATE */
|
||||||
png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
png_default_warning(png_const_structrp png_ptr, png_const_charp warning_message)
|
||||||
{
|
{
|
||||||
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
#ifdef PNG_CONSOLE_IO_SUPPORTED
|
||||||
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
# ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
@ -632,15 +824,15 @@ png_default_warning(png_structp png_ptr, png_const_charp warning_message)
|
|||||||
#endif
|
#endif
|
||||||
PNG_UNUSED(png_ptr) /* Make compiler happy */
|
PNG_UNUSED(png_ptr) /* Make compiler happy */
|
||||||
}
|
}
|
||||||
#endif /* PNG_WARNINGS_SUPPORTED */
|
#endif /* WARNINGS */
|
||||||
|
|
||||||
/* This function is called when the application wants to use another method
|
/* This function is called when the application wants to use another method
|
||||||
* of handling errors and warnings. Note that the error function MUST NOT
|
* of handling errors and warnings. Note that the error function MUST NOT
|
||||||
* return to the calling routine or serious problems will occur. The return
|
* return to the calling routine or serious problems will occur. The return
|
||||||
* method used in the default routine calls longjmp(png_ptr->longjmp_buffer, 1)
|
* method used in the default routine calls longjmp(png_ptr->jmp_buf_ptr, 1)
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
png_set_error_fn(png_structrp png_ptr, png_voidp error_ptr,
|
||||||
png_error_ptr error_fn, png_error_ptr warning_fn)
|
png_error_ptr error_fn, png_error_ptr warning_fn)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
@ -661,7 +853,7 @@ png_set_error_fn(png_structp png_ptr, png_voidp error_ptr,
|
|||||||
* pointer before png_write_destroy and png_read_destroy are called.
|
* pointer before png_write_destroy and png_read_destroy are called.
|
||||||
*/
|
*/
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_error_ptr(png_const_structp png_ptr)
|
png_get_error_ptr(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -672,7 +864,7 @@ png_get_error_ptr(png_const_structp png_ptr)
|
|||||||
|
|
||||||
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
#ifdef PNG_ERROR_NUMBERS_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
png_set_strip_error_numbers(png_structrp png_ptr, png_uint_32 strip_mode)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
@ -682,4 +874,90 @@ png_set_strip_error_numbers(png_structp png_ptr, png_uint_32 strip_mode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
|
||||||
|
#if defined(PNG_SIMPLIFIED_READ_SUPPORTED) ||\
|
||||||
|
defined(PNG_SIMPLIFIED_WRITE_SUPPORTED)
|
||||||
|
/* Currently the above both depend on SETJMP_SUPPORTED, however it would be
|
||||||
|
* possible to implement without setjmp support just so long as there is some
|
||||||
|
* way to handle the error return here:
|
||||||
|
*/
|
||||||
|
PNG_FUNCTION(void /* PRIVATE */, (PNGCBAPI
|
||||||
|
png_safe_error),(png_structp png_nonconst_ptr, png_const_charp error_message),
|
||||||
|
PNG_NORETURN)
|
||||||
|
{
|
||||||
|
const png_const_structrp png_ptr = png_nonconst_ptr;
|
||||||
|
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
|
||||||
|
|
||||||
|
/* An error is always logged here, overwriting anything (typically a warning)
|
||||||
|
* that is already there:
|
||||||
|
*/
|
||||||
|
if (image != NULL)
|
||||||
|
{
|
||||||
|
png_safecat(image->message, (sizeof image->message), 0, error_message);
|
||||||
|
image->warning_or_error |= PNG_IMAGE_ERROR;
|
||||||
|
|
||||||
|
/* Retrieve the jmp_buf from within the png_control, making this work for
|
||||||
|
* C++ compilation too is pretty tricky: C++ wants a pointer to the first
|
||||||
|
* element of a jmp_buf, but C doesn't tell us the type of that.
|
||||||
|
*/
|
||||||
|
if (image->opaque != NULL && image->opaque->error_buf != NULL)
|
||||||
|
longjmp(png_control_jmp_buf(image->opaque), 1);
|
||||||
|
|
||||||
|
/* Missing longjmp buffer, the following is to help debugging: */
|
||||||
|
{
|
||||||
|
size_t pos = png_safecat(image->message, (sizeof image->message), 0,
|
||||||
|
"bad longjmp: ");
|
||||||
|
png_safecat(image->message, (sizeof image->message), pos,
|
||||||
|
error_message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Here on an internal programming error. */
|
||||||
|
abort();
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
|
void /* PRIVATE */ PNGCBAPI
|
||||||
|
png_safe_warning(png_structp png_nonconst_ptr, png_const_charp warning_message)
|
||||||
|
{
|
||||||
|
const png_const_structrp png_ptr = png_nonconst_ptr;
|
||||||
|
png_imagep image = png_voidcast(png_imagep, png_ptr->error_ptr);
|
||||||
|
|
||||||
|
/* A warning is only logged if there is no prior warning or error. */
|
||||||
|
if (image->warning_or_error == 0)
|
||||||
|
{
|
||||||
|
png_safecat(image->message, (sizeof image->message), 0, warning_message);
|
||||||
|
image->warning_or_error |= PNG_IMAGE_WARNING;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int /* PRIVATE */
|
||||||
|
png_safe_execute(png_imagep image_in, int (*function)(png_voidp), png_voidp arg)
|
||||||
|
{
|
||||||
|
volatile png_imagep image = image_in;
|
||||||
|
volatile int result;
|
||||||
|
volatile png_voidp saved_error_buf;
|
||||||
|
jmp_buf safe_jmpbuf;
|
||||||
|
|
||||||
|
/* Safely execute function(arg) with png_error returning to this function. */
|
||||||
|
saved_error_buf = image->opaque->error_buf;
|
||||||
|
result = setjmp(safe_jmpbuf) == 0;
|
||||||
|
|
||||||
|
if (result != 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
image->opaque->error_buf = safe_jmpbuf;
|
||||||
|
result = function(arg);
|
||||||
|
}
|
||||||
|
|
||||||
|
image->opaque->error_buf = saved_error_buf;
|
||||||
|
|
||||||
|
/* And do the cleanup prior to any failure return. */
|
||||||
|
if (result == 0)
|
||||||
|
png_image_free(image);
|
||||||
|
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
#endif /* SIMPLIFIED READ || SIMPLIFIED_WRITE */
|
||||||
|
#endif /* READ || WRITE */
|
||||||
|
553
src/3rdparty/libpng/pngget.c
vendored
553
src/3rdparty/libpng/pngget.c
vendored
File diff suppressed because it is too large
Load Diff
76
src/3rdparty/libpng/pnginfo.h
vendored
76
src/3rdparty/libpng/pnginfo.h
vendored
@ -1,12 +1,11 @@
|
|||||||
|
|
||||||
/* pnginfo.h - header file for PNG reference library
|
/* pnginfo.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||||
|
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.0 [January 6, 2011]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
@ -55,7 +54,7 @@
|
|||||||
|
|
||||||
struct png_info_def
|
struct png_info_def
|
||||||
{
|
{
|
||||||
/* the following are necessary for every PNG file */
|
/* The following are necessary for every PNG file */
|
||||||
png_uint_32 width; /* width of image in pixels (from IHDR) */
|
png_uint_32 width; /* width of image in pixels (from IHDR) */
|
||||||
png_uint_32 height; /* height of image in pixels (from IHDR) */
|
png_uint_32 height; /* height of image in pixels (from IHDR) */
|
||||||
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
|
png_uint_32 valid; /* valid chunk data (see PNG_INFO_ below) */
|
||||||
@ -70,11 +69,17 @@ struct png_info_def
|
|||||||
png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
|
png_byte filter_type; /* must be PNG_FILTER_TYPE_BASE (from IHDR) */
|
||||||
png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
|
png_byte interlace_type; /* One of PNG_INTERLACE_NONE, PNG_INTERLACE_ADAM7 */
|
||||||
|
|
||||||
/* The following is informational only on read, and not used on writes. */
|
/* The following are set by png_set_IHDR, called from the application on
|
||||||
|
* write, but the are never actually used by the write code.
|
||||||
|
*/
|
||||||
png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
|
png_byte channels; /* number of data channels per pixel (1, 2, 3, 4) */
|
||||||
png_byte pixel_depth; /* number of bits per pixel */
|
png_byte pixel_depth; /* number of bits per pixel */
|
||||||
png_byte spare_byte; /* to align the data, and for future use */
|
png_byte spare_byte; /* to align the data, and for future use */
|
||||||
|
|
||||||
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
/* This is never set during write */
|
||||||
png_byte signature[8]; /* magic bytes read by libpng from start of file */
|
png_byte signature[8]; /* magic bytes read by libpng from start of file */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* The rest of the data is optional. If you are reading, check the
|
/* The rest of the data is optional. If you are reading, check the
|
||||||
* valid field to see if the information in these are valid. If you
|
* valid field to see if the information in these are valid. If you
|
||||||
@ -82,18 +87,25 @@ struct png_info_def
|
|||||||
* and initialize the appropriate fields below.
|
* and initialize the appropriate fields below.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined(PNG_gAMA_SUPPORTED)
|
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
|
||||||
/* The gAMA chunk describes the gamma characteristics of the system
|
/* png_colorspace only contains 'flags' if neither GAMMA or COLORSPACE are
|
||||||
* on which the image was created, normally in the range [1.0, 2.5].
|
* defined. When COLORSPACE is switched on all the colorspace-defining
|
||||||
* Data is valid if (valid & PNG_INFO_gAMA) is non-zero.
|
* chunks should be enabled, when GAMMA is switched on all the gamma-defining
|
||||||
|
* chunks should be enabled. If this is not done it becomes possible to read
|
||||||
|
* inconsistent PNG files and assign a probably incorrect interpretation to
|
||||||
|
* the information. (In other words, by carefully choosing which chunks to
|
||||||
|
* recognize the system configuration can select an interpretation for PNG
|
||||||
|
* files containing ambiguous data and this will result in inconsistent
|
||||||
|
* behavior between different libpng builds!)
|
||||||
*/
|
*/
|
||||||
png_fixed_point gamma;
|
png_colorspace colorspace;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_sRGB_SUPPORTED
|
#ifdef PNG_iCCP_SUPPORTED
|
||||||
/* GR-P, 0.96a */
|
/* iCCP chunk data. */
|
||||||
/* Data valid if (valid & PNG_INFO_sRGB) non-zero. */
|
png_charp iccp_name; /* profile name */
|
||||||
png_byte srgb_intent; /* sRGB rendering intent [0, 1, 2, or 3] */
|
png_bytep iccp_profile; /* International Color Consortium profile data */
|
||||||
|
png_uint_32 iccp_proflen; /* ICC profile data length */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_TEXT_SUPPORTED
|
#ifdef PNG_TEXT_SUPPORTED
|
||||||
@ -108,7 +120,7 @@ struct png_info_def
|
|||||||
int num_text; /* number of comments read or comments to write */
|
int num_text; /* number of comments read or comments to write */
|
||||||
int max_text; /* current size of text array */
|
int max_text; /* current size of text array */
|
||||||
png_textp text; /* array of comments read or comments to write */
|
png_textp text; /* array of comments read or comments to write */
|
||||||
#endif /* PNG_TEXT_SUPPORTED */
|
#endif /* TEXT */
|
||||||
|
|
||||||
#ifdef PNG_tIME_SUPPORTED
|
#ifdef PNG_tIME_SUPPORTED
|
||||||
/* The tIME chunk holds the last time the displayed image data was
|
/* The tIME chunk holds the last time the displayed image data was
|
||||||
@ -183,23 +195,6 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|||||||
png_uint_16p hist;
|
png_uint_16p hist;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_cHRM_SUPPORTED
|
|
||||||
/* The cHRM chunk describes the CIE color characteristics of the monitor
|
|
||||||
* on which the PNG was created. This data allows the viewer to do gamut
|
|
||||||
* mapping of the input image to ensure that the viewer sees the same
|
|
||||||
* colors in the image as the creator. Values are in the range
|
|
||||||
* [0.0, 0.8]. Data valid if (valid & PNG_INFO_cHRM) non-zero.
|
|
||||||
*/
|
|
||||||
png_fixed_point x_white;
|
|
||||||
png_fixed_point y_white;
|
|
||||||
png_fixed_point x_red;
|
|
||||||
png_fixed_point y_red;
|
|
||||||
png_fixed_point x_green;
|
|
||||||
png_fixed_point y_green;
|
|
||||||
png_fixed_point x_blue;
|
|
||||||
png_fixed_point y_blue;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_pCAL_SUPPORTED
|
#ifdef PNG_pCAL_SUPPORTED
|
||||||
/* The pCAL chunk describes a transformation between the stored pixel
|
/* The pCAL chunk describes a transformation between the stored pixel
|
||||||
* values and original physical data values used to create the image.
|
* values and original physical data values used to create the image.
|
||||||
@ -224,25 +219,20 @@ defined(PNG_READ_BACKGROUND_SUPPORTED)
|
|||||||
/* New members added in libpng-1.0.6 */
|
/* New members added in libpng-1.0.6 */
|
||||||
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
png_uint_32 free_me; /* flags items libpng is responsible for freeing */
|
||||||
|
|
||||||
#if defined(PNG_UNKNOWN_CHUNKS_SUPPORTED) || \
|
#ifdef PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
defined(PNG_HANDLE_AS_UNKNOWN_SUPPORTED)
|
|
||||||
/* Storage for unknown chunks that the library doesn't recognize. */
|
/* Storage for unknown chunks that the library doesn't recognize. */
|
||||||
png_unknown_chunkp unknown_chunks;
|
png_unknown_chunkp unknown_chunks;
|
||||||
int unknown_chunks_num;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_iCCP_SUPPORTED
|
/* The type of this field is limited by the type of
|
||||||
/* iCCP chunk data. */
|
* png_struct::user_chunk_cache_max, else overflow can occur.
|
||||||
png_charp iccp_name; /* profile name */
|
*/
|
||||||
png_bytep iccp_profile; /* International Color Consortium profile data */
|
int unknown_chunks_num;
|
||||||
png_uint_32 iccp_proflen; /* ICC profile data length */
|
|
||||||
png_byte iccp_compression; /* Always zero */
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_sPLT_SUPPORTED
|
#ifdef PNG_sPLT_SUPPORTED
|
||||||
/* Data on sPLT chunks (there may be more than one). */
|
/* Data on sPLT chunks (there may be more than one). */
|
||||||
png_sPLT_tp splt_palettes;
|
png_sPLT_tp splt_palettes;
|
||||||
png_uint_32 splt_palettes_num;
|
int splt_palettes_num; /* Match type returned by png_get API */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_sCAL_SUPPORTED
|
#ifdef PNG_sCAL_SUPPORTED
|
||||||
|
183
src/3rdparty/libpng/pnglibconf.h
vendored
183
src/3rdparty/libpng/pnglibconf.h
vendored
@ -1,48 +1,31 @@
|
|||||||
|
/* libpng 1.6.17 STANDARD API DEFINITION */
|
||||||
/* libpng STANDARD API DEFINITION */
|
|
||||||
|
|
||||||
/* pnglibconf.h - library build configuration */
|
/* pnglibconf.h - library build configuration */
|
||||||
|
|
||||||
/* Libpng 1.5.10 - March 29, 2012 */
|
/* Libpng version 1.6.17 - March 26, 2015 */
|
||||||
|
|
||||||
/* Copyright (c) 1998-2012 Glenn Randers-Pehrson */
|
/* Copyright (c) 1998-2014 Glenn Randers-Pehrson */
|
||||||
|
|
||||||
/* This code is released under the libpng license. */
|
/* This code is released under the libpng license. */
|
||||||
/* For conditions of distribution and use, see the disclaimer */
|
/* For conditions of distribution and use, see the disclaimer */
|
||||||
/* and license in png.h */
|
/* and license in png.h */
|
||||||
|
|
||||||
/* pnglibconf.h */
|
/* pnglibconf.h */
|
||||||
|
/* Machine generated file: DO NOT EDIT */
|
||||||
/* Derived from: scripts/pnglibconf.dfa */
|
/* Derived from: scripts/pnglibconf.dfa */
|
||||||
/* If you edit this file by hand you must obey the rules expressed in */
|
|
||||||
/* pnglibconf.dfa with respect to the dependencies between the following */
|
|
||||||
/* symbols. It is much better to generate a new file using */
|
|
||||||
/* scripts/libpngconf.mak */
|
|
||||||
|
|
||||||
#ifndef PNGLCONF_H
|
#ifndef PNGLCONF_H
|
||||||
#define PNGLCONF_H
|
#define PNGLCONF_H
|
||||||
/* settings */
|
|
||||||
#define PNG_API_RULE 0
|
|
||||||
#define PNG_CALLOC_SUPPORTED
|
|
||||||
#define PNG_COST_SHIFT 3
|
|
||||||
#define PNG_DEFAULT_READ_MACROS 1
|
|
||||||
#define PNG_GAMMA_THRESHOLD_FIXED 5000
|
|
||||||
#define PNG_MAX_GAMMA_8 11
|
|
||||||
#define PNG_QUANTIZE_BLUE_BITS 5
|
|
||||||
#define PNG_QUANTIZE_GREEN_BITS 5
|
|
||||||
#define PNG_QUANTIZE_RED_BITS 5
|
|
||||||
#define PNG_sCAL_PRECISION 5
|
|
||||||
#define PNG_WEIGHT_SHIFT 8
|
|
||||||
#define PNG_ZBUF_SIZE 8192
|
|
||||||
/* end of settings */
|
|
||||||
/* options */
|
/* options */
|
||||||
#define PNG_16BIT_SUPPORTED
|
#define PNG_16BIT_SUPPORTED
|
||||||
#define PNG_ALIGN_MEMORY_SUPPORTED
|
#define PNG_ALIGNED_MEMORY_SUPPORTED
|
||||||
|
/*#undef PNG_ARM_NEON_API_SUPPORTED*/
|
||||||
|
/*#undef PNG_ARM_NEON_CHECK_SUPPORTED*/
|
||||||
#define PNG_BENIGN_ERRORS_SUPPORTED
|
#define PNG_BENIGN_ERRORS_SUPPORTED
|
||||||
#define PNG_bKGD_SUPPORTED
|
#define PNG_BENIGN_READ_ERRORS_SUPPORTED
|
||||||
|
/*#undef PNG_BENIGN_WRITE_ERRORS_SUPPORTED*/
|
||||||
#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
|
#define PNG_BUILD_GRAYSCALE_PALETTE_SUPPORTED
|
||||||
#define PNG_CHECK_cHRM_SUPPORTED
|
|
||||||
#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
#define PNG_cHRM_SUPPORTED
|
#define PNG_COLORSPACE_SUPPORTED
|
||||||
#define PNG_CONSOLE_IO_SUPPORTED
|
#define PNG_CONSOLE_IO_SUPPORTED
|
||||||
#ifndef _WIN32_WCE
|
#ifndef _WIN32_WCE
|
||||||
#define PNG_CONVERT_tIME_SUPPORTED
|
#define PNG_CONVERT_tIME_SUPPORTED
|
||||||
@ -53,18 +36,15 @@
|
|||||||
#define PNG_FIXED_POINT_SUPPORTED
|
#define PNG_FIXED_POINT_SUPPORTED
|
||||||
#define PNG_FLOATING_ARITHMETIC_SUPPORTED
|
#define PNG_FLOATING_ARITHMETIC_SUPPORTED
|
||||||
#define PNG_FLOATING_POINT_SUPPORTED
|
#define PNG_FLOATING_POINT_SUPPORTED
|
||||||
#define PNG_gAMA_SUPPORTED
|
#define PNG_FORMAT_AFIRST_SUPPORTED
|
||||||
|
#define PNG_FORMAT_BGR_SUPPORTED
|
||||||
|
#define PNG_GAMMA_SUPPORTED
|
||||||
|
#define PNG_GET_PALETTE_MAX_SUPPORTED
|
||||||
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
#define PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
#define PNG_hIST_SUPPORTED
|
|
||||||
#define PNG_iCCP_SUPPORTED
|
|
||||||
#define PNG_INCH_CONVERSIONS_SUPPORTED
|
#define PNG_INCH_CONVERSIONS_SUPPORTED
|
||||||
#define PNG_INFO_IMAGE_SUPPORTED
|
#define PNG_INFO_IMAGE_SUPPORTED
|
||||||
#define PNG_IO_STATE_SUPPORTED
|
#define PNG_IO_STATE_SUPPORTED
|
||||||
#define PNG_iTXt_SUPPORTED
|
|
||||||
#define PNG_MNG_FEATURES_SUPPORTED
|
#define PNG_MNG_FEATURES_SUPPORTED
|
||||||
#define PNG_oFFs_SUPPORTED
|
|
||||||
#define PNG_pCAL_SUPPORTED
|
|
||||||
#define PNG_pHYs_SUPPORTED
|
|
||||||
#define PNG_POINTER_INDEXING_SUPPORTED
|
#define PNG_POINTER_INDEXING_SUPPORTED
|
||||||
#define PNG_PROGRESSIVE_READ_SUPPORTED
|
#define PNG_PROGRESSIVE_READ_SUPPORTED
|
||||||
#define PNG_READ_16BIT_SUPPORTED
|
#define PNG_READ_16BIT_SUPPORTED
|
||||||
@ -72,68 +52,74 @@
|
|||||||
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
|
#define PNG_READ_ANCILLARY_CHUNKS_SUPPORTED
|
||||||
#define PNG_READ_BACKGROUND_SUPPORTED
|
#define PNG_READ_BACKGROUND_SUPPORTED
|
||||||
#define PNG_READ_BGR_SUPPORTED
|
#define PNG_READ_BGR_SUPPORTED
|
||||||
#define PNG_READ_bKGD_SUPPORTED
|
|
||||||
#define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
#define PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
#define PNG_READ_cHRM_SUPPORTED
|
|
||||||
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
#define PNG_READ_COMPOSITE_NODIV_SUPPORTED
|
||||||
#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
|
#define PNG_READ_COMPRESSED_TEXT_SUPPORTED
|
||||||
#define PNG_READ_EXPAND_16_SUPPORTED
|
#define PNG_READ_EXPAND_16_SUPPORTED
|
||||||
#define PNG_READ_EXPAND_SUPPORTED
|
#define PNG_READ_EXPAND_SUPPORTED
|
||||||
#define PNG_READ_FILLER_SUPPORTED
|
#define PNG_READ_FILLER_SUPPORTED
|
||||||
#define PNG_READ_gAMA_SUPPORTED
|
|
||||||
#define PNG_READ_GAMMA_SUPPORTED
|
#define PNG_READ_GAMMA_SUPPORTED
|
||||||
|
#define PNG_READ_GET_PALETTE_MAX_SUPPORTED
|
||||||
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
|
#define PNG_READ_GRAY_TO_RGB_SUPPORTED
|
||||||
#define PNG_READ_hIST_SUPPORTED
|
|
||||||
#define PNG_READ_iCCP_SUPPORTED
|
|
||||||
#define PNG_READ_INTERLACING_SUPPORTED
|
#define PNG_READ_INTERLACING_SUPPORTED
|
||||||
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
|
#define PNG_READ_INT_FUNCTIONS_SUPPORTED
|
||||||
#define PNG_READ_INVERT_ALPHA_SUPPORTED
|
#define PNG_READ_INVERT_ALPHA_SUPPORTED
|
||||||
#define PNG_READ_INVERT_SUPPORTED
|
#define PNG_READ_INVERT_SUPPORTED
|
||||||
#define PNG_READ_iTXt_SUPPORTED
|
|
||||||
#define PNG_READ_oFFs_SUPPORTED
|
|
||||||
#define PNG_READ_OPT_PLTE_SUPPORTED
|
#define PNG_READ_OPT_PLTE_SUPPORTED
|
||||||
#define PNG_READ_PACK_SUPPORTED
|
|
||||||
#define PNG_READ_PACKSWAP_SUPPORTED
|
#define PNG_READ_PACKSWAP_SUPPORTED
|
||||||
#define PNG_READ_pCAL_SUPPORTED
|
#define PNG_READ_PACK_SUPPORTED
|
||||||
#define PNG_READ_pHYs_SUPPORTED
|
|
||||||
#define PNG_READ_QUANTIZE_SUPPORTED
|
#define PNG_READ_QUANTIZE_SUPPORTED
|
||||||
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
|
#define PNG_READ_RGB_TO_GRAY_SUPPORTED
|
||||||
#define PNG_READ_sBIT_SUPPORTED
|
|
||||||
#define PNG_READ_SCALE_16_TO_8_SUPPORTED
|
#define PNG_READ_SCALE_16_TO_8_SUPPORTED
|
||||||
#define PNG_READ_sCAL_SUPPORTED
|
|
||||||
#define PNG_READ_SHIFT_SUPPORTED
|
#define PNG_READ_SHIFT_SUPPORTED
|
||||||
#define PNG_READ_sPLT_SUPPORTED
|
|
||||||
#define PNG_READ_sRGB_SUPPORTED
|
|
||||||
#define PNG_READ_STRIP_16_TO_8_SUPPORTED
|
#define PNG_READ_STRIP_16_TO_8_SUPPORTED
|
||||||
#define PNG_READ_STRIP_ALPHA_SUPPORTED
|
#define PNG_READ_STRIP_ALPHA_SUPPORTED
|
||||||
#define PNG_READ_SUPPORTED
|
#define PNG_READ_SUPPORTED
|
||||||
#define PNG_READ_SWAP_ALPHA_SUPPORTED
|
#define PNG_READ_SWAP_ALPHA_SUPPORTED
|
||||||
#define PNG_READ_SWAP_SUPPORTED
|
#define PNG_READ_SWAP_SUPPORTED
|
||||||
#define PNG_READ_tEXt_SUPPORTED
|
|
||||||
#define PNG_READ_TEXT_SUPPORTED
|
#define PNG_READ_TEXT_SUPPORTED
|
||||||
#define PNG_READ_tIME_SUPPORTED
|
|
||||||
#define PNG_READ_TRANSFORMS_SUPPORTED
|
#define PNG_READ_TRANSFORMS_SUPPORTED
|
||||||
#define PNG_READ_tRNS_SUPPORTED
|
|
||||||
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
#define PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
#define PNG_READ_USER_CHUNKS_SUPPORTED
|
#define PNG_READ_USER_CHUNKS_SUPPORTED
|
||||||
#define PNG_READ_USER_TRANSFORM_SUPPORTED
|
#define PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||||
|
#define PNG_READ_bKGD_SUPPORTED
|
||||||
|
#define PNG_READ_cHRM_SUPPORTED
|
||||||
|
#define PNG_READ_gAMA_SUPPORTED
|
||||||
|
#define PNG_READ_hIST_SUPPORTED
|
||||||
|
#define PNG_READ_iCCP_SUPPORTED
|
||||||
|
#define PNG_READ_iTXt_SUPPORTED
|
||||||
|
#define PNG_READ_oFFs_SUPPORTED
|
||||||
|
#define PNG_READ_pCAL_SUPPORTED
|
||||||
|
#define PNG_READ_pHYs_SUPPORTED
|
||||||
|
#define PNG_READ_sBIT_SUPPORTED
|
||||||
|
#define PNG_READ_sCAL_SUPPORTED
|
||||||
|
#define PNG_READ_sPLT_SUPPORTED
|
||||||
|
#define PNG_READ_sRGB_SUPPORTED
|
||||||
|
#define PNG_READ_tEXt_SUPPORTED
|
||||||
|
#define PNG_READ_tIME_SUPPORTED
|
||||||
|
#define PNG_READ_tRNS_SUPPORTED
|
||||||
#define PNG_READ_zTXt_SUPPORTED
|
#define PNG_READ_zTXt_SUPPORTED
|
||||||
#define PNG_SAVE_INT_32_SUPPORTED
|
#define PNG_SAVE_INT_32_SUPPORTED
|
||||||
#define PNG_sBIT_SUPPORTED
|
#define PNG_SAVE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
#define PNG_sCAL_SUPPORTED
|
|
||||||
#define PNG_SEQUENTIAL_READ_SUPPORTED
|
#define PNG_SEQUENTIAL_READ_SUPPORTED
|
||||||
|
#define PNG_SETJMP_SUPPORTED
|
||||||
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
|
#define PNG_SET_CHUNK_CACHE_LIMIT_SUPPORTED
|
||||||
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
#define PNG_SET_CHUNK_MALLOC_LIMIT_SUPPORTED
|
||||||
#define PNG_SETJMP_SUPPORTED
|
#define PNG_SET_OPTION_SUPPORTED
|
||||||
|
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
#define PNG_SET_USER_LIMITS_SUPPORTED
|
#define PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
#define PNG_sPLT_SUPPORTED
|
#ifndef _WIN32_WCE
|
||||||
#define PNG_sRGB_SUPPORTED
|
#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
|
||||||
|
#define PNG_SIMPLIFIED_READ_BGR_SUPPORTED
|
||||||
|
#define PNG_SIMPLIFIED_READ_SUPPORTED
|
||||||
|
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
||||||
|
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
|
||||||
|
#define PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||||
|
#endif
|
||||||
#define PNG_STDIO_SUPPORTED
|
#define PNG_STDIO_SUPPORTED
|
||||||
#define PNG_tEXt_SUPPORTED
|
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
#define PNG_TEXT_SUPPORTED
|
#define PNG_TEXT_SUPPORTED
|
||||||
#define PNG_TIME_RFC1123_SUPPORTED
|
#define PNG_TIME_RFC1123_SUPPORTED
|
||||||
#define PNG_tIME_SUPPORTED
|
|
||||||
#define PNG_tRNS_SUPPORTED
|
|
||||||
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
|
#define PNG_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
#define PNG_USER_CHUNKS_SUPPORTED
|
#define PNG_USER_CHUNKS_SUPPORTED
|
||||||
#define PNG_USER_LIMITS_SUPPORTED
|
#define PNG_USER_LIMITS_SUPPORTED
|
||||||
@ -144,46 +130,89 @@
|
|||||||
#define PNG_WRITE_16BIT_SUPPORTED
|
#define PNG_WRITE_16BIT_SUPPORTED
|
||||||
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
|
#define PNG_WRITE_ANCILLARY_CHUNKS_SUPPORTED
|
||||||
#define PNG_WRITE_BGR_SUPPORTED
|
#define PNG_WRITE_BGR_SUPPORTED
|
||||||
#define PNG_WRITE_bKGD_SUPPORTED
|
|
||||||
#define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
#define PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
#define PNG_WRITE_cHRM_SUPPORTED
|
|
||||||
#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
|
#define PNG_WRITE_COMPRESSED_TEXT_SUPPORTED
|
||||||
|
#define PNG_WRITE_CUSTOMIZE_COMPRESSION_SUPPORTED
|
||||||
#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
|
#define PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
|
||||||
#define PNG_WRITE_FILLER_SUPPORTED
|
#define PNG_WRITE_FILLER_SUPPORTED
|
||||||
#define PNG_WRITE_FILTER_SUPPORTED
|
#define PNG_WRITE_FILTER_SUPPORTED
|
||||||
#define PNG_WRITE_FLUSH_SUPPORTED
|
#define PNG_WRITE_FLUSH_SUPPORTED
|
||||||
#define PNG_WRITE_gAMA_SUPPORTED
|
#define PNG_WRITE_GET_PALETTE_MAX_SUPPORTED
|
||||||
#define PNG_WRITE_hIST_SUPPORTED
|
|
||||||
#define PNG_WRITE_iCCP_SUPPORTED
|
|
||||||
#define PNG_WRITE_INTERLACING_SUPPORTED
|
#define PNG_WRITE_INTERLACING_SUPPORTED
|
||||||
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
|
#define PNG_WRITE_INT_FUNCTIONS_SUPPORTED
|
||||||
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
#define PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||||
#define PNG_WRITE_INVERT_SUPPORTED
|
#define PNG_WRITE_INVERT_SUPPORTED
|
||||||
|
#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
||||||
|
#define PNG_WRITE_PACKSWAP_SUPPORTED
|
||||||
|
#define PNG_WRITE_PACK_SUPPORTED
|
||||||
|
#define PNG_WRITE_SHIFT_SUPPORTED
|
||||||
|
#define PNG_WRITE_SUPPORTED
|
||||||
|
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||||
|
#define PNG_WRITE_SWAP_SUPPORTED
|
||||||
|
#define PNG_WRITE_TEXT_SUPPORTED
|
||||||
|
#define PNG_WRITE_TRANSFORMS_SUPPORTED
|
||||||
|
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||||
|
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||||
|
#define PNG_WRITE_bKGD_SUPPORTED
|
||||||
|
#define PNG_WRITE_cHRM_SUPPORTED
|
||||||
|
#define PNG_WRITE_gAMA_SUPPORTED
|
||||||
|
#define PNG_WRITE_hIST_SUPPORTED
|
||||||
|
#define PNG_WRITE_iCCP_SUPPORTED
|
||||||
#define PNG_WRITE_iTXt_SUPPORTED
|
#define PNG_WRITE_iTXt_SUPPORTED
|
||||||
#define PNG_WRITE_oFFs_SUPPORTED
|
#define PNG_WRITE_oFFs_SUPPORTED
|
||||||
#define PNG_WRITE_OPTIMIZE_CMF_SUPPORTED
|
|
||||||
#define PNG_WRITE_PACK_SUPPORTED
|
|
||||||
#define PNG_WRITE_PACKSWAP_SUPPORTED
|
|
||||||
#define PNG_WRITE_pCAL_SUPPORTED
|
#define PNG_WRITE_pCAL_SUPPORTED
|
||||||
#define PNG_WRITE_pHYs_SUPPORTED
|
#define PNG_WRITE_pHYs_SUPPORTED
|
||||||
#define PNG_WRITE_sBIT_SUPPORTED
|
#define PNG_WRITE_sBIT_SUPPORTED
|
||||||
#define PNG_WRITE_sCAL_SUPPORTED
|
#define PNG_WRITE_sCAL_SUPPORTED
|
||||||
#define PNG_WRITE_SHIFT_SUPPORTED
|
|
||||||
#define PNG_WRITE_sPLT_SUPPORTED
|
#define PNG_WRITE_sPLT_SUPPORTED
|
||||||
#define PNG_WRITE_sRGB_SUPPORTED
|
#define PNG_WRITE_sRGB_SUPPORTED
|
||||||
#define PNG_WRITE_SUPPORTED
|
|
||||||
#define PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
|
||||||
#define PNG_WRITE_SWAP_SUPPORTED
|
|
||||||
#define PNG_WRITE_tEXt_SUPPORTED
|
#define PNG_WRITE_tEXt_SUPPORTED
|
||||||
#define PNG_WRITE_TEXT_SUPPORTED
|
|
||||||
#define PNG_WRITE_tIME_SUPPORTED
|
#define PNG_WRITE_tIME_SUPPORTED
|
||||||
#define PNG_WRITE_TRANSFORMS_SUPPORTED
|
|
||||||
#define PNG_WRITE_tRNS_SUPPORTED
|
#define PNG_WRITE_tRNS_SUPPORTED
|
||||||
#define PNG_WRITE_UNKNOWN_CHUNKS_SUPPORTED
|
|
||||||
#define PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
|
||||||
#define PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
|
||||||
#define PNG_WRITE_zTXt_SUPPORTED
|
#define PNG_WRITE_zTXt_SUPPORTED
|
||||||
|
#define PNG_bKGD_SUPPORTED
|
||||||
|
#define PNG_cHRM_SUPPORTED
|
||||||
|
#define PNG_gAMA_SUPPORTED
|
||||||
|
#define PNG_hIST_SUPPORTED
|
||||||
|
#define PNG_iCCP_SUPPORTED
|
||||||
|
#define PNG_iTXt_SUPPORTED
|
||||||
|
#define PNG_oFFs_SUPPORTED
|
||||||
|
#define PNG_pCAL_SUPPORTED
|
||||||
|
#define PNG_pHYs_SUPPORTED
|
||||||
|
#define PNG_sBIT_SUPPORTED
|
||||||
|
#define PNG_sCAL_SUPPORTED
|
||||||
|
#define PNG_sPLT_SUPPORTED
|
||||||
|
#define PNG_sRGB_SUPPORTED
|
||||||
|
#define PNG_tEXt_SUPPORTED
|
||||||
|
#define PNG_tIME_SUPPORTED
|
||||||
|
#define PNG_tRNS_SUPPORTED
|
||||||
#define PNG_zTXt_SUPPORTED
|
#define PNG_zTXt_SUPPORTED
|
||||||
/* end of options */
|
/* end of options */
|
||||||
#define PNG_SAFE_LIMITS_SUPPORTED
|
/* settings */
|
||||||
|
#define PNG_API_RULE 0
|
||||||
|
#define PNG_COST_SHIFT 3
|
||||||
|
#define PNG_DEFAULT_READ_MACROS 1
|
||||||
|
#define PNG_GAMMA_THRESHOLD_FIXED 5000
|
||||||
|
#define PNG_IDAT_READ_SIZE PNG_ZBUF_SIZE
|
||||||
|
#define PNG_INFLATE_BUF_SIZE 1024
|
||||||
|
#define PNG_MAX_GAMMA_8 11
|
||||||
|
#define PNG_QUANTIZE_BLUE_BITS 5
|
||||||
|
#define PNG_QUANTIZE_GREEN_BITS 5
|
||||||
|
#define PNG_QUANTIZE_RED_BITS 5
|
||||||
|
#define PNG_TEXT_Z_DEFAULT_COMPRESSION (-1)
|
||||||
|
#define PNG_TEXT_Z_DEFAULT_STRATEGY 0
|
||||||
|
#define PNG_USER_CHUNK_CACHE_MAX 1000
|
||||||
|
#define PNG_USER_CHUNK_MALLOC_MAX 8000000
|
||||||
|
#define PNG_USER_HEIGHT_MAX 1000000
|
||||||
|
#define PNG_USER_WIDTH_MAX 1000000
|
||||||
|
#define PNG_WEIGHT_SHIFT 8
|
||||||
|
#define PNG_ZBUF_SIZE 8192
|
||||||
|
#define PNG_ZLIB_VERNUM 0 /* unknown */
|
||||||
|
#define PNG_Z_DEFAULT_COMPRESSION (-1)
|
||||||
|
#define PNG_Z_DEFAULT_NOFILTER_STRATEGY 0
|
||||||
|
#define PNG_Z_DEFAULT_STRATEGY 1
|
||||||
|
#define PNG_sCAL_PRECISION 5
|
||||||
|
#define PNG_sRGB_PROFILE_CHECKS 2
|
||||||
|
/* end of settings */
|
||||||
#endif /* PNGLCONF_H */
|
#endif /* PNGLCONF_H */
|
||||||
|
734
src/3rdparty/libpng/pngmem.c
vendored
734
src/3rdparty/libpng/pngmem.c
vendored
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngmem.c - stub functions for memory allocation
|
/* pngmem.c - stub functions for memory allocation
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.7 [December 15, 2011]
|
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -20,627 +20,241 @@
|
|||||||
#include "pngpriv.h"
|
#include "pngpriv.h"
|
||||||
|
|
||||||
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
#if defined(PNG_READ_SUPPORTED) || defined(PNG_WRITE_SUPPORTED)
|
||||||
|
/* Free a png_struct */
|
||||||
/* Borland DOS special memory handler */
|
|
||||||
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
|
||||||
/* If you change this, be sure to change the one in png.h also */
|
|
||||||
|
|
||||||
/* Allocate memory for a png_struct. The malloc and memset can be replaced
|
|
||||||
by a single call to calloc() if this is thought to improve performance. */
|
|
||||||
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
|
||||||
png_create_struct,(int type),PNG_ALLOCATED)
|
|
||||||
{
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
return (png_create_struct_2(type, NULL, NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Alternate version of png_create_struct, for use with user-defined malloc. */
|
|
||||||
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
|
||||||
png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
|
|
||||||
PNG_ALLOCATED)
|
|
||||||
{
|
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
png_size_t size;
|
|
||||||
png_voidp struct_ptr;
|
|
||||||
|
|
||||||
if (type == PNG_STRUCT_INFO)
|
|
||||||
size = png_sizeof(png_info);
|
|
||||||
|
|
||||||
else if (type == PNG_STRUCT_PNG)
|
|
||||||
size = png_sizeof(png_struct);
|
|
||||||
|
|
||||||
else
|
|
||||||
return (png_get_copyright(NULL));
|
|
||||||
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (malloc_fn != NULL)
|
|
||||||
{
|
|
||||||
png_struct dummy_struct;
|
|
||||||
memset(&dummy_struct, 0, sizeof dummy_struct);
|
|
||||||
dummy_struct.mem_ptr=mem_ptr;
|
|
||||||
struct_ptr = (*(malloc_fn))(&dummy_struct, (png_alloc_size_t)size);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
struct_ptr = (png_voidp)farmalloc(size);
|
|
||||||
if (struct_ptr != NULL)
|
|
||||||
png_memset(struct_ptr, 0, size);
|
|
||||||
|
|
||||||
return (struct_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_destroy_struct(png_voidp struct_ptr)
|
png_destroy_png_struct(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
if (png_ptr != NULL)
|
||||||
png_destroy_struct_2(struct_ptr, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
|
||||||
png_voidp mem_ptr)
|
|
||||||
{
|
{
|
||||||
# endif
|
/* png_free might call png_error and may certainly call
|
||||||
if (struct_ptr != NULL)
|
* png_get_mem_ptr, so fake a temporary png_struct to support this.
|
||||||
{
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (free_fn != NULL)
|
|
||||||
{
|
|
||||||
png_struct dummy_struct;
|
|
||||||
memset(&dummy_struct, 0, sizeof dummy_struct);
|
|
||||||
dummy_struct.mem_ptr=mem_ptr;
|
|
||||||
(*(free_fn))(&dummy_struct, struct_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
farfree (struct_ptr);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate memory. For reasonable files, size should never exceed
|
|
||||||
* 64K. However, zlib may allocate more then 64K if you don't tell
|
|
||||||
* it not to. See zconf.h and png.h for more information. zlib does
|
|
||||||
* need to allocate exactly 64K, so whatever you call here must
|
|
||||||
* have the ability to do that.
|
|
||||||
*
|
|
||||||
* Borland seems to have a problem in DOS mode for exactly 64K.
|
|
||||||
* It gives you a segment with an offset of 8 (perhaps to store its
|
|
||||||
* memory stuff). zlib doesn't like this at all, so we have to
|
|
||||||
* detect and deal with it. This code should not be needed in
|
|
||||||
* Windows or OS/2 modes, and only in 16 bit mode. This code has
|
|
||||||
* been updated by Alexander Lehmann for version 0.89 to waste less
|
|
||||||
* memory.
|
|
||||||
*
|
|
||||||
* Note that we can't use png_size_t for the "size" declaration,
|
|
||||||
* since on some systems a png_size_t is a 16-bit quantity, and as a
|
|
||||||
* result, we would be truncating potentially larger memory requests
|
|
||||||
* (which should cause a fatal error) and introducing major problems.
|
|
||||||
*/
|
*/
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
png_struct dummy_struct = *png_ptr;
|
||||||
png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
memset(png_ptr, 0, (sizeof *png_ptr));
|
||||||
{
|
png_free(&dummy_struct, png_ptr);
|
||||||
png_voidp ret;
|
|
||||||
|
|
||||||
ret = (png_malloc(png_ptr, size));
|
# ifdef PNG_SETJMP_SUPPORTED
|
||||||
|
/* We may have a jmp_buf left to deallocate. */
|
||||||
if (ret != NULL)
|
png_free_jmpbuf(&dummy_struct);
|
||||||
png_memset(ret,0,(png_size_t)size);
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
|
||||||
png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
|
||||||
{
|
|
||||||
png_voidp ret;
|
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (png_ptr->malloc_fn != NULL)
|
|
||||||
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, size));
|
|
||||||
|
|
||||||
else
|
|
||||||
ret = (png_malloc_default(png_ptr, size));
|
|
||||||
|
|
||||||
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out of memory");
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
|
||||||
png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
|
||||||
{
|
|
||||||
png_voidp ret;
|
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
# ifdef PNG_MAX_MALLOC_64K
|
|
||||||
if (size > (png_uint_32)65536L)
|
|
||||||
{
|
|
||||||
png_warning(png_ptr, "Cannot Allocate > 64K");
|
|
||||||
ret = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
# endif
|
|
||||||
|
|
||||||
if (size != (size_t)size)
|
|
||||||
ret = NULL;
|
|
||||||
|
|
||||||
else if (size == (png_uint_32)65536L)
|
|
||||||
{
|
|
||||||
if (png_ptr->offset_table == NULL)
|
|
||||||
{
|
|
||||||
/* Try to see if we need to do any of this fancy stuff */
|
|
||||||
ret = farmalloc(size);
|
|
||||||
if (ret == NULL || ((png_size_t)ret & 0xffff))
|
|
||||||
{
|
|
||||||
int num_blocks;
|
|
||||||
png_uint_32 total_size;
|
|
||||||
png_bytep table;
|
|
||||||
int i, mem_level, window_bits;
|
|
||||||
png_byte huge * hptr;
|
|
||||||
int window_bits
|
|
||||||
|
|
||||||
if (ret != NULL)
|
|
||||||
{
|
|
||||||
farfree(ret);
|
|
||||||
ret = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
window_bits =
|
|
||||||
png_ptr->zlib_window_bits >= png_ptr->zlib_text_window_bits ?
|
|
||||||
png_ptr->zlib_window_bits : png_ptr->zlib_text_window_bits;
|
|
||||||
|
|
||||||
if (window_bits > 14)
|
|
||||||
num_blocks = (int)(1 << (window_bits - 14));
|
|
||||||
|
|
||||||
else
|
|
||||||
num_blocks = 1;
|
|
||||||
|
|
||||||
mem_level =
|
|
||||||
png_ptr->zlib_mem_level >= png_ptr->zlib_text_mem_level ?
|
|
||||||
png_ptr->zlib_mem_level : png_ptr->zlib_text_mem_level;
|
|
||||||
|
|
||||||
if (mem_level >= 7)
|
|
||||||
num_blocks += (int)(1 << (mem_level - 7));
|
|
||||||
|
|
||||||
else
|
|
||||||
num_blocks++;
|
|
||||||
|
|
||||||
total_size = ((png_uint_32)65536L) * (png_uint_32)num_blocks+16;
|
|
||||||
|
|
||||||
table = farmalloc(total_size);
|
|
||||||
|
|
||||||
if (table == NULL)
|
|
||||||
{
|
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out Of Memory"); /* Note "O", "M" */
|
|
||||||
|
|
||||||
else
|
|
||||||
png_warning(png_ptr, "Out Of Memory");
|
|
||||||
# endif
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((png_size_t)table & 0xfff0)
|
|
||||||
{
|
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr,
|
|
||||||
"Farmalloc didn't return normalized pointer");
|
|
||||||
|
|
||||||
else
|
|
||||||
png_warning(png_ptr,
|
|
||||||
"Farmalloc didn't return normalized pointer");
|
|
||||||
# endif
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
png_ptr->offset_table = table;
|
|
||||||
png_ptr->offset_table_ptr = farmalloc(num_blocks *
|
|
||||||
png_sizeof(png_bytep));
|
|
||||||
|
|
||||||
if (png_ptr->offset_table_ptr == NULL)
|
|
||||||
{
|
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out Of memory"); /* Note "O", "m" */
|
|
||||||
|
|
||||||
else
|
|
||||||
png_warning(png_ptr, "Out Of memory");
|
|
||||||
# endif
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
hptr = (png_byte huge *)table;
|
|
||||||
if ((png_size_t)hptr & 0xf)
|
|
||||||
{
|
|
||||||
hptr = (png_byte huge *)((long)(hptr) & 0xfffffff0L);
|
|
||||||
hptr = hptr + 16L; /* "hptr += 16L" fails on Turbo C++ 3.0 */
|
|
||||||
}
|
|
||||||
|
|
||||||
for (i = 0; i < num_blocks; i++)
|
|
||||||
{
|
|
||||||
png_ptr->offset_table_ptr[i] = (png_bytep)hptr;
|
|
||||||
hptr = hptr + (png_uint_32)65536L; /* "+=" fails on TC++3.0 */
|
|
||||||
}
|
|
||||||
|
|
||||||
png_ptr->offset_table_number = num_blocks;
|
|
||||||
png_ptr->offset_table_count = 0;
|
|
||||||
png_ptr->offset_table_count_free = 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (png_ptr->offset_table_count >= png_ptr->offset_table_number)
|
|
||||||
{
|
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out of Memory"); /* Note "O" and "M" */
|
|
||||||
|
|
||||||
else
|
|
||||||
png_warning(png_ptr, "Out of Memory");
|
|
||||||
# endif
|
|
||||||
return (NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
ret = png_ptr->offset_table_ptr[png_ptr->offset_table_count++];
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
ret = farmalloc(size);
|
|
||||||
|
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (ret == NULL)
|
|
||||||
{
|
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out of memory"); /* Note "o" and "m" */
|
|
||||||
|
|
||||||
else
|
|
||||||
png_warning(png_ptr, "Out of memory"); /* Note "o" and "m" */
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free a pointer allocated by png_malloc(). In the default
|
|
||||||
* configuration, png_ptr is not used, but is passed in case it
|
|
||||||
* is needed. If ptr is NULL, return without taking any action.
|
|
||||||
*/
|
|
||||||
void PNGAPI
|
|
||||||
png_free(png_structp png_ptr, png_voidp ptr)
|
|
||||||
{
|
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (png_ptr->free_fn != NULL)
|
|
||||||
{
|
|
||||||
(*(png_ptr->free_fn))(png_ptr, ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
png_free_default(png_ptr, ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
void PNGAPI
|
|
||||||
png_free_default(png_structp png_ptr, png_voidp ptr)
|
|
||||||
{
|
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
|
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (png_ptr->offset_table != NULL)
|
|
||||||
{
|
|
||||||
int i;
|
|
||||||
|
|
||||||
for (i = 0; i < png_ptr->offset_table_count; i++)
|
|
||||||
{
|
|
||||||
if (ptr == png_ptr->offset_table_ptr[i])
|
|
||||||
{
|
|
||||||
ptr = NULL;
|
|
||||||
png_ptr->offset_table_count_free++;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (png_ptr->offset_table_count_free == png_ptr->offset_table_count)
|
|
||||||
{
|
|
||||||
farfree(png_ptr->offset_table);
|
|
||||||
farfree(png_ptr->offset_table_ptr);
|
|
||||||
png_ptr->offset_table = NULL;
|
|
||||||
png_ptr->offset_table_ptr = NULL;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ptr != NULL)
|
|
||||||
farfree(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
#else /* Not the Borland DOS special memory handler */
|
|
||||||
|
|
||||||
/* Allocate memory for a png_struct or a png_info. The malloc and
|
|
||||||
memset can be replaced by a single call to calloc() if this is thought
|
|
||||||
to improve performance noticably. */
|
|
||||||
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
|
||||||
png_create_struct,(int type),PNG_ALLOCATED)
|
|
||||||
{
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
return (png_create_struct_2(type, NULL, NULL));
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Allocate memory for a png_struct or a png_info. The malloc and
|
|
||||||
memset can be replaced by a single call to calloc() if this is thought
|
|
||||||
to improve performance noticably. */
|
|
||||||
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
|
||||||
png_create_struct_2,(int type, png_malloc_ptr malloc_fn, png_voidp mem_ptr),
|
|
||||||
PNG_ALLOCATED)
|
|
||||||
{
|
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
png_size_t size;
|
|
||||||
png_voidp struct_ptr;
|
|
||||||
|
|
||||||
if (type == PNG_STRUCT_INFO)
|
|
||||||
size = png_sizeof(png_info);
|
|
||||||
|
|
||||||
else if (type == PNG_STRUCT_PNG)
|
|
||||||
size = png_sizeof(png_struct);
|
|
||||||
|
|
||||||
else
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (malloc_fn != NULL)
|
|
||||||
{
|
|
||||||
png_struct dummy_struct;
|
|
||||||
png_structp png_ptr = &dummy_struct;
|
|
||||||
png_ptr->mem_ptr=mem_ptr;
|
|
||||||
struct_ptr = (*(malloc_fn))(png_ptr, size);
|
|
||||||
|
|
||||||
if (struct_ptr != NULL)
|
|
||||||
png_memset(struct_ptr, 0, size);
|
|
||||||
|
|
||||||
return (struct_ptr);
|
|
||||||
}
|
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
|
|
||||||
# if defined(__TURBOC__) && !defined(__FLAT__)
|
|
||||||
struct_ptr = (png_voidp)farmalloc(size);
|
|
||||||
# else
|
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
|
||||||
struct_ptr = (png_voidp)halloc(size, 1);
|
|
||||||
# else
|
|
||||||
struct_ptr = (png_voidp)malloc(size);
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
|
|
||||||
if (struct_ptr != NULL)
|
|
||||||
png_memset(struct_ptr, 0, size);
|
|
||||||
|
|
||||||
return (struct_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_destroy_struct(png_voidp struct_ptr)
|
|
||||||
{
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
png_destroy_struct_2(struct_ptr, NULL, NULL);
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Free memory allocated by a png_create_struct() call */
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_destroy_struct_2(png_voidp struct_ptr, png_free_ptr free_fn,
|
|
||||||
png_voidp mem_ptr)
|
|
||||||
{
|
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
if (struct_ptr != NULL)
|
|
||||||
{
|
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
|
||||||
if (free_fn != NULL)
|
|
||||||
{
|
|
||||||
png_struct dummy_struct;
|
|
||||||
png_structp png_ptr = &dummy_struct;
|
|
||||||
png_ptr->mem_ptr=mem_ptr;
|
|
||||||
(*(free_fn))(png_ptr, struct_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
# if defined(__TURBOC__) && !defined(__FLAT__)
|
|
||||||
farfree(struct_ptr);
|
|
||||||
|
|
||||||
# else
|
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
|
||||||
hfree(struct_ptr);
|
|
||||||
|
|
||||||
# else
|
|
||||||
free(struct_ptr);
|
|
||||||
|
|
||||||
# endif
|
|
||||||
# endif
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Allocate memory. For reasonable files, size should never exceed
|
/* Allocate memory. For reasonable files, size should never exceed
|
||||||
* 64K. However, zlib may allocate more then 64K if you don't tell
|
* 64K. However, zlib may allocate more than 64K if you don't tell
|
||||||
* it not to. See zconf.h and png.h for more information. zlib does
|
* it not to. See zconf.h and png.h for more information. zlib does
|
||||||
* need to allocate exactly 64K, so whatever you call here must
|
* need to allocate exactly 64K, so whatever you call here must
|
||||||
* have the ability to do that.
|
* have the ability to do that.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
PNG_FUNCTION(png_voidp,PNGAPI
|
||||||
png_calloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
png_calloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
||||||
{
|
{
|
||||||
png_voidp ret;
|
png_voidp ret;
|
||||||
|
|
||||||
ret = (png_malloc(png_ptr, size));
|
ret = png_malloc(png_ptr, size);
|
||||||
|
|
||||||
if (ret != NULL)
|
if (ret != NULL)
|
||||||
png_memset(ret,0,(png_size_t)size);
|
memset(ret, 0, size);
|
||||||
|
|
||||||
return (ret);
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
/* png_malloc_base, an internal function added at libpng 1.6.0, does the work of
|
||||||
png_malloc,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
* allocating memory, taking into account limits and PNG_USER_MEM_SUPPORTED.
|
||||||
{
|
* Checking and error handling must happen outside this routine; it returns NULL
|
||||||
png_voidp ret;
|
* if the allocation cannot be done (for any reason.)
|
||||||
|
*/
|
||||||
# ifdef PNG_USER_MEM_SUPPORTED
|
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
||||||
if (png_ptr == NULL || size == 0)
|
png_malloc_base,(png_const_structrp png_ptr, png_alloc_size_t size),
|
||||||
return (NULL);
|
PNG_ALLOCATED)
|
||||||
|
|
||||||
if (png_ptr->malloc_fn != NULL)
|
|
||||||
ret = ((png_voidp)(*(png_ptr->malloc_fn))(png_ptr, (png_size_t)size));
|
|
||||||
|
|
||||||
else
|
|
||||||
ret = (png_malloc_default(png_ptr, size));
|
|
||||||
|
|
||||||
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
|
||||||
png_error(png_ptr, "Out of Memory");
|
|
||||||
|
|
||||||
return (ret);
|
|
||||||
}
|
|
||||||
|
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
|
||||||
png_malloc_default,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
|
||||||
{
|
|
||||||
png_voidp ret;
|
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
|
|
||||||
if (png_ptr == NULL || size == 0)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
# ifdef PNG_MAX_MALLOC_64K
|
|
||||||
if (size > (png_uint_32)65536L)
|
|
||||||
{
|
{
|
||||||
|
/* Moved to png_malloc_base from png_malloc_default in 1.6.0; the DOS
|
||||||
|
* allocators have also been removed in 1.6.0, so any 16-bit system now has
|
||||||
|
* to implement a user memory handler. This checks to be sure it isn't
|
||||||
|
* called with big numbers.
|
||||||
|
*/
|
||||||
#ifndef PNG_USER_MEM_SUPPORTED
|
#ifndef PNG_USER_MEM_SUPPORTED
|
||||||
if ((png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
PNG_UNUSED(png_ptr)
|
||||||
png_error(png_ptr, "Cannot Allocate > 64K");
|
#endif
|
||||||
|
|
||||||
|
if (size > 0 && size <= PNG_SIZE_MAX
|
||||||
|
# ifdef PNG_MAX_MALLOC_64K
|
||||||
|
&& size <= 65536U
|
||||||
|
# endif
|
||||||
|
)
|
||||||
|
{
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
if (png_ptr != NULL && png_ptr->malloc_fn != NULL)
|
||||||
|
return png_ptr->malloc_fn(png_constcast(png_structrp,png_ptr), size);
|
||||||
|
|
||||||
else
|
else
|
||||||
#endif
|
#endif
|
||||||
|
return malloc((size_t)size); /* checked for truncation above */
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
# endif
|
|
||||||
|
|
||||||
/* Check for overflow */
|
#if defined(PNG_TEXT_SUPPORTED) || defined(PNG_sPLT_SUPPORTED) ||\
|
||||||
# if defined(__TURBOC__) && !defined(__FLAT__)
|
defined(PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED)
|
||||||
|
/* This is really here only to work round a spurious warning in GCC 4.6 and 4.7
|
||||||
|
* that arises because of the checks in png_realloc_array that are repeated in
|
||||||
|
* png_malloc_array.
|
||||||
|
*/
|
||||||
|
static png_voidp
|
||||||
|
png_malloc_array_checked(png_const_structrp png_ptr, int nelements,
|
||||||
|
size_t element_size)
|
||||||
|
{
|
||||||
|
png_alloc_size_t req = nelements; /* known to be > 0 */
|
||||||
|
|
||||||
if (size != (unsigned long)size)
|
if (req <= PNG_SIZE_MAX/element_size)
|
||||||
ret = NULL;
|
return png_malloc_base(png_ptr, req * element_size);
|
||||||
|
|
||||||
else
|
/* The failure case when the request is too large */
|
||||||
ret = farmalloc(size);
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
# else
|
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
png_malloc_array,(png_const_structrp png_ptr, int nelements,
|
||||||
if (size != (unsigned long)size)
|
size_t element_size),PNG_ALLOCATED)
|
||||||
ret = NULL;
|
{
|
||||||
|
if (nelements <= 0 || element_size == 0)
|
||||||
|
png_error(png_ptr, "internal error: array alloc");
|
||||||
|
|
||||||
else
|
return png_malloc_array_checked(png_ptr, nelements, element_size);
|
||||||
ret = halloc(size, 1);
|
}
|
||||||
|
|
||||||
# else
|
PNG_FUNCTION(png_voidp /* PRIVATE */,
|
||||||
if (size != (size_t)size)
|
png_realloc_array,(png_const_structrp png_ptr, png_const_voidp old_array,
|
||||||
ret = NULL;
|
int old_elements, int add_elements, size_t element_size),PNG_ALLOCATED)
|
||||||
|
{
|
||||||
|
/* These are internal errors: */
|
||||||
|
if (add_elements <= 0 || element_size == 0 || old_elements < 0 ||
|
||||||
|
(old_array == NULL && old_elements > 0))
|
||||||
|
png_error(png_ptr, "internal error: array realloc");
|
||||||
|
|
||||||
else
|
/* Check for overflow on the elements count (so the caller does not have to
|
||||||
ret = malloc((size_t)size);
|
* check.)
|
||||||
# endif
|
*/
|
||||||
# endif
|
if (add_elements <= INT_MAX - old_elements)
|
||||||
|
{
|
||||||
|
png_voidp new_array = png_malloc_array_checked(png_ptr,
|
||||||
|
old_elements+add_elements, element_size);
|
||||||
|
|
||||||
# ifndef PNG_USER_MEM_SUPPORTED
|
if (new_array != NULL)
|
||||||
if (ret == NULL && (png_ptr->flags&PNG_FLAG_MALLOC_NULL_MEM_OK) == 0)
|
{
|
||||||
png_error(png_ptr, "Out of Memory");
|
/* Because png_malloc_array worked the size calculations below cannot
|
||||||
# endif
|
* overflow.
|
||||||
|
*/
|
||||||
|
if (old_elements > 0)
|
||||||
|
memcpy(new_array, old_array, element_size*(unsigned)old_elements);
|
||||||
|
|
||||||
return (ret);
|
memset((char*)new_array + element_size*(unsigned)old_elements, 0,
|
||||||
|
element_size*(unsigned)add_elements);
|
||||||
|
|
||||||
|
return new_array;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL; /* error */
|
||||||
|
}
|
||||||
|
#endif /* TEXT || sPLT || STORE_UNKNOWN_CHUNKS */
|
||||||
|
|
||||||
|
/* Various functions that have different error handling are derived from this.
|
||||||
|
* png_malloc always exists, but if PNG_USER_MEM_SUPPORTED is defined a separate
|
||||||
|
* function png_malloc_default is also provided.
|
||||||
|
*/
|
||||||
|
PNG_FUNCTION(png_voidp,PNGAPI
|
||||||
|
png_malloc,(png_const_structrp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
||||||
|
{
|
||||||
|
png_voidp ret;
|
||||||
|
|
||||||
|
if (png_ptr == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
ret = png_malloc_base(png_ptr, size);
|
||||||
|
|
||||||
|
if (ret == NULL)
|
||||||
|
png_error(png_ptr, "Out of memory"); /* 'm' means png_malloc */
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
|
PNG_FUNCTION(png_voidp,PNGAPI
|
||||||
|
png_malloc_default,(png_const_structrp png_ptr, png_alloc_size_t size),
|
||||||
|
PNG_ALLOCATED PNG_DEPRECATED)
|
||||||
|
{
|
||||||
|
png_voidp ret;
|
||||||
|
|
||||||
|
if (png_ptr == NULL)
|
||||||
|
return NULL;
|
||||||
|
|
||||||
|
/* Passing 'NULL' here bypasses the application provided memory handler. */
|
||||||
|
ret = png_malloc_base(NULL/*use malloc*/, size);
|
||||||
|
|
||||||
|
if (ret == NULL)
|
||||||
|
png_error(png_ptr, "Out of Memory"); /* 'M' means png_malloc_default */
|
||||||
|
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
#endif /* USER_MEM */
|
||||||
|
|
||||||
|
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
|
||||||
|
* function will issue a png_warning and return NULL instead of issuing a
|
||||||
|
* png_error, if it fails to allocate the requested memory.
|
||||||
|
*/
|
||||||
|
PNG_FUNCTION(png_voidp,PNGAPI
|
||||||
|
png_malloc_warn,(png_const_structrp png_ptr, png_alloc_size_t size),
|
||||||
|
PNG_ALLOCATED)
|
||||||
|
{
|
||||||
|
if (png_ptr != NULL)
|
||||||
|
{
|
||||||
|
png_voidp ret = png_malloc_base(png_ptr, size);
|
||||||
|
|
||||||
|
if (ret != NULL)
|
||||||
|
return ret;
|
||||||
|
|
||||||
|
png_warning(png_ptr, "Out of memory");
|
||||||
|
}
|
||||||
|
|
||||||
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Free a pointer allocated by png_malloc(). If ptr is NULL, return
|
/* Free a pointer allocated by png_malloc(). If ptr is NULL, return
|
||||||
* without taking any action.
|
* without taking any action.
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_free(png_structp png_ptr, png_voidp ptr)
|
png_free(png_const_structrp png_ptr, png_voidp ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
if (png_ptr->free_fn != NULL)
|
if (png_ptr->free_fn != NULL)
|
||||||
{
|
png_ptr->free_fn(png_constcast(png_structrp,png_ptr), ptr);
|
||||||
(*(png_ptr->free_fn))(png_ptr, ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
else
|
||||||
png_free_default(png_ptr, ptr);
|
png_free_default(png_ptr, ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PNGAPI
|
PNG_FUNCTION(void,PNGAPI
|
||||||
png_free_default(png_structp png_ptr, png_voidp ptr)
|
png_free_default,(png_const_structrp png_ptr, png_voidp ptr),PNG_DEPRECATED)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || ptr == NULL)
|
if (png_ptr == NULL || ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
#endif /* USER_MEM */
|
||||||
|
|
||||||
# endif /* PNG_USER_MEM_SUPPORTED */
|
|
||||||
|
|
||||||
# if defined(__TURBOC__) && !defined(__FLAT__)
|
|
||||||
farfree(ptr);
|
|
||||||
|
|
||||||
# else
|
|
||||||
# if defined(_MSC_VER) && defined(MAXSEG_64K)
|
|
||||||
hfree(ptr);
|
|
||||||
|
|
||||||
# else
|
|
||||||
free(ptr);
|
free(ptr);
|
||||||
|
|
||||||
# endif
|
|
||||||
# endif
|
|
||||||
}
|
}
|
||||||
#endif /* Not Borland DOS special memory handler */
|
|
||||||
|
|
||||||
/* This function was added at libpng version 1.2.3. The png_malloc_warn()
|
|
||||||
* function will set up png_malloc() to issue a png_warning and return NULL
|
|
||||||
* instead of issuing a png_error, if it fails to allocate the requested
|
|
||||||
* memory.
|
|
||||||
*/
|
|
||||||
PNG_FUNCTION(png_voidp,PNGAPI
|
|
||||||
png_malloc_warn,(png_structp png_ptr, png_alloc_size_t size),PNG_ALLOCATED)
|
|
||||||
{
|
|
||||||
png_voidp ptr;
|
|
||||||
png_uint_32 save_flags;
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return (NULL);
|
|
||||||
|
|
||||||
save_flags = png_ptr->flags;
|
|
||||||
png_ptr->flags|=PNG_FLAG_MALLOC_NULL_MEM_OK;
|
|
||||||
ptr = (png_voidp)png_malloc((png_structp)png_ptr, size);
|
|
||||||
png_ptr->flags=save_flags;
|
|
||||||
return(ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
#ifdef PNG_USER_MEM_SUPPORTED
|
#ifdef PNG_USER_MEM_SUPPORTED
|
||||||
/* This function is called when the application wants to use another method
|
/* This function is called when the application wants to use another method
|
||||||
* of allocating and freeing memory.
|
* of allocating and freeing memory.
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
png_set_mem_fn(png_structrp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
||||||
malloc_fn, png_free_ptr free_fn)
|
malloc_fn, png_free_ptr free_fn)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
@ -656,12 +270,12 @@ png_set_mem_fn(png_structp png_ptr, png_voidp mem_ptr, png_malloc_ptr
|
|||||||
* pointer before png_write_destroy and png_read_destroy are called.
|
* pointer before png_write_destroy and png_read_destroy are called.
|
||||||
*/
|
*/
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_mem_ptr(png_const_structp png_ptr)
|
png_get_mem_ptr(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (NULL);
|
return NULL;
|
||||||
|
|
||||||
return ((png_voidp)png_ptr->mem_ptr);
|
return png_ptr->mem_ptr;
|
||||||
}
|
}
|
||||||
#endif /* PNG_USER_MEM_SUPPORTED */
|
#endif /* USER_MEM */
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
#endif /* READ || WRITE */
|
||||||
|
420
src/3rdparty/libpng/pngpread.c
vendored
420
src/3rdparty/libpng/pngpread.c
vendored
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngpread.c - read a png file in push mode
|
/* pngpread.c - read a png file in push mode
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.9 [February 18, 2012]
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -26,8 +26,15 @@
|
|||||||
#define PNG_READ_iTXt_MODE 7
|
#define PNG_READ_iTXt_MODE 7
|
||||||
#define PNG_ERROR_MODE 8
|
#define PNG_ERROR_MODE 8
|
||||||
|
|
||||||
|
#define PNG_PUSH_SAVE_BUFFER_IF_FULL \
|
||||||
|
if (png_ptr->push_length + 4 > png_ptr->buffer_size) \
|
||||||
|
{ png_push_save_buffer(png_ptr); return; }
|
||||||
|
#define PNG_PUSH_SAVE_BUFFER_IF_LT(N) \
|
||||||
|
if (png_ptr->buffer_size < N) \
|
||||||
|
{ png_push_save_buffer(png_ptr); return; }
|
||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_process_data(png_structp png_ptr, png_infop info_ptr,
|
png_process_data(png_structrp png_ptr, png_inforp info_ptr,
|
||||||
png_bytep buffer, png_size_t buffer_size)
|
png_bytep buffer, png_size_t buffer_size)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL || info_ptr == NULL)
|
if (png_ptr == NULL || info_ptr == NULL)
|
||||||
@ -42,14 +49,14 @@ png_process_data(png_structp png_ptr, png_infop info_ptr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
png_size_t PNGAPI
|
png_size_t PNGAPI
|
||||||
png_process_data_pause(png_structp png_ptr, int save)
|
png_process_data_pause(png_structrp png_ptr, int save)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
{
|
{
|
||||||
/* It's easiest for the caller if we do the save, then the caller doesn't
|
/* It's easiest for the caller if we do the save; then the caller doesn't
|
||||||
* have to supply the same data again:
|
* have to supply the same data again:
|
||||||
*/
|
*/
|
||||||
if (save)
|
if (save != 0)
|
||||||
png_push_save_buffer(png_ptr);
|
png_push_save_buffer(png_ptr);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -69,7 +76,7 @@ png_process_data_pause(png_structp png_ptr, int save)
|
|||||||
}
|
}
|
||||||
|
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_process_data_skip(png_structp png_ptr)
|
png_process_data_skip(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
png_uint_32 remaining = 0;
|
png_uint_32 remaining = 0;
|
||||||
|
|
||||||
@ -103,7 +110,7 @@ png_process_data_skip(png_structp png_ptr)
|
|||||||
* doing before we ran out of data...
|
* doing before we ran out of data...
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_process_some_data(png_structp png_ptr, png_infop info_ptr)
|
png_process_some_data(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
@ -149,9 +156,9 @@ png_process_some_data(png_structp png_ptr, png_infop info_ptr)
|
|||||||
* routine.
|
* routine.
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
|
png_push_read_sig(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
{
|
{
|
||||||
png_size_t num_checked = png_ptr->sig_bytes,
|
png_size_t num_checked = png_ptr->sig_bytes, /* SAFE, does not exceed 8 */
|
||||||
num_to_check = 8 - num_checked;
|
num_to_check = 8 - num_checked;
|
||||||
|
|
||||||
if (png_ptr->buffer_size < num_to_check)
|
if (png_ptr->buffer_size < num_to_check)
|
||||||
@ -172,7 +179,6 @@ png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
|
|||||||
else
|
else
|
||||||
png_error(png_ptr, "PNG file corrupted by ASCII conversion");
|
png_error(png_ptr, "PNG file corrupted by ASCII conversion");
|
||||||
}
|
}
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (png_ptr->sig_bytes >= 8)
|
if (png_ptr->sig_bytes >= 8)
|
||||||
@ -183,27 +189,25 @@ png_push_read_sig(png_structp png_ptr, png_infop info_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
png_push_read_chunk(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
{
|
{
|
||||||
png_uint_32 chunk_name;
|
png_uint_32 chunk_name;
|
||||||
|
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
|
int keep; /* unknown handling method */
|
||||||
|
#endif
|
||||||
|
|
||||||
/* First we make sure we have enough data for the 4 byte chunk name
|
/* First we make sure we have enough data for the 4-byte chunk name
|
||||||
* and the 4 byte chunk length before proceeding with decoding the
|
* and the 4-byte chunk length before proceeding with decoding the
|
||||||
* chunk data. To fully decode each of these chunks, we also make
|
* chunk data. To fully decode each of these chunks, we also make
|
||||||
* sure we have enough data in the buffer for the 4 byte CRC at the
|
* sure we have enough data in the buffer for the 4-byte CRC at the
|
||||||
* end of every chunk (except IDAT, which is handled separately).
|
* end of every chunk (except IDAT, which is handled separately).
|
||||||
*/
|
*/
|
||||||
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
|
if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0)
|
||||||
{
|
{
|
||||||
png_byte chunk_length[4];
|
png_byte chunk_length[4];
|
||||||
png_byte chunk_tag[4];
|
png_byte chunk_tag[4];
|
||||||
|
|
||||||
if (png_ptr->buffer_size < 8)
|
PNG_PUSH_SAVE_BUFFER_IF_LT(8)
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
||||||
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
|
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
|
||||||
png_reset_crc(png_ptr);
|
png_reset_crc(png_ptr);
|
||||||
@ -217,14 +221,29 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
|
|
||||||
if (chunk_name == png_IDAT)
|
if (chunk_name == png_IDAT)
|
||||||
{
|
{
|
||||||
/* This is here above the if/else case statement below because if the
|
if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
|
||||||
* unknown handling marks 'IDAT' as unknown then the IDAT handling case is
|
|
||||||
* completely skipped.
|
|
||||||
*
|
|
||||||
* TODO: there must be a better way of doing this.
|
|
||||||
*/
|
|
||||||
if (png_ptr->mode & PNG_AFTER_IDAT)
|
|
||||||
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
png_ptr->mode |= PNG_HAVE_CHUNK_AFTER_IDAT;
|
||||||
|
|
||||||
|
/* If we reach an IDAT chunk, this means we have read all of the
|
||||||
|
* header chunks, and we can start reading the image (or if this
|
||||||
|
* is called after the image has been read - we have an error).
|
||||||
|
*/
|
||||||
|
if ((png_ptr->mode & PNG_HAVE_IHDR) == 0)
|
||||||
|
png_error(png_ptr, "Missing IHDR before IDAT");
|
||||||
|
|
||||||
|
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
||||||
|
(png_ptr->mode & PNG_HAVE_PLTE) == 0)
|
||||||
|
png_error(png_ptr, "Missing PLTE before IDAT");
|
||||||
|
|
||||||
|
png_ptr->mode |= PNG_HAVE_IDAT;
|
||||||
|
png_ptr->process_mode = PNG_READ_IDAT_MODE;
|
||||||
|
|
||||||
|
if ((png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT) == 0)
|
||||||
|
if (png_ptr->push_length == 0)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if ((png_ptr->mode & PNG_AFTER_IDAT) != 0)
|
||||||
|
png_benign_error(png_ptr, "Too many IDATs found");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (chunk_name == png_IHDR)
|
if (chunk_name == png_IHDR)
|
||||||
@ -232,23 +251,13 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
if (png_ptr->push_length != 13)
|
if (png_ptr->push_length != 13)
|
||||||
png_error(png_ptr, "Invalid IHDR length");
|
png_error(png_ptr, "Invalid IHDR length");
|
||||||
|
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_IHDR(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (chunk_name == png_IEND)
|
else if (chunk_name == png_IEND)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_IEND(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
|
|
||||||
png_ptr->process_mode = PNG_READ_DONE_MODE;
|
png_ptr->process_mode = PNG_READ_DONE_MODE;
|
||||||
@ -256,70 +265,25 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
||||||
else if (png_chunk_unknown_handling(png_ptr, chunk_name))
|
else if ((keep = png_chunk_unknown_handling(png_ptr, chunk_name)) != 0)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length, keep);
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (chunk_name == png_IDAT)
|
|
||||||
png_ptr->mode |= PNG_HAVE_IDAT;
|
|
||||||
|
|
||||||
png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
|
|
||||||
|
|
||||||
if (chunk_name == png_PLTE)
|
if (chunk_name == png_PLTE)
|
||||||
png_ptr->mode |= PNG_HAVE_PLTE;
|
png_ptr->mode |= PNG_HAVE_PLTE;
|
||||||
|
|
||||||
else if (chunk_name == png_IDAT)
|
|
||||||
{
|
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
|
||||||
png_error(png_ptr, "Missing IHDR before IDAT");
|
|
||||||
|
|
||||||
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
|
||||||
!(png_ptr->mode & PNG_HAVE_PLTE))
|
|
||||||
png_error(png_ptr, "Missing PLTE before IDAT");
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
else if (chunk_name == png_PLTE)
|
else if (chunk_name == png_PLTE)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_PLTE(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (chunk_name == png_IDAT)
|
else if (chunk_name == png_IDAT)
|
||||||
{
|
{
|
||||||
/* If we reach an IDAT chunk, this means we have read all of the
|
|
||||||
* header chunks, and we can start reading the image (or if this
|
|
||||||
* is called after the image has been read - we have an error).
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (!(png_ptr->mode & PNG_HAVE_IHDR))
|
|
||||||
png_error(png_ptr, "Missing IHDR before IDAT");
|
|
||||||
|
|
||||||
else if (png_ptr->color_type == PNG_COLOR_TYPE_PALETTE &&
|
|
||||||
!(png_ptr->mode & PNG_HAVE_PLTE))
|
|
||||||
png_error(png_ptr, "Missing PLTE before IDAT");
|
|
||||||
|
|
||||||
if (png_ptr->mode & PNG_HAVE_IDAT)
|
|
||||||
{
|
|
||||||
if (!(png_ptr->mode & PNG_HAVE_CHUNK_AFTER_IDAT))
|
|
||||||
if (png_ptr->push_length == 0)
|
|
||||||
return;
|
|
||||||
|
|
||||||
if (png_ptr->mode & PNG_AFTER_IDAT)
|
|
||||||
png_benign_error(png_ptr, "Too many IDATs found");
|
|
||||||
}
|
|
||||||
|
|
||||||
png_ptr->idat_size = png_ptr->push_length;
|
png_ptr->idat_size = png_ptr->push_length;
|
||||||
png_ptr->mode |= PNG_HAVE_IDAT;
|
|
||||||
png_ptr->process_mode = PNG_READ_IDAT_MODE;
|
png_ptr->process_mode = PNG_READ_IDAT_MODE;
|
||||||
png_push_have_info(png_ptr, info_ptr);
|
png_push_have_info(png_ptr, info_ptr);
|
||||||
png_ptr->zstream.avail_out =
|
png_ptr->zstream.avail_out =
|
||||||
@ -332,12 +296,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_gAMA_SUPPORTED
|
#ifdef PNG_READ_gAMA_SUPPORTED
|
||||||
else if (png_ptr->chunk_name == png_gAMA)
|
else if (png_ptr->chunk_name == png_gAMA)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_gAMA(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -345,12 +304,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_sBIT_SUPPORTED
|
#ifdef PNG_READ_sBIT_SUPPORTED
|
||||||
else if (png_ptr->chunk_name == png_sBIT)
|
else if (png_ptr->chunk_name == png_sBIT)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_sBIT(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -358,12 +312,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_cHRM_SUPPORTED
|
#ifdef PNG_READ_cHRM_SUPPORTED
|
||||||
else if (png_ptr->chunk_name == png_cHRM)
|
else if (png_ptr->chunk_name == png_cHRM)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_cHRM(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -371,12 +320,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_sRGB_SUPPORTED
|
#ifdef PNG_READ_sRGB_SUPPORTED
|
||||||
else if (chunk_name == png_sRGB)
|
else if (chunk_name == png_sRGB)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_sRGB(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -384,12 +328,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_iCCP_SUPPORTED
|
#ifdef PNG_READ_iCCP_SUPPORTED
|
||||||
else if (png_ptr->chunk_name == png_iCCP)
|
else if (png_ptr->chunk_name == png_iCCP)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_iCCP(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -397,12 +336,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_sPLT_SUPPORTED
|
#ifdef PNG_READ_sPLT_SUPPORTED
|
||||||
else if (chunk_name == png_sPLT)
|
else if (chunk_name == png_sPLT)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_sPLT(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -410,12 +344,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_tRNS_SUPPORTED
|
#ifdef PNG_READ_tRNS_SUPPORTED
|
||||||
else if (chunk_name == png_tRNS)
|
else if (chunk_name == png_tRNS)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_tRNS(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -423,12 +352,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_bKGD_SUPPORTED
|
#ifdef PNG_READ_bKGD_SUPPORTED
|
||||||
else if (chunk_name == png_bKGD)
|
else if (chunk_name == png_bKGD)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_bKGD(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -436,12 +360,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_hIST_SUPPORTED
|
#ifdef PNG_READ_hIST_SUPPORTED
|
||||||
else if (chunk_name == png_hIST)
|
else if (chunk_name == png_hIST)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_hIST(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,12 +368,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_pHYs_SUPPORTED
|
#ifdef PNG_READ_pHYs_SUPPORTED
|
||||||
else if (chunk_name == png_pHYs)
|
else if (chunk_name == png_pHYs)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_pHYs(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -462,12 +376,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_oFFs_SUPPORTED
|
#ifdef PNG_READ_oFFs_SUPPORTED
|
||||||
else if (chunk_name == png_oFFs)
|
else if (chunk_name == png_oFFs)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_oFFs(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -475,12 +384,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_pCAL_SUPPORTED
|
#ifdef PNG_READ_pCAL_SUPPORTED
|
||||||
else if (chunk_name == png_pCAL)
|
else if (chunk_name == png_pCAL)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_pCAL(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -488,12 +392,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_sCAL_SUPPORTED
|
#ifdef PNG_READ_sCAL_SUPPORTED
|
||||||
else if (chunk_name == png_sCAL)
|
else if (chunk_name == png_sCAL)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_sCAL(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -501,12 +400,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_tIME_SUPPORTED
|
#ifdef PNG_READ_tIME_SUPPORTED
|
||||||
else if (chunk_name == png_tIME)
|
else if (chunk_name == png_tIME)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_tIME(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -514,12 +408,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_tEXt_SUPPORTED
|
#ifdef PNG_READ_tEXt_SUPPORTED
|
||||||
else if (chunk_name == png_tEXt)
|
else if (chunk_name == png_tEXt)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_tEXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -527,12 +416,7 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_zTXt_SUPPORTED
|
#ifdef PNG_READ_zTXt_SUPPORTED
|
||||||
else if (chunk_name == png_zTXt)
|
else if (chunk_name == png_zTXt)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_zTXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -540,40 +424,32 @@ png_push_read_chunk(png_structp png_ptr, png_infop info_ptr)
|
|||||||
#ifdef PNG_READ_iTXt_SUPPORTED
|
#ifdef PNG_READ_iTXt_SUPPORTED
|
||||||
else if (chunk_name == png_iTXt)
|
else if (chunk_name == png_iTXt)
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
|
png_handle_iTXt(png_ptr, info_ptr, png_ptr->push_length);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (png_ptr->push_length + 4 > png_ptr->buffer_size)
|
PNG_PUSH_SAVE_BUFFER_IF_FULL
|
||||||
{
|
png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length,
|
||||||
png_push_save_buffer(png_ptr);
|
PNG_HANDLE_CHUNK_AS_DEFAULT);
|
||||||
return;
|
|
||||||
}
|
|
||||||
png_handle_unknown(png_ptr, info_ptr, png_ptr->push_length);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
|
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
|
||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_crc_skip(png_structp png_ptr, png_uint_32 skip)
|
png_push_crc_skip(png_structrp png_ptr, png_uint_32 skip)
|
||||||
{
|
{
|
||||||
png_ptr->process_mode = PNG_SKIP_MODE;
|
png_ptr->process_mode = PNG_SKIP_MODE;
|
||||||
png_ptr->skip_length = skip;
|
png_ptr->skip_length = skip;
|
||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_crc_finish(png_structp png_ptr)
|
png_push_crc_finish(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr->skip_length && png_ptr->save_buffer_size)
|
if (png_ptr->skip_length != 0 && png_ptr->save_buffer_size != 0)
|
||||||
{
|
{
|
||||||
png_size_t save_size = png_ptr->save_buffer_size;
|
png_size_t save_size = png_ptr->save_buffer_size;
|
||||||
png_uint_32 skip_length = png_ptr->skip_length;
|
png_uint_32 skip_length = png_ptr->skip_length;
|
||||||
@ -597,8 +473,7 @@ png_push_crc_finish(png_structp png_ptr)
|
|||||||
png_ptr->save_buffer_size -= save_size;
|
png_ptr->save_buffer_size -= save_size;
|
||||||
png_ptr->save_buffer_ptr += save_size;
|
png_ptr->save_buffer_ptr += save_size;
|
||||||
}
|
}
|
||||||
|
if (png_ptr->skip_length != 0 && png_ptr->current_buffer_size != 0)
|
||||||
if (png_ptr->skip_length && png_ptr->current_buffer_size)
|
|
||||||
{
|
{
|
||||||
png_size_t save_size = png_ptr->current_buffer_size;
|
png_size_t save_size = png_ptr->current_buffer_size;
|
||||||
png_uint_32 skip_length = png_ptr->skip_length;
|
png_uint_32 skip_length = png_ptr->skip_length;
|
||||||
@ -619,15 +494,9 @@ png_push_crc_finish(png_structp png_ptr)
|
|||||||
png_ptr->current_buffer_size -= save_size;
|
png_ptr->current_buffer_size -= save_size;
|
||||||
png_ptr->current_buffer_ptr += save_size;
|
png_ptr->current_buffer_ptr += save_size;
|
||||||
}
|
}
|
||||||
|
if (png_ptr->skip_length == 0)
|
||||||
if (!png_ptr->skip_length)
|
|
||||||
{
|
{
|
||||||
if (png_ptr->buffer_size < 4)
|
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_crc_finish(png_ptr, 0);
|
png_crc_finish(png_ptr, 0);
|
||||||
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
||||||
}
|
}
|
||||||
@ -642,8 +511,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
ptr = buffer;
|
ptr = buffer;
|
||||||
|
if (png_ptr->save_buffer_size != 0)
|
||||||
if (png_ptr->save_buffer_size)
|
|
||||||
{
|
{
|
||||||
png_size_t save_size;
|
png_size_t save_size;
|
||||||
|
|
||||||
@ -653,15 +521,14 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
|||||||
else
|
else
|
||||||
save_size = png_ptr->save_buffer_size;
|
save_size = png_ptr->save_buffer_size;
|
||||||
|
|
||||||
png_memcpy(ptr, png_ptr->save_buffer_ptr, save_size);
|
memcpy(ptr, png_ptr->save_buffer_ptr, save_size);
|
||||||
length -= save_size;
|
length -= save_size;
|
||||||
ptr += save_size;
|
ptr += save_size;
|
||||||
png_ptr->buffer_size -= save_size;
|
png_ptr->buffer_size -= save_size;
|
||||||
png_ptr->save_buffer_size -= save_size;
|
png_ptr->save_buffer_size -= save_size;
|
||||||
png_ptr->save_buffer_ptr += save_size;
|
png_ptr->save_buffer_ptr += save_size;
|
||||||
}
|
}
|
||||||
|
if (length != 0 && png_ptr->current_buffer_size != 0)
|
||||||
if (length && png_ptr->current_buffer_size)
|
|
||||||
{
|
{
|
||||||
png_size_t save_size;
|
png_size_t save_size;
|
||||||
|
|
||||||
@ -671,7 +538,7 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
|||||||
else
|
else
|
||||||
save_size = png_ptr->current_buffer_size;
|
save_size = png_ptr->current_buffer_size;
|
||||||
|
|
||||||
png_memcpy(ptr, png_ptr->current_buffer_ptr, save_size);
|
memcpy(ptr, png_ptr->current_buffer_ptr, save_size);
|
||||||
png_ptr->buffer_size -= save_size;
|
png_ptr->buffer_size -= save_size;
|
||||||
png_ptr->current_buffer_size -= save_size;
|
png_ptr->current_buffer_size -= save_size;
|
||||||
png_ptr->current_buffer_ptr += save_size;
|
png_ptr->current_buffer_ptr += save_size;
|
||||||
@ -679,9 +546,9 @@ png_push_fill_buffer(png_structp png_ptr, png_bytep buffer, png_size_t length)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_save_buffer(png_structp png_ptr)
|
png_push_save_buffer(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr->save_buffer_size)
|
if (png_ptr->save_buffer_size != 0)
|
||||||
{
|
{
|
||||||
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
|
if (png_ptr->save_buffer_ptr != png_ptr->save_buffer)
|
||||||
{
|
{
|
||||||
@ -690,7 +557,6 @@ png_push_save_buffer(png_structp png_ptr)
|
|||||||
png_bytep dp;
|
png_bytep dp;
|
||||||
|
|
||||||
istop = png_ptr->save_buffer_size;
|
istop = png_ptr->save_buffer_size;
|
||||||
|
|
||||||
for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer;
|
for (i = 0, sp = png_ptr->save_buffer_ptr, dp = png_ptr->save_buffer;
|
||||||
i < istop; i++, sp++, dp++)
|
i < istop; i++, sp++, dp++)
|
||||||
{
|
{
|
||||||
@ -698,7 +564,6 @@ png_push_save_buffer(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->save_buffer_size + png_ptr->current_buffer_size >
|
if (png_ptr->save_buffer_size + png_ptr->current_buffer_size >
|
||||||
png_ptr->save_buffer_max)
|
png_ptr->save_buffer_max)
|
||||||
{
|
{
|
||||||
@ -713,33 +578,34 @@ png_push_save_buffer(png_structp png_ptr)
|
|||||||
|
|
||||||
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
|
new_max = png_ptr->save_buffer_size + png_ptr->current_buffer_size + 256;
|
||||||
old_buffer = png_ptr->save_buffer;
|
old_buffer = png_ptr->save_buffer;
|
||||||
png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr, new_max);
|
png_ptr->save_buffer = (png_bytep)png_malloc_warn(png_ptr,
|
||||||
|
(png_size_t)new_max);
|
||||||
|
|
||||||
if (png_ptr->save_buffer == NULL)
|
if (png_ptr->save_buffer == NULL)
|
||||||
{
|
{
|
||||||
png_free(png_ptr, old_buffer);
|
png_free(png_ptr, old_buffer);
|
||||||
|
old_buffer = NULL;
|
||||||
png_error(png_ptr, "Insufficient memory for save_buffer");
|
png_error(png_ptr, "Insufficient memory for save_buffer");
|
||||||
}
|
}
|
||||||
|
|
||||||
png_memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
memcpy(png_ptr->save_buffer, old_buffer, png_ptr->save_buffer_size);
|
||||||
png_free(png_ptr, old_buffer);
|
png_free(png_ptr, old_buffer);
|
||||||
|
old_buffer = NULL;
|
||||||
png_ptr->save_buffer_max = new_max;
|
png_ptr->save_buffer_max = new_max;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->current_buffer_size)
|
if (png_ptr->current_buffer_size)
|
||||||
{
|
{
|
||||||
png_memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size,
|
memcpy(png_ptr->save_buffer + png_ptr->save_buffer_size,
|
||||||
png_ptr->current_buffer_ptr, png_ptr->current_buffer_size);
|
png_ptr->current_buffer_ptr, png_ptr->current_buffer_size);
|
||||||
png_ptr->save_buffer_size += png_ptr->current_buffer_size;
|
png_ptr->save_buffer_size += png_ptr->current_buffer_size;
|
||||||
png_ptr->current_buffer_size = 0;
|
png_ptr->current_buffer_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
png_ptr->save_buffer_ptr = png_ptr->save_buffer;
|
png_ptr->save_buffer_ptr = png_ptr->save_buffer;
|
||||||
png_ptr->buffer_size = 0;
|
png_ptr->buffer_size = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_restore_buffer(png_structp png_ptr, png_bytep buffer,
|
png_push_restore_buffer(png_structrp png_ptr, png_bytep buffer,
|
||||||
png_size_t buffer_length)
|
png_size_t buffer_length)
|
||||||
{
|
{
|
||||||
png_ptr->current_buffer = buffer;
|
png_ptr->current_buffer = buffer;
|
||||||
@ -749,20 +615,15 @@ png_push_restore_buffer(png_structp png_ptr, png_bytep buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_read_IDAT(png_structp png_ptr)
|
png_push_read_IDAT(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (!(png_ptr->mode & PNG_HAVE_CHUNK_HEADER))
|
if ((png_ptr->mode & PNG_HAVE_CHUNK_HEADER) == 0)
|
||||||
{
|
{
|
||||||
png_byte chunk_length[4];
|
png_byte chunk_length[4];
|
||||||
png_byte chunk_tag[4];
|
png_byte chunk_tag[4];
|
||||||
|
|
||||||
/* TODO: this code can be commoned up with the same code in push_read */
|
/* TODO: this code can be commoned up with the same code in push_read */
|
||||||
if (png_ptr->buffer_size < 8)
|
PNG_PUSH_SAVE_BUFFER_IF_LT(8)
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
png_push_fill_buffer(png_ptr, chunk_length, 4);
|
||||||
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
|
png_ptr->push_length = png_get_uint_31(png_ptr, chunk_length);
|
||||||
png_reset_crc(png_ptr);
|
png_reset_crc(png_ptr);
|
||||||
@ -774,7 +635,7 @@ png_push_read_IDAT(png_structp png_ptr)
|
|||||||
{
|
{
|
||||||
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
png_ptr->process_mode = PNG_READ_CHUNK_MODE;
|
||||||
|
|
||||||
if (!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
|
if ((png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
|
||||||
png_error(png_ptr, "Not enough compressed data");
|
png_error(png_ptr, "Not enough compressed data");
|
||||||
|
|
||||||
return;
|
return;
|
||||||
@ -783,7 +644,7 @@ png_push_read_IDAT(png_structp png_ptr)
|
|||||||
png_ptr->idat_size = png_ptr->push_length;
|
png_ptr->idat_size = png_ptr->push_length;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->idat_size && png_ptr->save_buffer_size)
|
if (png_ptr->idat_size != 0 && png_ptr->save_buffer_size != 0)
|
||||||
{
|
{
|
||||||
png_size_t save_size = png_ptr->save_buffer_size;
|
png_size_t save_size = png_ptr->save_buffer_size;
|
||||||
png_uint_32 idat_size = png_ptr->idat_size;
|
png_uint_32 idat_size = png_ptr->idat_size;
|
||||||
@ -810,7 +671,7 @@ png_push_read_IDAT(png_structp png_ptr)
|
|||||||
png_ptr->save_buffer_ptr += save_size;
|
png_ptr->save_buffer_ptr += save_size;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (png_ptr->idat_size && png_ptr->current_buffer_size)
|
if (png_ptr->idat_size != 0 && png_ptr->current_buffer_size != 0)
|
||||||
{
|
{
|
||||||
png_size_t save_size = png_ptr->current_buffer_size;
|
png_size_t save_size = png_ptr->current_buffer_size;
|
||||||
png_uint_32 idat_size = png_ptr->idat_size;
|
png_uint_32 idat_size = png_ptr->idat_size;
|
||||||
@ -835,23 +696,18 @@ png_push_read_IDAT(png_structp png_ptr)
|
|||||||
png_ptr->current_buffer_size -= save_size;
|
png_ptr->current_buffer_size -= save_size;
|
||||||
png_ptr->current_buffer_ptr += save_size;
|
png_ptr->current_buffer_ptr += save_size;
|
||||||
}
|
}
|
||||||
|
if (png_ptr->idat_size == 0)
|
||||||
if (!png_ptr->idat_size)
|
|
||||||
{
|
{
|
||||||
if (png_ptr->buffer_size < 4)
|
PNG_PUSH_SAVE_BUFFER_IF_LT(4)
|
||||||
{
|
|
||||||
png_push_save_buffer(png_ptr);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
png_crc_finish(png_ptr, 0);
|
png_crc_finish(png_ptr, 0);
|
||||||
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
|
png_ptr->mode &= ~PNG_HAVE_CHUNK_HEADER;
|
||||||
png_ptr->mode |= PNG_AFTER_IDAT;
|
png_ptr->mode |= PNG_AFTER_IDAT;
|
||||||
|
png_ptr->zowner = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
|
png_process_IDAT_data(png_structrp png_ptr, png_bytep buffer,
|
||||||
png_size_t buffer_length)
|
png_size_t buffer_length)
|
||||||
{
|
{
|
||||||
/* The caller checks for a non-zero buffer length. */
|
/* The caller checks for a non-zero buffer length. */
|
||||||
@ -863,13 +719,14 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
|
|||||||
* handle the uncompressed results.
|
* handle the uncompressed results.
|
||||||
*/
|
*/
|
||||||
png_ptr->zstream.next_in = buffer;
|
png_ptr->zstream.next_in = buffer;
|
||||||
|
/* TODO: WARNING: TRUNCATION ERROR: DANGER WILL ROBINSON: */
|
||||||
png_ptr->zstream.avail_in = (uInt)buffer_length;
|
png_ptr->zstream.avail_in = (uInt)buffer_length;
|
||||||
|
|
||||||
/* Keep going until the decompressed data is all processed
|
/* Keep going until the decompressed data is all processed
|
||||||
* or the stream marked as finished.
|
* or the stream marked as finished.
|
||||||
*/
|
*/
|
||||||
while (png_ptr->zstream.avail_in > 0 &&
|
while (png_ptr->zstream.avail_in > 0 &&
|
||||||
!(png_ptr->flags & PNG_FLAG_ZLIB_FINISHED))
|
(png_ptr->flags & PNG_FLAG_ZSTREAM_ENDED) == 0)
|
||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
@ -880,9 +737,9 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
|
|||||||
*/
|
*/
|
||||||
if (!(png_ptr->zstream.avail_out > 0))
|
if (!(png_ptr->zstream.avail_out > 0))
|
||||||
{
|
{
|
||||||
png_ptr->zstream.avail_out =
|
/* TODO: WARNING: TRUNCATION ERROR: DANGER WILL ROBINSON: */
|
||||||
(uInt) PNG_ROWBYTES(png_ptr->pixel_depth,
|
png_ptr->zstream.avail_out = (uInt)(PNG_ROWBYTES(png_ptr->pixel_depth,
|
||||||
png_ptr->iwidth) + 1;
|
png_ptr->iwidth) + 1);
|
||||||
|
|
||||||
png_ptr->zstream.next_out = png_ptr->row_buf;
|
png_ptr->zstream.next_out = png_ptr->row_buf;
|
||||||
}
|
}
|
||||||
@ -900,7 +757,8 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
|
|||||||
if (ret != Z_OK && ret != Z_STREAM_END)
|
if (ret != Z_OK && ret != Z_STREAM_END)
|
||||||
{
|
{
|
||||||
/* Terminate the decompression. */
|
/* Terminate the decompression. */
|
||||||
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
|
png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
|
||||||
|
png_ptr->zowner = 0;
|
||||||
|
|
||||||
/* This may be a truncated stream (missing or
|
/* This may be a truncated stream (missing or
|
||||||
* damaged end code). Treat that as a warning.
|
* damaged end code). Treat that as a warning.
|
||||||
@ -928,7 +786,8 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
|
|||||||
{
|
{
|
||||||
/* Extra data. */
|
/* Extra data. */
|
||||||
png_warning(png_ptr, "Extra compressed data in IDAT");
|
png_warning(png_ptr, "Extra compressed data in IDAT");
|
||||||
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
|
png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
|
||||||
|
png_ptr->zowner = 0;
|
||||||
|
|
||||||
/* Do no more processing; skip the unprocessed
|
/* Do no more processing; skip the unprocessed
|
||||||
* input check below.
|
* input check below.
|
||||||
@ -943,7 +802,7 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
|
|||||||
|
|
||||||
/* And check for the end of the stream. */
|
/* And check for the end of the stream. */
|
||||||
if (ret == Z_STREAM_END)
|
if (ret == Z_STREAM_END)
|
||||||
png_ptr->flags |= PNG_FLAG_ZLIB_FINISHED;
|
png_ptr->flags |= PNG_FLAG_ZSTREAM_ENDED;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* All the data should have been processed, if anything
|
/* All the data should have been processed, if anything
|
||||||
@ -955,7 +814,7 @@ png_process_IDAT_data(png_structp png_ptr, png_bytep buffer,
|
|||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_process_row(png_structp png_ptr)
|
png_push_process_row(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
/* 1.5.6: row_info moved out of png_struct to a local here. */
|
/* 1.5.6: row_info moved out of png_struct to a local here. */
|
||||||
png_row_info row_info;
|
png_row_info row_info;
|
||||||
@ -981,10 +840,10 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
* it may not be in the future, so this was changed just to copy the
|
* it may not be in the future, so this was changed just to copy the
|
||||||
* interlaced row count:
|
* interlaced row count:
|
||||||
*/
|
*/
|
||||||
png_memcpy(png_ptr->prev_row, png_ptr->row_buf, row_info.rowbytes + 1);
|
memcpy(png_ptr->prev_row, png_ptr->row_buf, row_info.rowbytes + 1);
|
||||||
|
|
||||||
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
#ifdef PNG_READ_TRANSFORMS_SUPPORTED
|
||||||
if (png_ptr->transformations)
|
if (png_ptr->transformations != 0)
|
||||||
png_do_read_transformations(png_ptr, &row_info);
|
png_do_read_transformations(png_ptr, &row_info);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1001,8 +860,9 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
|
|
||||||
|
|
||||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||||
/* Blow up interlaced rows to full size */
|
/* Expand interlaced rows to full size */
|
||||||
if (png_ptr->interlaced && (png_ptr->transformations & PNG_INTERLACE))
|
if (png_ptr->interlaced != 0 &&
|
||||||
|
(png_ptr->transformations & PNG_INTERLACE) != 0)
|
||||||
{
|
{
|
||||||
if (png_ptr->pass < 6)
|
if (png_ptr->pass < 6)
|
||||||
png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
|
png_do_read_interlace(&row_info, png_ptr->row_buf + 1, png_ptr->pass,
|
||||||
@ -1184,26 +1044,26 @@ png_push_process_row(png_structp png_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_read_push_finish_row(png_structp png_ptr)
|
png_read_push_finish_row(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||||
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
/* Arrays to facilitate easy interlacing - use pass (0 - 6) as index */
|
||||||
|
|
||||||
/* Start of interlace block */
|
/* Start of interlace block */
|
||||||
static PNG_CONST png_byte FARDATA png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
static PNG_CONST png_byte png_pass_start[] = {0, 4, 0, 2, 0, 1, 0};
|
||||||
|
|
||||||
/* Offset to next interlace block */
|
/* Offset to next interlace block */
|
||||||
static PNG_CONST png_byte FARDATA png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
static PNG_CONST png_byte png_pass_inc[] = {8, 8, 4, 4, 2, 2, 1};
|
||||||
|
|
||||||
/* Start of interlace block in the y direction */
|
/* Start of interlace block in the y direction */
|
||||||
static PNG_CONST png_byte FARDATA png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
static PNG_CONST png_byte png_pass_ystart[] = {0, 0, 4, 0, 2, 0, 1};
|
||||||
|
|
||||||
/* Offset to next interlace block in the y direction */
|
/* Offset to next interlace block in the y direction */
|
||||||
static PNG_CONST png_byte FARDATA png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
static PNG_CONST png_byte png_pass_yinc[] = {8, 8, 8, 4, 4, 2, 2};
|
||||||
|
|
||||||
/* Height of interlace block. This is not currently used - if you need
|
/* Height of interlace block. This is not currently used - if you need
|
||||||
* it, uncomment it here and in png.h
|
* it, uncomment it here and in png.h
|
||||||
static PNG_CONST png_byte FARDATA png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
static PNG_CONST png_byte png_pass_height[] = {8, 8, 4, 4, 2, 2, 1};
|
||||||
*/
|
*/
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1212,10 +1072,10 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||||
if (png_ptr->interlaced)
|
if (png_ptr->interlaced != 0)
|
||||||
{
|
{
|
||||||
png_ptr->row_number = 0;
|
png_ptr->row_number = 0;
|
||||||
png_memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
|
memset(png_ptr->prev_row, 0, png_ptr->rowbytes + 1);
|
||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
@ -1236,7 +1096,7 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||||||
png_pass_start[png_ptr->pass]) /
|
png_pass_start[png_ptr->pass]) /
|
||||||
png_pass_inc[png_ptr->pass];
|
png_pass_inc[png_ptr->pass];
|
||||||
|
|
||||||
if (png_ptr->transformations & PNG_INTERLACE)
|
if ((png_ptr->transformations & PNG_INTERLACE) != 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
png_ptr->num_rows = (png_ptr->height +
|
png_ptr->num_rows = (png_ptr->height +
|
||||||
@ -1246,25 +1106,25 @@ png_read_push_finish_row(png_structp png_ptr)
|
|||||||
|
|
||||||
} while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
|
} while (png_ptr->iwidth == 0 || png_ptr->num_rows == 0);
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
#endif /* READ_INTERLACING */
|
||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_have_info(png_structp png_ptr, png_infop info_ptr)
|
png_push_have_info(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr->info_fn != NULL)
|
if (png_ptr->info_fn != NULL)
|
||||||
(*(png_ptr->info_fn))(png_ptr, info_ptr);
|
(*(png_ptr->info_fn))(png_ptr, info_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_have_end(png_structp png_ptr, png_infop info_ptr)
|
png_push_have_end(png_structrp png_ptr, png_inforp info_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr->end_fn != NULL)
|
if (png_ptr->end_fn != NULL)
|
||||||
(*(png_ptr->end_fn))(png_ptr, info_ptr);
|
(*(png_ptr->end_fn))(png_ptr, info_ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_push_have_row(png_structp png_ptr, png_bytep row)
|
png_push_have_row(png_structrp png_ptr, png_bytep row)
|
||||||
{
|
{
|
||||||
if (png_ptr->row_fn != NULL)
|
if (png_ptr->row_fn != NULL)
|
||||||
(*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number,
|
(*(png_ptr->row_fn))(png_ptr, row, png_ptr->row_number,
|
||||||
@ -1273,7 +1133,7 @@ png_push_have_row(png_structp png_ptr, png_bytep row)
|
|||||||
|
|
||||||
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
#ifdef PNG_READ_INTERLACING_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_progressive_combine_row (png_structp png_ptr, png_bytep old_row,
|
png_progressive_combine_row(png_const_structrp png_ptr, png_bytep old_row,
|
||||||
png_const_bytep new_row)
|
png_const_bytep new_row)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
@ -1284,12 +1144,12 @@ png_progressive_combine_row (png_structp png_ptr, png_bytep old_row,
|
|||||||
* it must be png_ptr->row_buf+1
|
* it must be png_ptr->row_buf+1
|
||||||
*/
|
*/
|
||||||
if (new_row != NULL)
|
if (new_row != NULL)
|
||||||
png_combine_row(png_ptr, old_row, 1/*display*/);
|
png_combine_row(png_ptr, old_row, 1/*blocky display*/);
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_INTERLACING_SUPPORTED */
|
#endif /* READ_INTERLACING */
|
||||||
|
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
|
png_set_progressive_read_fn(png_structrp png_ptr, png_voidp progressive_ptr,
|
||||||
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
|
png_progressive_info_ptr info_fn, png_progressive_row_ptr row_fn,
|
||||||
png_progressive_end_ptr end_fn)
|
png_progressive_end_ptr end_fn)
|
||||||
{
|
{
|
||||||
@ -1304,11 +1164,11 @@ png_set_progressive_read_fn(png_structp png_ptr, png_voidp progressive_ptr,
|
|||||||
}
|
}
|
||||||
|
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_progressive_ptr(png_const_structp png_ptr)
|
png_get_progressive_ptr(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
return png_ptr->io_ptr;
|
return png_ptr->io_ptr;
|
||||||
}
|
}
|
||||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
#endif /* PROGRESSIVE_READ */
|
||||||
|
1605
src/3rdparty/libpng/pngpriv.h
vendored
1605
src/3rdparty/libpng/pngpriv.h
vendored
File diff suppressed because it is too large
Load Diff
3675
src/3rdparty/libpng/pngread.c
vendored
3675
src/3rdparty/libpng/pngread.c
vendored
File diff suppressed because it is too large
Load Diff
74
src/3rdparty/libpng/pngrio.c
vendored
74
src/3rdparty/libpng/pngrio.c
vendored
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngrio.c - functions for data input
|
/* pngrio.c - functions for data input
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.0 [January 6, 2011]
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -26,10 +26,10 @@
|
|||||||
* reads from a file pointer. Note that this routine sometimes gets called
|
* reads from a file pointer. Note that this routine sometimes gets called
|
||||||
* with very small lengths, so you should implement some kind of simple
|
* with very small lengths, so you should implement some kind of simple
|
||||||
* buffering if you are using unbuffered reads. This should never be asked
|
* buffering if you are using unbuffered reads. This should never be asked
|
||||||
* to read more then 64K on a 16 bit machine.
|
* to read more than 64K on a 16 bit machine.
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_read_data(png_structrp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
png_debug1(4, "reading %d bytes", (int)length);
|
png_debug1(4, "reading %d bytes", (int)length);
|
||||||
|
|
||||||
@ -46,7 +46,6 @@ png_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
* read_data function and use it at run time with png_set_read_fn(), rather
|
* read_data function and use it at run time with png_set_read_fn(), rather
|
||||||
* than changing the library.
|
* than changing the library.
|
||||||
*/
|
*/
|
||||||
# ifndef USE_FAR_KEYWORD
|
|
||||||
void PNGCBAPI
|
void PNGCBAPI
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
@ -58,68 +57,11 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
/* fread() returns 0 on error, so it is OK to store this in a png_size_t
|
||||||
* instead of an int, which is what fread() actually returns.
|
* instead of an int, which is what fread() actually returns.
|
||||||
*/
|
*/
|
||||||
check = fread(data, 1, length, (png_FILE_p)png_ptr->io_ptr);
|
check = fread(data, 1, length, png_voidcast(png_FILE_p, png_ptr->io_ptr));
|
||||||
|
|
||||||
if (check != length)
|
if (check != length)
|
||||||
png_error(png_ptr, "Read Error");
|
png_error(png_ptr, "Read Error");
|
||||||
}
|
}
|
||||||
# else
|
|
||||||
/* This is the model-independent version. Since the standard I/O library
|
|
||||||
can't handle far buffers in the medium and small models, we have to copy
|
|
||||||
the data.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define NEAR_BUF_SIZE 1024
|
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
|
||||||
|
|
||||||
static void PNGCBAPI
|
|
||||||
png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|
||||||
{
|
|
||||||
png_size_t check;
|
|
||||||
png_byte *n_data;
|
|
||||||
png_FILE_p io_ptr;
|
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Check if data really is near. If so, use usual code. */
|
|
||||||
n_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
|
||||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
|
||||||
|
|
||||||
if ((png_bytep)n_data == data)
|
|
||||||
{
|
|
||||||
check = fread(n_data, 1, length, io_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_byte buf[NEAR_BUF_SIZE];
|
|
||||||
png_size_t read, remaining, err;
|
|
||||||
check = 0;
|
|
||||||
remaining = length;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
read = MIN(NEAR_BUF_SIZE, remaining);
|
|
||||||
err = fread(buf, 1, read, io_ptr);
|
|
||||||
png_memcpy(data, buf, read); /* copy far buffer to near buffer */
|
|
||||||
|
|
||||||
if (err != read)
|
|
||||||
break;
|
|
||||||
|
|
||||||
else
|
|
||||||
check += err;
|
|
||||||
|
|
||||||
data += read;
|
|
||||||
remaining -= read;
|
|
||||||
}
|
|
||||||
while (remaining != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if ((png_uint_32)check != (png_uint_32)length)
|
|
||||||
png_error(png_ptr, "read Error");
|
|
||||||
}
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function allows the application to supply a new input function
|
/* This function allows the application to supply a new input function
|
||||||
@ -142,7 +84,7 @@ png_default_read_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
* be used.
|
* be used.
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
png_set_read_fn(png_structrp png_ptr, png_voidp io_ptr,
|
||||||
png_rw_ptr read_data_fn)
|
png_rw_ptr read_data_fn)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
@ -160,6 +102,7 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
png_ptr->read_data_fn = read_data_fn;
|
png_ptr->read_data_fn = read_data_fn;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
/* It is an error to write to a read device */
|
/* It is an error to write to a read device */
|
||||||
if (png_ptr->write_data_fn != NULL)
|
if (png_ptr->write_data_fn != NULL)
|
||||||
{
|
{
|
||||||
@ -168,9 +111,10 @@ png_set_read_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
"Can't set both read_data_fn and write_data_fn in the"
|
"Can't set both read_data_fn and write_data_fn in the"
|
||||||
" same structure");
|
" same structure");
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||||
png_ptr->output_flush_fn = NULL;
|
png_ptr->output_flush_fn = NULL;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_SUPPORTED */
|
#endif /* READ */
|
||||||
|
1437
src/3rdparty/libpng/pngrtran.c
vendored
1437
src/3rdparty/libpng/pngrtran.c
vendored
File diff suppressed because it is too large
Load Diff
3281
src/3rdparty/libpng/pngrutil.c
vendored
3281
src/3rdparty/libpng/pngrutil.c
vendored
File diff suppressed because it is too large
Load Diff
1135
src/3rdparty/libpng/pngset.c
vendored
1135
src/3rdparty/libpng/pngset.c
vendored
File diff suppressed because it is too large
Load Diff
213
src/3rdparty/libpng/pngstruct.h
vendored
213
src/3rdparty/libpng/pngstruct.h
vendored
@ -1,12 +1,11 @@
|
|||||||
|
|
||||||
/* pngstruct.h - header file for PNG reference library
|
/* pngstruct.h - header file for PNG reference library
|
||||||
*
|
*
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Last changed in libpng 1.6.1 [March 28, 2013]
|
||||||
|
* Copyright (c) 1998-2013 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.9 [March 29, 2012]
|
|
||||||
*
|
|
||||||
* This code is released under the libpng license.
|
* This code is released under the libpng license.
|
||||||
* For conditions of distribution and use, see the disclaimer
|
* For conditions of distribution and use, see the disclaimer
|
||||||
* and license in png.h
|
* and license in png.h
|
||||||
@ -24,13 +23,130 @@
|
|||||||
* in this structure and is required for decompressing the LZ compressed
|
* in this structure and is required for decompressing the LZ compressed
|
||||||
* data in PNG files.
|
* data in PNG files.
|
||||||
*/
|
*/
|
||||||
|
#ifndef ZLIB_CONST
|
||||||
|
/* We must ensure that zlib uses 'const' in declarations. */
|
||||||
|
# define ZLIB_CONST
|
||||||
|
#endif
|
||||||
#include "zlib.h"
|
#include "zlib.h"
|
||||||
|
#ifdef const
|
||||||
|
/* zlib.h sometimes #defines const to nothing, undo this. */
|
||||||
|
# undef const
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* zlib.h has mediocre z_const use before 1.2.6, this stuff is for compatibility
|
||||||
|
* with older builds.
|
||||||
|
*/
|
||||||
|
#if ZLIB_VERNUM < 0x1260
|
||||||
|
# define PNGZ_MSG_CAST(s) png_constcast(char*,s)
|
||||||
|
# define PNGZ_INPUT_CAST(b) png_constcast(png_bytep,b)
|
||||||
|
#else
|
||||||
|
# define PNGZ_MSG_CAST(s) (s)
|
||||||
|
# define PNGZ_INPUT_CAST(b) (b)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* zlib.h declares a magic type 'uInt' that limits the amount of data that zlib
|
||||||
|
* can handle at once. This type need be no larger than 16 bits (so maximum of
|
||||||
|
* 65535), this define allows us to discover how big it is, but limited by the
|
||||||
|
* maximuum for png_size_t. The value can be overriden in a library build
|
||||||
|
* (pngusr.h, or set it in CPPFLAGS) and it works to set it to a considerably
|
||||||
|
* lower value (e.g. 255 works). A lower value may help memory usage (slightly)
|
||||||
|
* and may even improve performance on some systems (and degrade it on others.)
|
||||||
|
*/
|
||||||
|
#ifndef ZLIB_IO_MAX
|
||||||
|
# define ZLIB_IO_MAX ((uInt)-1)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
/* The type of a compression buffer list used by the write code. */
|
||||||
|
typedef struct png_compression_buffer
|
||||||
|
{
|
||||||
|
struct png_compression_buffer *next;
|
||||||
|
png_byte output[1]; /* actually zbuf_size */
|
||||||
|
} png_compression_buffer, *png_compression_bufferp;
|
||||||
|
|
||||||
|
#define PNG_COMPRESSION_BUFFER_SIZE(pp)\
|
||||||
|
(offsetof(png_compression_buffer, output) + (pp)->zbuffer_size)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Colorspace support; structures used in png_struct, png_info and in internal
|
||||||
|
* functions to hold and communicate information about the color space.
|
||||||
|
*
|
||||||
|
* PNG_COLORSPACE_SUPPORTED is only required if the application will perform
|
||||||
|
* colorspace corrections, otherwise all the colorspace information can be
|
||||||
|
* skipped and the size of libpng can be reduced (significantly) by compiling
|
||||||
|
* out the colorspace support.
|
||||||
|
*/
|
||||||
|
#ifdef PNG_COLORSPACE_SUPPORTED
|
||||||
|
/* The chromaticities of the red, green and blue colorants and the chromaticity
|
||||||
|
* of the corresponding white point (i.e. of rgb(1.0,1.0,1.0)).
|
||||||
|
*/
|
||||||
|
typedef struct png_xy
|
||||||
|
{
|
||||||
|
png_fixed_point redx, redy;
|
||||||
|
png_fixed_point greenx, greeny;
|
||||||
|
png_fixed_point bluex, bluey;
|
||||||
|
png_fixed_point whitex, whitey;
|
||||||
|
} png_xy;
|
||||||
|
|
||||||
|
/* The same data as above but encoded as CIE XYZ values. When this data comes
|
||||||
|
* from chromaticities the sum of the Y values is assumed to be 1.0
|
||||||
|
*/
|
||||||
|
typedef struct png_XYZ
|
||||||
|
{
|
||||||
|
png_fixed_point red_X, red_Y, red_Z;
|
||||||
|
png_fixed_point green_X, green_Y, green_Z;
|
||||||
|
png_fixed_point blue_X, blue_Y, blue_Z;
|
||||||
|
} png_XYZ;
|
||||||
|
#endif /* COLORSPACE */
|
||||||
|
|
||||||
|
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
|
||||||
|
/* A colorspace is all the above plus, potentially, profile information;
|
||||||
|
* however at present libpng does not use the profile internally so it is only
|
||||||
|
* stored in the png_info struct (if iCCP is supported.) The rendering intent
|
||||||
|
* is retained here and is checked.
|
||||||
|
*
|
||||||
|
* The file gamma encoding information is also stored here and gamma correction
|
||||||
|
* is done by libpng, whereas color correction must currently be done by the
|
||||||
|
* application.
|
||||||
|
*/
|
||||||
|
typedef struct png_colorspace
|
||||||
|
{
|
||||||
|
#ifdef PNG_GAMMA_SUPPORTED
|
||||||
|
png_fixed_point gamma; /* File gamma */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_COLORSPACE_SUPPORTED
|
||||||
|
png_xy end_points_xy; /* End points as chromaticities */
|
||||||
|
png_XYZ end_points_XYZ; /* End points as CIE XYZ colorant values */
|
||||||
|
png_uint_16 rendering_intent; /* Rendering intent of a profile */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* Flags are always defined to simplify the code. */
|
||||||
|
png_uint_16 flags; /* As defined below */
|
||||||
|
} png_colorspace, * PNG_RESTRICT png_colorspacerp;
|
||||||
|
|
||||||
|
typedef const png_colorspace * PNG_RESTRICT png_const_colorspacerp;
|
||||||
|
|
||||||
|
/* General flags for the 'flags' field */
|
||||||
|
#define PNG_COLORSPACE_HAVE_GAMMA 0x0001
|
||||||
|
#define PNG_COLORSPACE_HAVE_ENDPOINTS 0x0002
|
||||||
|
#define PNG_COLORSPACE_HAVE_INTENT 0x0004
|
||||||
|
#define PNG_COLORSPACE_FROM_gAMA 0x0008
|
||||||
|
#define PNG_COLORSPACE_FROM_cHRM 0x0010
|
||||||
|
#define PNG_COLORSPACE_FROM_sRGB 0x0020
|
||||||
|
#define PNG_COLORSPACE_ENDPOINTS_MATCH_sRGB 0x0040
|
||||||
|
#define PNG_COLORSPACE_MATCHES_sRGB 0x0080 /* exact match on profile */
|
||||||
|
#define PNG_COLORSPACE_INVALID 0x8000
|
||||||
|
#define PNG_COLORSPACE_CANCEL(flags) (0xffff ^ (flags))
|
||||||
|
#endif /* COLORSPACE || GAMMA */
|
||||||
|
|
||||||
struct png_struct_def
|
struct png_struct_def
|
||||||
{
|
{
|
||||||
#ifdef PNG_SETJMP_SUPPORTED
|
#ifdef PNG_SETJMP_SUPPORTED
|
||||||
jmp_buf longjmp_buffer; /* used in png_error */
|
jmp_buf jmp_buf_local; /* New name in 1.6.0 for jmp_buf in png_struct */
|
||||||
png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
|
png_longjmp_ptr longjmp_fn;/* setjmp non-local goto function. */
|
||||||
|
jmp_buf *jmp_buf_ptr; /* passed to longjmp_fn */
|
||||||
|
size_t jmp_buf_size; /* size of the above, if allocated */
|
||||||
#endif
|
#endif
|
||||||
png_error_ptr error_fn; /* function for printing errors and aborting */
|
png_error_ptr error_fn; /* function for printing errors and aborting */
|
||||||
#ifdef PNG_WARNINGS_SUPPORTED
|
#ifdef PNG_WARNINGS_SUPPORTED
|
||||||
@ -63,22 +179,12 @@ struct png_struct_def
|
|||||||
png_uint_32 flags; /* flags indicating various things to libpng */
|
png_uint_32 flags; /* flags indicating various things to libpng */
|
||||||
png_uint_32 transformations; /* which transformations to perform */
|
png_uint_32 transformations; /* which transformations to perform */
|
||||||
|
|
||||||
z_stream zstream; /* pointer to decompression structure (below) */
|
png_uint_32 zowner; /* ID (chunk type) of zstream owner, 0 if none */
|
||||||
png_bytep zbuf; /* buffer for zlib */
|
z_stream zstream; /* decompression structure */
|
||||||
uInt zbuf_size; /* size of zbuf (typically 65536) */
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
png_compression_bufferp zbuffer_list; /* Created on demand during write */
|
||||||
/* Added in 1.5.4: state to keep track of whether the zstream has been
|
uInt zbuffer_size; /* size of the actual buffer */
|
||||||
* initialized and if so whether it is for IDAT or some other chunk.
|
|
||||||
*/
|
|
||||||
#define PNG_ZLIB_UNINITIALIZED 0
|
|
||||||
#define PNG_ZLIB_FOR_IDAT 1
|
|
||||||
#define PNG_ZLIB_FOR_TEXT 2 /* anything other than IDAT */
|
|
||||||
#define PNG_ZLIB_USE_MASK 3 /* bottom two bits */
|
|
||||||
#define PNG_ZLIB_IN_USE 4 /* a flag value */
|
|
||||||
|
|
||||||
png_uint_32 zlib_state; /* State of zlib initialization */
|
|
||||||
/* End of material added at libpng 1.5.4 */
|
|
||||||
|
|
||||||
int zlib_level; /* holds zlib compression level */
|
int zlib_level; /* holds zlib compression level */
|
||||||
int zlib_method; /* holds zlib compression method */
|
int zlib_method; /* holds zlib compression method */
|
||||||
@ -87,8 +193,7 @@ struct png_struct_def
|
|||||||
int zlib_strategy; /* holds zlib compression strategy */
|
int zlib_strategy; /* holds zlib compression strategy */
|
||||||
#endif
|
#endif
|
||||||
/* Added at libpng 1.5.4 */
|
/* Added at libpng 1.5.4 */
|
||||||
#if defined(PNG_WRITE_COMPRESSED_TEXT_SUPPORTED) || \
|
#ifdef PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED
|
||||||
defined(PNG_WRITE_CUSTOMIZE_ZTXT_COMPRESSION_SUPPORTED)
|
|
||||||
int zlib_text_level; /* holds zlib compression level */
|
int zlib_text_level; /* holds zlib compression level */
|
||||||
int zlib_text_method; /* holds zlib compression method */
|
int zlib_text_method; /* holds zlib compression method */
|
||||||
int zlib_text_window_bits; /* holds zlib compression window bits */
|
int zlib_text_window_bits; /* holds zlib compression window bits */
|
||||||
@ -96,6 +201,14 @@ struct png_struct_def
|
|||||||
int zlib_text_strategy; /* holds zlib compression strategy */
|
int zlib_text_strategy; /* holds zlib compression strategy */
|
||||||
#endif
|
#endif
|
||||||
/* End of material added at libpng 1.5.4 */
|
/* End of material added at libpng 1.5.4 */
|
||||||
|
/* Added at libpng 1.6.0 */
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
int zlib_set_level; /* Actual values set into the zstream on write */
|
||||||
|
int zlib_set_method;
|
||||||
|
int zlib_set_window_bits;
|
||||||
|
int zlib_set_mem_level;
|
||||||
|
int zlib_set_strategy;
|
||||||
|
#endif
|
||||||
|
|
||||||
png_uint_32 width; /* width of image in pixels */
|
png_uint_32 width; /* width of image in pixels */
|
||||||
png_uint_32 height; /* height of image in pixels */
|
png_uint_32 height; /* height of image in pixels */
|
||||||
@ -111,10 +224,12 @@ struct png_struct_def
|
|||||||
png_bytep row_buf; /* buffer to save current (unfiltered) row.
|
png_bytep row_buf; /* buffer to save current (unfiltered) row.
|
||||||
* This is a pointer into big_row_buf
|
* This is a pointer into big_row_buf
|
||||||
*/
|
*/
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
png_bytep sub_row; /* buffer to save "sub" row when filtering */
|
png_bytep sub_row; /* buffer to save "sub" row when filtering */
|
||||||
png_bytep up_row; /* buffer to save "up" row when filtering */
|
png_bytep up_row; /* buffer to save "up" row when filtering */
|
||||||
png_bytep avg_row; /* buffer to save "avg" row when filtering */
|
png_bytep avg_row; /* buffer to save "avg" row when filtering */
|
||||||
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
|
png_bytep paeth_row; /* buffer to save "Paeth" row when filtering */
|
||||||
|
#endif
|
||||||
png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
|
png_size_t info_rowbytes; /* Added in 1.5.4: cache of updated row bytes */
|
||||||
|
|
||||||
png_uint_32 idat_size; /* current IDAT size for read */
|
png_uint_32 idat_size; /* current IDAT size for read */
|
||||||
@ -138,15 +253,14 @@ struct png_struct_def
|
|||||||
png_byte usr_bit_depth; /* bit depth of users row: write only */
|
png_byte usr_bit_depth; /* bit depth of users row: write only */
|
||||||
png_byte pixel_depth; /* number of bits per pixel */
|
png_byte pixel_depth; /* number of bits per pixel */
|
||||||
png_byte channels; /* number of channels in file */
|
png_byte channels; /* number of channels in file */
|
||||||
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
png_byte usr_channels; /* channels at start of write: write only */
|
png_byte usr_channels; /* channels at start of write: write only */
|
||||||
|
#endif
|
||||||
png_byte sig_bytes; /* magic bytes read/written from start of file */
|
png_byte sig_bytes; /* magic bytes read/written from start of file */
|
||||||
png_byte maximum_pixel_depth;
|
png_byte maximum_pixel_depth;
|
||||||
/* pixel depth used for the row buffers */
|
/* pixel depth used for the row buffers */
|
||||||
png_byte transformed_pixel_depth;
|
png_byte transformed_pixel_depth;
|
||||||
/* pixel depth after read/write transforms */
|
/* pixel depth after read/write transforms */
|
||||||
png_byte io_chunk_string[5];
|
|
||||||
/* string name of chunk */
|
|
||||||
|
|
||||||
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
#if defined(PNG_READ_FILLER_SUPPORTED) || defined(PNG_WRITE_FILLER_SUPPORTED)
|
||||||
png_uint_16 filler; /* filler bytes for pixel expansion */
|
png_uint_16 filler; /* filler bytes for pixel expansion */
|
||||||
#endif
|
#endif
|
||||||
@ -159,7 +273,7 @@ struct png_struct_def
|
|||||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||||
png_color_16 background_1; /* background normalized to gamma 1.0 */
|
png_color_16 background_1; /* background normalized to gamma 1.0 */
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_bKGD_SUPPORTED */
|
#endif /* bKGD */
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||||
png_flush_ptr output_flush_fn; /* Function for flushing output */
|
png_flush_ptr output_flush_fn; /* Function for flushing output */
|
||||||
@ -169,7 +283,6 @@ struct png_struct_def
|
|||||||
|
|
||||||
#ifdef PNG_READ_GAMMA_SUPPORTED
|
#ifdef PNG_READ_GAMMA_SUPPORTED
|
||||||
int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
|
int gamma_shift; /* number of "insignificant" bits in 16-bit gamma */
|
||||||
png_fixed_point gamma; /* file gamma value */
|
|
||||||
png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
|
png_fixed_point screen_gamma; /* screen gamma value (display_exponent) */
|
||||||
|
|
||||||
png_bytep gamma_table; /* gamma table for 8-bit depth files */
|
png_bytep gamma_table; /* gamma table for 8-bit depth files */
|
||||||
@ -217,7 +330,7 @@ struct png_struct_def
|
|||||||
int process_mode; /* what push library is currently doing */
|
int process_mode; /* what push library is currently doing */
|
||||||
int cur_palette; /* current push library palette index */
|
int cur_palette; /* current push library palette index */
|
||||||
|
|
||||||
#endif /* PNG_PROGRESSIVE_READ_SUPPORTED */
|
#endif /* PROGRESSIVE_READ */
|
||||||
|
|
||||||
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
#if defined(__TURBOC__) && !defined(_Windows) && !defined(__FLAT__)
|
||||||
/* For the Borland special 64K segment handler */
|
/* For the Borland special 64K segment handler */
|
||||||
@ -233,10 +346,6 @@ struct png_struct_def
|
|||||||
png_bytep quantize_index; /* index translation for palette files */
|
png_bytep quantize_index; /* index translation for palette files */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PNG_READ_QUANTIZE_SUPPORTED) || defined(PNG_hIST_SUPPORTED)
|
|
||||||
png_uint_16p hist; /* histogram */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
#ifdef PNG_WRITE_WEIGHTED_FILTER_SUPPORTED
|
||||||
png_byte heuristic_method; /* heuristic for row filter selection */
|
png_byte heuristic_method; /* heuristic for row filter selection */
|
||||||
png_byte num_prev_filters; /* number of weights for previous rows */
|
png_byte num_prev_filters; /* number of weights for previous rows */
|
||||||
@ -247,9 +356,17 @@ struct png_struct_def
|
|||||||
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
|
png_uint_16p inv_filter_costs; /* 1/relative filter calculation cost */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Options */
|
||||||
|
#ifdef PNG_SET_OPTION_SUPPORTED
|
||||||
|
png_byte options; /* On/off state (up to 4 options) */
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if PNG_LIBPNG_VER < 10700
|
||||||
|
/* To do: remove this from libpng-1.7 */
|
||||||
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
#ifdef PNG_TIME_RFC1123_SUPPORTED
|
||||||
char time_buffer[29]; /* String to hold RFC 1123 time text */
|
char time_buffer[29]; /* String to hold RFC 1123 time text */
|
||||||
#endif
|
#endif
|
||||||
|
#endif
|
||||||
|
|
||||||
/* New members added in libpng-1.0.6 */
|
/* New members added in libpng-1.0.6 */
|
||||||
|
|
||||||
@ -257,17 +374,16 @@ struct png_struct_def
|
|||||||
|
|
||||||
#ifdef PNG_USER_CHUNKS_SUPPORTED
|
#ifdef PNG_USER_CHUNKS_SUPPORTED
|
||||||
png_voidp user_chunk_ptr;
|
png_voidp user_chunk_ptr;
|
||||||
|
#ifdef PNG_READ_USER_CHUNKS_SUPPORTED
|
||||||
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
|
png_user_chunk_ptr read_user_chunk_fn; /* user read chunk handler */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_HANDLE_AS_UNKNOWN_SUPPORTED
|
|
||||||
int num_chunk_list;
|
|
||||||
png_bytep chunk_list;
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_READ_sRGB_SUPPORTED
|
#ifdef PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
/* Added in 1.5.5 to record an sRGB chunk in the png. */
|
int unknown_default; /* As PNG_HANDLE_* */
|
||||||
png_byte is_sRGB;
|
unsigned int num_chunk_list; /* Number of entries in the list */
|
||||||
|
png_bytep chunk_list; /* List of png_byte[5]; the textual chunk name
|
||||||
|
* followed by a PNG_HANDLE_* byte */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* New members added in libpng-1.0.3 */
|
/* New members added in libpng-1.0.3 */
|
||||||
@ -332,16 +448,24 @@ struct png_struct_def
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* New member added in libpng-1.0.25 and 1.2.17 */
|
/* New member added in libpng-1.0.25 and 1.2.17 */
|
||||||
#ifdef PNG_UNKNOWN_CHUNKS_SUPPORTED
|
#ifdef PNG_READ_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
/* Storage for unknown chunk that the library doesn't recognize. */
|
/* Temporary storage for unknown chunk that the library doesn't recognize,
|
||||||
|
* used while reading the chunk.
|
||||||
|
*/
|
||||||
png_unknown_chunk unknown_chunk;
|
png_unknown_chunk unknown_chunk;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* New member added in libpng-1.2.26 */
|
/* New member added in libpng-1.2.26 */
|
||||||
png_size_t old_big_row_buf_size;
|
png_size_t old_big_row_buf_size;
|
||||||
|
|
||||||
|
#ifdef PNG_READ_SUPPORTED
|
||||||
/* New member added in libpng-1.2.30 */
|
/* New member added in libpng-1.2.30 */
|
||||||
png_charp chunkdata; /* buffer for reading chunk data */
|
png_bytep read_buffer; /* buffer for reading chunk data */
|
||||||
|
png_alloc_size_t read_buffer_size; /* current size of the buffer */
|
||||||
|
#endif
|
||||||
|
#ifdef PNG_SEQUENTIAL_READ_SUPPORTED
|
||||||
|
uInt IDAT_read_size; /* limit on read buffer size for IDAT */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_IO_STATE_SUPPORTED
|
#ifdef PNG_IO_STATE_SUPPORTED
|
||||||
/* New member added in libpng-1.4.0 */
|
/* New member added in libpng-1.4.0 */
|
||||||
@ -351,7 +475,14 @@ struct png_struct_def
|
|||||||
/* New member added in libpng-1.5.6 */
|
/* New member added in libpng-1.5.6 */
|
||||||
png_bytep big_prev_row;
|
png_bytep big_prev_row;
|
||||||
|
|
||||||
|
/* New member added in libpng-1.5.7 */
|
||||||
void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info,
|
void (*read_filter[PNG_FILTER_VALUE_LAST-1])(png_row_infop row_info,
|
||||||
png_bytep row, png_const_bytep prev_row);
|
png_bytep row, png_const_bytep prev_row);
|
||||||
|
|
||||||
|
#ifdef PNG_READ_SUPPORTED
|
||||||
|
#if defined(PNG_COLORSPACE_SUPPORTED) || defined(PNG_GAMMA_SUPPORTED)
|
||||||
|
png_colorspace colorspace;
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
#endif /* PNGSTRUCT_H */
|
#endif /* PNGSTRUCT_H */
|
||||||
|
176
src/3rdparty/libpng/pngtrans.c
vendored
176
src/3rdparty/libpng/pngtrans.c
vendored
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
/* pngtrans.c - transforms the data in a row (used by both readers and writers)
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.10 [March 8, 2012]
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2012 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -18,7 +18,7 @@
|
|||||||
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
#if defined(PNG_READ_BGR_SUPPORTED) || defined(PNG_WRITE_BGR_SUPPORTED)
|
||||||
/* Turn on BGR-to-RGB mapping */
|
/* Turn on BGR-to-RGB mapping */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_bgr(png_structp png_ptr)
|
png_set_bgr(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_bgr");
|
png_debug(1, "in png_set_bgr");
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ png_set_bgr(png_structp png_ptr)
|
|||||||
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
#if defined(PNG_READ_SWAP_SUPPORTED) || defined(PNG_WRITE_SWAP_SUPPORTED)
|
||||||
/* Turn on 16 bit byte swapping */
|
/* Turn on 16 bit byte swapping */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_swap(png_structp png_ptr)
|
png_set_swap(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_swap");
|
png_debug(1, "in png_set_swap");
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ png_set_swap(png_structp png_ptr)
|
|||||||
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
#if defined(PNG_READ_PACK_SUPPORTED) || defined(PNG_WRITE_PACK_SUPPORTED)
|
||||||
/* Turn on pixel packing */
|
/* Turn on pixel packing */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_packing(png_structp png_ptr)
|
png_set_packing(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_packing");
|
png_debug(1, "in png_set_packing");
|
||||||
|
|
||||||
@ -57,7 +57,9 @@ png_set_packing(png_structp png_ptr)
|
|||||||
if (png_ptr->bit_depth < 8)
|
if (png_ptr->bit_depth < 8)
|
||||||
{
|
{
|
||||||
png_ptr->transformations |= PNG_PACK;
|
png_ptr->transformations |= PNG_PACK;
|
||||||
|
# ifdef PNG_WRITE_SUPPORTED
|
||||||
png_ptr->usr_bit_depth = 8;
|
png_ptr->usr_bit_depth = 8;
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
@ -65,7 +67,7 @@ png_set_packing(png_structp png_ptr)
|
|||||||
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
#if defined(PNG_READ_PACKSWAP_SUPPORTED)||defined(PNG_WRITE_PACKSWAP_SUPPORTED)
|
||||||
/* Turn on packed pixel swapping */
|
/* Turn on packed pixel swapping */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_packswap(png_structp png_ptr)
|
png_set_packswap(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_packswap");
|
png_debug(1, "in png_set_packswap");
|
||||||
|
|
||||||
@ -79,7 +81,7 @@ png_set_packswap(png_structp png_ptr)
|
|||||||
|
|
||||||
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
#if defined(PNG_READ_SHIFT_SUPPORTED) || defined(PNG_WRITE_SHIFT_SUPPORTED)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_shift(png_structp png_ptr, png_const_color_8p true_bits)
|
png_set_shift(png_structrp png_ptr, png_const_color_8p true_bits)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_shift");
|
png_debug(1, "in png_set_shift");
|
||||||
|
|
||||||
@ -94,11 +96,11 @@ png_set_shift(png_structp png_ptr, png_const_color_8p true_bits)
|
|||||||
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
#if defined(PNG_READ_INTERLACING_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
defined(PNG_WRITE_INTERLACING_SUPPORTED)
|
||||||
int PNGAPI
|
int PNGAPI
|
||||||
png_set_interlace_handling(png_structp png_ptr)
|
png_set_interlace_handling(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_interlace handling");
|
png_debug(1, "in png_set_interlace handling");
|
||||||
|
|
||||||
if (png_ptr && png_ptr->interlaced)
|
if (png_ptr != 0 && png_ptr->interlaced != 0)
|
||||||
{
|
{
|
||||||
png_ptr->transformations |= PNG_INTERLACE;
|
png_ptr->transformations |= PNG_INTERLACE;
|
||||||
return (7);
|
return (7);
|
||||||
@ -115,44 +117,91 @@ png_set_interlace_handling(png_structp png_ptr)
|
|||||||
* that don't like bytes as parameters.
|
* that don't like bytes as parameters.
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_filler(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
png_set_filler(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_filler");
|
png_debug(1, "in png_set_filler");
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
png_ptr->transformations |= PNG_FILLER;
|
/* In libpng 1.6 it is possible to determine whether this is a read or write
|
||||||
|
* operation and therefore to do more checking here for a valid call.
|
||||||
|
*/
|
||||||
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0)
|
||||||
|
{
|
||||||
|
# ifdef PNG_READ_FILLER_SUPPORTED
|
||||||
|
/* On read png_set_filler is always valid, regardless of the base PNG
|
||||||
|
* format, because other transformations can give a format where the
|
||||||
|
* filler code can execute (basically an 8 or 16-bit component RGB or G
|
||||||
|
* format.)
|
||||||
|
*
|
||||||
|
* NOTE: usr_channels is not used by the read code! (This has led to
|
||||||
|
* confusion in the past.) The filler is only used in the read code.
|
||||||
|
*/
|
||||||
png_ptr->filler = (png_uint_16)filler;
|
png_ptr->filler = (png_uint_16)filler;
|
||||||
|
# else
|
||||||
|
png_app_error(png_ptr, "png_set_filler not supported on read");
|
||||||
|
PNG_UNUSED(filler) /* not used in the write case */
|
||||||
|
return;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
else /* write */
|
||||||
|
{
|
||||||
|
# ifdef PNG_WRITE_FILLER_SUPPORTED
|
||||||
|
/* On write the usr_channels parameter must be set correctly at the
|
||||||
|
* start to record the number of channels in the app-supplied data.
|
||||||
|
*/
|
||||||
|
switch (png_ptr->color_type)
|
||||||
|
{
|
||||||
|
case PNG_COLOR_TYPE_RGB:
|
||||||
|
png_ptr->usr_channels = 4;
|
||||||
|
break;
|
||||||
|
|
||||||
|
case PNG_COLOR_TYPE_GRAY:
|
||||||
|
if (png_ptr->bit_depth >= 8)
|
||||||
|
{
|
||||||
|
png_ptr->usr_channels = 2;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
else
|
||||||
|
{
|
||||||
|
/* There simply isn't any code in libpng to strip out bits
|
||||||
|
* from bytes when the components are less than a byte in
|
||||||
|
* size!
|
||||||
|
*/
|
||||||
|
png_app_error(png_ptr,
|
||||||
|
"png_set_filler is invalid for low bit depth gray output");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
png_app_error(png_ptr,
|
||||||
|
"png_set_filler: inappropriate color type");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
# else
|
||||||
|
png_app_error(png_ptr, "png_set_filler not supported on write");
|
||||||
|
return;
|
||||||
|
# endif
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Here on success - libpng supports the operation, set the transformation
|
||||||
|
* and the flag to say where the filler channel is.
|
||||||
|
*/
|
||||||
|
png_ptr->transformations |= PNG_FILLER;
|
||||||
|
|
||||||
if (filler_loc == PNG_FILLER_AFTER)
|
if (filler_loc == PNG_FILLER_AFTER)
|
||||||
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
|
png_ptr->flags |= PNG_FLAG_FILLER_AFTER;
|
||||||
|
|
||||||
else
|
else
|
||||||
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
|
png_ptr->flags &= ~PNG_FLAG_FILLER_AFTER;
|
||||||
|
|
||||||
/* This should probably go in the "do_read_filler" routine.
|
|
||||||
* I attempted to do that in libpng-1.0.1a but that caused problems
|
|
||||||
* so I restored it in libpng-1.0.2a
|
|
||||||
*/
|
|
||||||
|
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_RGB)
|
|
||||||
{
|
|
||||||
png_ptr->usr_channels = 4;
|
|
||||||
}
|
|
||||||
|
|
||||||
/* Also I added this in libpng-1.0.2a (what happens when we expand
|
|
||||||
* a less-than-8-bit grayscale to GA?) */
|
|
||||||
|
|
||||||
if (png_ptr->color_type == PNG_COLOR_TYPE_GRAY && png_ptr->bit_depth >= 8)
|
|
||||||
{
|
|
||||||
png_ptr->usr_channels = 2;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Added to libpng-1.2.7 */
|
/* Added to libpng-1.2.7 */
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
png_set_add_alpha(png_structrp png_ptr, png_uint_32 filler, int filler_loc)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_add_alpha");
|
png_debug(1, "in png_set_add_alpha");
|
||||||
|
|
||||||
@ -160,6 +209,8 @@ png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
png_set_filler(png_ptr, filler, filler_loc);
|
png_set_filler(png_ptr, filler, filler_loc);
|
||||||
|
/* The above may fail to do anything. */
|
||||||
|
if ((png_ptr->transformations & PNG_FILLER) != 0)
|
||||||
png_ptr->transformations |= PNG_ADD_ALPHA;
|
png_ptr->transformations |= PNG_ADD_ALPHA;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,7 +219,7 @@ png_set_add_alpha(png_structp png_ptr, png_uint_32 filler, int filler_loc)
|
|||||||
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
|
#if defined(PNG_READ_SWAP_ALPHA_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
|
defined(PNG_WRITE_SWAP_ALPHA_SUPPORTED)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_swap_alpha(png_structp png_ptr)
|
png_set_swap_alpha(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_swap_alpha");
|
png_debug(1, "in png_set_swap_alpha");
|
||||||
|
|
||||||
@ -182,7 +233,7 @@ png_set_swap_alpha(png_structp png_ptr)
|
|||||||
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
|
#if defined(PNG_READ_INVERT_ALPHA_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
|
defined(PNG_WRITE_INVERT_ALPHA_SUPPORTED)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_invert_alpha(png_structp png_ptr)
|
png_set_invert_alpha(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_invert_alpha");
|
png_debug(1, "in png_set_invert_alpha");
|
||||||
|
|
||||||
@ -195,7 +246,7 @@ png_set_invert_alpha(png_structp png_ptr)
|
|||||||
|
|
||||||
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
|
#if defined(PNG_READ_INVERT_SUPPORTED) || defined(PNG_WRITE_INVERT_SUPPORTED)
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_invert_mono(png_structp png_ptr)
|
png_set_invert_mono(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_invert_mono");
|
png_debug(1, "in png_set_invert_mono");
|
||||||
|
|
||||||
@ -276,9 +327,16 @@ png_do_swap(png_row_infop row_info, png_bytep row)
|
|||||||
|
|
||||||
for (i = 0; i < istop; i++, rp += 2)
|
for (i = 0; i < istop; i++, rp += 2)
|
||||||
{
|
{
|
||||||
|
#ifdef PNG_BUILTIN_BSWAP16_SUPPORTED
|
||||||
|
/* Feature added to libpng-1.6.11 for testing purposes, not
|
||||||
|
* enabled by default.
|
||||||
|
*/
|
||||||
|
*(png_uint_16*)rp = __builtin_bswap16(*(png_uint_16*)rp);
|
||||||
|
#else
|
||||||
png_byte t = *rp;
|
png_byte t = *rp;
|
||||||
*rp = *(rp + 1);
|
*rp = *(rp + 1);
|
||||||
*(rp + 1) = t;
|
*(rp + 1) = t;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -420,7 +478,7 @@ png_do_packswap(png_row_infop row_info, png_bytep row)
|
|||||||
*rp = table[*rp];
|
*rp = table[*rp];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_PACKSWAP_SUPPORTED or PNG_WRITE_PACKSWAP_SUPPORTED */
|
#endif /* PACKSWAP || WRITE_PACKSWAP */
|
||||||
|
|
||||||
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
#if defined(PNG_WRITE_FILLER_SUPPORTED) || \
|
||||||
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
defined(PNG_READ_STRIP_ALPHA_SUPPORTED)
|
||||||
@ -452,7 +510,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||||||
{
|
{
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
if (at_start) /* Skip initial filler */
|
if (at_start != 0) /* Skip initial filler */
|
||||||
++sp;
|
++sp;
|
||||||
else /* Skip initial channel and, for sp, the filler */
|
else /* Skip initial channel and, for sp, the filler */
|
||||||
sp += 2, ++dp;
|
sp += 2, ++dp;
|
||||||
@ -466,7 +524,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||||||
|
|
||||||
else if (row_info->bit_depth == 16)
|
else if (row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
if (at_start) /* Skip initial filler */
|
if (at_start != 0) /* Skip initial filler */
|
||||||
sp += 2;
|
sp += 2;
|
||||||
else /* Skip initial channel and, for sp, the filler */
|
else /* Skip initial channel and, for sp, the filler */
|
||||||
sp += 4, dp += 2;
|
sp += 4, dp += 2;
|
||||||
@ -492,7 +550,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||||||
{
|
{
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
{
|
{
|
||||||
if (at_start) /* Skip initial filler */
|
if (at_start != 0) /* Skip initial filler */
|
||||||
++sp;
|
++sp;
|
||||||
else /* Skip initial channels and, for sp, the filler */
|
else /* Skip initial channels and, for sp, the filler */
|
||||||
sp += 4, dp += 3;
|
sp += 4, dp += 3;
|
||||||
@ -506,7 +564,7 @@ png_do_strip_channel(png_row_infop row_info, png_bytep row, int at_start)
|
|||||||
|
|
||||||
else if (row_info->bit_depth == 16)
|
else if (row_info->bit_depth == 16)
|
||||||
{
|
{
|
||||||
if (at_start) /* Skip initial filler */
|
if (at_start != 0) /* Skip initial filler */
|
||||||
sp += 2;
|
sp += 2;
|
||||||
else /* Skip initial channels and, for sp, the filler */
|
else /* Skip initial channels and, for sp, the filler */
|
||||||
sp += 8, dp += 6;
|
sp += 8, dp += 6;
|
||||||
@ -547,7 +605,7 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
{
|
{
|
||||||
png_debug(1, "in png_do_bgr");
|
png_debug(1, "in png_do_bgr");
|
||||||
|
|
||||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
|
if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
{
|
{
|
||||||
png_uint_32 row_width = row_info->width;
|
png_uint_32 row_width = row_info->width;
|
||||||
if (row_info->bit_depth == 8)
|
if (row_info->bit_depth == 8)
|
||||||
@ -617,16 +675,16 @@ png_do_bgr(png_row_infop row_info, png_bytep row)
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_READ_BGR_SUPPORTED or PNG_WRITE_BGR_SUPPORTED */
|
#endif /* READ_BGR || WRITE_BGR */
|
||||||
|
|
||||||
#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
|
#if defined(PNG_READ_CHECK_FOR_INVALID_INDEX_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
|
defined(PNG_WRITE_CHECK_FOR_INVALID_INDEX_SUPPORTED)
|
||||||
/* Added at libpng-1.5.10 */
|
/* Added at libpng-1.5.10 */
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_check_palette_indexes(png_structp png_ptr, png_row_infop row_info)
|
png_do_check_palette_indexes(png_structrp png_ptr, png_row_infop row_info)
|
||||||
{
|
{
|
||||||
if (png_ptr->num_palette < (1 << row_info->bit_depth) &&
|
if (png_ptr->num_palette < (1 << row_info->bit_depth) &&
|
||||||
png_ptr->num_palette_max >= 0)
|
png_ptr->num_palette > 0) /* num_palette can be 0 in MNG files */
|
||||||
{
|
{
|
||||||
/* Calculations moved outside switch in an attempt to stop different
|
/* Calculations moved outside switch in an attempt to stop different
|
||||||
* compiler warnings. 'padding' is in *bits* within the last byte, it is
|
* compiler warnings. 'padding' is in *bits* within the last byte, it is
|
||||||
@ -708,7 +766,7 @@ png_do_check_palette_indexes(png_structp png_ptr, png_row_infop row_info)
|
|||||||
{
|
{
|
||||||
for (; rp > png_ptr->row_buf; rp--)
|
for (; rp > png_ptr->row_buf; rp--)
|
||||||
{
|
{
|
||||||
if (*rp >= png_ptr->num_palette_max)
|
if (*rp > png_ptr->num_palette_max)
|
||||||
png_ptr->num_palette_max = (int) *rp;
|
png_ptr->num_palette_max = (int) *rp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -720,19 +778,30 @@ png_do_check_palette_indexes(png_structp png_ptr, png_row_infop row_info)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED */
|
#endif /* CHECK_FOR_INVALID_INDEX */
|
||||||
|
|
||||||
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
#if defined(PNG_READ_USER_TRANSFORM_SUPPORTED) || \
|
||||||
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
defined(PNG_WRITE_USER_TRANSFORM_SUPPORTED)
|
||||||
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_user_transform_info(png_structp png_ptr, png_voidp
|
png_set_user_transform_info(png_structrp png_ptr, png_voidp
|
||||||
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
user_transform_ptr, int user_transform_depth, int user_transform_channels)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_set_user_transform_info");
|
png_debug(1, "in png_set_user_transform_info");
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
#ifdef PNG_READ_USER_TRANSFORM_SUPPORTED
|
||||||
|
if ((png_ptr->mode & PNG_IS_READ_STRUCT) != 0 &&
|
||||||
|
(png_ptr->flags & PNG_FLAG_ROW_INIT) != 0)
|
||||||
|
{
|
||||||
|
png_app_error(png_ptr,
|
||||||
|
"info change after png_start_read_image or png_read_update_info");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
png_ptr->user_transform_ptr = user_transform_ptr;
|
png_ptr->user_transform_ptr = user_transform_ptr;
|
||||||
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
png_ptr->user_transform_depth = (png_byte)user_transform_depth;
|
||||||
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
png_ptr->user_transform_channels = (png_byte)user_transform_channels;
|
||||||
@ -746,20 +815,20 @@ png_set_user_transform_info(png_structp png_ptr, png_voidp
|
|||||||
*/
|
*/
|
||||||
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
#ifdef PNG_USER_TRANSFORM_PTR_SUPPORTED
|
||||||
png_voidp PNGAPI
|
png_voidp PNGAPI
|
||||||
png_get_user_transform_ptr(png_const_structp png_ptr)
|
png_get_user_transform_ptr(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return (NULL);
|
return (NULL);
|
||||||
|
|
||||||
return ((png_voidp)png_ptr->user_transform_ptr);
|
return png_ptr->user_transform_ptr;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
|
#ifdef PNG_USER_TRANSFORM_INFO_SUPPORTED
|
||||||
png_uint_32 PNGAPI
|
png_uint_32 PNGAPI
|
||||||
png_get_current_row_number(png_const_structp png_ptr)
|
png_get_current_row_number(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
/* See the comments in png.h - this is the sub-image row when reading and
|
/* See the comments in png.h - this is the sub-image row when reading an
|
||||||
* interlaced image.
|
* interlaced image.
|
||||||
*/
|
*/
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
@ -769,13 +838,12 @@ png_get_current_row_number(png_const_structp png_ptr)
|
|||||||
}
|
}
|
||||||
|
|
||||||
png_byte PNGAPI
|
png_byte PNGAPI
|
||||||
png_get_current_pass_number(png_const_structp png_ptr)
|
png_get_current_pass_number(png_const_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr != NULL)
|
if (png_ptr != NULL)
|
||||||
return png_ptr->pass;
|
return png_ptr->pass;
|
||||||
return 8; /* invalid */
|
return 8; /* invalid */
|
||||||
}
|
}
|
||||||
#endif /* PNG_USER_TRANSFORM_INFO_SUPPORTED */
|
#endif /* USER_TRANSFORM_INFO */
|
||||||
#endif /* PNG_READ_USER_TRANSFORM_SUPPORTED ||
|
#endif /* READ_USER_TRANSFORM || WRITE_USER_TRANSFORM */
|
||||||
PNG_WRITE_USER_TRANSFORM_SUPPORTED */
|
#endif /* READ || WRITE */
|
||||||
#endif /* PNG_READ_SUPPORTED || PNG_WRITE_SUPPORTED */
|
|
||||||
|
114
src/3rdparty/libpng/pngwio.c
vendored
114
src/3rdparty/libpng/pngwio.c
vendored
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngwio.c - functions for data output
|
/* pngwio.c - functions for data output
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.0 [January 6, 2011]
|
* Last changed in libpng 1.6.15 [November 20, 2014]
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2014 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -30,11 +30,12 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_write_data(png_structp png_ptr, png_const_bytep data, png_size_t length)
|
png_write_data(png_structrp png_ptr, png_const_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
/* NOTE: write_data_fn must not change the buffer! */
|
/* NOTE: write_data_fn must not change the buffer! */
|
||||||
if (png_ptr->write_data_fn != NULL )
|
if (png_ptr->write_data_fn != NULL )
|
||||||
(*(png_ptr->write_data_fn))(png_ptr, (png_bytep)data, length);
|
(*(png_ptr->write_data_fn))(png_ptr, png_constcast(png_bytep,data),
|
||||||
|
length);
|
||||||
|
|
||||||
else
|
else
|
||||||
png_error(png_ptr, "Call to NULL write function");
|
png_error(png_ptr, "Call to NULL write function");
|
||||||
@ -46,7 +47,6 @@ png_write_data(png_structp png_ptr, png_const_bytep data, png_size_t length)
|
|||||||
* write_data function and use it at run time with png_set_write_fn(), rather
|
* write_data function and use it at run time with png_set_write_fn(), rather
|
||||||
* than changing the library.
|
* than changing the library.
|
||||||
*/
|
*/
|
||||||
#ifndef USE_FAR_KEYWORD
|
|
||||||
void PNGCBAPI
|
void PNGCBAPI
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
||||||
{
|
{
|
||||||
@ -60,64 +60,6 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
if (check != length)
|
if (check != length)
|
||||||
png_error(png_ptr, "Write Error");
|
png_error(png_ptr, "Write Error");
|
||||||
}
|
}
|
||||||
#else
|
|
||||||
/* This is the model-independent version. Since the standard I/O library
|
|
||||||
* can't handle far buffers in the medium and small models, we have to copy
|
|
||||||
* the data.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#define NEAR_BUF_SIZE 1024
|
|
||||||
#define MIN(a,b) (a <= b ? a : b)
|
|
||||||
|
|
||||||
void PNGCBAPI
|
|
||||||
png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|
||||||
{
|
|
||||||
png_uint_32 check;
|
|
||||||
png_byte *near_data; /* Needs to be "png_byte *" instead of "png_bytep" */
|
|
||||||
png_FILE_p io_ptr;
|
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
/* Check if data really is near. If so, use usual code. */
|
|
||||||
near_data = (png_byte *)CVT_PTR_NOCHECK(data);
|
|
||||||
io_ptr = (png_FILE_p)CVT_PTR(png_ptr->io_ptr);
|
|
||||||
|
|
||||||
if ((png_bytep)near_data == data)
|
|
||||||
{
|
|
||||||
check = fwrite(near_data, 1, length, io_ptr);
|
|
||||||
}
|
|
||||||
|
|
||||||
else
|
|
||||||
{
|
|
||||||
png_byte buf[NEAR_BUF_SIZE];
|
|
||||||
png_size_t written, remaining, err;
|
|
||||||
check = 0;
|
|
||||||
remaining = length;
|
|
||||||
|
|
||||||
do
|
|
||||||
{
|
|
||||||
written = MIN(NEAR_BUF_SIZE, remaining);
|
|
||||||
png_memcpy(buf, data, written); /* Copy far buffer to near buffer */
|
|
||||||
err = fwrite(buf, 1, written, io_ptr);
|
|
||||||
|
|
||||||
if (err != written)
|
|
||||||
break;
|
|
||||||
|
|
||||||
else
|
|
||||||
check += err;
|
|
||||||
|
|
||||||
data += written;
|
|
||||||
remaining -= written;
|
|
||||||
}
|
|
||||||
while (remaining != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (check != length)
|
|
||||||
png_error(png_ptr, "Write Error");
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* This function is called to output any data pending writing (normally
|
/* This function is called to output any data pending writing (normally
|
||||||
@ -126,7 +68,7 @@ png_default_write_data(png_structp png_ptr, png_bytep data, png_size_t length)
|
|||||||
*/
|
*/
|
||||||
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
#ifdef PNG_WRITE_FLUSH_SUPPORTED
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_flush(png_structp png_ptr)
|
png_flush(png_structrp png_ptr)
|
||||||
{
|
{
|
||||||
if (png_ptr->output_flush_fn != NULL)
|
if (png_ptr->output_flush_fn != NULL)
|
||||||
(*(png_ptr->output_flush_fn))(png_ptr);
|
(*(png_ptr->output_flush_fn))(png_ptr);
|
||||||
@ -141,7 +83,7 @@ png_default_flush(png_structp png_ptr)
|
|||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
io_ptr = (png_FILE_p)CVT_PTR((png_ptr->io_ptr));
|
io_ptr = png_voidcast(png_FILE_p, (png_ptr->io_ptr));
|
||||||
fflush(io_ptr);
|
fflush(io_ptr);
|
||||||
}
|
}
|
||||||
# endif
|
# endif
|
||||||
@ -177,7 +119,7 @@ png_default_flush(png_structp png_ptr)
|
|||||||
* *FILE structure.
|
* *FILE structure.
|
||||||
*/
|
*/
|
||||||
void PNGAPI
|
void PNGAPI
|
||||||
png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
png_set_write_fn(png_structrp png_ptr, png_voidp io_ptr,
|
||||||
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
png_rw_ptr write_data_fn, png_flush_ptr output_flush_fn)
|
||||||
{
|
{
|
||||||
if (png_ptr == NULL)
|
if (png_ptr == NULL)
|
||||||
@ -207,8 +149,11 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
# else
|
# else
|
||||||
png_ptr->output_flush_fn = output_flush_fn;
|
png_ptr->output_flush_fn = output_flush_fn;
|
||||||
# endif
|
# endif
|
||||||
#endif /* PNG_WRITE_FLUSH_SUPPORTED */
|
#else
|
||||||
|
PNG_UNUSED(output_flush_fn)
|
||||||
|
#endif /* WRITE_FLUSH */
|
||||||
|
|
||||||
|
#ifdef PNG_READ_SUPPORTED
|
||||||
/* It is an error to read while writing a png file */
|
/* It is an error to read while writing a png file */
|
||||||
if (png_ptr->read_data_fn != NULL)
|
if (png_ptr->read_data_fn != NULL)
|
||||||
{
|
{
|
||||||
@ -218,37 +163,6 @@ png_set_write_fn(png_structp png_ptr, png_voidp io_ptr,
|
|||||||
"Can't set both read_data_fn and write_data_fn in the"
|
"Can't set both read_data_fn and write_data_fn in the"
|
||||||
" same structure");
|
" same structure");
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef USE_FAR_KEYWORD
|
|
||||||
# ifdef _MSC_VER
|
|
||||||
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
|
|
||||||
{
|
|
||||||
void *near_ptr;
|
|
||||||
void FAR *far_ptr;
|
|
||||||
FP_OFF(near_ptr) = FP_OFF(ptr);
|
|
||||||
far_ptr = (void FAR *)near_ptr;
|
|
||||||
|
|
||||||
if (check != 0)
|
|
||||||
if (FP_SEG(ptr) != FP_SEG(far_ptr))
|
|
||||||
png_error(png_ptr, "segment lost in conversion");
|
|
||||||
|
|
||||||
return(near_ptr);
|
|
||||||
}
|
|
||||||
# else
|
|
||||||
void *png_far_to_near(png_structp png_ptr, png_voidp ptr, int check)
|
|
||||||
{
|
|
||||||
void *near_ptr;
|
|
||||||
void FAR *far_ptr;
|
|
||||||
near_ptr = (void FAR *)ptr;
|
|
||||||
far_ptr = (void FAR *)near_ptr;
|
|
||||||
|
|
||||||
if (check != 0)
|
|
||||||
if (far_ptr != ptr)
|
|
||||||
png_error(png_ptr, "segment lost in conversion");
|
|
||||||
|
|
||||||
return(near_ptr);
|
|
||||||
}
|
|
||||||
#endif
|
#endif
|
||||||
#endif
|
}
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
#endif /* WRITE */
|
||||||
|
1732
src/3rdparty/libpng/pngwrite.c
vendored
1732
src/3rdparty/libpng/pngwrite.c
vendored
File diff suppressed because it is too large
Load Diff
259
src/3rdparty/libpng/pngwtran.c
vendored
259
src/3rdparty/libpng/pngwtran.c
vendored
@ -1,8 +1,8 @@
|
|||||||
|
|
||||||
/* pngwtran.c - transforms the data in a row for PNG writers
|
/* pngwtran.c - transforms the data in a row for PNG writers
|
||||||
*
|
*
|
||||||
* Last changed in libpng 1.5.6 [November 3, 2011]
|
* Last changed in libpng 1.6.17 [March 26, 2015]
|
||||||
* Copyright (c) 1998-2011 Glenn Randers-Pehrson
|
* Copyright (c) 1998-2015 Glenn Randers-Pehrson
|
||||||
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
* (Version 0.96 Copyright (c) 1996, 1997 Andreas Dilger)
|
||||||
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
* (Version 0.88 Copyright (c) 1995, 1996 Guy Eric Schalnat, Group 42, Inc.)
|
||||||
*
|
*
|
||||||
@ -14,90 +14,14 @@
|
|||||||
#include "pngpriv.h"
|
#include "pngpriv.h"
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SUPPORTED
|
#ifdef PNG_WRITE_SUPPORTED
|
||||||
|
|
||||||
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
|
#ifdef PNG_WRITE_TRANSFORMS_SUPPORTED
|
||||||
/* Transform the data according to the user's wishes. The order of
|
|
||||||
* transformations is significant.
|
|
||||||
*/
|
|
||||||
void /* PRIVATE */
|
|
||||||
png_do_write_transformations(png_structp png_ptr, png_row_infop row_info)
|
|
||||||
{
|
|
||||||
png_debug(1, "in png_do_write_transformations");
|
|
||||||
|
|
||||||
if (png_ptr == NULL)
|
|
||||||
return;
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_USER_TRANSFORM)
|
|
||||||
if (png_ptr->write_user_transform_fn != NULL)
|
|
||||||
(*(png_ptr->write_user_transform_fn)) /* User write transform
|
|
||||||
function */
|
|
||||||
(png_ptr, /* png_ptr */
|
|
||||||
row_info, /* row_info: */
|
|
||||||
/* png_uint_32 width; width of row */
|
|
||||||
/* png_size_t rowbytes; number of bytes in row */
|
|
||||||
/* png_byte color_type; color type of pixels */
|
|
||||||
/* png_byte bit_depth; bit depth of samples */
|
|
||||||
/* png_byte channels; number of channels (1-4) */
|
|
||||||
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
|
||||||
png_ptr->row_buf + 1); /* start of pixel data for row */
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_FILLER_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_FILLER)
|
|
||||||
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
|
||||||
!(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_PACKSWAP)
|
|
||||||
png_do_packswap(row_info, png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_PACK)
|
|
||||||
png_do_pack(row_info, png_ptr->row_buf + 1,
|
|
||||||
(png_uint_32)png_ptr->bit_depth);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SWAP_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_SWAP_BYTES)
|
|
||||||
png_do_swap(row_info, png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_SHIFT)
|
|
||||||
png_do_shift(row_info, png_ptr->row_buf + 1,
|
|
||||||
&(png_ptr->shift));
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_SWAP_ALPHA)
|
|
||||||
png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_INVERT_ALPHA)
|
|
||||||
png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_BGR_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_BGR)
|
|
||||||
png_do_bgr(row_info, png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_INVERT_SUPPORTED
|
|
||||||
if (png_ptr->transformations & PNG_INVERT_MONO)
|
|
||||||
png_do_invert(row_info, png_ptr->row_buf + 1);
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#ifdef PNG_WRITE_PACK_SUPPORTED
|
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||||
/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
|
/* Pack pixels into bytes. Pass the true bit depth in bit_depth. The
|
||||||
* row_info bit depth should be 8 (one pixel per byte). The channels
|
* row_info bit depth should be 8 (one pixel per byte). The channels
|
||||||
* should be 1 (this only happens on grayscale and paletted images).
|
* should be 1 (this only happens on grayscale and paletted images).
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
static void
|
||||||
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_pack");
|
png_debug(1, "in png_do_pack");
|
||||||
@ -242,7 +166,7 @@ png_do_pack(png_row_infop row_info, png_bytep row, png_uint_32 bit_depth)
|
|||||||
* would pass 3 as bit_depth, and this routine would translate the
|
* would pass 3 as bit_depth, and this routine would translate the
|
||||||
* data to 0 to 15.
|
* data to 0 to 15.
|
||||||
*/
|
*/
|
||||||
void /* PRIVATE */
|
static void
|
||||||
png_do_shift(png_row_infop row_info, png_bytep row,
|
png_do_shift(png_row_infop row_info, png_bytep row,
|
||||||
png_const_color_8p bit_depth)
|
png_const_color_8p bit_depth)
|
||||||
{
|
{
|
||||||
@ -253,7 +177,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
|||||||
int shift_start[4], shift_dec[4];
|
int shift_start[4], shift_dec[4];
|
||||||
int channels = 0;
|
int channels = 0;
|
||||||
|
|
||||||
if (row_info->color_type & PNG_COLOR_MASK_COLOR)
|
if ((row_info->color_type & PNG_COLOR_MASK_COLOR) != 0)
|
||||||
{
|
{
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->red;
|
shift_start[channels] = row_info->bit_depth - bit_depth->red;
|
||||||
shift_dec[channels] = bit_depth->red;
|
shift_dec[channels] = bit_depth->red;
|
||||||
@ -275,7 +199,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
|||||||
channels++;
|
channels++;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (row_info->color_type & PNG_COLOR_MASK_ALPHA)
|
if ((row_info->color_type & PNG_COLOR_MASK_ALPHA) != 0)
|
||||||
{
|
{
|
||||||
shift_start[channels] = row_info->bit_depth - bit_depth->alpha;
|
shift_start[channels] = row_info->bit_depth - bit_depth->alpha;
|
||||||
shift_dec[channels] = bit_depth->alpha;
|
shift_dec[channels] = bit_depth->alpha;
|
||||||
@ -287,7 +211,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
|||||||
{
|
{
|
||||||
png_bytep bp = row;
|
png_bytep bp = row;
|
||||||
png_size_t i;
|
png_size_t i;
|
||||||
png_byte mask;
|
unsigned int mask;
|
||||||
png_size_t row_bytes = row_info->rowbytes;
|
png_size_t row_bytes = row_info->rowbytes;
|
||||||
|
|
||||||
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
|
if (bit_depth->gray == 1 && row_info->bit_depth == 2)
|
||||||
@ -301,20 +225,22 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
|||||||
|
|
||||||
for (i = 0; i < row_bytes; i++, bp++)
|
for (i = 0; i < row_bytes; i++, bp++)
|
||||||
{
|
{
|
||||||
png_uint_16 v;
|
|
||||||
int j;
|
int j;
|
||||||
|
unsigned int v, out;
|
||||||
|
|
||||||
v = *bp;
|
v = *bp;
|
||||||
*bp = 0;
|
out = 0;
|
||||||
|
|
||||||
for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0])
|
for (j = shift_start[0]; j > -shift_dec[0]; j -= shift_dec[0])
|
||||||
{
|
{
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
*bp |= (png_byte)((v << j) & 0xff);
|
out |= v << j;
|
||||||
|
|
||||||
else
|
else
|
||||||
*bp |= (png_byte)((v >> (-j)) & mask);
|
out |= (v >> (-j)) & mask;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*bp = (png_byte)(out & 0xff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,21 +253,23 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
|||||||
for (i = 0; i < istop; i++, bp++)
|
for (i = 0; i < istop; i++, bp++)
|
||||||
{
|
{
|
||||||
|
|
||||||
png_uint_16 v;
|
const unsigned int c = i%channels;
|
||||||
int j;
|
int j;
|
||||||
int c = (int)(i%channels);
|
unsigned int v, out;
|
||||||
|
|
||||||
v = *bp;
|
v = *bp;
|
||||||
*bp = 0;
|
out = 0;
|
||||||
|
|
||||||
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
|
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
|
||||||
{
|
{
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
*bp |= (png_byte)((v << j) & 0xff);
|
out |= v << j;
|
||||||
|
|
||||||
else
|
else
|
||||||
*bp |= (png_byte)((v >> (-j)) & 0xff);
|
out |= v >> (-j);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
*bp = (png_byte)(out & 0xff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -353,22 +281,22 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
|||||||
|
|
||||||
for (bp = row, i = 0; i < istop; i++)
|
for (bp = row, i = 0; i < istop; i++)
|
||||||
{
|
{
|
||||||
int c = (int)(i%channels);
|
const unsigned int c = i%channels;
|
||||||
png_uint_16 value, v;
|
|
||||||
int j;
|
int j;
|
||||||
|
unsigned int value, v;
|
||||||
|
|
||||||
v = (png_uint_16)(((png_uint_16)(*bp) << 8) + *(bp + 1));
|
v = png_get_uint_16(bp);
|
||||||
value = 0;
|
value = 0;
|
||||||
|
|
||||||
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
|
for (j = shift_start[c]; j > -shift_dec[c]; j -= shift_dec[c])
|
||||||
{
|
{
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
value |= (png_uint_16)((v << j) & (png_uint_16)0xffff);
|
value |= v << j;
|
||||||
|
|
||||||
else
|
else
|
||||||
value |= (png_uint_16)((v >> (-j)) & (png_uint_16)0xffff);
|
value |= v >> (-j);
|
||||||
}
|
}
|
||||||
*bp++ = (png_byte)(value >> 8);
|
*bp++ = (png_byte)((value >> 8) & 0xff);
|
||||||
*bp++ = (png_byte)(value & 0xff);
|
*bp++ = (png_byte)(value & 0xff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -377,7 +305,7 @@ png_do_shift(png_row_infop row_info, png_bytep row,
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||||
void /* PRIVATE */
|
static void
|
||||||
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_swap_alpha");
|
png_debug(1, "in png_do_write_swap_alpha");
|
||||||
@ -425,7 +353,7 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = save[1];
|
*(dp++) = save[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
#endif /* WRITE_16BIT */
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
@ -464,14 +392,14 @@ png_do_write_swap_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = save[1];
|
*(dp++) = save[1];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
#endif /* WRITE_16BIT */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||||
void /* PRIVATE */
|
static void
|
||||||
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_invert_alpha");
|
png_debug(1, "in png_do_write_invert_alpha");
|
||||||
@ -521,7 +449,7 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
#endif /* WRITE_16BIT */
|
||||||
}
|
}
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
else if (row_info->color_type == PNG_COLOR_TYPE_GRAY_ALPHA)
|
||||||
@ -559,75 +487,88 @@ png_do_write_invert_alpha(png_row_infop row_info, png_bytep row)
|
|||||||
*(dp++) = (png_byte)(255 - *(sp++));
|
*(dp++) = (png_byte)(255 - *(sp++));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
#endif /* WRITE_16BIT */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
#endif /* PNG_WRITE_TRANSFORMS_SUPPORTED */
|
|
||||||
|
|
||||||
#ifdef PNG_MNG_FEATURES_SUPPORTED
|
/* Transform the data according to the user's wishes. The order of
|
||||||
/* Undoes intrapixel differencing */
|
* transformations is significant.
|
||||||
|
*/
|
||||||
void /* PRIVATE */
|
void /* PRIVATE */
|
||||||
png_do_write_intrapixel(png_row_infop row_info, png_bytep row)
|
png_do_write_transformations(png_structrp png_ptr, png_row_infop row_info)
|
||||||
{
|
{
|
||||||
png_debug(1, "in png_do_write_intrapixel");
|
png_debug(1, "in png_do_write_transformations");
|
||||||
|
|
||||||
if ((row_info->color_type & PNG_COLOR_MASK_COLOR))
|
if (png_ptr == NULL)
|
||||||
{
|
|
||||||
int bytes_per_pixel;
|
|
||||||
png_uint_32 row_width = row_info->width;
|
|
||||||
if (row_info->bit_depth == 8)
|
|
||||||
{
|
|
||||||
png_bytep rp;
|
|
||||||
png_uint_32 i;
|
|
||||||
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
|
||||||
bytes_per_pixel = 3;
|
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
|
||||||
bytes_per_pixel = 4;
|
|
||||||
|
|
||||||
else
|
|
||||||
return;
|
return;
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
#ifdef PNG_WRITE_USER_TRANSFORM_SUPPORTED
|
||||||
{
|
if ((png_ptr->transformations & PNG_USER_TRANSFORM) != 0)
|
||||||
*(rp) = (png_byte)((*rp - *(rp + 1)) & 0xff);
|
if (png_ptr->write_user_transform_fn != NULL)
|
||||||
*(rp + 2) = (png_byte)((*(rp + 2) - *(rp + 1)) & 0xff);
|
(*(png_ptr->write_user_transform_fn)) /* User write transform
|
||||||
}
|
function */
|
||||||
}
|
(png_ptr, /* png_ptr */
|
||||||
|
row_info, /* row_info: */
|
||||||
|
/* png_uint_32 width; width of row */
|
||||||
|
/* png_size_t rowbytes; number of bytes in row */
|
||||||
|
/* png_byte color_type; color type of pixels */
|
||||||
|
/* png_byte bit_depth; bit depth of samples */
|
||||||
|
/* png_byte channels; number of channels (1-4) */
|
||||||
|
/* png_byte pixel_depth; bits per pixel (depth*channels) */
|
||||||
|
png_ptr->row_buf + 1); /* start of pixel data for row */
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PNG_WRITE_16BIT_SUPPORTED
|
#ifdef PNG_WRITE_FILLER_SUPPORTED
|
||||||
else if (row_info->bit_depth == 16)
|
if ((png_ptr->transformations & PNG_FILLER) != 0)
|
||||||
{
|
png_do_strip_channel(row_info, png_ptr->row_buf + 1,
|
||||||
png_bytep rp;
|
!(png_ptr->flags & PNG_FLAG_FILLER_AFTER));
|
||||||
png_uint_32 i;
|
#endif
|
||||||
|
|
||||||
if (row_info->color_type == PNG_COLOR_TYPE_RGB)
|
#ifdef PNG_WRITE_PACKSWAP_SUPPORTED
|
||||||
bytes_per_pixel = 6;
|
if ((png_ptr->transformations & PNG_PACKSWAP) != 0)
|
||||||
|
png_do_packswap(row_info, png_ptr->row_buf + 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
else if (row_info->color_type == PNG_COLOR_TYPE_RGB_ALPHA)
|
#ifdef PNG_WRITE_PACK_SUPPORTED
|
||||||
bytes_per_pixel = 8;
|
if ((png_ptr->transformations & PNG_PACK) != 0)
|
||||||
|
png_do_pack(row_info, png_ptr->row_buf + 1,
|
||||||
|
(png_uint_32)png_ptr->bit_depth);
|
||||||
|
#endif
|
||||||
|
|
||||||
else
|
#ifdef PNG_WRITE_SWAP_SUPPORTED
|
||||||
return;
|
# ifdef PNG_16BIT_SUPPORTED
|
||||||
|
if ((png_ptr->transformations & PNG_SWAP_BYTES) != 0)
|
||||||
|
png_do_swap(row_info, png_ptr->row_buf + 1);
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
for (i = 0, rp = row; i < row_width; i++, rp += bytes_per_pixel)
|
#ifdef PNG_WRITE_SHIFT_SUPPORTED
|
||||||
{
|
if ((png_ptr->transformations & PNG_SHIFT) != 0)
|
||||||
png_uint_32 s0 = (*(rp ) << 8) | *(rp + 1);
|
png_do_shift(row_info, png_ptr->row_buf + 1,
|
||||||
png_uint_32 s1 = (*(rp + 2) << 8) | *(rp + 3);
|
&(png_ptr->shift));
|
||||||
png_uint_32 s2 = (*(rp + 4) << 8) | *(rp + 5);
|
#endif
|
||||||
png_uint_32 red = (png_uint_32)((s0 - s1) & 0xffffL);
|
|
||||||
png_uint_32 blue = (png_uint_32)((s2 - s1) & 0xffffL);
|
#ifdef PNG_WRITE_SWAP_ALPHA_SUPPORTED
|
||||||
*(rp ) = (png_byte)((red >> 8) & 0xff);
|
if ((png_ptr->transformations & PNG_SWAP_ALPHA) != 0)
|
||||||
*(rp + 1) = (png_byte)(red & 0xff);
|
png_do_write_swap_alpha(row_info, png_ptr->row_buf + 1);
|
||||||
*(rp + 4) = (png_byte)((blue >> 8) & 0xff);
|
#endif
|
||||||
*(rp + 5) = (png_byte)(blue & 0xff);
|
|
||||||
|
#ifdef PNG_WRITE_INVERT_ALPHA_SUPPORTED
|
||||||
|
if ((png_ptr->transformations & PNG_INVERT_ALPHA) != 0)
|
||||||
|
png_do_write_invert_alpha(row_info, png_ptr->row_buf + 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_BGR_SUPPORTED
|
||||||
|
if ((png_ptr->transformations & PNG_BGR) != 0)
|
||||||
|
png_do_bgr(row_info, png_ptr->row_buf + 1);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifdef PNG_WRITE_INVERT_SUPPORTED
|
||||||
|
if ((png_ptr->transformations & PNG_INVERT_MONO) != 0)
|
||||||
|
png_do_invert(row_info, png_ptr->row_buf + 1);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
#endif /* WRITE_TRANSFORMS */
|
||||||
#endif /* PNG_WRITE_16BIT_SUPPORTED */
|
#endif /* WRITE */
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif /* PNG_MNG_FEATURES_SUPPORTED */
|
|
||||||
#endif /* PNG_WRITE_SUPPORTED */
|
|
||||||
|
1912
src/3rdparty/libpng/pngwutil.c
vendored
1912
src/3rdparty/libpng/pngwutil.c
vendored
File diff suppressed because it is too large
Load Diff
77
src/3rdparty/libpng/qtpatches.diff
vendored
Normal file
77
src/3rdparty/libpng/qtpatches.diff
vendored
Normal file
@ -0,0 +1,77 @@
|
|||||||
|
diff --git a/src/3rdparty/libpng/pnglibconf.h b/src/3rdparty/libpng/pnglibconf.h
|
||||||
|
index b4ec3c3..f0fdcf8 100644
|
||||||
|
--- a/src/3rdparty/libpng/pnglibconf.h
|
||||||
|
+++ b/src/3rdparty/libpng/pnglibconf.h
|
||||||
|
@@ -27,7 +27,9 @@
|
||||||
|
#define PNG_CHECK_FOR_INVALID_INDEX_SUPPORTED
|
||||||
|
#define PNG_COLORSPACE_SUPPORTED
|
||||||
|
#define PNG_CONSOLE_IO_SUPPORTED
|
||||||
|
+#ifndef _WIN32_WCE
|
||||||
|
#define PNG_CONVERT_tIME_SUPPORTED
|
||||||
|
+#endif
|
||||||
|
#define PNG_EASY_ACCESS_SUPPORTED
|
||||||
|
/*#undef PNG_ERROR_NUMBERS_SUPPORTED*/
|
||||||
|
#define PNG_ERROR_TEXT_SUPPORTED
|
||||||
|
@@ -106,12 +108,14 @@
|
||||||
|
#define PNG_SET_OPTION_SUPPORTED
|
||||||
|
#define PNG_SET_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_SET_USER_LIMITS_SUPPORTED
|
||||||
|
+#ifndef _WIN32_WCE
|
||||||
|
#define PNG_SIMPLIFIED_READ_AFIRST_SUPPORTED
|
||||||
|
#define PNG_SIMPLIFIED_READ_BGR_SUPPORTED
|
||||||
|
#define PNG_SIMPLIFIED_READ_SUPPORTED
|
||||||
|
#define PNG_SIMPLIFIED_WRITE_AFIRST_SUPPORTED
|
||||||
|
#define PNG_SIMPLIFIED_WRITE_BGR_SUPPORTED
|
||||||
|
#define PNG_SIMPLIFIED_WRITE_SUPPORTED
|
||||||
|
+#endif
|
||||||
|
#define PNG_STDIO_SUPPORTED
|
||||||
|
#define PNG_STORE_UNKNOWN_CHUNKS_SUPPORTED
|
||||||
|
#define PNG_TEXT_SUPPORTED
|
||||||
|
diff --git a/src/3rdparty/libpng/pngpriv.h b/src/3rdparty/libpng/pngpriv.h
|
||||||
|
index 5980a3f..7185444 100644
|
||||||
|
--- a/src/3rdparty/libpng/pngpriv.h
|
||||||
|
+++ b/src/3rdparty/libpng/pngpriv.h
|
||||||
|
@@ -23,6 +23,12 @@
|
||||||
|
#ifndef PNGPRIV_H
|
||||||
|
#define PNGPRIV_H
|
||||||
|
|
||||||
|
+#ifdef _MSC_VER
|
||||||
|
+# ifndef _CRT_SECURE_NO_DEPRECATE
|
||||||
|
+# define _CRT_SECURE_NO_DEPRECATE
|
||||||
|
+# endif
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/* Feature Test Macros. The following are defined here to ensure that correctly
|
||||||
|
* implemented libraries reveal the APIs libpng needs to build and hide those
|
||||||
|
* that are not needed and potentially damaging to the compilation.
|
||||||
|
@@ -215,6 +221,11 @@
|
||||||
|
# endif
|
||||||
|
#endif /* Setting PNG_BUILD_DLL if required */
|
||||||
|
|
||||||
|
+/* Modfied for usage in Qt: Do not export the libpng APIs */
|
||||||
|
+#ifdef PNG_BUILD_DLL
|
||||||
|
+#undef PNG_BUILD_DLL
|
||||||
|
+#endif
|
||||||
|
+
|
||||||
|
/* See pngconf.h for more details: the builder of the library may set this on
|
||||||
|
* the command line to the right thing for the specific compilation system or it
|
||||||
|
* may be automagically set above (at present we know of no system where it does
|
||||||
|
@@ -426,6 +437,9 @@
|
||||||
|
#if defined(WIN32) || defined(_Windows) || defined(_WINDOWS) || \
|
||||||
|
defined(_WIN32) || defined(__WIN32__)
|
||||||
|
# include <windows.h> /* defines _WINDOWS_ macro */
|
||||||
|
+# if defined(WINAPI_FAMILY) && (WINAPI_FAMILY==WINAPI_FAMILY_APP || WINAPI_FAMILY==WINAPI_FAMILY_PHONE_APP)
|
||||||
|
+# define _WINRT_ /* Define a macro for Windows Runtime builds */
|
||||||
|
+# endif
|
||||||
|
#endif
|
||||||
|
#endif /* PNG_VERSION_INFO_ONLY */
|
||||||
|
|
||||||
|
@@ -436,7 +450,7 @@
|
||||||
|
|
||||||
|
/* Memory model/platform independent fns */
|
||||||
|
#ifndef PNG_ABORT
|
||||||
|
-# ifdef _WINDOWS_
|
||||||
|
+# if (defined(_WINDOWS_) || defined(_WIN32_WCE)) && !defined(_WINRT_)
|
||||||
|
# define PNG_ABORT() ExitProcess(0)
|
||||||
|
# else
|
||||||
|
# define PNG_ABORT() abort()
|
134
src/3rdparty/pcre/pcre_compile.c
vendored
134
src/3rdparty/pcre/pcre_compile.c
vendored
@ -866,6 +866,14 @@ static const pcre_uint8 opcode_possessify[] = {
|
|||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
/* Structure for mutual recursion detection. */
|
||||||
|
|
||||||
|
typedef struct recurse_check {
|
||||||
|
struct recurse_check *prev;
|
||||||
|
const pcre_uchar *group;
|
||||||
|
} recurse_check;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*************************************************
|
/*************************************************
|
||||||
* Find an error text *
|
* Find an error text *
|
||||||
@ -1704,6 +1712,7 @@ Arguments:
|
|||||||
utf TRUE in UTF-8 / UTF-16 / UTF-32 mode
|
utf TRUE in UTF-8 / UTF-16 / UTF-32 mode
|
||||||
atend TRUE if called when the pattern is complete
|
atend TRUE if called when the pattern is complete
|
||||||
cd the "compile data" structure
|
cd the "compile data" structure
|
||||||
|
recurses chain of recurse_check to catch mutual recursion
|
||||||
|
|
||||||
Returns: the fixed length,
|
Returns: the fixed length,
|
||||||
or -1 if there is no fixed length,
|
or -1 if there is no fixed length,
|
||||||
@ -1713,10 +1722,11 @@ Returns: the fixed length,
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
static int
|
static int
|
||||||
find_fixedlength(pcre_uchar *code, BOOL utf, BOOL atend, compile_data *cd)
|
find_fixedlength(pcre_uchar *code, BOOL utf, BOOL atend, compile_data *cd,
|
||||||
|
recurse_check *recurses)
|
||||||
{
|
{
|
||||||
int length = -1;
|
int length = -1;
|
||||||
|
recurse_check this_recurse;
|
||||||
register int branchlength = 0;
|
register int branchlength = 0;
|
||||||
register pcre_uchar *cc = code + 1 + LINK_SIZE;
|
register pcre_uchar *cc = code + 1 + LINK_SIZE;
|
||||||
|
|
||||||
@ -1741,7 +1751,8 @@ for (;;)
|
|||||||
case OP_ONCE:
|
case OP_ONCE:
|
||||||
case OP_ONCE_NC:
|
case OP_ONCE_NC:
|
||||||
case OP_COND:
|
case OP_COND:
|
||||||
d = find_fixedlength(cc + ((op == OP_CBRA)? IMM2_SIZE : 0), utf, atend, cd);
|
d = find_fixedlength(cc + ((op == OP_CBRA)? IMM2_SIZE : 0), utf, atend, cd,
|
||||||
|
recurses);
|
||||||
if (d < 0) return d;
|
if (d < 0) return d;
|
||||||
branchlength += d;
|
branchlength += d;
|
||||||
do cc += GET(cc, 1); while (*cc == OP_ALT);
|
do cc += GET(cc, 1); while (*cc == OP_ALT);
|
||||||
@ -1775,7 +1786,15 @@ for (;;)
|
|||||||
cs = ce = (pcre_uchar *)cd->start_code + GET(cc, 1); /* Start subpattern */
|
cs = ce = (pcre_uchar *)cd->start_code + GET(cc, 1); /* Start subpattern */
|
||||||
do ce += GET(ce, 1); while (*ce == OP_ALT); /* End subpattern */
|
do ce += GET(ce, 1); while (*ce == OP_ALT); /* End subpattern */
|
||||||
if (cc > cs && cc < ce) return -1; /* Recursion */
|
if (cc > cs && cc < ce) return -1; /* Recursion */
|
||||||
d = find_fixedlength(cs + IMM2_SIZE, utf, atend, cd);
|
else /* Check for mutual recursion */
|
||||||
|
{
|
||||||
|
recurse_check *r = recurses;
|
||||||
|
for (r = recurses; r != NULL; r = r->prev) if (r->group == cs) break;
|
||||||
|
if (r != NULL) return -1; /* Mutual recursion */
|
||||||
|
}
|
||||||
|
this_recurse.prev = recurses;
|
||||||
|
this_recurse.group = cs;
|
||||||
|
d = find_fixedlength(cs + IMM2_SIZE, utf, atend, cd, &this_recurse);
|
||||||
if (d < 0) return d;
|
if (d < 0) return d;
|
||||||
branchlength += d;
|
branchlength += d;
|
||||||
cc += 1 + LINK_SIZE;
|
cc += 1 + LINK_SIZE;
|
||||||
@ -2362,11 +2381,6 @@ Arguments:
|
|||||||
Returns: TRUE if what is matched could be empty
|
Returns: TRUE if what is matched could be empty
|
||||||
*/
|
*/
|
||||||
|
|
||||||
typedef struct recurse_check {
|
|
||||||
struct recurse_check *prev;
|
|
||||||
const pcre_uchar *group;
|
|
||||||
} recurse_check;
|
|
||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
could_be_empty_branch(const pcre_uchar *code, const pcre_uchar *endcode,
|
could_be_empty_branch(const pcre_uchar *code, const pcre_uchar *endcode,
|
||||||
BOOL utf, compile_data *cd, recurse_check *recurses)
|
BOOL utf, compile_data *cd, recurse_check *recurses)
|
||||||
@ -2497,8 +2511,8 @@ for (code = first_significant_code(code + PRIV(OP_lengths)[*code], TRUE);
|
|||||||
empty_branch = FALSE;
|
empty_branch = FALSE;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if (!empty_branch && could_be_empty_branch(code, endcode, utf, cd, NULL))
|
if (!empty_branch && could_be_empty_branch(code, endcode, utf, cd,
|
||||||
empty_branch = TRUE;
|
recurses)) empty_branch = TRUE;
|
||||||
code += GET(code, 1);
|
code += GET(code, 1);
|
||||||
}
|
}
|
||||||
while (*code == OP_ALT);
|
while (*code == OP_ALT);
|
||||||
@ -3093,7 +3107,7 @@ Returns: TRUE if the auto-possessification is possible
|
|||||||
|
|
||||||
static BOOL
|
static BOOL
|
||||||
compare_opcodes(const pcre_uchar *code, BOOL utf, const compile_data *cd,
|
compare_opcodes(const pcre_uchar *code, BOOL utf, const compile_data *cd,
|
||||||
const pcre_uint32 *base_list, const pcre_uchar *base_end)
|
const pcre_uint32 *base_list, const pcre_uchar *base_end, int *rec_limit)
|
||||||
{
|
{
|
||||||
pcre_uchar c;
|
pcre_uchar c;
|
||||||
pcre_uint32 list[8];
|
pcre_uint32 list[8];
|
||||||
@ -3110,6 +3124,9 @@ pcre_uint32 chr;
|
|||||||
BOOL accepted, invert_bits;
|
BOOL accepted, invert_bits;
|
||||||
BOOL entered_a_group = FALSE;
|
BOOL entered_a_group = FALSE;
|
||||||
|
|
||||||
|
if (*rec_limit == 0) return FALSE;
|
||||||
|
--(*rec_limit);
|
||||||
|
|
||||||
/* Note: the base_list[1] contains whether the current opcode has greedy
|
/* Note: the base_list[1] contains whether the current opcode has greedy
|
||||||
(represented by a non-zero value) quantifier. This is a different from
|
(represented by a non-zero value) quantifier. This is a different from
|
||||||
other character type lists, which stores here that the character iterator
|
other character type lists, which stores here that the character iterator
|
||||||
@ -3180,7 +3197,8 @@ for(;;)
|
|||||||
|
|
||||||
while (*next_code == OP_ALT)
|
while (*next_code == OP_ALT)
|
||||||
{
|
{
|
||||||
if (!compare_opcodes(code, utf, cd, base_list, base_end)) return FALSE;
|
if (!compare_opcodes(code, utf, cd, base_list, base_end, rec_limit))
|
||||||
|
return FALSE;
|
||||||
code = next_code + 1 + LINK_SIZE;
|
code = next_code + 1 + LINK_SIZE;
|
||||||
next_code += GET(next_code, 1);
|
next_code += GET(next_code, 1);
|
||||||
}
|
}
|
||||||
@ -3200,7 +3218,7 @@ for(;;)
|
|||||||
/* The bracket content will be checked by the
|
/* The bracket content will be checked by the
|
||||||
OP_BRA/OP_CBRA case above. */
|
OP_BRA/OP_CBRA case above. */
|
||||||
next_code += 1 + LINK_SIZE;
|
next_code += 1 + LINK_SIZE;
|
||||||
if (!compare_opcodes(next_code, utf, cd, base_list, base_end))
|
if (!compare_opcodes(next_code, utf, cd, base_list, base_end, rec_limit))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
code += PRIV(OP_lengths)[c];
|
code += PRIV(OP_lengths)[c];
|
||||||
@ -3633,6 +3651,7 @@ register pcre_uchar c;
|
|||||||
const pcre_uchar *end;
|
const pcre_uchar *end;
|
||||||
pcre_uchar *repeat_opcode;
|
pcre_uchar *repeat_opcode;
|
||||||
pcre_uint32 list[8];
|
pcre_uint32 list[8];
|
||||||
|
int rec_limit;
|
||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
@ -3653,7 +3672,8 @@ for (;;)
|
|||||||
get_chr_property_list(code, utf, cd->fcc, list) : NULL;
|
get_chr_property_list(code, utf, cd->fcc, list) : NULL;
|
||||||
list[1] = c == OP_STAR || c == OP_PLUS || c == OP_QUERY || c == OP_UPTO;
|
list[1] = c == OP_STAR || c == OP_PLUS || c == OP_QUERY || c == OP_UPTO;
|
||||||
|
|
||||||
if (end != NULL && compare_opcodes(end, utf, cd, list, end))
|
rec_limit = 1000;
|
||||||
|
if (end != NULL && compare_opcodes(end, utf, cd, list, end, &rec_limit))
|
||||||
{
|
{
|
||||||
switch(c)
|
switch(c)
|
||||||
{
|
{
|
||||||
@ -3709,7 +3729,8 @@ for (;;)
|
|||||||
|
|
||||||
list[1] = (c & 1) == 0;
|
list[1] = (c & 1) == 0;
|
||||||
|
|
||||||
if (compare_opcodes(end, utf, cd, list, end))
|
rec_limit = 1000;
|
||||||
|
if (compare_opcodes(end, utf, cd, list, end, &rec_limit))
|
||||||
{
|
{
|
||||||
switch (c)
|
switch (c)
|
||||||
{
|
{
|
||||||
@ -4208,7 +4229,11 @@ if ((options & PCRE_CASELESS) != 0)
|
|||||||
range. Otherwise, use a recursive call to add the additional range. */
|
range. Otherwise, use a recursive call to add the additional range. */
|
||||||
|
|
||||||
else if (oc < start && od >= start - 1) start = oc; /* Extend downwards */
|
else if (oc < start && od >= start - 1) start = oc; /* Extend downwards */
|
||||||
else if (od > end && oc <= end + 1) end = od; /* Extend upwards */
|
else if (od > end && oc <= end + 1)
|
||||||
|
{
|
||||||
|
end = od; /* Extend upwards */
|
||||||
|
if (end > classbits_end) classbits_end = (end <= 0xff ? end : 0xff);
|
||||||
|
}
|
||||||
else n8 += add_to_class(classbits, uchardptr, options, cd, oc, od);
|
else n8 += add_to_class(classbits, uchardptr, options, cd, oc, od);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5509,6 +5534,12 @@ for (;; ptr++)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* Even though any XCLASS list is now discarded, we must allow for
|
||||||
|
its memory. */
|
||||||
|
|
||||||
|
if (lengthptr != NULL)
|
||||||
|
*lengthptr += (int)(class_uchardata - class_uchardata_base);
|
||||||
|
|
||||||
/* If there are no characters > 255, or they are all to be included or
|
/* If there are no characters > 255, or they are all to be included or
|
||||||
excluded, set the opcode to OP_CLASS or OP_NCLASS, depending on whether the
|
excluded, set the opcode to OP_CLASS or OP_NCLASS, depending on whether the
|
||||||
whole class was negated and whether there were negative specials such as \S
|
whole class was negated and whether there were negative specials such as \S
|
||||||
@ -5907,6 +5938,7 @@ for (;; ptr++)
|
|||||||
{
|
{
|
||||||
register int i;
|
register int i;
|
||||||
int len = (int)(code - previous);
|
int len = (int)(code - previous);
|
||||||
|
size_t base_hwm_offset = save_hwm_offset;
|
||||||
pcre_uchar *bralink = NULL;
|
pcre_uchar *bralink = NULL;
|
||||||
pcre_uchar *brazeroptr = NULL;
|
pcre_uchar *brazeroptr = NULL;
|
||||||
|
|
||||||
@ -6053,20 +6085,20 @@ for (;; ptr++)
|
|||||||
|
|
||||||
while (cd->hwm > cd->start_workspace + cd->workspace_size -
|
while (cd->hwm > cd->start_workspace + cd->workspace_size -
|
||||||
WORK_SIZE_SAFETY_MARGIN -
|
WORK_SIZE_SAFETY_MARGIN -
|
||||||
(this_hwm_offset - save_hwm_offset))
|
(this_hwm_offset - base_hwm_offset))
|
||||||
{
|
{
|
||||||
*errorcodeptr = expand_workspace(cd);
|
*errorcodeptr = expand_workspace(cd);
|
||||||
if (*errorcodeptr != 0) goto FAILED;
|
if (*errorcodeptr != 0) goto FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (hc = (pcre_uchar *)cd->start_workspace + save_hwm_offset;
|
for (hc = (pcre_uchar *)cd->start_workspace + base_hwm_offset;
|
||||||
hc < (pcre_uchar *)cd->start_workspace + this_hwm_offset;
|
hc < (pcre_uchar *)cd->start_workspace + this_hwm_offset;
|
||||||
hc += LINK_SIZE)
|
hc += LINK_SIZE)
|
||||||
{
|
{
|
||||||
PUT(cd->hwm, 0, GET(hc, 0) + len);
|
PUT(cd->hwm, 0, GET(hc, 0) + len);
|
||||||
cd->hwm += LINK_SIZE;
|
cd->hwm += LINK_SIZE;
|
||||||
}
|
}
|
||||||
save_hwm_offset = this_hwm_offset;
|
base_hwm_offset = this_hwm_offset;
|
||||||
code += len;
|
code += len;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -6134,20 +6166,20 @@ for (;; ptr++)
|
|||||||
|
|
||||||
while (cd->hwm > cd->start_workspace + cd->workspace_size -
|
while (cd->hwm > cd->start_workspace + cd->workspace_size -
|
||||||
WORK_SIZE_SAFETY_MARGIN -
|
WORK_SIZE_SAFETY_MARGIN -
|
||||||
(this_hwm_offset - save_hwm_offset))
|
(this_hwm_offset - base_hwm_offset))
|
||||||
{
|
{
|
||||||
*errorcodeptr = expand_workspace(cd);
|
*errorcodeptr = expand_workspace(cd);
|
||||||
if (*errorcodeptr != 0) goto FAILED;
|
if (*errorcodeptr != 0) goto FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (hc = (pcre_uchar *)cd->start_workspace + save_hwm_offset;
|
for (hc = (pcre_uchar *)cd->start_workspace + base_hwm_offset;
|
||||||
hc < (pcre_uchar *)cd->start_workspace + this_hwm_offset;
|
hc < (pcre_uchar *)cd->start_workspace + this_hwm_offset;
|
||||||
hc += LINK_SIZE)
|
hc += LINK_SIZE)
|
||||||
{
|
{
|
||||||
PUT(cd->hwm, 0, GET(hc, 0) + len + ((i != 0)? 2+LINK_SIZE : 1));
|
PUT(cd->hwm, 0, GET(hc, 0) + len + ((i != 0)? 2+LINK_SIZE : 1));
|
||||||
cd->hwm += LINK_SIZE;
|
cd->hwm += LINK_SIZE;
|
||||||
}
|
}
|
||||||
save_hwm_offset = this_hwm_offset;
|
base_hwm_offset = this_hwm_offset;
|
||||||
code += len;
|
code += len;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -6455,15 +6487,25 @@ for (;; ptr++)
|
|||||||
parenthesis forms. */
|
parenthesis forms. */
|
||||||
|
|
||||||
case CHAR_LEFT_PARENTHESIS:
|
case CHAR_LEFT_PARENTHESIS:
|
||||||
newoptions = options;
|
|
||||||
skipbytes = 0;
|
|
||||||
bravalue = OP_CBRA;
|
|
||||||
save_hwm_offset = cd->hwm - cd->start_workspace;
|
|
||||||
reset_bracount = FALSE;
|
|
||||||
|
|
||||||
/* First deal with various "verbs" that can be introduced by '*'. */
|
|
||||||
|
|
||||||
ptr++;
|
ptr++;
|
||||||
|
|
||||||
|
/* First deal with comments. Putting this code right at the start ensures
|
||||||
|
that comments have no bad side effects. */
|
||||||
|
|
||||||
|
if (ptr[0] == CHAR_QUESTION_MARK && ptr[1] == CHAR_NUMBER_SIGN)
|
||||||
|
{
|
||||||
|
ptr += 2;
|
||||||
|
while (*ptr != CHAR_NULL && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
|
||||||
|
if (*ptr == CHAR_NULL)
|
||||||
|
{
|
||||||
|
*errorcodeptr = ERR18;
|
||||||
|
goto FAILED;
|
||||||
|
}
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* Now deal with various "verbs" that can be introduced by '*'. */
|
||||||
|
|
||||||
if (ptr[0] == CHAR_ASTERISK && (ptr[1] == ':'
|
if (ptr[0] == CHAR_ASTERISK && (ptr[1] == ':'
|
||||||
|| (MAX_255(ptr[1]) && ((cd->ctypes[ptr[1]] & ctype_letter) != 0))))
|
|| (MAX_255(ptr[1]) && ((cd->ctypes[ptr[1]] & ctype_letter) != 0))))
|
||||||
{
|
{
|
||||||
@ -6584,10 +6626,18 @@ for (;; ptr++)
|
|||||||
goto FAILED;
|
goto FAILED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Initialize for "real" parentheses */
|
||||||
|
|
||||||
|
newoptions = options;
|
||||||
|
skipbytes = 0;
|
||||||
|
bravalue = OP_CBRA;
|
||||||
|
save_hwm_offset = cd->hwm - cd->start_workspace;
|
||||||
|
reset_bracount = FALSE;
|
||||||
|
|
||||||
/* Deal with the extended parentheses; all are introduced by '?', and the
|
/* Deal with the extended parentheses; all are introduced by '?', and the
|
||||||
appearance of any of them means that this is not a capturing group. */
|
appearance of any of them means that this is not a capturing group. */
|
||||||
|
|
||||||
else if (*ptr == CHAR_QUESTION_MARK)
|
if (*ptr == CHAR_QUESTION_MARK)
|
||||||
{
|
{
|
||||||
int i, set, unset, namelen;
|
int i, set, unset, namelen;
|
||||||
int *optset;
|
int *optset;
|
||||||
@ -6596,17 +6646,6 @@ for (;; ptr++)
|
|||||||
|
|
||||||
switch (*(++ptr))
|
switch (*(++ptr))
|
||||||
{
|
{
|
||||||
case CHAR_NUMBER_SIGN: /* Comment; skip to ket */
|
|
||||||
ptr++;
|
|
||||||
while (*ptr != CHAR_NULL && *ptr != CHAR_RIGHT_PARENTHESIS) ptr++;
|
|
||||||
if (*ptr == CHAR_NULL)
|
|
||||||
{
|
|
||||||
*errorcodeptr = ERR18;
|
|
||||||
goto FAILED;
|
|
||||||
}
|
|
||||||
continue;
|
|
||||||
|
|
||||||
|
|
||||||
/* ------------------------------------------------------------ */
|
/* ------------------------------------------------------------ */
|
||||||
case CHAR_VERTICAL_LINE: /* Reset capture count for each branch */
|
case CHAR_VERTICAL_LINE: /* Reset capture count for each branch */
|
||||||
reset_bracount = TRUE;
|
reset_bracount = TRUE;
|
||||||
@ -6655,7 +6694,9 @@ for (;; ptr++)
|
|||||||
if (tempptr[1] == CHAR_QUESTION_MARK &&
|
if (tempptr[1] == CHAR_QUESTION_MARK &&
|
||||||
(tempptr[2] == CHAR_EQUALS_SIGN ||
|
(tempptr[2] == CHAR_EQUALS_SIGN ||
|
||||||
tempptr[2] == CHAR_EXCLAMATION_MARK ||
|
tempptr[2] == CHAR_EXCLAMATION_MARK ||
|
||||||
tempptr[2] == CHAR_LESS_THAN_SIGN))
|
(tempptr[2] == CHAR_LESS_THAN_SIGN &&
|
||||||
|
(tempptr[3] == CHAR_EQUALS_SIGN ||
|
||||||
|
tempptr[3] == CHAR_EXCLAMATION_MARK))))
|
||||||
{
|
{
|
||||||
cd->iscondassert = TRUE;
|
cd->iscondassert = TRUE;
|
||||||
break;
|
break;
|
||||||
@ -8264,7 +8305,7 @@ for (;;)
|
|||||||
int fixed_length;
|
int fixed_length;
|
||||||
*code = OP_END;
|
*code = OP_END;
|
||||||
fixed_length = find_fixedlength(last_branch, (options & PCRE_UTF8) != 0,
|
fixed_length = find_fixedlength(last_branch, (options & PCRE_UTF8) != 0,
|
||||||
FALSE, cd);
|
FALSE, cd, NULL);
|
||||||
DPRINTF(("fixed length = %d\n", fixed_length));
|
DPRINTF(("fixed length = %d\n", fixed_length));
|
||||||
if (fixed_length == -3)
|
if (fixed_length == -3)
|
||||||
{
|
{
|
||||||
@ -8549,6 +8590,7 @@ do {
|
|||||||
case OP_RREF:
|
case OP_RREF:
|
||||||
case OP_DNRREF:
|
case OP_DNRREF:
|
||||||
case OP_DEF:
|
case OP_DEF:
|
||||||
|
case OP_FAIL:
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
default: /* Assertion */
|
default: /* Assertion */
|
||||||
@ -9366,7 +9408,7 @@ if (cd->check_lookbehind)
|
|||||||
int end_op = *be;
|
int end_op = *be;
|
||||||
*be = OP_END;
|
*be = OP_END;
|
||||||
fixed_length = find_fixedlength(cc, (re->options & PCRE_UTF8) != 0, TRUE,
|
fixed_length = find_fixedlength(cc, (re->options & PCRE_UTF8) != 0, TRUE,
|
||||||
cd);
|
cd, NULL);
|
||||||
*be = end_op;
|
*be = end_op;
|
||||||
DPRINTF(("fixed length = %d\n", fixed_length));
|
DPRINTF(("fixed length = %d\n", fixed_length));
|
||||||
if (fixed_length < 0)
|
if (fixed_length < 0)
|
||||||
|
5
src/3rdparty/pcre/pcre_dfa_exec.c
vendored
5
src/3rdparty/pcre/pcre_dfa_exec.c
vendored
@ -2736,9 +2736,10 @@ for (;;)
|
|||||||
condcode == OP_DNRREF)
|
condcode == OP_DNRREF)
|
||||||
return PCRE_ERROR_DFA_UCOND;
|
return PCRE_ERROR_DFA_UCOND;
|
||||||
|
|
||||||
/* The DEFINE condition is always false */
|
/* The DEFINE condition is always false, and the assertion (?!) is
|
||||||
|
converted to OP_FAIL. */
|
||||||
|
|
||||||
if (condcode == OP_DEF)
|
if (condcode == OP_DEF || condcode == OP_FAIL)
|
||||||
{ ADD_ACTIVE(state_offset + codelink + LINK_SIZE + 1, 0); }
|
{ ADD_ACTIVE(state_offset + codelink + LINK_SIZE + 1, 0); }
|
||||||
|
|
||||||
/* The only supported version of OP_RREF is for the value RREF_ANY,
|
/* The only supported version of OP_RREF is for the value RREF_ANY,
|
||||||
|
20
src/3rdparty/pcre/pcre_exec.c
vendored
20
src/3rdparty/pcre/pcre_exec.c
vendored
@ -1376,6 +1376,7 @@ for (;;)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OP_DEF: /* DEFINE - always false */
|
case OP_DEF: /* DEFINE - always false */
|
||||||
|
case OP_FAIL: /* From optimized (?!) condition */
|
||||||
break;
|
break;
|
||||||
|
|
||||||
/* The condition is an assertion. Call match() to evaluate it - setting
|
/* The condition is an assertion. Call match() to evaluate it - setting
|
||||||
@ -3482,7 +3483,7 @@ for (;;)
|
|||||||
if (possessive) continue; /* No backtracking */
|
if (possessive) continue; /* No backtracking */
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
if (eptr == pp) goto TAIL_RECURSE;
|
if (eptr <= pp) goto TAIL_RECURSE;
|
||||||
RMATCH(eptr, ecode, offset_top, md, eptrb, RM23);
|
RMATCH(eptr, ecode, offset_top, md, eptrb, RM23);
|
||||||
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
||||||
#ifdef SUPPORT_UCP
|
#ifdef SUPPORT_UCP
|
||||||
@ -3903,7 +3904,7 @@ for (;;)
|
|||||||
if (possessive) continue; /* No backtracking */
|
if (possessive) continue; /* No backtracking */
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
if (eptr == pp) goto TAIL_RECURSE;
|
if (eptr <= pp) goto TAIL_RECURSE;
|
||||||
RMATCH(eptr, ecode, offset_top, md, eptrb, RM30);
|
RMATCH(eptr, ecode, offset_top, md, eptrb, RM30);
|
||||||
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
||||||
eptr--;
|
eptr--;
|
||||||
@ -4038,7 +4039,7 @@ for (;;)
|
|||||||
if (possessive) continue; /* No backtracking */
|
if (possessive) continue; /* No backtracking */
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
if (eptr == pp) goto TAIL_RECURSE;
|
if (eptr <= pp) goto TAIL_RECURSE;
|
||||||
RMATCH(eptr, ecode, offset_top, md, eptrb, RM34);
|
RMATCH(eptr, ecode, offset_top, md, eptrb, RM34);
|
||||||
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
||||||
eptr--;
|
eptr--;
|
||||||
@ -5609,7 +5610,7 @@ for (;;)
|
|||||||
if (possessive) continue; /* No backtracking */
|
if (possessive) continue; /* No backtracking */
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
if (eptr == pp) goto TAIL_RECURSE;
|
if (eptr <= pp) goto TAIL_RECURSE;
|
||||||
RMATCH(eptr, ecode, offset_top, md, eptrb, RM44);
|
RMATCH(eptr, ecode, offset_top, md, eptrb, RM44);
|
||||||
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
||||||
eptr--;
|
eptr--;
|
||||||
@ -5651,12 +5652,17 @@ for (;;)
|
|||||||
|
|
||||||
if (possessive) continue; /* No backtracking */
|
if (possessive) continue; /* No backtracking */
|
||||||
|
|
||||||
|
/* We use <= pp rather than == pp to detect the start of the run while
|
||||||
|
backtracking because the use of \C in UTF mode can cause BACKCHAR to
|
||||||
|
move back past pp. This is just palliative; the use of \C in UTF mode
|
||||||
|
is fraught with danger. */
|
||||||
|
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
int lgb, rgb;
|
int lgb, rgb;
|
||||||
PCRE_PUCHAR fptr;
|
PCRE_PUCHAR fptr;
|
||||||
|
|
||||||
if (eptr == pp) goto TAIL_RECURSE; /* At start of char run */
|
if (eptr <= pp) goto TAIL_RECURSE; /* At start of char run */
|
||||||
RMATCH(eptr, ecode, offset_top, md, eptrb, RM45);
|
RMATCH(eptr, ecode, offset_top, md, eptrb, RM45);
|
||||||
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
||||||
|
|
||||||
@ -5674,7 +5680,7 @@ for (;;)
|
|||||||
|
|
||||||
for (;;)
|
for (;;)
|
||||||
{
|
{
|
||||||
if (eptr == pp) goto TAIL_RECURSE; /* At start of char run */
|
if (eptr <= pp) goto TAIL_RECURSE; /* At start of char run */
|
||||||
fptr = eptr - 1;
|
fptr = eptr - 1;
|
||||||
if (!utf) c = *fptr; else
|
if (!utf) c = *fptr; else
|
||||||
{
|
{
|
||||||
@ -5924,7 +5930,7 @@ for (;;)
|
|||||||
if (possessive) continue; /* No backtracking */
|
if (possessive) continue; /* No backtracking */
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
if (eptr == pp) goto TAIL_RECURSE;
|
if (eptr <= pp) goto TAIL_RECURSE;
|
||||||
RMATCH(eptr, ecode, offset_top, md, eptrb, RM46);
|
RMATCH(eptr, ecode, offset_top, md, eptrb, RM46);
|
||||||
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
if (rrc != MATCH_NOMATCH) RRETURN(rrc);
|
||||||
eptr--;
|
eptr--;
|
||||||
|
8
src/3rdparty/pcre/pcre_jit_compile.c
vendored
8
src/3rdparty/pcre/pcre_jit_compile.c
vendored
@ -2108,7 +2108,7 @@ sljit_uw *result;
|
|||||||
if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
|
if (SLJIT_UNLIKELY(sljit_get_compiler_error(compiler)))
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
result = (sljit_uw *)SLJIT_MALLOC(size + sizeof(sljit_uw), common->allocator_data);
|
result = (sljit_uw *)SLJIT_MALLOC(size + sizeof(sljit_uw), compiler->allocator_data);
|
||||||
if (SLJIT_UNLIKELY(result == NULL))
|
if (SLJIT_UNLIKELY(result == NULL))
|
||||||
{
|
{
|
||||||
sljit_set_compiler_memory_error(compiler);
|
sljit_set_compiler_memory_error(compiler);
|
||||||
@ -6997,7 +6997,7 @@ cc += GET(cc, 1);
|
|||||||
|
|
||||||
has_alternatives = *cc == OP_ALT;
|
has_alternatives = *cc == OP_ALT;
|
||||||
if (SLJIT_UNLIKELY(opcode == OP_COND || opcode == OP_SCOND))
|
if (SLJIT_UNLIKELY(opcode == OP_COND || opcode == OP_SCOND))
|
||||||
has_alternatives = (*matchingpath == OP_RREF || *matchingpath == OP_DNRREF) ? FALSE : TRUE;
|
has_alternatives = (*matchingpath == OP_RREF || *matchingpath == OP_DNRREF || *matchingpath == OP_FAIL) ? FALSE : TRUE;
|
||||||
|
|
||||||
if (SLJIT_UNLIKELY(opcode == OP_COND) && (*cc == OP_KETRMAX || *cc == OP_KETRMIN))
|
if (SLJIT_UNLIKELY(opcode == OP_COND) && (*cc == OP_KETRMAX || *cc == OP_KETRMIN))
|
||||||
opcode = OP_SCOND;
|
opcode = OP_SCOND;
|
||||||
@ -7255,12 +7255,14 @@ if (opcode == OP_COND || opcode == OP_SCOND)
|
|||||||
add_jump(compiler, &(BACKTRACK_AS(bracket_backtrack)->u.condfailed), JUMP(SLJIT_ZERO));
|
add_jump(compiler, &(BACKTRACK_AS(bracket_backtrack)->u.condfailed), JUMP(SLJIT_ZERO));
|
||||||
matchingpath += 1 + 2 * IMM2_SIZE;
|
matchingpath += 1 + 2 * IMM2_SIZE;
|
||||||
}
|
}
|
||||||
else if (*matchingpath == OP_RREF || *matchingpath == OP_DNRREF)
|
else if (*matchingpath == OP_RREF || *matchingpath == OP_DNRREF || *matchingpath == OP_FAIL)
|
||||||
{
|
{
|
||||||
/* Never has other case. */
|
/* Never has other case. */
|
||||||
BACKTRACK_AS(bracket_backtrack)->u.condfailed = NULL;
|
BACKTRACK_AS(bracket_backtrack)->u.condfailed = NULL;
|
||||||
SLJIT_ASSERT(!has_alternatives);
|
SLJIT_ASSERT(!has_alternatives);
|
||||||
|
|
||||||
|
if (*matchingpath == OP_FAIL)
|
||||||
|
stacksize = 0;
|
||||||
if (*matchingpath == OP_RREF)
|
if (*matchingpath == OP_RREF)
|
||||||
{
|
{
|
||||||
stacksize = GET2(matchingpath, 1);
|
stacksize = GET2(matchingpath, 1);
|
||||||
|
6
src/3rdparty/pcre/sljit/sljitLir.c
vendored
6
src/3rdparty/pcre/sljit/sljitLir.c
vendored
@ -435,6 +435,12 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compile
|
|||||||
SLJIT_FREE(compiler, allocator_data);
|
SLJIT_FREE(compiler, allocator_data);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_compiler_memory_error(struct sljit_compiler *compiler)
|
||||||
|
{
|
||||||
|
if (compiler->error == SLJIT_SUCCESS)
|
||||||
|
compiler->error = SLJIT_ERR_ALLOC_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
#if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
|
#if (defined SLJIT_CONFIG_ARM_THUMB2 && SLJIT_CONFIG_ARM_THUMB2)
|
||||||
SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code)
|
SLJIT_API_FUNC_ATTRIBUTE void sljit_free_code(void* code)
|
||||||
{
|
{
|
||||||
|
12
src/3rdparty/pcre/sljit/sljitLir.h
vendored
12
src/3rdparty/pcre/sljit/sljitLir.h
vendored
@ -429,11 +429,13 @@ SLJIT_API_FUNC_ATTRIBUTE void sljit_free_compiler(struct sljit_compiler *compile
|
|||||||
these checks increases the performance of the compiling process. */
|
these checks increases the performance of the compiling process. */
|
||||||
static SLJIT_INLINE sljit_si sljit_get_compiler_error(struct sljit_compiler *compiler) { return compiler->error; }
|
static SLJIT_INLINE sljit_si sljit_get_compiler_error(struct sljit_compiler *compiler) { return compiler->error; }
|
||||||
|
|
||||||
/* Sets the compiler error code to SLJIT_ERR_ALLOC_FAILED. After
|
/* Sets the compiler error code to SLJIT_ERR_ALLOC_FAILED except
|
||||||
the error code is set, the compiler behaves as if itself detected
|
if an error was detected before. After the error code is set
|
||||||
an allocation failure. This can greatly simplify error management,
|
the compiler behaves as if the allocation failure happened
|
||||||
since only the compiler needs to be checked after compilation. */
|
during an sljit function call. This can greatly simplify error
|
||||||
static SLJIT_INLINE void sljit_set_compiler_memory_error(struct sljit_compiler *compiler) { compiler->error = SLJIT_ERR_ALLOC_FAILED; }
|
checking, since only the compiler status needs to be checked
|
||||||
|
after the compilation. */
|
||||||
|
SLJIT_API_FUNC_ATTRIBUTE void sljit_set_compiler_memory_error(struct sljit_compiler *compiler);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
Allocate a small amount of memory. The size must be <= 64 bytes on 32 bit,
|
Allocate a small amount of memory. The size must be <= 64 bytes on 32 bit,
|
||||||
|
@ -136,7 +136,7 @@
|
|||||||
\image resources.png Building resources into an application
|
\image resources.png Building resources into an application
|
||||||
|
|
||||||
Currently, Qt always stores the data directly in the executable,
|
Currently, Qt always stores the data directly in the executable,
|
||||||
even on Windows and Mac OS X, where the operating system provides
|
even on Windows, OS X, and iOS, where the operating system provides
|
||||||
native support for resources. This might change in a future Qt
|
native support for resources. This might change in a future Qt
|
||||||
release.
|
release.
|
||||||
|
|
||||||
|
@ -921,7 +921,7 @@
|
|||||||
# endif // Q_OS_QNX
|
# endif // Q_OS_QNX
|
||||||
# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) && defined(__GNUC_LIBSTD__) \
|
# if (defined(Q_CC_CLANG) || defined(Q_CC_INTEL)) && defined(Q_OS_MAC) && defined(__GNUC_LIBSTD__) \
|
||||||
&& ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402)
|
&& ((__GNUC_LIBSTD__-0) * 100 + __GNUC_LIBSTD_MINOR__-0 <= 402)
|
||||||
// Mac OS X: Apple has not updated libstdc++ since 2007, which means it does not have
|
// Apple has not updated libstdc++ since 2007, which means it does not have
|
||||||
// <initializer_list> or std::move. Let's disable these features
|
// <initializer_list> or std::move. Let's disable these features
|
||||||
# undef Q_COMPILER_INITIALIZER_LISTS
|
# undef Q_COMPILER_INITIALIZER_LISTS
|
||||||
# undef Q_COMPILER_RVALUE_REFS
|
# undef Q_COMPILER_RVALUE_REFS
|
||||||
@ -937,7 +937,7 @@
|
|||||||
# endif
|
# endif
|
||||||
# endif
|
# endif
|
||||||
# if defined(Q_COMPILER_THREADSAFE_STATICS) && defined(Q_OS_MAC)
|
# if defined(Q_COMPILER_THREADSAFE_STATICS) && defined(Q_OS_MAC)
|
||||||
// Mac OS X: Apple's low-level implementation of the C++ support library
|
// Apple's low-level implementation of the C++ support library
|
||||||
// (libc++abi.dylib, shared between libstdc++ and libc++) has deadlocks. The
|
// (libc++abi.dylib, shared between libstdc++ and libc++) has deadlocks. The
|
||||||
// C++11 standard requires the deadlocks to be removed, so this will eventually
|
// C++11 standard requires the deadlocks to be removed, so this will eventually
|
||||||
// be fixed; for now, let's disable this.
|
// be fixed; for now, let's disable this.
|
||||||
|
@ -111,7 +111,7 @@
|
|||||||
shown in any menus unless specifically set by the
|
shown in any menus unless specifically set by the
|
||||||
QAction::iconVisibleInMenu property.
|
QAction::iconVisibleInMenu property.
|
||||||
Menus that are currently open or menus already created in the native
|
Menus that are currently open or menus already created in the native
|
||||||
Mac OS X menubar \e{may not} pick up a change in this attribute. Changes
|
OS X menubar \e{may not} pick up a change in this attribute. Changes
|
||||||
in the QAction::iconVisibleInMenu property will always be picked up.
|
in the QAction::iconVisibleInMenu property will always be picked up.
|
||||||
|
|
||||||
\value AA_NativeWindows Ensures that widgets have native windows.
|
\value AA_NativeWindows Ensures that widgets have native windows.
|
||||||
@ -129,9 +129,9 @@
|
|||||||
|
|
||||||
\value AA_DontUseNativeMenuBar All menubars created while this attribute is
|
\value AA_DontUseNativeMenuBar All menubars created while this attribute is
|
||||||
set to true won't be used as a native menubar (e.g, the menubar at
|
set to true won't be used as a native menubar (e.g, the menubar at
|
||||||
the top of the main screen on Mac OS X or at the bottom in Windows CE).
|
the top of the main screen on OS X or at the bottom in Windows CE).
|
||||||
|
|
||||||
\value AA_MacDontSwapCtrlAndMeta On Mac OS X by default, Qt swaps the
|
\value AA_MacDontSwapCtrlAndMeta On OS X by default, Qt swaps the
|
||||||
Control and Meta (Command) keys (i.e., whenever Control is pressed, Qt
|
Control and Meta (Command) keys (i.e., whenever Control is pressed, Qt
|
||||||
sends Meta, and whenever Meta is pressed Control is sent). When this
|
sends Meta, and whenever Meta is pressed Control is sent). When this
|
||||||
attribute is true, Qt will not do the flip. \l QKeySequence::StandardKey
|
attribute is true, Qt will not do the flip. \l QKeySequence::StandardKey
|
||||||
@ -294,7 +294,7 @@
|
|||||||
|
|
||||||
\omitvalue KeyboardModifierMask
|
\omitvalue KeyboardModifierMask
|
||||||
|
|
||||||
\note On Mac OS X, the \c ControlModifier value corresponds to
|
\note On OS X, the \c ControlModifier value corresponds to
|
||||||
the Command keys on the Macintosh keyboard, and the \c MetaModifier value
|
the Command keys on the Macintosh keyboard, and the \c MetaModifier value
|
||||||
corresponds to the Control keys. The \c KeypadModifier value will also be set
|
corresponds to the Control keys. The \c KeypadModifier value will also be set
|
||||||
when an arrow key is pressed as the arrow keys are considered part of the
|
when an arrow key is pressed as the arrow keys are considered part of the
|
||||||
@ -312,7 +312,7 @@
|
|||||||
This enum provides shorter names for the keyboard modifier keys
|
This enum provides shorter names for the keyboard modifier keys
|
||||||
supported by Qt.
|
supported by Qt.
|
||||||
|
|
||||||
\note On Mac OS X, the \c CTRL value corresponds to
|
\note On OS X, the \c CTRL value corresponds to
|
||||||
the Command keys on the Macintosh keyboard, and the \c META value
|
the Command keys on the Macintosh keyboard, and the \c META value
|
||||||
corresponds to the Control keys.
|
corresponds to the Control keys.
|
||||||
|
|
||||||
@ -913,34 +913,34 @@
|
|||||||
|
|
||||||
\value WA_MacOpaqueSizeGrip Indicates that the native Carbon size grip
|
\value WA_MacOpaqueSizeGrip Indicates that the native Carbon size grip
|
||||||
should be opaque instead of transparent (the default). This attribute
|
should be opaque instead of transparent (the default). This attribute
|
||||||
is only applicable to Mac OS X and is set by the widget's author.
|
is only applicable to OS X and is set by the widget's author.
|
||||||
|
|
||||||
\value WA_MacShowFocusRect Indicates that this widget should get a
|
\value WA_MacShowFocusRect Indicates that this widget should get a
|
||||||
QFocusFrame around it. Some widgets draw their own focus halo
|
QFocusFrame around it. Some widgets draw their own focus halo
|
||||||
regardless of this attribute. Not that the QWidget::focusPolicy
|
regardless of this attribute. Not that the QWidget::focusPolicy
|
||||||
also plays the main role in whether something is given focus or
|
also plays the main role in whether something is given focus or
|
||||||
not, this only controls whether or not this gets the focus
|
not, this only controls whether or not this gets the focus
|
||||||
frame. This attribute is only applicable to Mac OS X.
|
frame. This attribute is only applicable to OS X.
|
||||||
|
|
||||||
\value WA_MacNormalSize Indicates the widget should have the
|
\value WA_MacNormalSize Indicates the widget should have the
|
||||||
normal size for widgets in Mac OS X. This attribute is only
|
normal size for widgets in OS X. This attribute is only
|
||||||
applicable to Mac OS X.
|
applicable to OS X.
|
||||||
|
|
||||||
\value WA_MacSmallSize Indicates the widget should have the small
|
\value WA_MacSmallSize Indicates the widget should have the small
|
||||||
size for widgets in Mac OS X. This attribute is only applicable to
|
size for widgets in OS X. This attribute is only applicable to
|
||||||
Mac OS X.
|
OS X.
|
||||||
|
|
||||||
\value WA_MacMiniSize Indicates the widget should have the mini
|
\value WA_MacMiniSize Indicates the widget should have the mini
|
||||||
size for widgets in Mac OS X. This attribute is only applicable to
|
size for widgets in OS X. This attribute is only applicable to
|
||||||
Mac OS X.
|
OS X.
|
||||||
|
|
||||||
\value WA_MacVariableSize Indicates the widget can choose between
|
\value WA_MacVariableSize Indicates the widget can choose between
|
||||||
alternative sizes for widgets to avoid clipping.
|
alternative sizes for widgets to avoid clipping.
|
||||||
This attribute is only applicable to Mac OS X.
|
This attribute is only applicable to OS X.
|
||||||
|
|
||||||
\value WA_MacBrushedMetal Indicates the widget should be drawn in
|
\value WA_MacBrushedMetal Indicates the widget should be drawn in
|
||||||
the brushed metal style as supported by the windowing system. This
|
the brushed metal style as supported by the windowing system. This
|
||||||
attribute is only applicable to Mac OS X.
|
attribute is only applicable to OS X.
|
||||||
|
|
||||||
\omitvalue WA_MacMetalStyle
|
\omitvalue WA_MacMetalStyle
|
||||||
|
|
||||||
@ -1090,14 +1090,14 @@
|
|||||||
\b Warning: This flag must \e never be set or cleared by the widget's author.
|
\b Warning: This flag must \e never be set or cleared by the widget's author.
|
||||||
|
|
||||||
\value WA_WindowModified Indicates that the window is marked as modified.
|
\value WA_WindowModified Indicates that the window is marked as modified.
|
||||||
On some platforms this flag will do nothing, on others (including Mac OS X
|
On some platforms this flag will do nothing, on others (including OS X
|
||||||
and Windows) the window will take a modified appearance. This flag is set
|
and Windows) the window will take a modified appearance. This flag is set
|
||||||
or cleared by QWidget::setWindowModified().
|
or cleared by QWidget::setWindowModified().
|
||||||
|
|
||||||
\value WA_WindowPropagation Makes a toplevel window inherit font and
|
\value WA_WindowPropagation Makes a toplevel window inherit font and
|
||||||
palette from its parent.
|
palette from its parent.
|
||||||
|
|
||||||
\value WA_MacAlwaysShowToolWindow On Mac OS X, show the tool window even
|
\value WA_MacAlwaysShowToolWindow On OS X, show the tool window even
|
||||||
when the application is not active. By default, all tool windows are
|
when the application is not active. By default, all tool windows are
|
||||||
hidden when the application is inactive.
|
hidden when the application is inactive.
|
||||||
|
|
||||||
@ -1280,8 +1280,8 @@
|
|||||||
\value Key_PageUp
|
\value Key_PageUp
|
||||||
\value Key_PageDown
|
\value Key_PageDown
|
||||||
\value Key_Shift
|
\value Key_Shift
|
||||||
\value Key_Control On Mac OS X, this corresponds to the Command keys.
|
\value Key_Control On OS X, this corresponds to the Command keys.
|
||||||
\value Key_Meta On Mac OS X, this corresponds to the Control keys.
|
\value Key_Meta On OS X, this corresponds to the Control keys.
|
||||||
On Windows keyboards, this key is mapped to the
|
On Windows keyboards, this key is mapped to the
|
||||||
Windows key.
|
Windows key.
|
||||||
\value Key_Alt
|
\value Key_Alt
|
||||||
@ -1919,7 +1919,7 @@
|
|||||||
\value TabFocus the widget accepts focus by tabbing.
|
\value TabFocus the widget accepts focus by tabbing.
|
||||||
\value ClickFocus the widget accepts focus by clicking.
|
\value ClickFocus the widget accepts focus by clicking.
|
||||||
\value StrongFocus the widget accepts focus by both tabbing
|
\value StrongFocus the widget accepts focus by both tabbing
|
||||||
and clicking. On Mac OS X this will also
|
and clicking. On OS X this will also
|
||||||
be indicate that the widget accepts tab focus
|
be indicate that the widget accepts tab focus
|
||||||
when in 'Text/List focus mode'.
|
when in 'Text/List focus mode'.
|
||||||
\value WheelFocus like Qt::StrongFocus plus the widget accepts
|
\value WheelFocus like Qt::StrongFocus plus the widget accepts
|
||||||
@ -2025,7 +2025,7 @@
|
|||||||
system supports it, a tool window can be decorated
|
system supports it, a tool window can be decorated
|
||||||
with a somewhat lighter frame. It can also be
|
with a somewhat lighter frame. It can also be
|
||||||
combined with Qt::FramelessWindowHint.
|
combined with Qt::FramelessWindowHint.
|
||||||
On Mac OS X, tool windows correspond to the
|
On OS X, tool windows correspond to the
|
||||||
\l{http://developer.apple.com/documentation/Carbon/Conceptual/HandlingWindowsControls/hitb-wind_cont_concept/chapter_2_section_2.html}{Floating}
|
\l{http://developer.apple.com/documentation/Carbon/Conceptual/HandlingWindowsControls/hitb-wind_cont_concept/chapter_2_section_2.html}{Floating}
|
||||||
class of windows. This means that the window lives on a
|
class of windows. This means that the window lives on a
|
||||||
level above normal windows; it impossible to put a normal
|
level above normal windows; it impossible to put a normal
|
||||||
@ -2114,10 +2114,10 @@
|
|||||||
\value WindowContextHelpButtonHint Adds a context help button to dialogs.
|
\value WindowContextHelpButtonHint Adds a context help button to dialogs.
|
||||||
On some platforms this implies Qt::WindowSystemMenuHint for it to work.
|
On some platforms this implies Qt::WindowSystemMenuHint for it to work.
|
||||||
|
|
||||||
\value MacWindowToolBarButtonHint On Mac OS X adds a tool bar button (i.e.,
|
\value MacWindowToolBarButtonHint On OS X adds a tool bar button (i.e.,
|
||||||
the oblong button that is on the top right of windows that have toolbars).
|
the oblong button that is on the top right of windows that have toolbars).
|
||||||
|
|
||||||
\value WindowFullscreenButtonHint On Mac OS X adds a fullscreen button.
|
\value WindowFullscreenButtonHint On OS X adds a fullscreen button.
|
||||||
|
|
||||||
\value BypassGraphicsProxyWidget Prevents the window and its children from
|
\value BypassGraphicsProxyWidget Prevents the window and its children from
|
||||||
automatically embedding themselves into a QGraphicsProxyWidget if the
|
automatically embedding themselves into a QGraphicsProxyWidget if the
|
||||||
@ -2141,7 +2141,7 @@
|
|||||||
that support _NET_WM_STATE_BELOW atom. If a window always
|
that support _NET_WM_STATE_BELOW atom. If a window always
|
||||||
on the bottom has a parent, the parent will also be left on
|
on the bottom has a parent, the parent will also be left on
|
||||||
the bottom. This window hint is currently not implemented
|
the bottom. This window hint is currently not implemented
|
||||||
for Mac OS X.
|
for OS X.
|
||||||
|
|
||||||
\value WindowOkButtonHint Adds an OK button to the window decoration of a dialog.
|
\value WindowOkButtonHint Adds an OK button to the window decoration of a dialog.
|
||||||
Only supported for Windows CE.
|
Only supported for Windows CE.
|
||||||
@ -2954,7 +2954,7 @@
|
|||||||
\value CoarseTimer Coarse timers try to keep accuracy within 5% of the desired interval
|
\value CoarseTimer Coarse timers try to keep accuracy within 5% of the desired interval
|
||||||
\value VeryCoarseTimer Very coarse timers only keep full second accuracy
|
\value VeryCoarseTimer Very coarse timers only keep full second accuracy
|
||||||
|
|
||||||
On UNIX (including Linux and Mac OS X), Qt will keep millisecond accuracy
|
On UNIX (including Linux, OS X, and iOS), Qt will keep millisecond accuracy
|
||||||
for Qt::PreciseTimer. For Qt::CoarseTimer, the interval will be adjusted up
|
for Qt::PreciseTimer. For Qt::CoarseTimer, the interval will be adjusted up
|
||||||
to 5% to align the timer with other timers that are expected to fire at or
|
to 5% to align the timer with other timers that are expected to fire at or
|
||||||
around the same time. The objective is to make most timers wake up at the
|
around the same time. The objective is to make most timers wake up at the
|
||||||
|
@ -299,7 +299,7 @@ QAbstractFileEngine *QAbstractFileEngine::create(const QString &fileName)
|
|||||||
the file system (i.e. not a file or directory).
|
the file system (i.e. not a file or directory).
|
||||||
\value FileType The file is a regular file to the file system
|
\value FileType The file is a regular file to the file system
|
||||||
(i.e. not a link or directory)
|
(i.e. not a link or directory)
|
||||||
\value BundleType The file is a Mac OS X bundle implies DirectoryType
|
\value BundleType OS X and iOS: the file is a bundle; implies DirectoryType
|
||||||
\value DirectoryType The file is a directory in the file system
|
\value DirectoryType The file is a directory in the file system
|
||||||
(i.e. not a link or file).
|
(i.e. not a link or file).
|
||||||
|
|
||||||
|
@ -1818,8 +1818,8 @@ QFileInfoList QDir::drives()
|
|||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
Returns the native directory separator: "/" under Unix (including
|
Returns the native directory separator: "/" under Unix
|
||||||
Mac OS X) and "\\" under Windows.
|
and "\\" under Windows.
|
||||||
|
|
||||||
You do not need to use this function to build file paths. If you
|
You do not need to use this function to build file paths. If you
|
||||||
always use "/", Qt will translate your paths to conform to the
|
always use "/", Qt will translate your paths to conform to the
|
||||||
|
@ -199,9 +199,9 @@ QAbstractFileEngine *QFilePrivate::engine() const
|
|||||||
|
|
||||||
\section1 Platform Specific Issues
|
\section1 Platform Specific Issues
|
||||||
|
|
||||||
File permissions are handled differently on Linux/Mac OS X and
|
File permissions are handled differently on Unix-like systems and
|
||||||
Windows. In a non \l{QIODevice::isWritable()}{writable}
|
Windows. In a non \l{QIODevice::isWritable()}{writable}
|
||||||
directory on Linux, files cannot be created. This is not always
|
directory on Unix-like systems, files cannot be created. This is not always
|
||||||
the case on Windows, where, for instance, the 'My Documents'
|
the case on Windows, where, for instance, the 'My Documents'
|
||||||
directory usually is not writable, but it is still possible to
|
directory usually is not writable, but it is still possible to
|
||||||
create files in it.
|
create files in it.
|
||||||
|
@ -234,7 +234,7 @@ QDateTime &QFileInfoPrivate::getFileTime(QAbstractFileEngine::FileTime request)
|
|||||||
isSymLink(). The symLinkTarget() function provides the name of the file
|
isSymLink(). The symLinkTarget() function provides the name of the file
|
||||||
the symlink points to.
|
the symlink points to.
|
||||||
|
|
||||||
On Unix (including Mac OS X), the symlink has the same size() has
|
On Unix (including OS X and iOS), the symlink has the same size() has
|
||||||
the file it points to, because Unix handles symlinks
|
the file it points to, because Unix handles symlinks
|
||||||
transparently; similarly, opening a symlink using QFile
|
transparently; similarly, opening a symlink using QFile
|
||||||
effectively opens the link's target. For example:
|
effectively opens the link's target. For example:
|
||||||
@ -753,7 +753,7 @@ QString QFileInfo::fileName() const
|
|||||||
\since 4.3
|
\since 4.3
|
||||||
Returns the name of the bundle.
|
Returns the name of the bundle.
|
||||||
|
|
||||||
On Mac OS X this returns the proper localized name for a bundle if the
|
On OS X and iOS this returns the proper localized name for a bundle if the
|
||||||
path isBundle(). On all other platforms an empty QString is returned.
|
path isBundle(). On all other platforms an empty QString is returned.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
@ -1029,7 +1029,7 @@ bool QFileInfo::isDir() const
|
|||||||
/*!
|
/*!
|
||||||
\since 4.3
|
\since 4.3
|
||||||
Returns \c true if this object points to a bundle or to a symbolic
|
Returns \c true if this object points to a bundle or to a symbolic
|
||||||
link to a bundle on Mac OS X; otherwise returns \c false.
|
link to a bundle on OS X and iOS; otherwise returns \c false.
|
||||||
|
|
||||||
\sa isDir(), isSymLink(), isFile()
|
\sa isDir(), isSymLink(), isFile()
|
||||||
*/
|
*/
|
||||||
@ -1050,7 +1050,7 @@ bool QFileInfo::isBundle() const
|
|||||||
Returns \c true if this object points to a symbolic link (or to a
|
Returns \c true if this object points to a symbolic link (or to a
|
||||||
shortcut on Windows); otherwise returns \c false.
|
shortcut on Windows); otherwise returns \c false.
|
||||||
|
|
||||||
On Unix (including Mac OS X), opening a symlink effectively opens
|
On Unix (including OS X and iOS), opening a symlink effectively opens
|
||||||
the \l{symLinkTarget()}{link's target}. On Windows, it opens the \c
|
the \l{symLinkTarget()}{link's target}. On Windows, it opens the \c
|
||||||
.lnk file itself.
|
.lnk file itself.
|
||||||
|
|
||||||
|
@ -323,7 +323,7 @@ void QFileSystemMetaData::fillFromDirEnt(const QT_DIRENT &entry)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
#elif defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4)
|
#elif defined(_DIRENT_HAVE_D_TYPE) || defined(Q_OS_BSD4)
|
||||||
// BSD4 includes Mac OS X
|
// BSD4 includes OS X and iOS
|
||||||
|
|
||||||
// ### This will clear all entry flags and knownFlagsMask
|
// ### This will clear all entry flags and knownFlagsMask
|
||||||
switch (entry.d_type)
|
switch (entry.d_type)
|
||||||
|
@ -432,7 +432,7 @@ bool QFileSystemEngine::fillMetaData(const QFileSystemEntry &entry, QFileSystemM
|
|||||||
what |= QFileSystemMetaData::DirectoryType;
|
what |= QFileSystemMetaData::DirectoryType;
|
||||||
}
|
}
|
||||||
if (what & QFileSystemMetaData::HiddenAttribute) {
|
if (what & QFileSystemMetaData::HiddenAttribute) {
|
||||||
// Mac OS >= 10.5: st_flags & UF_HIDDEN
|
// OS X >= 10.5: st_flags & UF_HIDDEN
|
||||||
what |= QFileSystemMetaData::PosixStatFlags;
|
what |= QFileSystemMetaData::PosixStatFlags;
|
||||||
}
|
}
|
||||||
#endif // defined(Q_OS_MACX)
|
#endif // defined(Q_OS_MACX)
|
||||||
|
@ -185,7 +185,7 @@ void QFileSystemWatcherPrivate::_q_directoryChanged(const QString &path, bool re
|
|||||||
the file system monitor. Also note that your process may have
|
the file system monitor. Also note that your process may have
|
||||||
other file descriptors open in addition to the ones for files
|
other file descriptors open in addition to the ones for files
|
||||||
being monitored, and these other open descriptors also count in
|
being monitored, and these other open descriptors also count in
|
||||||
the total. Mac OS X 10.5 and up use a different backend and do not
|
the total. OS X 10.5 and up use a different backend and do not
|
||||||
suffer from this issue.
|
suffer from this issue.
|
||||||
|
|
||||||
|
|
||||||
|
@ -603,7 +603,7 @@ qint64 QFSFileEnginePrivate::readFdFh(char *data, qint64 len)
|
|||||||
result = fread(data + readBytes, 1, size_t(len - readBytes), fh);
|
result = fread(data + readBytes, 1, size_t(len - readBytes), fh);
|
||||||
eof = feof(fh);
|
eof = feof(fh);
|
||||||
if (retry && eof && result == 0) {
|
if (retry && eof && result == 0) {
|
||||||
// On Mac OS, this is needed, e.g., if a file was written to
|
// On OS X, this is needed, e.g., if a file was written to
|
||||||
// through another stream since our last read. See test
|
// through another stream since our last read. See test
|
||||||
// tst_QFile::appendAndRead
|
// tst_QFile::appendAndRead
|
||||||
QT_FSEEK(fh, QT_FTELL(fh), SEEK_SET); // re-sync stream.
|
QT_FSEEK(fh, QT_FTELL(fh), SEEK_SET); // re-sync stream.
|
||||||
@ -875,7 +875,7 @@ bool QFSFileEngine::supportsExtension(Extension extension) const
|
|||||||
|
|
||||||
/*! \fn QFileInfoList QFSFileEngine::drives()
|
/*! \fn QFileInfoList QFSFileEngine::drives()
|
||||||
For Windows, returns the list of drives in the file system as a list
|
For Windows, returns the list of drives in the file system as a list
|
||||||
of QFileInfo objects. On unix, Mac OS X and Windows CE, only the
|
of QFileInfo objects. On Unix and Windows CE, only the
|
||||||
root path is returned. On Windows, this function returns all drives
|
root path is returned. On Windows, this function returns all drives
|
||||||
(A:\, C:\, D:\, etc.).
|
(A:\, C:\, D:\, etc.).
|
||||||
|
|
||||||
|
@ -666,7 +666,7 @@ bool QIODevice::seek(qint64 pos)
|
|||||||
For some devices, atEnd() can return true even though there is more data
|
For some devices, atEnd() can return true even though there is more data
|
||||||
to read. This special case only applies to devices that generate data in
|
to read. This special case only applies to devices that generate data in
|
||||||
direct response to you calling read() (e.g., \c /dev or \c /proc files on
|
direct response to you calling read() (e.g., \c /dev or \c /proc files on
|
||||||
Unix and Mac OS X, or console input / \c stdin on all platforms).
|
Unix and OS X, or console input / \c stdin on all platforms).
|
||||||
|
|
||||||
\sa bytesAvailable(), read(), isSequential()
|
\sa bytesAvailable(), read(), isSequential()
|
||||||
*/
|
*/
|
||||||
|
@ -102,7 +102,7 @@ static QBasicAtomicInt fcntlOK = Q_BASIC_ATOMIC_INITIALIZER(-1);
|
|||||||
/*!
|
/*!
|
||||||
\internal
|
\internal
|
||||||
Checks that the OS isn't using POSIX locks to emulate flock().
|
Checks that the OS isn't using POSIX locks to emulate flock().
|
||||||
Mac OS X is one of those.
|
OS X is one of those.
|
||||||
*/
|
*/
|
||||||
static bool fcntlWorksAfterFlock()
|
static bool fcntlWorksAfterFlock()
|
||||||
{
|
{
|
||||||
|
@ -159,7 +159,7 @@ static void setBoolLane(QBasicAtomicInt *atomic, bool enable, int shift)
|
|||||||
by QStandardPaths::GenericConfigLocation, e.g.
|
by QStandardPaths::GenericConfigLocation, e.g.
|
||||||
|
|
||||||
\list
|
\list
|
||||||
\li on Mac OS X: \c ~/Library/Preferences
|
\li on OS X and iOS: \c ~/Library/Preferences
|
||||||
\li on Unix: \c ~/.config, \c /etc/xdg
|
\li on Unix: \c ~/.config, \c /etc/xdg
|
||||||
\li on Windows: \c %LOCALAPPDATA%, \c %ProgramData%,
|
\li on Windows: \c %LOCALAPPDATA%, \c %ProgramData%,
|
||||||
\l QCoreApplication::applicationDirPath(),
|
\l QCoreApplication::applicationDirPath(),
|
||||||
|
@ -1915,7 +1915,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
|||||||
Users normally expect an application to remember its settings
|
Users normally expect an application to remember its settings
|
||||||
(window sizes and positions, options, etc.) across sessions. This
|
(window sizes and positions, options, etc.) across sessions. This
|
||||||
information is often stored in the system registry on Windows,
|
information is often stored in the system registry on Windows,
|
||||||
and in XML preferences files on Mac OS X. On Unix systems, in the
|
and in property list files on OS X and iOS. On Unix systems, in the
|
||||||
absence of a standard, many applications (including the KDE
|
absence of a standard, many applications (including the KDE
|
||||||
applications) use INI text files.
|
applications) use INI text files.
|
||||||
|
|
||||||
@ -1960,8 +1960,8 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
|||||||
\snippet settings/settings.cpp 4
|
\snippet settings/settings.cpp 4
|
||||||
|
|
||||||
(Here, we also specify the organization's Internet domain. When
|
(Here, we also specify the organization's Internet domain. When
|
||||||
the Internet domain is set, it is used on Mac OS X instead of the
|
the Internet domain is set, it is used on OS X and iOS instead of the
|
||||||
organization name, since Mac OS X applications conventionally use
|
organization name, since OS X and iOS applications conventionally use
|
||||||
Internet domains to identify themselves. If no domain is set, a
|
Internet domains to identify themselves. If no domain is set, a
|
||||||
fake domain is derived from the organization name. See the
|
fake domain is derived from the organization name. See the
|
||||||
\l{Platform-Specific Notes} below for details.)
|
\l{Platform-Specific Notes} below for details.)
|
||||||
@ -2019,7 +2019,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
|||||||
|
|
||||||
Setting keys can contain any Unicode characters. The Windows
|
Setting keys can contain any Unicode characters. The Windows
|
||||||
registry and INI files use case-insensitive keys, whereas the
|
registry and INI files use case-insensitive keys, whereas the
|
||||||
Carbon Preferences API on Mac OS X uses case-sensitive keys. To
|
CFPreferences API on OS X and iOS uses case-sensitive keys. To
|
||||||
avoid portability problems, follow these simple rules:
|
avoid portability problems, follow these simple rules:
|
||||||
|
|
||||||
\list 1
|
\list 1
|
||||||
@ -2222,7 +2222,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
|||||||
in the application's home directory.
|
in the application's home directory.
|
||||||
|
|
||||||
If the file format is IniFormat, the following files are
|
If the file format is IniFormat, the following files are
|
||||||
used on Unix and Mac OS X:
|
used on Unix, OS X, and iOS:
|
||||||
|
|
||||||
\list 1
|
\list 1
|
||||||
\li \c{$HOME/.config/MySoft/Star Runner.ini} (Qt for Embedded Linux: \c{$HOME/Settings/MySoft/Star Runner.ini})
|
\li \c{$HOME/.config/MySoft/Star Runner.ini} (Qt for Embedded Linux: \c{$HOME/Settings/MySoft/Star Runner.ini})
|
||||||
@ -2250,7 +2250,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
|||||||
in the application's home directory.
|
in the application's home directory.
|
||||||
|
|
||||||
The paths for the \c .ini and \c .conf files can be changed using
|
The paths for the \c .ini and \c .conf files can be changed using
|
||||||
setPath(). On Unix and Mac OS X, the user can override them by
|
setPath(). On Unix, OS X, and iOS the user can override them by
|
||||||
setting the \c XDG_CONFIG_HOME environment variable; see
|
setting the \c XDG_CONFIG_HOME environment variable; see
|
||||||
setPath() for details.
|
setPath() for details.
|
||||||
|
|
||||||
@ -2267,7 +2267,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
|||||||
You can then use the QSettings object to read and write settings
|
You can then use the QSettings object to read and write settings
|
||||||
in the file.
|
in the file.
|
||||||
|
|
||||||
On Mac OS X, you can access XML-based \c .plist files by passing
|
On OS X and iOS, you can access property list \c .plist files by passing
|
||||||
QSettings::NativeFormat as second argument. For example:
|
QSettings::NativeFormat as second argument. For example:
|
||||||
|
|
||||||
\snippet code/src_corelib_io_qsettings.cpp 3
|
\snippet code/src_corelib_io_qsettings.cpp 3
|
||||||
@ -2321,13 +2321,13 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
|||||||
limitations is to store the settings using the IniFormat
|
limitations is to store the settings using the IniFormat
|
||||||
instead of the NativeFormat.
|
instead of the NativeFormat.
|
||||||
|
|
||||||
\li On Mac OS X, allKeys() will return some extra keys for global
|
\li On OS X and iOS, allKeys() will return some extra keys for global
|
||||||
settings that apply to all applications. These keys can be
|
settings that apply to all applications. These keys can be
|
||||||
read using value() but cannot be changed, only shadowed.
|
read using value() but cannot be changed, only shadowed.
|
||||||
Calling setFallbacksEnabled(false) will hide these global
|
Calling setFallbacksEnabled(false) will hide these global
|
||||||
settings.
|
settings.
|
||||||
|
|
||||||
\li On Mac OS X, the CFPreferences API used by QSettings expects
|
\li On OS X and iOS, the CFPreferences API used by QSettings expects
|
||||||
Internet domain names rather than organization names. To
|
Internet domain names rather than organization names. To
|
||||||
provide a uniform API, QSettings derives a fake domain name
|
provide a uniform API, QSettings derives a fake domain name
|
||||||
from the organization name (unless the organization name
|
from the organization name (unless the organization name
|
||||||
@ -2344,7 +2344,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
|||||||
|
|
||||||
\snippet code/src_corelib_io_qsettings.cpp 7
|
\snippet code/src_corelib_io_qsettings.cpp 7
|
||||||
|
|
||||||
\li On Mac OS X, permissions to access settings not belonging to the
|
\li On OS X, permissions to access settings not belonging to the
|
||||||
current user (i.e. SystemScope) have changed with 10.7 (Lion). Prior to
|
current user (i.e. SystemScope) have changed with 10.7 (Lion). Prior to
|
||||||
that version, users having admin rights could access these. For 10.7 and
|
that version, users having admin rights could access these. For 10.7 and
|
||||||
10.8 (Mountain Lion), only root can. However, 10.9 (Mavericks) changes
|
10.8 (Mountain Lion), only root can. However, 10.9 (Mavericks) changes
|
||||||
@ -2384,7 +2384,7 @@ void QConfFileSettingsPrivate::ensureSectionParsed(QConfFile *confFile,
|
|||||||
\value NativeFormat Store the settings using the most
|
\value NativeFormat Store the settings using the most
|
||||||
appropriate storage format for the platform.
|
appropriate storage format for the platform.
|
||||||
On Windows, this means the system registry;
|
On Windows, this means the system registry;
|
||||||
on Mac OS X, this means the CFPreferences
|
on OS X and iOS, this means the CFPreferences
|
||||||
API; on Unix, this means textual
|
API; on Unix, this means textual
|
||||||
configuration files in INI format.
|
configuration files in INI format.
|
||||||
\value IniFormat Store the settings in INI files.
|
\value IniFormat Store the settings in INI files.
|
||||||
@ -2547,7 +2547,7 @@ QSettings::QSettings(Format format, Scope scope, const QString &organization,
|
|||||||
|
|
||||||
If \a format is QSettings::NativeFormat, the meaning of \a
|
If \a format is QSettings::NativeFormat, the meaning of \a
|
||||||
fileName depends on the platform. On Unix, \a fileName is the
|
fileName depends on the platform. On Unix, \a fileName is the
|
||||||
name of an INI file. On Mac OS X, \a fileName is the name of a
|
name of an INI file. On OS X and iOS, \a fileName is the name of a
|
||||||
\c .plist file. On Windows, \a fileName is a path in the system
|
\c .plist file. On Windows, \a fileName is a path in the system
|
||||||
registry.
|
registry.
|
||||||
|
|
||||||
@ -2600,7 +2600,7 @@ QSettings::QSettings(const QString &fileName, Format format, QObject *parent)
|
|||||||
called, the QSettings object will not be able to read or write
|
called, the QSettings object will not be able to read or write
|
||||||
any settings, and status() will return AccessError.
|
any settings, and status() will return AccessError.
|
||||||
|
|
||||||
On Mac OS X, if both a name and an Internet domain are specified
|
On OS X and iOS, if both a name and an Internet domain are specified
|
||||||
for the organization, the domain is preferred over the name. On
|
for the organization, the domain is preferred over the name. On
|
||||||
other platforms, the name is preferred over the domain.
|
other platforms, the name is preferred over the domain.
|
||||||
|
|
||||||
@ -3116,7 +3116,7 @@ bool QSettings::isWritable() const
|
|||||||
exists, the previous value is overwritten.
|
exists, the previous value is overwritten.
|
||||||
|
|
||||||
Note that the Windows registry and INI files use case-insensitive
|
Note that the Windows registry and INI files use case-insensitive
|
||||||
keys, whereas the Carbon Preferences API on Mac OS X uses
|
keys, whereas the CFPreferences API on OS X and iOS uses
|
||||||
case-sensitive keys. To avoid portability problems, see the
|
case-sensitive keys. To avoid portability problems, see the
|
||||||
\l{Section and Key Syntax} rules.
|
\l{Section and Key Syntax} rules.
|
||||||
|
|
||||||
@ -3155,7 +3155,7 @@ void QSettings::setValue(const QString &key, const QVariant &value)
|
|||||||
\snippet code/src_corelib_io_qsettings.cpp 25
|
\snippet code/src_corelib_io_qsettings.cpp 25
|
||||||
|
|
||||||
Note that the Windows registry and INI files use case-insensitive
|
Note that the Windows registry and INI files use case-insensitive
|
||||||
keys, whereas the Carbon Preferences API on Mac OS X uses
|
keys, whereas the CFPreferences API on OS X and iOS uses
|
||||||
case-sensitive keys. To avoid portability problems, see the
|
case-sensitive keys. To avoid portability problems, see the
|
||||||
\l{Section and Key Syntax} rules.
|
\l{Section and Key Syntax} rules.
|
||||||
|
|
||||||
@ -3190,7 +3190,7 @@ void QSettings::remove(const QString &key)
|
|||||||
relative to that group.
|
relative to that group.
|
||||||
|
|
||||||
Note that the Windows registry and INI files use case-insensitive
|
Note that the Windows registry and INI files use case-insensitive
|
||||||
keys, whereas the Carbon Preferences API on Mac OS X uses
|
keys, whereas the CFPreferences API on OS X and iOS uses
|
||||||
case-sensitive keys. To avoid portability problems, see the
|
case-sensitive keys. To avoid portability problems, see the
|
||||||
\l{Section and Key Syntax} rules.
|
\l{Section and Key Syntax} rules.
|
||||||
|
|
||||||
@ -3252,7 +3252,7 @@ bool QSettings::event(QEvent *event)
|
|||||||
returned.
|
returned.
|
||||||
|
|
||||||
Note that the Windows registry and INI files use case-insensitive
|
Note that the Windows registry and INI files use case-insensitive
|
||||||
keys, whereas the Carbon Preferences API on Mac OS X uses
|
keys, whereas the CFPreferences API on OS X and iOS uses
|
||||||
case-sensitive keys. To avoid portability problems, see the
|
case-sensitive keys. To avoid portability problems, see the
|
||||||
\l{Section and Key Syntax} rules.
|
\l{Section and Key Syntax} rules.
|
||||||
|
|
||||||
@ -3355,18 +3355,18 @@ void QSettings::setUserIniPath(const QString &dir)
|
|||||||
\row \li SystemScope \li \c /etc/xdg
|
\row \li SystemScope \li \c /etc/xdg
|
||||||
\row \li{1,2} Qt for Embedded Linux \li{1,2} NativeFormat, IniFormat \li UserScope \li \c $HOME/Settings
|
\row \li{1,2} Qt for Embedded Linux \li{1,2} NativeFormat, IniFormat \li UserScope \li \c $HOME/Settings
|
||||||
\row \li SystemScope \li \c /etc/xdg
|
\row \li SystemScope \li \c /etc/xdg
|
||||||
\row \li{1,2} Mac OS X \li{1,2} IniFormat \li UserScope \li \c $HOME/.config
|
\row \li{1,2} OS X and iOS \li{1,2} IniFormat \li UserScope \li \c $HOME/.config
|
||||||
\row \li SystemScope \li \c /etc/xdg
|
\row \li SystemScope \li \c /etc/xdg
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
The default UserScope paths on Unix and Mac OS X (\c
|
The default UserScope paths on Unix, OS X, and iOS (\c
|
||||||
$HOME/.config or $HOME/Settings) can be overridden by the user by setting the
|
$HOME/.config or $HOME/Settings) can be overridden by the user by setting the
|
||||||
\c XDG_CONFIG_HOME environment variable. The default SystemScope
|
\c XDG_CONFIG_HOME environment variable. The default SystemScope
|
||||||
paths on Unix and Mac OS X (\c /etc/xdg) can be overridden when
|
paths on Unix, OS X, and iOS (\c /etc/xdg) can be overridden when
|
||||||
building the Qt library using the \c configure script's \c
|
building the Qt library using the \c configure script's \c
|
||||||
-sysconfdir flag (see QLibraryInfo for details).
|
-sysconfdir flag (see QLibraryInfo for details).
|
||||||
|
|
||||||
Setting the NativeFormat paths on Windows and Mac OS X has no
|
Setting the NativeFormat paths on Windows, OS X, and iOS has no
|
||||||
effect.
|
effect.
|
||||||
|
|
||||||
\warning This function doesn't affect existing QSettings objects.
|
\warning This function doesn't affect existing QSettings objects.
|
||||||
|
@ -696,7 +696,7 @@ QCoreApplication::QCoreApplication(QCoreApplicationPrivate &p)
|
|||||||
|
|
||||||
If you are doing graphical changes inside a loop that does not
|
If you are doing graphical changes inside a loop that does not
|
||||||
return to the event loop on asynchronous window systems like X11
|
return to the event loop on asynchronous window systems like X11
|
||||||
or double buffered window systems like Mac OS X, and you want to
|
or double buffered window systems like Quartz (OS X and iOS), and you want to
|
||||||
visualize these changes immediately (e.g. Splash Screens), call
|
visualize these changes immediately (e.g. Splash Screens), call
|
||||||
this function.
|
this function.
|
||||||
|
|
||||||
@ -2003,7 +2003,7 @@ void QCoreApplicationPrivate::setApplicationFilePath(const QString &path)
|
|||||||
directory, and you run the \c{regexp} example, this function will
|
directory, and you run the \c{regexp} example, this function will
|
||||||
return "C:/Qt/examples/tools/regexp".
|
return "C:/Qt/examples/tools/regexp".
|
||||||
|
|
||||||
On Mac OS X this will point to the directory actually containing the
|
On OS X and iOS this will point to the directory actually containing the
|
||||||
executable, which may be inside of an application bundle (if the
|
executable, which may be inside of an application bundle (if the
|
||||||
application is bundled).
|
application is bundled).
|
||||||
|
|
||||||
|
@ -167,7 +167,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
\value NonClientAreaMouseButtonPress A mouse button press occurred outside the client area.
|
\value NonClientAreaMouseButtonPress A mouse button press occurred outside the client area.
|
||||||
\value NonClientAreaMouseButtonRelease A mouse button release occurred outside the client area.
|
\value NonClientAreaMouseButtonRelease A mouse button release occurred outside the client area.
|
||||||
\value NonClientAreaMouseMove A mouse move occurred outside the client area.
|
\value NonClientAreaMouseMove A mouse move occurred outside the client area.
|
||||||
\value MacSizeChange The user changed his widget sizes (Mac OS X only).
|
\value MacSizeChange The user changed his widget sizes (OS X only).
|
||||||
\value MetaCall An asynchronous method invocation via QMetaObject::invokeMethod().
|
\value MetaCall An asynchronous method invocation via QMetaObject::invokeMethod().
|
||||||
\value ModifiedChange Widgets modification state has been changed.
|
\value ModifiedChange Widgets modification state has been changed.
|
||||||
\value MouseButtonDblClick Mouse press again (QMouseEvent).
|
\value MouseButtonDblClick Mouse press again (QMouseEvent).
|
||||||
@ -211,7 +211,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
\omitvalue ThemeChange
|
\omitvalue ThemeChange
|
||||||
\value ThreadChange The object is moved to another thread. This is the last event sent to this object in the previous thread. See QObject::moveToThread().
|
\value ThreadChange The object is moved to another thread. This is the last event sent to this object in the previous thread. See QObject::moveToThread().
|
||||||
\value Timer Regular timer events (QTimerEvent).
|
\value Timer Regular timer events (QTimerEvent).
|
||||||
\value ToolBarChange The toolbar button is toggled on Mac OS X.
|
\value ToolBarChange The toolbar button is toggled on OS X.
|
||||||
\value ToolTip A tooltip was requested (QHelpEvent).
|
\value ToolTip A tooltip was requested (QHelpEvent).
|
||||||
\value ToolTipChange The widget's tooltip has changed.
|
\value ToolTipChange The widget's tooltip has changed.
|
||||||
\value TouchBegin Beginning of a sequence of touch-screen or track-pad events (QTouchEvent).
|
\value TouchBegin Beginning of a sequence of touch-screen or track-pad events (QTouchEvent).
|
||||||
|
@ -49,6 +49,8 @@
|
|||||||
#define qEventDispatcherDebug QT_NO_QDEBUG_MACRO()
|
#define qEventDispatcherDebug QT_NO_QDEBUG_MACRO()
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
class BpsChannelScopeSwitcher
|
class BpsChannelScopeSwitcher
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
@ -1476,7 +1476,7 @@ void QObject::moveToThread(QThread *targetThread)
|
|||||||
currentData->thread, d->threadData->thread, targetData ? targetData->thread : Q_NULLPTR);
|
currentData->thread, d->threadData->thread, targetData ? targetData->thread : Q_NULLPTR);
|
||||||
|
|
||||||
#ifdef Q_OS_MAC
|
#ifdef Q_OS_MAC
|
||||||
qWarning("On Mac OS X, you might be loading two sets of Qt binaries into the same process. "
|
qWarning("You might be loading two sets of Qt binaries into the same process. "
|
||||||
"Check that all plugins are compiled against the right Qt binaries. Export "
|
"Check that all plugins are compiled against the right Qt binaries. Export "
|
||||||
"DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.");
|
"DYLD_PRINT_LIBRARIES=1 and check that only one set of binaries are being loaded.");
|
||||||
#endif
|
#endif
|
||||||
|
@ -37,6 +37,8 @@
|
|||||||
#include <QDebug>
|
#include <QDebug>
|
||||||
#include <QVariant>
|
#include <QVariant>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
//
|
//
|
||||||
// QPpsAttributePrivate
|
// QPpsAttributePrivate
|
||||||
@ -298,3 +300,5 @@ QDebug operator<<(QDebug dbg, const QPpsAttribute &attribute)
|
|||||||
|
|
||||||
return dbg;
|
return dbg;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
@ -57,8 +57,6 @@ class QPpsAttribute;
|
|||||||
|
|
||||||
typedef QList<QPpsAttribute> QPpsAttributeList;
|
typedef QList<QPpsAttribute> QPpsAttributeList;
|
||||||
typedef QMap<QString, QPpsAttribute> QPpsAttributeMap;
|
typedef QMap<QString, QPpsAttribute> QPpsAttributeMap;
|
||||||
Q_DECLARE_METATYPE(QPpsAttributeList)
|
|
||||||
Q_DECLARE_METATYPE(QPpsAttributeMap)
|
|
||||||
|
|
||||||
class Q_CORE_EXPORT QPpsAttribute
|
class Q_CORE_EXPORT QPpsAttribute
|
||||||
{
|
{
|
||||||
@ -128,4 +126,7 @@ Q_CORE_EXPORT QDebug operator<<(QDebug dbg, const QPpsAttribute &attribute);
|
|||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
Q_DECLARE_METATYPE(QPpsAttributeList)
|
||||||
|
Q_DECLARE_METATYPE(QPpsAttributeMap)
|
||||||
|
|
||||||
#endif // QPPSATTRIBUTE_P_H
|
#endif // QPPSATTRIBUTE_P_H
|
||||||
|
@ -50,6 +50,8 @@
|
|||||||
|
|
||||||
#include <sys/pps.h>
|
#include <sys/pps.h>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////////////////////////
|
||||||
static inline void safeAssign(bool *pointer, bool value)
|
static inline void safeAssign(bool *pointer, bool value)
|
||||||
{
|
{
|
||||||
@ -954,3 +956,5 @@ int QPpsObject::sendMessage(const QString &path, const QByteArray &ppsData)
|
|||||||
|
|
||||||
return EOK;
|
return EOK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
@ -238,7 +238,7 @@ bool QMimeDatabasePrivate::inherits(const QString &mime, const QString &parent)
|
|||||||
|
|
||||||
The MIME type database is provided by the freedesktop.org shared-mime-info
|
The MIME type database is provided by the freedesktop.org shared-mime-info
|
||||||
project. If the MIME type database cannot be found on the system, as is the case
|
project. If the MIME type database cannot be found on the system, as is the case
|
||||||
on most Windows and Mac OS X systems, Qt will use its own copy of it.
|
on most Windows, OS X, and iOS systems, Qt will use its own copy of it.
|
||||||
|
|
||||||
Applications which want to define custom MIME types need to install an
|
Applications which want to define custom MIME types need to install an
|
||||||
XML file into the locations searched for MIME definitions.
|
XML file into the locations searched for MIME definitions.
|
||||||
|
@ -599,7 +599,7 @@ bool QLibraryPrivate::loadPlugin()
|
|||||||
\row \li Unix/Linux \li \c .so
|
\row \li Unix/Linux \li \c .so
|
||||||
\row \li AIX \li \c .a
|
\row \li AIX \li \c .a
|
||||||
\row \li HP-UX \li \c .sl, \c .so (HP-UXi)
|
\row \li HP-UX \li \c .sl, \c .so (HP-UXi)
|
||||||
\row \li Mac OS X \li \c .dylib, \c .bundle, \c .so
|
\row \li OS X and iOS \li \c .dylib, \c .bundle, \c .so
|
||||||
\endtable
|
\endtable
|
||||||
|
|
||||||
Trailing versioning numbers on Unix are ignored.
|
Trailing versioning numbers on Unix are ignored.
|
||||||
@ -836,7 +836,7 @@ QLibrary::QLibrary(QObject *parent)
|
|||||||
We recommend omitting the file's suffix in \a fileName, since
|
We recommend omitting the file's suffix in \a fileName, since
|
||||||
QLibrary will automatically look for the file with the appropriate
|
QLibrary will automatically look for the file with the appropriate
|
||||||
suffix in accordance with the platform, e.g. ".so" on Unix,
|
suffix in accordance with the platform, e.g. ".so" on Unix,
|
||||||
".dylib" on Mac OS X, and ".dll" on Windows. (See \l{fileName}.)
|
".dylib" on OS X and iOS, and ".dll" on Windows. (See \l{fileName}.)
|
||||||
*/
|
*/
|
||||||
QLibrary::QLibrary(const QString& fileName, QObject *parent)
|
QLibrary::QLibrary(const QString& fileName, QObject *parent)
|
||||||
:QObject(parent), d(0), did_load(false)
|
:QObject(parent), d(0), did_load(false)
|
||||||
@ -853,7 +853,7 @@ QLibrary::QLibrary(const QString& fileName, QObject *parent)
|
|||||||
We recommend omitting the file's suffix in \a fileName, since
|
We recommend omitting the file's suffix in \a fileName, since
|
||||||
QLibrary will automatically look for the file with the appropriate
|
QLibrary will automatically look for the file with the appropriate
|
||||||
suffix in accordance with the platform, e.g. ".so" on Unix,
|
suffix in accordance with the platform, e.g. ".so" on Unix,
|
||||||
".dylib" on Mac OS X, and ".dll" on Windows. (See \l{fileName}.)
|
".dylib" on OS X and iOS, and ".dll" on Windows. (See \l{fileName}.)
|
||||||
*/
|
*/
|
||||||
QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent)
|
QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent)
|
||||||
:QObject(parent), d(0), did_load(false)
|
:QObject(parent), d(0), did_load(false)
|
||||||
@ -869,7 +869,7 @@ QLibrary::QLibrary(const QString& fileName, int verNum, QObject *parent)
|
|||||||
We recommend omitting the file's suffix in \a fileName, since
|
We recommend omitting the file's suffix in \a fileName, since
|
||||||
QLibrary will automatically look for the file with the appropriate
|
QLibrary will automatically look for the file with the appropriate
|
||||||
suffix in accordance with the platform, e.g. ".so" on Unix,
|
suffix in accordance with the platform, e.g. ".so" on Unix,
|
||||||
".dylib" on Mac OS X, and ".dll" on Windows. (See \l{fileName}.)
|
".dylib" on OS X and iOS, and ".dll" on Windows. (See \l{fileName}.)
|
||||||
*/
|
*/
|
||||||
QLibrary::QLibrary(const QString& fileName, const QString &version, QObject *parent)
|
QLibrary::QLibrary(const QString& fileName, const QString &version, QObject *parent)
|
||||||
:QObject(parent), d(0), did_load(false)
|
:QObject(parent), d(0), did_load(false)
|
||||||
|
@ -139,7 +139,7 @@ QPluginLoader::QPluginLoader(QObject *parent)
|
|||||||
|
|
||||||
To be loadable, the file's suffix must be a valid suffix for a
|
To be loadable, the file's suffix must be a valid suffix for a
|
||||||
loadable library in accordance with the platform, e.g. \c .so on
|
loadable library in accordance with the platform, e.g. \c .so on
|
||||||
Unix, - \c .dylib on Mac OS X, and \c .dll on Windows. The suffix
|
Unix, - \c .dylib on OS X and iOS, and \c .dll on Windows. The suffix
|
||||||
can be verified with QLibrary::isLibrary().
|
can be verified with QLibrary::isLibrary().
|
||||||
|
|
||||||
\sa setFileName()
|
\sa setFileName()
|
||||||
|
@ -400,7 +400,7 @@ int QThread::idealThreadCount() Q_DECL_NOTHROW
|
|||||||
cores = (int)psd.psd_proc_cnt;
|
cores = (int)psd.psd_proc_cnt;
|
||||||
}
|
}
|
||||||
#elif defined(Q_OS_BSD4)
|
#elif defined(Q_OS_BSD4)
|
||||||
// FreeBSD, OpenBSD, NetBSD, BSD/OS, Mac OS X
|
// FreeBSD, OpenBSD, NetBSD, BSD/OS, OS X, iOS
|
||||||
size_t len = sizeof(cores);
|
size_t len = sizeof(cores);
|
||||||
int mib[2];
|
int mib[2];
|
||||||
mib[0] = CTL_HW;
|
mib[0] = CTL_HW;
|
||||||
|
@ -131,7 +131,7 @@ QT_BEGIN_NAMESPACE
|
|||||||
\value SystemTime The human-readable system time. This clock is not monotonic.
|
\value SystemTime The human-readable system time. This clock is not monotonic.
|
||||||
\value MonotonicClock The system's monotonic clock, usually found in Unix systems. This clock is monotonic and does not overflow.
|
\value MonotonicClock The system's monotonic clock, usually found in Unix systems. This clock is monotonic and does not overflow.
|
||||||
\value TickCounter The system's tick counter, used on Windows systems. This clock may overflow.
|
\value TickCounter The system's tick counter, used on Windows systems. This clock may overflow.
|
||||||
\value MachAbsoluteTime The Mach kernel's absolute time (Mac OS X). This clock is monotonic and does not overflow.
|
\value MachAbsoluteTime The Mach kernel's absolute time (OS X and iOS). This clock is monotonic and does not overflow.
|
||||||
\value PerformanceCounter The high-resolution performance counter provided by Windows. This clock is monotonic and does not overflow.
|
\value PerformanceCounter The high-resolution performance counter provided by Windows. This clock is monotonic and does not overflow.
|
||||||
|
|
||||||
\section2 SystemTime
|
\section2 SystemTime
|
||||||
@ -173,8 +173,8 @@ QT_BEGIN_NAMESPACE
|
|||||||
\section2 MachAbsoluteTime
|
\section2 MachAbsoluteTime
|
||||||
|
|
||||||
This clock type is based on the absolute time presented by Mach kernels,
|
This clock type is based on the absolute time presented by Mach kernels,
|
||||||
such as that found on Mac OS X. This clock type is presented separately
|
such as that found on OS X. This clock type is presented separately
|
||||||
from MonotonicClock since Mac OS X is also a Unix system and may support
|
from MonotonicClock since OS X and iOS are also Unix systems and may support
|
||||||
a POSIX monotonic clock with values differing from the Mach absolute
|
a POSIX monotonic clock with values differing from the Mach absolute
|
||||||
time.
|
time.
|
||||||
|
|
||||||
|
@ -5290,7 +5290,7 @@ int QString::compare_helper(const QChar *data1, int length1, QLatin1String s2,
|
|||||||
platform-dependent manner. Use this function to present sorted
|
platform-dependent manner. Use this function to present sorted
|
||||||
lists of strings to the user.
|
lists of strings to the user.
|
||||||
|
|
||||||
On Mac OS X since Qt 4.3, this function compares according the
|
On OS X and iOS this function compares according the
|
||||||
"Order for sorted lists" setting in the International preferences panel.
|
"Order for sorted lists" setting in the International preferences panel.
|
||||||
|
|
||||||
\sa compare(), QLocale
|
\sa compare(), QLocale
|
||||||
@ -7689,7 +7689,7 @@ QString QString::multiArg(int numArgs, const QString **args) const
|
|||||||
|
|
||||||
Constructs a new QString containing a copy of the \a string CFString.
|
Constructs a new QString containing a copy of the \a string CFString.
|
||||||
|
|
||||||
\note this function is only available on Mac OS X and iOS.
|
\note this function is only available on OS X and iOS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \fn CFStringRef QString::toCFString() const
|
/*! \fn CFStringRef QString::toCFString() const
|
||||||
@ -7698,7 +7698,7 @@ QString QString::multiArg(int numArgs, const QString **args) const
|
|||||||
Creates a CFString from a QString. The caller owns the CFString and is
|
Creates a CFString from a QString. The caller owns the CFString and is
|
||||||
responsible for releasing it.
|
responsible for releasing it.
|
||||||
|
|
||||||
\note this function is only available on Mac OS X and iOS.
|
\note this function is only available on OS X and iOS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \fn QString QString::fromNSString(const NSString *string)
|
/*! \fn QString QString::fromNSString(const NSString *string)
|
||||||
@ -7706,7 +7706,7 @@ QString QString::multiArg(int numArgs, const QString **args) const
|
|||||||
|
|
||||||
Constructs a new QString containing a copy of the \a string NSString.
|
Constructs a new QString containing a copy of the \a string NSString.
|
||||||
|
|
||||||
\note this function is only available on Mac OS X and iOS.
|
\note this function is only available on OS X and iOS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \fn NSString QString::toNSString() const
|
/*! \fn NSString QString::toNSString() const
|
||||||
@ -7714,7 +7714,7 @@ QString QString::multiArg(int numArgs, const QString **args) const
|
|||||||
|
|
||||||
Creates a NSString from a QString. The NSString is autoreleased.
|
Creates a NSString from a QString. The NSString is autoreleased.
|
||||||
|
|
||||||
\note this function is only available on Mac OS X and iOS.
|
\note this function is only available on OS X and iOS.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*! \fn bool QString::isSimpleText() const
|
/*! \fn bool QString::isSimpleText() const
|
||||||
@ -8925,7 +8925,7 @@ QStringRef QStringRef::appendTo(QString *string) const
|
|||||||
platform-dependent manner. Use this function to present sorted
|
platform-dependent manner. Use this function to present sorted
|
||||||
lists of strings to the user.
|
lists of strings to the user.
|
||||||
|
|
||||||
On Mac OS X, this function compares according the
|
On OS X and iOS, this function compares according the
|
||||||
"Order for sorted lists" setting in the International prefereces panel.
|
"Order for sorted lists" setting in the International prefereces panel.
|
||||||
|
|
||||||
\sa compare(), QLocale
|
\sa compare(), QLocale
|
||||||
|
@ -183,7 +183,7 @@ Q_GLOBAL_STATIC(QTimeZoneSingleton, global_tz);
|
|||||||
given moment then you should use a Qt::TimeSpec of Qt::LocalTime.
|
given moment then you should use a Qt::TimeSpec of Qt::LocalTime.
|
||||||
|
|
||||||
The method systemTimeZoneId() returns the current system IANA time zone
|
The method systemTimeZoneId() returns the current system IANA time zone
|
||||||
ID which on OSX and Linux will always be correct. On Windows this ID is
|
ID which on Unix-like systems will always be correct. On Windows this ID is
|
||||||
translated from the Windows system ID using an internal translation
|
translated from the Windows system ID using an internal translation
|
||||||
table and the user's selected country. As a consequence there is a small
|
table and the user's selected country. As a consequence there is a small
|
||||||
chance any Windows install may have IDs not known by Qt, in which case
|
chance any Windows install may have IDs not known by Qt, in which case
|
||||||
|
@ -584,6 +584,6 @@ void QClipboard::emitChanged(Mode mode)
|
|||||||
emit changed(mode);
|
emit changed(mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif // QT_NO_CLIPBOARD
|
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
|
#endif // QT_NO_CLIPBOARD
|
||||||
|
@ -179,7 +179,7 @@ QOpenGLTextureHelper::QOpenGLTextureHelper(QOpenGLContext *context)
|
|||||||
GetTexParameteriv = ::glGetTexParameteriv;
|
GetTexParameteriv = ::glGetTexParameteriv;
|
||||||
GetTexParameterfv = ::glGetTexParameterfv;
|
GetTexParameterfv = ::glGetTexParameterfv;
|
||||||
GetTexImage = 0;
|
GetTexImage = 0;
|
||||||
TexImage2D = ::glTexImage2D;
|
TexImage2D = reinterpret_cast<void (QOPENGLF_APIENTRYP)(GLenum , GLint , GLint , GLsizei , GLsizei , GLint , GLenum , GLenum , const GLvoid *)>(::glTexImage2D);
|
||||||
TexImage1D = 0;
|
TexImage1D = 0;
|
||||||
TexParameteriv = ::glTexParameteriv;
|
TexParameteriv = ::glTexParameteriv;
|
||||||
TexParameteri = ::glTexParameteri;
|
TexParameteri = ::glTexParameteri;
|
||||||
|
@ -287,7 +287,7 @@ void QNetworkReplyNSURLConnectionImpl::readyReadOutgoingData()
|
|||||||
|
|
||||||
if ([response expectedContentLength] != NSURLResponseUnknownLength) {
|
if ([response expectedContentLength] != NSURLResponseUnknownLength) {
|
||||||
QMetaObject::invokeMethod(replyprivate->q_func(), "downloadProgress", Qt::QueuedConnection,
|
QMetaObject::invokeMethod(replyprivate->q_func(), "downloadProgress", Qt::QueuedConnection,
|
||||||
Q_ARG(qint64, qint64([responseData length])),
|
Q_ARG(qint64, qint64([responseData length] + replyprivate->bytesRead)),
|
||||||
Q_ARG(qint64, qint64([response expectedContentLength])));
|
Q_ARG(qint64, qint64([response expectedContentLength])));
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -418,9 +418,7 @@ qint64 QNetworkReplyNSURLConnectionImpl::bytesAvailable() const
|
|||||||
{
|
{
|
||||||
Q_D(const QNetworkReplyNSURLConnectionImpl);
|
Q_D(const QNetworkReplyNSURLConnectionImpl);
|
||||||
qint64 available = QNetworkReply::bytesAvailable() +
|
qint64 available = QNetworkReply::bytesAvailable() +
|
||||||
[[d->urlConnectionDelegate responseData] length] -
|
[[d->urlConnectionDelegate responseData] length];
|
||||||
d->bytesRead;
|
|
||||||
|
|
||||||
return available;
|
return available;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,7 +430,7 @@ bool QNetworkReplyNSURLConnectionImpl::isSequential() const
|
|||||||
qint64 QNetworkReplyNSURLConnectionImpl::size() const
|
qint64 QNetworkReplyNSURLConnectionImpl::size() const
|
||||||
{
|
{
|
||||||
Q_D(const QNetworkReplyNSURLConnectionImpl);
|
Q_D(const QNetworkReplyNSURLConnectionImpl);
|
||||||
return [[d->urlConnectionDelegate responseData] length];
|
return [[d->urlConnectionDelegate responseData] length] + d->bytesRead;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
@ -442,9 +440,10 @@ qint64 QNetworkReplyNSURLConnectionImpl::readData(char *data, qint64 maxlen)
|
|||||||
{
|
{
|
||||||
Q_D(QNetworkReplyNSURLConnectionImpl);
|
Q_D(QNetworkReplyNSURLConnectionImpl);
|
||||||
qint64 dataSize = [[d->urlConnectionDelegate responseData] length];
|
qint64 dataSize = [[d->urlConnectionDelegate responseData] length];
|
||||||
qint64 canRead = qMin(maxlen, dataSize - d->bytesRead);
|
qint64 canRead = qMin(maxlen, dataSize);
|
||||||
const char *sourceBase = static_cast<const char *>([[d->urlConnectionDelegate responseData] bytes]);
|
const char *sourceBase = static_cast<const char *>([[d->urlConnectionDelegate responseData] bytes]);
|
||||||
memcpy(data, sourceBase + d->bytesRead, canRead);
|
memcpy(data, sourceBase, canRead);
|
||||||
|
[[d->urlConnectionDelegate responseData] replaceBytesInRange:NSMakeRange(0, canRead) withBytes:NULL length:0];
|
||||||
d->bytesRead += canRead;
|
d->bytesRead += canRead;
|
||||||
return canRead;
|
return canRead;
|
||||||
}
|
}
|
||||||
|
@ -276,7 +276,9 @@ bool QNetworkConfigurationManagerPrivate::isOnline() const
|
|||||||
{
|
{
|
||||||
QMutexLocker locker(&mutex);
|
QMutexLocker locker(&mutex);
|
||||||
|
|
||||||
return !onlineConfigurations.isEmpty();
|
// We need allConfigurations since onlineConfigurations is filled with queued connections
|
||||||
|
// and thus is not always (more importantly just after creation) up to date
|
||||||
|
return !allConfigurations(QNetworkConfiguration::Active).isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
QNetworkConfigurationManager::Capabilities QNetworkConfigurationManagerPrivate::capabilities() const
|
QNetworkConfigurationManager::Capabilities QNetworkConfigurationManagerPrivate::capabilities() const
|
||||||
|
@ -790,7 +790,7 @@ void QSslSocket::close()
|
|||||||
qCDebug(lcSsl) << "QSslSocket::close()";
|
qCDebug(lcSsl) << "QSslSocket::close()";
|
||||||
#endif
|
#endif
|
||||||
Q_D(QSslSocket);
|
Q_D(QSslSocket);
|
||||||
if (encryptedBytesToWrite())
|
if (encryptedBytesToWrite() || !d->writeBuffer.isEmpty())
|
||||||
flush();
|
flush();
|
||||||
if (d->plainSocket)
|
if (d->plainSocket)
|
||||||
d->plainSocket->close();
|
d->plainSocket->close();
|
||||||
|
@ -1392,7 +1392,7 @@ void QSslSocketBackendPrivate::_q_caRootLoaded(QSslCertificate cert, QSslCertifi
|
|||||||
if (plainSocket)
|
if (plainSocket)
|
||||||
plainSocket->resume();
|
plainSocket->resume();
|
||||||
paused = false;
|
paused = false;
|
||||||
if (checkSslErrors())
|
if (checkSslErrors() && ssl)
|
||||||
continueHandshake();
|
continueHandshake();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +55,8 @@
|
|||||||
#define qFilePickerDebug QT_NO_QDEBUG_MACRO
|
#define qFilePickerDebug QT_NO_QDEBUG_MACRO
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
static const char s_filePickerTarget[] = "sys.filepicker.target";
|
static const char s_filePickerTarget[] = "sys.filepicker.target";
|
||||||
|
|
||||||
QQnxFilePicker::QQnxFilePicker(QObject *parent)
|
QQnxFilePicker::QQnxFilePicker(QObject *parent)
|
||||||
@ -316,3 +318,5 @@ QString QQnxFilePicker::modeToString(QQnxFilePicker::Mode mode) const
|
|||||||
|
|
||||||
return QStringLiteral("Picker");
|
return QStringLiteral("Picker");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
@ -38,6 +38,8 @@
|
|||||||
#include <QObject>
|
#include <QObject>
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
|
|
||||||
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
struct navigator_invoke_invocation_t;
|
struct navigator_invoke_invocation_t;
|
||||||
|
|
||||||
class QQnxFilePicker : public QObject, public QAbstractNativeEventFilter
|
class QQnxFilePicker : public QObject, public QAbstractNativeEventFilter
|
||||||
@ -100,4 +102,6 @@ private:
|
|||||||
QString m_title;
|
QString m_title;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // QQNXFILEPICKER_H
|
#endif // QQNXFILEPICKER_H
|
||||||
|
@ -37,10 +37,10 @@
|
|||||||
#include <QtCore/qhash.h>
|
#include <QtCore/qhash.h>
|
||||||
#include <qpa/qplatformtheme.h>
|
#include <qpa/qplatformtheme.h>
|
||||||
|
|
||||||
class QPlatformFontDatabase;
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
|
||||||
|
class QPlatformFontDatabase;
|
||||||
|
|
||||||
QHash<QPlatformTheme::Font, QFont *> qt_qnx_createRoleFonts(QPlatformFontDatabase *fontDatabase);
|
QHash<QPlatformTheme::Font, QFont *> qt_qnx_createRoleFonts(QPlatformFontDatabase *fontDatabase);
|
||||||
|
|
||||||
QT_END_NAMESPACE
|
QT_END_NAMESPACE
|
||||||
|
@ -86,4 +86,6 @@ private:
|
|||||||
static const size_t ms_bufferSize;
|
static const size_t ms_bufferSize;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
QT_END_NAMESPACE
|
||||||
|
|
||||||
#endif // VIRTUALKEYBOARDPPS_H
|
#endif // VIRTUALKEYBOARDPPS_H
|
||||||
|
@ -38,7 +38,7 @@
|
|||||||
#include <QtPlatformSupport/private/qaccessiblebridgeutils_p.h>
|
#include <QtPlatformSupport/private/qaccessiblebridgeutils_p.h>
|
||||||
#include <QtGui/qaccessible.h>
|
#include <QtGui/qaccessible.h>
|
||||||
#include <QtGui/qclipboard.h>
|
#include <QtGui/qclipboard.h>
|
||||||
#include <QtWidgets/qapplication.h>
|
#include <QtGui/qguiapplication.h>
|
||||||
#include <QtCore/qdebug.h>
|
#include <QtCore/qdebug.h>
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
QT_BEGIN_NAMESPACE
|
||||||
|
@ -49,10 +49,6 @@
|
|||||||
#include <QtGui/qguiapplication.h>
|
#include <QtGui/qguiapplication.h>
|
||||||
#include <qpa/qplatformnativeinterface.h>
|
#include <qpa/qplatformnativeinterface.h>
|
||||||
#include <QtGui/qwindow.h>
|
#include <QtGui/qwindow.h>
|
||||||
#include <QtWidgets/qapplication.h>
|
|
||||||
#include <QtWidgets/qgraphicsitem.h>
|
|
||||||
#include <QtWidgets/qgraphicsview.h>
|
|
||||||
#include <QtWidgets/qmessagebox.h>
|
|
||||||
|
|
||||||
//#include <uiautomationcoreapi.h>
|
//#include <uiautomationcoreapi.h>
|
||||||
#ifndef UiaRootObjectId
|
#ifndef UiaRootObjectId
|
||||||
|
@ -601,6 +601,14 @@ static int choosePixelFormat(HDC hdc,
|
|||||||
break;
|
break;
|
||||||
if (iAttributes[samplesValuePosition] > 1) {
|
if (iAttributes[samplesValuePosition] > 1) {
|
||||||
iAttributes[samplesValuePosition] /= 2;
|
iAttributes[samplesValuePosition] /= 2;
|
||||||
|
} else if (iAttributes[samplesValuePosition] == 1) {
|
||||||
|
// Fallback in case it is unable to initialize with any
|
||||||
|
// samples to avoid falling back to the GDI path
|
||||||
|
// NB: The sample attributes needs to be at the end for this
|
||||||
|
// to work correctly
|
||||||
|
iAttributes[samplesValuePosition - 1] = FALSE;
|
||||||
|
iAttributes[samplesValuePosition] = 0;
|
||||||
|
iAttributes[samplesValuePosition + 1] = 0;
|
||||||
} else {
|
} else {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -94,7 +94,7 @@ int QPageSetupDialog::exec()
|
|||||||
parent = parent ? parent->window() : QApplication::activeWindow();
|
parent = parent ? parent->window() : QApplication::activeWindow();
|
||||||
Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
|
Q_ASSERT(!parent ||parent->testAttribute(Qt::WA_WState_Created));
|
||||||
|
|
||||||
QWindow *parentWindow = parent->windowHandle();
|
QWindow *parentWindow = parent ? parent->windowHandle() : 0;
|
||||||
psd.hwndOwner = parentWindow ? (HWND)QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", parentWindow) : 0;
|
psd.hwndOwner = parentWindow ? (HWND)QGuiApplication::platformNativeInterface()->nativeResourceForWindow("handle", parentWindow) : 0;
|
||||||
|
|
||||||
psd.Flags = PSD_MARGINS;
|
psd.Flags = PSD_MARGINS;
|
||||||
|
@ -98,7 +98,7 @@ namespace QTest
|
|||||||
mouseEvent(MouseRelease, window, button, stateKey, pos);
|
mouseEvent(MouseRelease, window, button, stateKey, pos);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
QTEST_ASSERT(stateKey == 0 || stateKey & Qt::KeyboardModifierMask);
|
QTEST_ASSERT(uint(stateKey) == 0 || stateKey & Qt::KeyboardModifierMask);
|
||||||
|
|
||||||
stateKey &= static_cast<unsigned int>(Qt::KeyboardModifierMask);
|
stateKey &= static_cast<unsigned int>(Qt::KeyboardModifierMask);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user