]> git.proxmox.com Git - libgit2.git/blobdiff - src/win32/w32_util.h
New upstream version 1.1.0+dfsg.1
[libgit2.git] / src / win32 / w32_util.h
index 3a7942563fc778c942dc7c234a53e1f7ce0ff9cc..d7f9d3da6d8240ff238ea837381097b33969b52d 100644 (file)
@@ -59,6 +59,11 @@ extern int git_win32__set_hidden(const char *path, bool hidden);
  */
 extern int git_win32__hidden(bool *hidden, const char *path);
 
+extern int git_win32__file_attribute_to_stat(
+       struct stat *st,
+       const WIN32_FILE_ATTRIBUTE_DATA *attrdata,
+       const wchar_t *path);
+
 /**
  * Converts a FILETIME structure to a struct timespec.
  *
@@ -115,7 +120,7 @@ GIT_INLINE(void) git_win32__stat_init(
        st->st_uid = 0;
        st->st_nlink = 1;
        st->st_mode = mode;
-       st->st_size = ((git_off_t)nFileSizeHigh << 32) + nFileSizeLow;
+       st->st_size = ((int64_t)nFileSizeHigh << 32) + nFileSizeLow;
        st->st_dev = _getdrive() - 1;
        st->st_rdev = st->st_dev;
        git_win32__filetime_to_timespec(&ftLastAccessTime, &(st->st_atim));
@@ -136,35 +141,4 @@ GIT_INLINE(void) git_win32__file_information_to_stat(
                fileinfo->ftLastWriteTime);
 }
 
-GIT_INLINE(int) git_win32__file_attribute_to_stat(
-       struct stat *st,
-       const WIN32_FILE_ATTRIBUTE_DATA *attrdata,
-       const wchar_t *path)
-{
-       git_win32__stat_init(st,
-               attrdata->dwFileAttributes,
-               attrdata->nFileSizeHigh,
-               attrdata->nFileSizeLow,
-               attrdata->ftCreationTime,
-               attrdata->ftLastAccessTime,
-               attrdata->ftLastWriteTime);
-
-       if (attrdata->dwFileAttributes & FILE_ATTRIBUTE_REPARSE_POINT && path) {
-               git_win32_path target;
-
-               if (git_win32_path_readlink_w(target, path) >= 0) {
-                       st->st_mode = (st->st_mode & ~S_IFMT) | S_IFLNK;
-
-                       /* st_size gets the UTF-8 length of the target name, in bytes,
-                        * not counting the NULL terminator */
-                       if ((st->st_size = git__utf16_to_8(NULL, 0, target)) < 0) {
-                               git_error_set(GIT_ERROR_OS, "could not convert reparse point name for '%ls'", path);
-                               return -1;
-                       }
-               }
-       }
-
-       return 0;
-}
-
 #endif