{"action":"created","issue":{"url":"https://api.github.com/repos/plonk/peercast-yt/issues/31","repository_url":"https://api.github.com/repos/plonk/peercast-yt","labels_url":"https://api.github.com/repos/plonk/peercast-yt/issues/31/labels{/name}","comments_url":"https://api.github.com/repos/plonk/peercast-yt/issues/31/comments","events_url":"https://api.github.com/repos/plonk/peercast-yt/issues/31/events","html_url":"https://github.com/plonk/peercast-yt/issues/31","id":236079926,"number":31,"title":"VisualStudioでビルドすると出た警告","user":{"login":"shinji3","id":10717926,"avatar_url":"https://avatars0.githubusercontent.com/u/10717926?v=4","gravatar_id":"","url":"https://api.github.com/users/shinji3","html_url":"https://github.com/shinji3","followers_url":"https://api.github.com/users/shinji3/followers","following_url":"https://api.github.com/users/shinji3/following{/other_user}","gists_url":"https://api.github.com/users/shinji3/gists{/gist_id}","starred_url":"https://api.github.com/users/shinji3/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/shinji3/subscriptions","organizations_url":"https://api.github.com/users/shinji3/orgs","repos_url":"https://api.github.com/users/shinji3/repos","events_url":"https://api.github.com/users/shinji3/events{/privacy}","received_events_url":"https://api.github.com/users/shinji3/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":39,"created_at":"2017-06-15T05:20:08Z","updated_at":"2017-07-30T00:13:50Z","closed_at":null,"body":"何か開発の参考になればと思い書きます\r\n\r\nsys.hにある\r\ntypedef unsigned int THREAD_HANDLE;\r\n\r\nのままVisualStudioを使って64bitでビルドすると下のような警告が出るので\r\nwarning C4312: '型キャスト': 'THREAD_HANDLE' からより大きいサイズの 'void *' へ変換します。\r\nwarning C4244: '=': 'uintptr_t' から 'THREAD_HANDLE' への変換です。データが失われる可能性があります。\r\n\r\ntypedef uintptr_t THREAD_HANDLE;\r\nにした方が良いと思います。IMでもそうなってました\r\n\r\ncgi.cppにあるrfc1123Time関数ですが\r\nptm = gmtime(&t);\r\nだとVisualStudioで\r\nwarning C4996: 'gmtime': This function or variable may be unsafe. Consider using gmtime_s instead. To disable deprecation, use _CRT_SECURE_NO_WARNINGS. See online help for details.\r\nと警告がでるのでgmtimeを使うよりもgmtime_sを使った方が良いと思います。引数もgmtime_rを反対にしただけですし\r\ngmtime_r(&t, &tm);がこうだとしたらgmtime_s(&tm, &t);はこんな感じに使えます\r\n\r\nwindows.hをインクルードするとstd::minとstd::maxの名前が衝突してしまいます\r\nstd::min()は(std::min)()でstd::max()は(std::max)()と書くと名前が衝突しないみたいです\r\n解決方法の一つの#define NOMINMAXのやり方は他のwindows.hのminとmaxを使うヘッダーをインクルードするとエラーになるのでNOMINMAXは使わない方が良さそうです\r\n\r\nsstream.cppにあるStringStream::readなんですが\r\nVisualStudioを使って64bitのDebugでビルドすると下のような警告が出るので\r\nwarning C4996: 'std::copy::_Unchecked_iterators::_Deprecate': Call to 'std::copy' with parameters that may be unsafe - this call relies on the caller to check that the passed values are correct. To disable this warning, use -D_SCL_SECURE_NO_WARNINGS. See documentation on how to use Visual C++ 'Checked Iterators'\r\n'std::copy::_Unchecked_iterators::_Deprecate' の宣言を確認してください\r\nコンパイル対象の関数 テンプレート インスタンス化 '_OutIt *std::copy<std::_String_iterator<std::_String_val<std::_Simple_types<char>>>,char*>(_InIt,_InIt,_OutIt)' のリファレンスを確認してください\r\n1>        with\r\n1>        [\r\n1>            _OutIt=char *,\r\n1>            _InIt=std::_String_iterator<std::_String_val<std::_Simple_types<char>>>\r\n1>        ]\r\nwarning C4244: 'return': '__int64' から 'int' への変換です。データが失われる可能性があります。\r\n\r\nこんな感じに書き直したのですがどうでしょうか？\r\n    int  StringStream::read(void *buf, int count)\r\n    {\r\n        if (m_pos == m_buffer.size())\r\n            throw StreamException(\"End of stream\");\r\n        int bytesRead = (std::min)(count, static_cast<int>(m_buffer.size() - m_pos));\r\n        memcpy(buf, m_buffer.c_str() + m_pos, bytesRead);;\r\n        m_pos += bytesRead;\r\n        return bytesRead;\r\n    }\r\n\r\nstricmpを使うと\r\nwarning C4996: 'stricmp': The POSIX name for this item is deprecated. Instead, use the ISO C and C++ conformant name: _stricmp. See online help for details.\r\nとVisualStudioに出るので_stricmpに書き直してはどうでしょうか？\r\n\r\n他にもfopenを使うとfopen_sとか\r\nctimeをctime_sとか\r\nVisualStudioで警告が出ました"},"comment":{"url":"https://api.github.com/repos/plonk/peercast-yt/issues/comments/318868197","html_url":"https://github.com/plonk/peercast-yt/issues/31#issuecomment-318868197","issue_url":"https://api.github.com/repos/plonk/peercast-yt/issues/31","id":318868197,"user":{"login":"plonk","id":1680210,"avatar_url":"https://avatars0.githubusercontent.com/u/1680210?v=4","gravatar_id":"","url":"https://api.github.com/users/plonk","html_url":"https://github.com/plonk","followers_url":"https://api.github.com/users/plonk/followers","following_url":"https://api.github.com/users/plonk/following{/other_user}","gists_url":"https://api.github.com/users/plonk/gists{/gist_id}","starred_url":"https://api.github.com/users/plonk/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plonk/subscriptions","organizations_url":"https://api.github.com/users/plonk/orgs","repos_url":"https://api.github.com/users/plonk/repos","events_url":"https://api.github.com/users/plonk/events{/privacy}","received_events_url":"https://api.github.com/users/plonk/received_events","type":"User","site_admin":false},"created_at":"2017-07-30T00:13:50Z","updated_at":"2017-07-30T00:13:50Z","body":"[パッチ](https://github.com/shinji3/peercast-yt/pull/3)を拝見したのですが、Linux で動く実装がないようですね。\r\n\r\nLinux 版で動く実装があって、HTML UI から制御できるならば取り込めないことはないのですが…。\r\n"}}
{"actor":{"display_login":"plonk"}}