Mercurial > hg > orthanc
annotate Resources/Patches/glog-port-h-v2.diff @ 1749:99f4a05f39fa db-changes
various types of constraints
author | Sebastien Jodogne <s.jodogne@gmail.com> |
---|---|
date | Tue, 27 Oct 2015 10:54:51 +0100 |
parents | 0d9812893262 |
children |
rev | line source |
---|---|
1381 | 1 124,130c124,146 |
2 < // ----------------------------------- THREADS | |
3 < typedef DWORD pthread_t; | |
4 < typedef DWORD pthread_key_t; | |
5 < typedef LONG pthread_once_t; | |
6 < enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock | |
7 < #define pthread_self GetCurrentThreadId | |
8 < #define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2)) | |
9 --- | |
10 > // ----------------------------------- SECURE STRINGS | |
1379
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
11 > |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
12 > #if HAVE_SECURE_STRING_EXTENSIONS == 0 |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
13 > // Emulation of "localtime_s" and "strerror_s" for old versions of MinGW |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
14 > inline int localtime_s(tm * _tm, const time_t * time) |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
15 > { |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
16 > tm * posix_local_time_struct = localtime(time); |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
17 > if (posix_local_time_struct == NULL) |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
18 > { |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
19 > return 1; |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
20 > } |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
21 > |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
22 > *_tm = *posix_local_time_struct; |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
23 > |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
24 > return 0; |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
25 > } |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
26 > |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
27 > inline char* strerror_s(char* buf, size_t buflen, int errnum) |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
28 > { |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
29 > const char* str = strerror(errnum); |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
30 > return strncpy(buf, str, buflen - 1); |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
31 > } |
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
32 > #endif |
1381 | 33 131a148,149 |
1379
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
34 > |
1380 | 35 > #if !defined(__MINGW32__) || HAVE_SECURE_STRING_EXTENSIONS == 0 |
1381 | 36 135a154,155 |
1378 | 37 > #endif |
1379
d0bb3dd34e2d
find build on old versions of MinGW
Sebastien Jodogne <s.jodogne@gmail.com>
parents:
1378
diff
changeset
|
38 > |
1381 | 39 140a161,173 |
40 > | |
41 > | |
42 > // ----------------------------------- THREADS | |
43 > | |
44 > #if !defined(__MINGW32__) || HAVE_WIN_PTHREAD == 0 | |
45 > typedef DWORD pthread_t; | |
46 > typedef DWORD pthread_key_t; | |
47 > typedef LONG pthread_once_t; | |
48 > enum { PTHREAD_ONCE_INIT = 0 }; // important that this be 0! for SpinLock | |
49 > #define pthread_self GetCurrentThreadId | |
50 > #define pthread_equal(pthread_t_1, pthread_t_2) ((pthread_t_1)==(pthread_t_2)) | |
51 > #endif | |
52 > |