{"action":"created","issue":{"url":"https://api.github.com/repos/lvandeve/lodepng/issues/69","repository_url":"https://api.github.com/repos/lvandeve/lodepng","labels_url":"https://api.github.com/repos/lvandeve/lodepng/issues/69/labels{/name}","comments_url":"https://api.github.com/repos/lvandeve/lodepng/issues/69/comments","events_url":"https://api.github.com/repos/lvandeve/lodepng/issues/69/events","html_url":"https://github.com/lvandeve/lodepng/issues/69","id":317738916,"number":69,"title":"load png with custom zlib, why not provide uncompressed size?","user":{"login":"powof2","id":11511290,"avatar_url":"https://avatars3.githubusercontent.com/u/11511290?v=4","gravatar_id":"","url":"https://api.github.com/users/powof2","html_url":"https://github.com/powof2","followers_url":"https://api.github.com/users/powof2/followers","following_url":"https://api.github.com/users/powof2/following{/other_user}","gists_url":"https://api.github.com/users/powof2/gists{/gist_id}","starred_url":"https://api.github.com/users/powof2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/powof2/subscriptions","organizations_url":"https://api.github.com/users/powof2/orgs","repos_url":"https://api.github.com/users/powof2/repos","events_url":"https://api.github.com/users/powof2/events{/privacy}","received_events_url":"https://api.github.com/users/powof2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-04-25T18:15:39Z","updated_at":"2018-05-08T14:10:59Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\nI'm using standard zlib to load pngs via lodepng, i find it would be much easier to provide uncompressed size for custom zlib_decompress to uncompress data, like this :\r\n\r\n```\r\n// decodeGeneric, line 4720 in lodepng.cpp\r\nscanlines.size = predict; // <--- add this to init the size with predict (the uncompressed size) instead of 0\r\nstate->error = zlib_decompress(&scanlines.data, &scanlines.size, idat.data,\r\n                                   idat.size, &state->decoder.zlibsettings);\r\n```\r\n\r\nwhat do you think? what's the correct way to load pngs with custom zlib?\r\n\r\nThank you."},"comment":{"url":"https://api.github.com/repos/lvandeve/lodepng/issues/comments/387415783","html_url":"https://github.com/lvandeve/lodepng/issues/69#issuecomment-387415783","issue_url":"https://api.github.com/repos/lvandeve/lodepng/issues/69","id":387415783,"user":{"login":"powof2","id":11511290,"avatar_url":"https://avatars3.githubusercontent.com/u/11511290?v=4","gravatar_id":"","url":"https://api.github.com/users/powof2","html_url":"https://github.com/powof2","followers_url":"https://api.github.com/users/powof2/followers","following_url":"https://api.github.com/users/powof2/following{/other_user}","gists_url":"https://api.github.com/users/powof2/gists{/gist_id}","starred_url":"https://api.github.com/users/powof2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/powof2/subscriptions","organizations_url":"https://api.github.com/users/powof2/orgs","repos_url":"https://api.github.com/users/powof2/repos","events_url":"https://api.github.com/users/powof2/events{/privacy}","received_events_url":"https://api.github.com/users/powof2/received_events","type":"User","site_admin":false},"created_at":"2018-05-08T14:10:59Z","updated_at":"2018-05-08T14:10:59Z","author_association":"NONE","body":"I said so because there are already 'predict' bytes memory allocated to scanlines, its size is 'predict and expecting decoded size is 'predict' too.\r\n\r\n```\r\n  // here predict bytes memory are allocated (reserved) to scanlines\r\n  if(!state->error && !ucvector_reserve(&scanlines, predict)) state->error = 83; /*alloc fail*/\r\n  if(!state->error)\r\n  {\r\n    state->error = zlib_decompress(&scanlines.data, &scanlines.size, idat.data,\r\n                                   idat.size, &state->decoder.zlibsettings);\r\n    if(!state->error && scanlines.size != predict) state->error = 91; /*decompressed size doesn't match prediction*/\r\n  }\r\n```\r\nbut it does not matter since it is possible to decode with unknown size, thank you for the link.\r\n"}}
{"actor":{"display_login":"powof2"}}