]> wimlib.net Git - wimlib/commitdiff
Remove unused win32_truncate_replacement()
authorEric Biggers <ebiggers3@gmail.com>
Thu, 15 May 2014 04:50:12 +0000 (23:50 -0500)
committerEric Biggers <ebiggers3@gmail.com>
Thu, 15 May 2014 04:50:12 +0000 (23:50 -0500)
include/wimlib_tchar.h
src/win32_replacements.c

index 8acaee1e5b6109fc19000a640979ec93a4e10560..b468ef366277151637795d4499be4b55188c092d 100644 (file)
@@ -62,7 +62,6 @@ typedef wchar_t tchar;
 #  define tmkdir(path, mode) _wmkdir(path)
 #  define tstrerror_r   win32_strerror_r_replacement
 #  define trename      win32_rename_replacement
-#  define ttruncate    win32_truncate_replacement
 #  define tglob                win32_wglob
 #else /* __WIN32__ */
 /* For non-Windows builds, the "tchar" type will be one byte and will specify a
@@ -117,7 +116,6 @@ typedef char tchar;
 #  define TSTRDUP      STRDUP
 #  define tstrerror_r  strerror_r
 #  define trename      rename
-#  define ttruncate    truncate
 #  define taccess      access
 #  define tglob                glob
 #endif /* !__WIN32__ */
index fcb22f7a1593bc4186ef77fcbde70fb17ac69ea9..39f031bb4d372f496e76c9b3d53716a586701d89 100644 (file)
@@ -188,37 +188,6 @@ err_set_errno:
        return -1;
 }
 
-/* truncate() replacement */
-int
-win32_truncate_replacement(const wchar_t *path, off_t size)
-{
-       DWORD err = NO_ERROR;
-       LARGE_INTEGER liOffset;
-
-       HANDLE h = win32_open_existing_file(path, GENERIC_WRITE);
-       if (h == INVALID_HANDLE_VALUE)
-               goto fail;
-
-       liOffset.QuadPart = size;
-       if (!SetFilePointerEx(h, liOffset, NULL, FILE_BEGIN))
-               goto fail_close_handle;
-
-       if (!SetEndOfFile(h))
-               goto fail_close_handle;
-       CloseHandle(h);
-       return 0;
-
-fail_close_handle:
-       err = GetLastError();
-       CloseHandle(h);
-fail:
-       if (err == NO_ERROR)
-               err = GetLastError();
-       set_errno_from_win32_error(err);
-       return -1;
-}
-
-
 /* This really could be replaced with _wcserror_s, but this doesn't seem to
  * actually be available in MSVCRT.DLL on Windows XP (perhaps it's statically
  * linked in by Visual Studio...?). */