{"action":"created","issue":{"url":"https://api.github.com/repos/byzhang/leveldb/issues/35","labels_url":"https://api.github.com/repos/byzhang/leveldb/issues/35/labels{/name}","comments_url":"https://api.github.com/repos/byzhang/leveldb/issues/35/comments","events_url":"https://api.github.com/repos/byzhang/leveldb/issues/35/events","html_url":"https://github.com/byzhang/leveldb/issues/35","id":59730054,"number":35,"title":"static_cast char to unsigned on BIG_ENDIAN platforms may cause errors","user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/byzhang/leveldb/labels/auto-migrated","name":"auto-migrated","color":"ededed"},{"url":"https://api.github.com/repos/byzhang/leveldb/labels/Priority-Medium","name":"Priority-Medium","color":"ededed"},{"url":"https://api.github.com/repos/byzhang/leveldb/labels/Type-Defect","name":"Type-Defect","color":"ededed"}],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-03-04T00:16:15Z","updated_at":"2015-03-04T00:16:17Z","closed_at":"2015-03-04T00:16:15Z","body":"```\nutil/coding_test may fail on some BIG_ENDIAN platforms\n\nuname -ms\nHP-UX ia64\n\ngcc version 4.3.3 (GCC)\n\nmicro test:\n====cast.cpp ====\n#include <stdio.h>\nint main(int ac, char *av[]) {\n  char c = -1;\n  printf(\"cast1=%u cast2=%u\",\n         static_cast<unsigned int>(c), //!!! wrong conversion\n         static_cast<unsigned int>(static_cast<unsigned char>(c)));\n}\n===================\n#g++ cast.cpp -o cast\n#./cast\ncast1=4294967295 cast2=255\n\n===================\nProblem in  file \"util\\coding.h\"\ninline uint32_t DecodeFixed32(const char* ptr) {\n...\n    return ((static_cast<uint32_t>(ptr[0]))\n            | (static_cast<uint32_t>(ptr[1]) << 8)\n            | (static_cast<uint32_t>(ptr[2]) << 16)\n            | (static_cast<uint32_t>(ptr[3]) << 24));\n}\n\nShould be:\n    return ((static_cast<uint32_t>(static_cast<unsigned char>(ptr[0])))\n            | (static_cast<uint32_t>(static_cast<unsigned char>(ptr[1])) << 8)\n            | (static_cast<uint32_t>(static_cast<unsigned char>(ptr[2])) << 16)\n            | (static_cast<uint32_t>(static_cast<unsigned char>(ptr[3])) << 24));\n\n\n\n```\n\nOriginal issue reported on code.google.com by `Alexande...@gmail.com` on 23 Aug 2011 at 6:31"},"comment":{"url":"https://api.github.com/repos/byzhang/leveldb/issues/comments/77070404","html_url":"https://github.com/byzhang/leveldb/issues/35#issuecomment-77070404","issue_url":"https://api.github.com/repos/byzhang/leveldb/issues/35","id":77070404,"user":{"login":"GoogleCodeExporter","id":9614759,"avatar_url":"https://avatars.githubusercontent.com/u/9614759?v=3","gravatar_id":"","url":"https://api.github.com/users/GoogleCodeExporter","html_url":"https://github.com/GoogleCodeExporter","followers_url":"https://api.github.com/users/GoogleCodeExporter/followers","following_url":"https://api.github.com/users/GoogleCodeExporter/following{/other_user}","gists_url":"https://api.github.com/users/GoogleCodeExporter/gists{/gist_id}","starred_url":"https://api.github.com/users/GoogleCodeExporter/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/GoogleCodeExporter/subscriptions","organizations_url":"https://api.github.com/users/GoogleCodeExporter/orgs","repos_url":"https://api.github.com/users/GoogleCodeExporter/repos","events_url":"https://api.github.com/users/GoogleCodeExporter/events{/privacy}","received_events_url":"https://api.github.com/users/GoogleCodeExporter/received_events","type":"User","site_admin":false},"created_at":"2015-03-04T00:16:17Z","updated_at":"2015-03-04T00:16:17Z","body":"```\nIssue 36 has been merged into this issue.\n```\n\nOriginal comment by `dgrogan@chromium.org` on 1 Jun 2012 at 11:55"}}