{"action":"created","issue":{"url":"https://api.github.com/repos/SOCI/soci/issues/355","labels_url":"https://api.github.com/repos/SOCI/soci/issues/355/labels{/name}","comments_url":"https://api.github.com/repos/SOCI/soci/issues/355/comments","events_url":"https://api.github.com/repos/SOCI/soci/issues/355/events","html_url":"https://github.com/SOCI/soci/pull/355","id":92072266,"number":355,"title":"Msvc warnings","user":{"login":"ravselj","id":6742843,"avatar_url":"https://avatars.githubusercontent.com/u/6742843?v=3","gravatar_id":"","url":"https://api.github.com/users/ravselj","html_url":"https://github.com/ravselj","followers_url":"https://api.github.com/users/ravselj/followers","following_url":"https://api.github.com/users/ravselj/following{/other_user}","gists_url":"https://api.github.com/users/ravselj/gists{/gist_id}","starred_url":"https://api.github.com/users/ravselj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravselj/subscriptions","organizations_url":"https://api.github.com/users/ravselj/orgs","repos_url":"https://api.github.com/users/ravselj/repos","events_url":"https://api.github.com/users/ravselj/events{/privacy}","received_events_url":"https://api.github.com/users/ravselj/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-06-30T11:52:12Z","updated_at":"2015-07-08T09:48:23Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/SOCI/soci/pulls/355","html_url":"https://github.com/SOCI/soci/pull/355","diff_url":"https://github.com/SOCI/soci/pull/355.diff","patch_url":"https://github.com/SOCI/soci/pull/355.patch"},"body":"I created a new branch that tries to achieve same goal - removing MSVC warning while compiling(based on comments in #353 )\r\n\r\nSome notes are also in commit messages but I will only describe the basic approach. All warnings are resolved either by:\r\n1. changing the code directly resolving the cause( static_cast, remove unused variable )\r\n2. pragma push, disable, pop ( this is used only once )\r\n3. Platform specific changes in soci-platform.h( without changing any cpp code) either by:\r\n  - pragma warning(disable: *) \r\n  - using defines (sprintf -> sprintf_s )\r\n  - using defines and platform specific inline wrapper functions(  strcpy -> strcpy_secure )\r\n4. Implemented global wrapper functions with different signature in soci namespace( currently soci::getenv, soci::localtime ) and replaced old calls with new ones. ( i.e. where getenv or std::getenv is called the call is replaced with soci::getenv ). This is necessary since function signature is not the same.\r\n\r\nI have removed all pragma warning(disable) from all cpp files. Suppressed warnings are reduced to only two warnings which should be ignored (4251 4275). All other warnings were removed as described above. \r\n\r\nI have also deleted soci-config.h and moved its content into soci-platform.h. There is no need for both headers since they both contain platform dependent code so I have merged them into one header."},"comment":{"url":"https://api.github.com/repos/SOCI/soci/issues/comments/119527111","html_url":"https://github.com/SOCI/soci/pull/355#issuecomment-119527111","issue_url":"https://api.github.com/repos/SOCI/soci/issues/355","id":119527111,"user":{"login":"ravselj","id":6742843,"avatar_url":"https://avatars.githubusercontent.com/u/6742843?v=3","gravatar_id":"","url":"https://api.github.com/users/ravselj","html_url":"https://github.com/ravselj","followers_url":"https://api.github.com/users/ravselj/followers","following_url":"https://api.github.com/users/ravselj/following{/other_user}","gists_url":"https://api.github.com/users/ravselj/gists{/gist_id}","starred_url":"https://api.github.com/users/ravselj/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ravselj/subscriptions","organizations_url":"https://api.github.com/users/ravselj/orgs","repos_url":"https://api.github.com/users/ravselj/repos","events_url":"https://api.github.com/users/ravselj/events{/privacy}","received_events_url":"https://api.github.com/users/ravselj/received_events","type":"User","site_admin":false},"created_at":"2015-07-08T09:48:22Z","updated_at":"2015-07-08T09:48:22Z","body":">I'm not entirely convinced about the wisdom of using MSVC wrappers, as the example of strcpy() shows this is not completely trivial and I'd prefer to have one version of all these functions to deal with instead of two.\r\n\r\nOK. I get that. Then the only solution to deprecated would be to define \r\n\r\n#define _CRT_SECURE_NO_WARNINGS in soci-platform.h and then we must make sure that soci-platform is the first header included. This way all MSVC wrappers will be removed.\r\n\r\n>I'm also not sure about merging soci-platform.h and soci-config.h, while I'm not sure about the difference between them neither, there might be existing code including the latter and I don't think it's worth breaking it by removing this header.\r\n\r\nIf I add back soci-config.h with only one line including soci-platform.h with comment //this header is obsolete - use soci-platform instead. This way we preserve all client code and all specific platform code is in one header. Would this be ok?\r\n\r\n>Also, while adding casts to silence the warnings is nice, they can sometimes be fixed in better ways and I'd like to review the changes to make sure this is not the case here but unfortunately the sheer number of changes makes it difficult to review all of them...\r\n\r\nIf you look at the first commit you'll see only static_cast changes. There aren't that many actually but I agree some of them can be resolved also without using static_cast. This can probably best be solved in separate PR since it is not directly related to this PR. Would you agree?\r\n\r\n"}}