I guess I should have anticipated that. This won't work very well fixing these one at a time. I don't have easy access to windows let alone mingw.
Replacing sprintf_s is trivial; I'll do that, but there are other windows-specific replacements to posix functions being used: _fseeki64/_ftelli64 as replacements for fseeko/ftello, and there are also windows-specific threading primitives to replace pthread. I'm curious whether Ptex would just work on mingw if it compiled as if for posix. Can you try this patch:
diff --git a/src/ptex/PtexPlatform.h b/src/ptex/PtexPlatform.h
index af8d851..a7757df 100644
--- a/src/ptex/PtexPlatform.h
+++ b/src/ptex/PtexPlatform.h
@@ -41,7 +41,7 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
*/
// platform-specific includes
-#if defined(_WIN32) || defined(_WINDOWS) || defined(_MSC_VER)
+#if (defined(_WIN32) || defined(_WINDOWS) || defined(_MSC_VER)) && !defined(__MINGW64__)
#ifndef WINDOWS
#define WINDOWS
#endif
@@ -58,6 +58,10 @@ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
#else
+#ifdef WINDOWS
+#undef WINDOWS
+#endif
+
// linux/unix/posix
#include <stdlib.h>
#include <alloca.h>