History

win: include dirs: add some docs, minor refactor

Avi Halachmi (:avih) committed 11 years ago

Commit 951c23f1 parent 37e815e1 file · +18 −4Browse files

Unified · Split

libtcc.c+18−4
@@ -1510,6 +1510,20 @@ LIBTCCAPI int tcc_add_symbol(TCCState *s, const char *name, const void *val) · 1509 unmodified lines
15101510 }
15111511
15121512
1513+/* Windows stat* ( https://msdn.microsoft.com/en-us/library/14h5k7ff.aspx ):
1514+ * - st_gid, st_ino, st_uid: only valid on "unix" file systems (not FAT, NTFS, etc)
1515+ * - st_atime, st_ctime: not valid on FAT, valid on NTFS.
1516+ * - Other fields should be reasonably compatible (and S_ISDIR should work).
1517+ *
1518+ * BY_HANDLE_FILE_INFORMATION ( https://msdn.microsoft.com/en-us/library/windows/desktop/aa363788%28v=vs.85%29.aspx ):
1519+ * - File index (combined nFileIndexHigh and nFileIndexLow) _may_ change when the file is opened.
1520+ * - But on NTFS: it's guaranteed to be the same value until the file is deleted.
1521+ * - On windows server 2012 there's a 128b file id, and the 64b one via
1522+ * nFileIndex* is not guaranteed to be unique.
1523+ *
1524+ * - MS Docs suggest to that volume number with the file index could be used to
1525+ * check if two handles refer to the same file.
1526+ */
15131527 #ifndef _WIN32
15141528 typedef struct stat file_info_t;
15151529 #else
@@ -1524,11 +1538,11 @@ int get_file_info(const char *fname, file_info_t *out_info) · 8 unmodified lines
15241538 int rv = 1;
15251539 HANDLE h = CreateFile(fname, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
15261540 FILE_ATTRIBUTE_NORMAL|FILE_FLAG_BACKUP_SEMANTICS, NULL);
1527− if (h == INVALID_HANDLE_VALUE)
1528− return rv;
15291541
1530− rv = !GetFileInformationByHandle(h, out_info);
1531− CloseHandle(h);
1542+ if (h != INVALID_HANDLE_VALUE) {
1543+ rv = !GetFileInformationByHandle(h, out_info);
1544+ CloseHandle(h);
1545+ }
15321546 return rv;
15331547 #endif
15341548 }

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t