Diff of /src/pt_safe_str.h [000000] .. [359336]  Maximize  Restore

Switch to side-by-side view

--- a
+++ b/src/pt_safe_str.h
@@ -0,0 +1,42 @@
+// Use the safe version of string functions when ever possible
+// This will help track down any buffer overruns
+
+#if     _MSC_VER > 1000
+#pragma once
+#endif
+
+#ifndef _PR_SAFE_STRING_FUNCTIONS_H
+#define _PR_SAFE_STRING_FUNCTIONS_H
+
+#if _MSC_VER && (_MSC_VER >= 1400)
+  #define PT_SSTRCPY(d,z,s) strcpy_s(d,z,s)
+  #define PT_SSTRCAT(d,z,s) strcat_s(d,z,s)
+  #define PT_SSTRNCPY(d,z,s,m) strncpy_s(d,z,s,m)
+  #define PT_FOPEN(pf,name,mode) (void)fopen_s(&pf,name,mode)
+  /*INLINE int PT_SPRINTF(char *d, size_t c, const char *f,...)
+  {
+    int result;
+    va_list valist;
+    va_start(valist,f);
+    result = sprintf_s(d,c,f,valist);
+    va_end(valist);
+    return result;
+  }*/
+#else
+sprintf_s sprintf
+  #define PT_SSTRCPY(d,z,s) strcpy(d,s)
+  #define PT_SSTRCAT(d,z,s) strcat(d,s)
+  #define PT_SSTRNCPY(d,z,s,m) strncpy(d,s,m)
+  #define FOPEN(pf,name,mode) pf = fopen(name,mode)
+  /*inline int PT_SPRINTF(char *d, size_t c, const char *f,...)
+  {
+    int result;
+    va_list valist;
+    va_start(valist,f);
+    result = sprintf(d,c,f,valist);
+    va_end(valist);
+    return result;
+  }*/
+#endif
+
+#endif // _PR_SAFE_STRING_FUNCTIONS_H