{"action":"closed","issue":{"url":"https://api.github.com/repos/protobuf-c/protobuf-c/issues/199","labels_url":"https://api.github.com/repos/protobuf-c/protobuf-c/issues/199/labels{/name}","comments_url":"https://api.github.com/repos/protobuf-c/protobuf-c/issues/199/comments","events_url":"https://api.github.com/repos/protobuf-c/protobuf-c/issues/199/events","html_url":"https://github.com/protobuf-c/protobuf-c/issues/199","id":121898307,"number":199,"title":"Enums with negative values do not get processed correctly","user":{"login":"lipnitsk","id":438785,"avatar_url":"https://avatars.githubusercontent.com/u/438785?v=3","gravatar_id":"","url":"https://api.github.com/users/lipnitsk","html_url":"https://github.com/lipnitsk","followers_url":"https://api.github.com/users/lipnitsk/followers","following_url":"https://api.github.com/users/lipnitsk/following{/other_user}","gists_url":"https://api.github.com/users/lipnitsk/gists{/gist_id}","starred_url":"https://api.github.com/users/lipnitsk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lipnitsk/subscriptions","organizations_url":"https://api.github.com/users/lipnitsk/orgs","repos_url":"https://api.github.com/users/lipnitsk/repos","events_url":"https://api.github.com/users/lipnitsk/events{/privacy}","received_events_url":"https://api.github.com/users/lipnitsk/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":{"url":"https://api.github.com/repos/protobuf-c/protobuf-c/milestones/1","html_url":"https://github.com/protobuf-c/protobuf-c/milestones/1.2.0","labels_url":"https://api.github.com/repos/protobuf-c/protobuf-c/milestones/1/labels","id":1495081,"number":1,"title":"1.2.0","description":null,"creator":{"login":"edmonds","id":202839,"avatar_url":"https://avatars.githubusercontent.com/u/202839?v=3","gravatar_id":"","url":"https://api.github.com/users/edmonds","html_url":"https://github.com/edmonds","followers_url":"https://api.github.com/users/edmonds/followers","following_url":"https://api.github.com/users/edmonds/following{/other_user}","gists_url":"https://api.github.com/users/edmonds/gists{/gist_id}","starred_url":"https://api.github.com/users/edmonds/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/edmonds/subscriptions","organizations_url":"https://api.github.com/users/edmonds/orgs","repos_url":"https://api.github.com/users/edmonds/repos","events_url":"https://api.github.com/users/edmonds/events{/privacy}","received_events_url":"https://api.github.com/users/edmonds/received_events","type":"User","site_admin":false},"open_issues":0,"closed_issues":6,"state":"open","created_at":"2016-01-09T22:41:48Z","updated_at":"2016-01-30T00:21:40Z","due_on":null,"closed_at":null},"comments":3,"created_at":"2015-12-13T04:26:45Z","updated_at":"2016-01-30T00:21:40Z","closed_at":"2016-01-30T00:21:40Z","body":"Packing an enum value of any negative value should yield a 10-byte two's complement of a 64-bit integer, since enums use a base-128 varint encoding.\r\n\r\nFrom the [Google Protobuf Language Guide](https://developers.google.com/protocol-buffers/docs/proto#enum):\r\n> Enumerator constants must be in the range of a 32-bit integer. Since enum values use varint encoding on the wire, negative values are inefficient and thus not recommended.\r\n\r\nWith the current version of protobuf-c, the result of encoding an enum value of `-1` is `08 ff ff ff ff 0f`, whereas it should be `08 ff ff ff ff ff ff ff ff ff 01`. Essentially the bug is that enums today are encoded as `uint32` numbers, but they need to be encoded as `int32`'s instead."}}