[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] Fix type errors in win32.
From: |
U2FsdGVkX1 |
Subject: |
[PATCH] Fix type errors in win32. |
Date: |
Mon, 25 Oct 2021 10:55:03 +0800 |
* src/commands.c (fatal_error_signal): DWORD type should be unsigned
* src/dir.c (print_dir_data_base): Fix format type mismatch
* src/function.c (windows32_openpipe): Use the WINAPI GetStdHandle function
instead
* src/getopt.c (_getopt_internal): Improve code readability
---
src/commands.c | 4 ++--
src/dir.c | 4 ++--
src/function.c | 8 ++++----
src/getopt.c | 3 ++-
4 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/src/commands.c b/src/commands.c
index 8a483bd..cacbfc8 100644
--- a/src/commands.c
+++ b/src/commands.c
@@ -515,12 +515,12 @@ fatal_error_signal (int sig)
DWORD susp_count = SuspendThread (main_thread);
if (susp_count != 0)
- fprintf (stderr, "SuspendThread: suspend count = %ld\n", susp_count);
+ fprintf (stderr, "SuspendThread: suspend count = %lu\n", susp_count);
else if (susp_count == (DWORD)-1)
{
DWORD ierr = GetLastError ();
- fprintf (stderr, "SuspendThread: error %ld: %s\n",
+ fprintf (stderr, "SuspendThread: error %lu: %s\n",
ierr, map_windows32_error_to_string (ierr));
}
}
diff --git a/src/dir.c b/src/dir.c
index edabcaf..724f750 100644
--- a/src/dir.c
+++ b/src/dir.c
@@ -1119,7 +1119,7 @@ print_dir_data_base (void)
else if (dir->contents->dirfiles.ht_vec == 0)
{
#ifdef WINDOWS32
- printf (_("# %s (key %s, mtime %I64u): could not be opened.\n"),
+ printf (_("# %s (key %s, mtime %llu): could not be opened.\n"),
dir->name, dir->contents->path_key,
(unsigned long long)dir->contents->mtime);
#else /* WINDOWS32 */
@@ -1156,7 +1156,7 @@ print_dir_data_base (void)
}
}
#ifdef WINDOWS32
- printf (_("# %s (key %s, mtime %I64u): "),
+ printf (_("# %s (key %s, mtime %llu): "),
dir->name, dir->contents->path_key,
(unsigned long long)dir->contents->mtime);
#else /* WINDOWS32 */
diff --git a/src/function.c b/src/function.c
index 5a7ad3a..a598d74 100644
--- a/src/function.c
+++ b/src/function.c
@@ -1581,11 +1581,11 @@ windows32_openpipe (int *pipedes, int errfd, pid_t
*pid_p, char **command_argv,
if (hIn == INVALID_HANDLE_VALUE)
{
ON (error, NILF,
- _("windows32_openpipe: DuplicateHandle(In) failed (e=%ld)\n"),
e);
+ _("windows32_openpipe: DuplicateHandle(In) failed (e=%lu)\n"),
e);
return -1;
}
}
- tmpErr = (HANDLE)_get_osfhandle (errfd);
+ tmpErr = GetStdHandle (errfd);
if (DuplicateHandle (GetCurrentProcess (), tmpErr,
GetCurrentProcess (), &hErr,
0, TRUE, DUPLICATE_SAME_ACCESS) == FALSE)
@@ -1605,14 +1605,14 @@ windows32_openpipe (int *pipedes, int errfd, pid_t
*pid_p, char **command_argv,
if (hErr == INVALID_HANDLE_VALUE)
{
ON (error, NILF,
- _("windows32_openpipe: DuplicateHandle(Err) failed (e=%ld)\n"),
e);
+ _("windows32_openpipe: DuplicateHandle(Err) failed (e=%lu)\n"),
e);
return -1;
}
}
if (! CreatePipe (&hChildOutRd, &hChildOutWr, &saAttr, 0))
{
- ON (error, NILF, _("CreatePipe() failed (e=%ld)\n"), GetLastError());
+ ON (error, NILF, _("CreatePipe() failed (e=%lu)\n"), GetLastError());
return -1;
}
diff --git a/src/getopt.c b/src/getopt.c
index 35e71ef..262633f 100644
--- a/src/getopt.c
+++ b/src/getopt.c
@@ -676,7 +676,7 @@ _getopt_internal (int argc, char *const *argv, const char
*optstring,
optarg = nameend + 1;
else
{
- if (opterr)
+ if (opterr) {
if (argv[optind - 1][1] == '-')
/* --option */
fprintf (stderr,
@@ -687,6 +687,7 @@ _getopt_internal (int argc, char *const *argv, const char
*optstring,
fprintf (stderr,
_("%s: option '%c%s' doesn't allow an argument\n"),
argv[0], argv[optind - 1][0], pfound->name);
+ }
nextchar += strlen (nextchar);
--
2.25.1
- [PATCH] Fix type errors in win32.,
U2FsdGVkX1 <=