{"action":"closed","issue":{"url":"https://api.github.com/repos/quixdb/squash/issues/43","labels_url":"https://api.github.com/repos/quixdb/squash/issues/43/labels{/name}","comments_url":"https://api.github.com/repos/quixdb/squash/issues/43/comments","events_url":"https://api.github.com/repos/quixdb/squash/issues/43/events","html_url":"https://github.com/quixdb/squash/issues/43","id":19114581,"number":43,"title":"Provide a way to test whether a codec can compress to a buffer smaller than max compressed size","user":{"login":"nemequ","id":1151,"avatar_url":"https://avatars.githubusercontent.com/u/1151?v=3","gravatar_id":"","url":"https://api.github.com/users/nemequ","html_url":"https://github.com/nemequ","followers_url":"https://api.github.com/users/nemequ/followers","following_url":"https://api.github.com/users/nemequ/following{/other_user}","gists_url":"https://api.github.com/users/nemequ/gists{/gist_id}","starred_url":"https://api.github.com/users/nemequ/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nemequ/subscriptions","organizations_url":"https://api.github.com/users/nemequ/orgs","repos_url":"https://api.github.com/users/nemequ/repos","events_url":"https://api.github.com/users/nemequ/events{/privacy}","received_events_url":"https://api.github.com/users/nemequ/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/quixdb/squash/labels/core","name":"core","color":"f7c6c7"},{"url":"https://api.github.com/repos/quixdb/squash/labels/enhancement","name":"enhancement","color":"84b6eb"},{"url":"https://api.github.com/repos/quixdb/squash/labels/plugins","name":"plugins","color":"bfe5bf"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2013-09-06T16:20:45Z","updated_at":"2015-03-18T08:04:55Z","closed_at":"2015-03-18T08:04:55Z","body":"Most codecs are capable of (trying to) compress to a buffer which is smaller than the max compressed size, and simply returning an error if the data doesn't fit.  This is nice for applications where you only want to compress data when you'll get a specified ratio (e.g., you'll just store it uncompressed unless you can get a 25% reduction in size).\r\n\r\nRight now the codecs which can't do that will just returned `SQAUSH_BUFFER_FULL` if the buffer is less than max compressed size.\r\n\r\nThis would also allow us to create a special case in Squash where if you try to compress with one of these codecs to a buffer which is less than the max uncompressed length we malloc a buffer which is max compressed length, compress to that, then memcpy the result to the provided buffer if it will fit and return `SQUASH_BUFFER_FULL` if it will not."}}