{"action":"closed","issue":{"url":"https://api.github.com/repos/uclouvain/openjpeg/issues/619","labels_url":"https://api.github.com/repos/uclouvain/openjpeg/issues/619/labels{/name}","comments_url":"https://api.github.com/repos/uclouvain/openjpeg/issues/619/comments","events_url":"https://api.github.com/repos/uclouvain/openjpeg/issues/619/events","html_url":"https://github.com/uclouvain/openjpeg/issues/619","id":110018016,"number":619,"title":"Use of enum variable for bit flags prevents compilation as C++ source","user":{"login":"smuehlst","id":98944,"avatar_url":"https://avatars.githubusercontent.com/u/98944?v=3","gravatar_id":"","url":"https://api.github.com/users/smuehlst","html_url":"https://github.com/smuehlst","followers_url":"https://api.github.com/users/smuehlst/followers","following_url":"https://api.github.com/users/smuehlst/following{/other_user}","gists_url":"https://api.github.com/users/smuehlst/gists{/gist_id}","starred_url":"https://api.github.com/users/smuehlst/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/smuehlst/subscriptions","organizations_url":"https://api.github.com/users/smuehlst/orgs","repos_url":"https://api.github.com/users/smuehlst/repos","events_url":"https://api.github.com/users/smuehlst/events{/privacy}","received_events_url":"https://api.github.com/users/smuehlst/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":9,"created_at":"2015-10-06T14:20:57Z","updated_at":"2015-10-07T18:44:07Z","closed_at":"2015-10-07T18:44:07Z","body":"I'm compiling OpenJPEG with the .NET compiler in C++ mode. There are two problems that prevent successful compilation out of the box. One is missing casts for return values of opj_malloc()/opj_calloc(). For that I already created pull request #618.\r\n\r\nThe other problem is the use of an enum typedef for a variable that is intended for holding bit flags. From src/lib/openjp2/cio.h:\r\n\r\n    typedef enum\r\n    {\r\n            opj_signed_sentinel\t\t= -1, /* do not use in code */\r\n            opj_stream_e_output\t\t= 0x1,\r\n            opj_stream_e_input\t\t= 0x2,\r\n            opj_stream_e_end\t\t= 0x4,\r\n            opj_stream_e_error\t\t= 0x8\r\n    }\r\n    opj_stream_flag ;\r\n\r\n    typedef struct opj_stream_private\r\n    {\r\n        ...\r\n        /**\r\n         * Flags to tell the status of the stream.\r\n         */\r\n        opj_stream_flag m_status;\r\n    }\r\n    opj_stream_private_t;\r\n\r\nAnd in src/lib/openjp2/cio.c for example:\r\n\r\n    l_stream->m_status |= opj_stream_e_input;\r\n\r\nThis fails to compile in C++ mode. The declaration of the `m_status` member as `opj_stream_flag` in my view does not add value here, because as the variable can contain a combination of the `opj_stream_*` flags it is not restricted anyway to the actual members of the` opj_stream_flag` enumeration.\r\n\r\nTo be able to compile in C++ mode I changed the type of the `m_status` variable from `opj_stream_flag` to `OPJ_INT32` in my local repository. Would you consider to apply this change? If so, I would create a corresponding pull request."}}