Showing the changes to lib (1 of 1 file). Show all
Unified · Split
| @@ -66,7 +66,11 @@ static FILE *open_tcov_file (char *cov_filename) · 65 unmodified lines | ||
| 66 | 66 | while (fcntl (fd, F_SETLKW, &lock) && errno == EINTR) |
| 67 | 67 | continue; |
| 68 | 68 | #else |
| 69 | − LockFile((HANDLE)_get_osfhandle(fd), 0, 0, 1, 0); | |
| 69 | + { | |
| 70 | + OVERLAPPED overlapped = { 0 }; | |
| 71 | + LockFileEx((HANDLE)_get_osfhandle(fd), LOCKFILE_EXCLUSIVE_LOCK, | |
| 72 | + 0, 1, 0, &overlapped); | |
| 73 | + } | |
| 70 | 74 | #endif |
| 71 | 75 | |
| 72 | 76 | return fdopen (fd, "r+"); |
| @@ -106,6 +110,7 @@ static int sort_line (const void *p, const void *q) · 33 unmodified lines | ||
| 106 | 110 | static tcov_file *sort_test_coverage (unsigned char *p) |
| 107 | 111 | { |
| 108 | 112 | int i, j, k; |
| 113 | + unsigned char *start = p; | |
| 109 | 114 | tcov_file *file = NULL; |
| 110 | 115 | tcov_file *nfile; |
| 111 | 116 | |
| @@ -148,7 +153,7 @@ static tcov_file *sort_test_coverage (unsigned char *p) · 36 unmodified lines | ||
| 148 | 153 | tcov_function *func; |
| 149 | 154 | |
| 150 | 155 | p += strlen (function) + 1; |
| 151 | − p += -(size_t)p & 7; | |
| 156 | + p += -(p - start) & 7; | |
| 152 | 157 | for (i = 0; i < nfile->n_func; i++) { |
| 153 | 158 | func = &nfile->func[i]; |
| 154 | 159 | if (strcmp (func->function, function) == 0) |