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

Switch to unified view

a b/src/pt_safe_str.h
1
// Use the safe version of string functions when ever possible
2
// This will help track down any buffer overruns
3
4
#if     _MSC_VER > 1000
5
#pragma once
6
#endif
7
8
#ifndef _PR_SAFE_STRING_FUNCTIONS_H
9
#define _PR_SAFE_STRING_FUNCTIONS_H
10
11
#if _MSC_VER && (_MSC_VER >= 1400)
12
  #define PT_SSTRCPY(d,z,s) strcpy_s(d,z,s)
13
  #define PT_SSTRCAT(d,z,s) strcat_s(d,z,s)
14
  #define PT_SSTRNCPY(d,z,s,m) strncpy_s(d,z,s,m)
15
  #define PT_FOPEN(pf,name,mode) (void)fopen_s(&pf,name,mode)
16
  /*INLINE int PT_SPRINTF(char *d, size_t c, const char *f,...)
17
  {
18
    int result;
19
    va_list valist;
20
    va_start(valist,f);
21
    result = sprintf_s(d,c,f,valist);
22
    va_end(valist);
23
    return result;
24
  }*/
25
#else
26
sprintf_s sprintf
27
  #define PT_SSTRCPY(d,z,s) strcpy(d,s)
28
  #define PT_SSTRCAT(d,z,s) strcat(d,s)
29
  #define PT_SSTRNCPY(d,z,s,m) strncpy(d,s,m)
30
  #define FOPEN(pf,name,mode) pf = fopen(name,mode)
31
  /*inline int PT_SPRINTF(char *d, size_t c, const char *f,...)
32
  {
33
    int result;
34
    va_list valist;
35
    va_start(valist,f);
36
    result = sprintf(d,c,f,valist);
37
    va_end(valist);
38
    return result;
39
  }*/
40
#endif
41
42
#endif // _PR_SAFE_STRING_FUNCTIONS_H

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks