{"action":"created","issue":{"url":"https://api.github.com/repos/libgd/libgd/issues/401","repository_url":"https://api.github.com/repos/libgd/libgd","labels_url":"https://api.github.com/repos/libgd/libgd/issues/401/labels{/name}","comments_url":"https://api.github.com/repos/libgd/libgd/issues/401/comments","events_url":"https://api.github.com/repos/libgd/libgd/issues/401/events","html_url":"https://github.com/libgd/libgd/issues/401","id":245737979,"number":401,"title":"visual studio builds lack getopt","user":{"login":"vshulga","id":30469226,"avatar_url":"https://avatars1.githubusercontent.com/u/30469226?v=4","gravatar_id":"","url":"https://api.github.com/users/vshulga","html_url":"https://github.com/vshulga","followers_url":"https://api.github.com/users/vshulga/followers","following_url":"https://api.github.com/users/vshulga/following{/other_user}","gists_url":"https://api.github.com/users/vshulga/gists{/gist_id}","starred_url":"https://api.github.com/users/vshulga/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/vshulga/subscriptions","organizations_url":"https://api.github.com/users/vshulga/orgs","repos_url":"https://api.github.com/users/vshulga/repos","events_url":"https://api.github.com/users/vshulga/events{/privacy}","received_events_url":"https://api.github.com/users/vshulga/received_events","type":"User","site_admin":false},"labels":[{"id":309090290,"url":"https://api.github.com/repos/libgd/libgd/labels/build","name":"build","color":"fbca04","default":false}],"state":"open","locked":false,"assignee":{"login":"cmb69","id":2306138,"avatar_url":"https://avatars1.githubusercontent.com/u/2306138?v=4","gravatar_id":"","url":"https://api.github.com/users/cmb69","html_url":"https://github.com/cmb69","followers_url":"https://api.github.com/users/cmb69/followers","following_url":"https://api.github.com/users/cmb69/following{/other_user}","gists_url":"https://api.github.com/users/cmb69/gists{/gist_id}","starred_url":"https://api.github.com/users/cmb69/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmb69/subscriptions","organizations_url":"https://api.github.com/users/cmb69/orgs","repos_url":"https://api.github.com/users/cmb69/repos","events_url":"https://api.github.com/users/cmb69/events{/privacy}","received_events_url":"https://api.github.com/users/cmb69/received_events","type":"User","site_admin":false},"assignees":[{"login":"cmb69","id":2306138,"avatar_url":"https://avatars1.githubusercontent.com/u/2306138?v=4","gravatar_id":"","url":"https://api.github.com/users/cmb69","html_url":"https://github.com/cmb69","followers_url":"https://api.github.com/users/cmb69/followers","following_url":"https://api.github.com/users/cmb69/following{/other_user}","gists_url":"https://api.github.com/users/cmb69/gists{/gist_id}","starred_url":"https://api.github.com/users/cmb69/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmb69/subscriptions","organizations_url":"https://api.github.com/users/cmb69/orgs","repos_url":"https://api.github.com/users/cmb69/repos","events_url":"https://api.github.com/users/cmb69/events{/privacy}","received_events_url":"https://api.github.com/users/cmb69/received_events","type":"User","site_admin":false}],"milestone":null,"comments":2,"created_at":"2017-07-26T14:18:47Z","updated_at":"2017-08-24T18:18:12Z","closed_at":null,"body":"See https://github.com/libgd/libgd/commit/2db153a93e22c9cd53022e131915c1000259eb52"},"comment":{"url":"https://api.github.com/repos/libgd/libgd/issues/comments/324715542","html_url":"https://github.com/libgd/libgd/issues/401#issuecomment-324715542","issue_url":"https://api.github.com/repos/libgd/libgd/issues/401","id":324715542,"user":{"login":"cmb69","id":2306138,"avatar_url":"https://avatars1.githubusercontent.com/u/2306138?v=4","gravatar_id":"","url":"https://api.github.com/users/cmb69","html_url":"https://github.com/cmb69","followers_url":"https://api.github.com/users/cmb69/followers","following_url":"https://api.github.com/users/cmb69/following{/other_user}","gists_url":"https://api.github.com/users/cmb69/gists{/gist_id}","starred_url":"https://api.github.com/users/cmb69/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cmb69/subscriptions","organizations_url":"https://api.github.com/users/cmb69/orgs","repos_url":"https://api.github.com/users/cmb69/repos","events_url":"https://api.github.com/users/cmb69/events{/privacy}","received_events_url":"https://api.github.com/users/cmb69/received_events","type":"User","site_admin":false},"created_at":"2017-08-24T18:18:12Z","updated_at":"2017-08-24T18:18:12Z","body":"@vapier I've had a closer look at the getopt replacement, and the one mentioned above appears to work fine. However, MSVC doesn't know about `mkstemp()` so I've employed the following replacement:\r\n````\r\n#ifdef _MSC_VER\r\n/* MSVC doesn't know mkstemp(), sigh ... */\r\n#include <fcntl.h>\r\nint mkstemp(char *template)\r\n{\r\n\tint fd;\r\n\r\n\tdo {\r\n\t\tif (!_mktemp(template)) {\r\n\t\t\treturn -1;\r\n\t\t}\r\n\t\tfd = _open(template, _O_RDWR|_O_CREAT|_O_EXCL);\r\n\t} while (fd == -1 && errno == EEXIST);\r\n\treturn fd;\r\n}\r\n#endif\r\n````\r\nThis also works fine so far, but apparently ignores the \"b\" flag in the [fdopen()](https://github.com/libgd/libgd/blob/b7977b574dbbb1ba7d3e109e55ab08b7d76fb42a/src/webpng.c#L275) call, so everytime an image is modified by webpng (`-i` or `-t`) it gets corrupted. Any ideas on how to work around this? Is it even necessary to write to a temporary file in the first place – can't we simply write to `infile` instead? Since `gdImagePng()` doesn't report success/failure, it doesn't seem to make a real difference."}}
{"actor":{"display_login":"cmb69"}}