cmd: Avoid comparison between signed and unsigned values
Frédéric Delanoy
frederic.delanoy at gmail.com
Mon Nov 7 03:52:22 CST 2011
-Wsign-compare
---
programs/cmd/batch.c | 4 ++--
programs/cmd/builtins.c | 8 ++++----
programs/cmd/directory.c | 6 +++---
programs/cmd/wcmd.h | 2 +-
programs/cmd/wcmdmain.c | 8 ++++----
5 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/programs/cmd/batch.c b/programs/cmd/batch.c
index acab893..7edb8df 100644
--- a/programs/cmd/batch.c
+++ b/programs/cmd/batch.c
@@ -186,12 +186,12 @@ WCHAR *WCMD_parameter (WCHAR *s, int n, WCHAR **start, WCHAR **end) {
* NULL on error or EOF
*/
-WCHAR *WCMD_fgets(WCHAR *buf, int noChars, HANDLE h)
+WCHAR *WCMD_fgets(WCHAR *buf, DWORD noChars, HANDLE h)
{
DWORD charsRead;
BOOL status;
LARGE_INTEGER filepos;
- int i;
+ DWORD i;
/* We can't use the native f* functions because of the filename syntax differences
between DOS and Unix. Also need to lose the LF (or CRLF) from the line. */
diff --git a/programs/cmd/builtins.c b/programs/cmd/builtins.c
index 22e0342..5272bfc 100644
--- a/programs/cmd/builtins.c
+++ b/programs/cmd/builtins.c
@@ -1323,9 +1323,9 @@ static void WCMD_part_execute(CMD_LIST **cmdList, const WCHAR *firstcmd,
* Simple on-line help. Help text is stored in the resource file.
*/
-void WCMD_give_help (const WCHAR *command) {
-
- int i;
+void WCMD_give_help (const WCHAR *command)
+{
+ size_t i;
command = WCMD_skip_leading_spaces((WCHAR*) command);
if (strlenW(command) == 0) {
@@ -1630,7 +1630,7 @@ void WCMD_move (void)
if (GetFileAttributesW(dest) != INVALID_FILE_ATTRIBUTES) {
BOOL force = FALSE;
WCHAR copycmd[MAXSTRING];
- int len;
+ DWORD len;
/* /-Y has the highest priority, then /Y and finally the COPYCMD env. variable */
if (strstrW (quals, parmNoY))
diff --git a/programs/cmd/directory.c b/programs/cmd/directory.c
index 3c6bd06..3634ded 100644
--- a/programs/cmd/directory.c
+++ b/programs/cmd/directory.c
@@ -627,10 +627,10 @@ static void WCMD_dir_trailer(WCHAR drive) {
*
*/
-void WCMD_directory (WCHAR *cmd) {
-
+void WCMD_directory (WCHAR *cmd)
+{
WCHAR path[MAX_PATH], cwd[MAX_PATH];
- int status;
+ DWORD status;
CONSOLE_SCREEN_BUFFER_INFO consoleInfo;
WCHAR *p;
WCHAR string[MAXSTRING];
diff --git a/programs/cmd/wcmd.h b/programs/cmd/wcmd.h
index 962fd52..205d31c 100644
--- a/programs/cmd/wcmd.h
+++ b/programs/cmd/wcmd.h
@@ -101,7 +101,7 @@ static inline BOOL WCMD_is_console_handle(HANDLE h)
{
return (((DWORD_PTR)h) & 3) == 3;
}
-WCHAR *WCMD_fgets (WCHAR *buf, int n, HANDLE stream);
+WCHAR *WCMD_fgets (WCHAR *buf, DWORD n, HANDLE stream);
WCHAR *WCMD_parameter (WCHAR *s, int n, WCHAR **start, WCHAR **end);
WCHAR *WCMD_skip_leading_spaces (WCHAR *string);
BOOL WCMD_keyword_ws_found(const WCHAR *keyword, int len, const WCHAR *ptr);
diff --git a/programs/cmd/wcmdmain.c b/programs/cmd/wcmdmain.c
index 40ed145..b529672 100644
--- a/programs/cmd/wcmdmain.c
+++ b/programs/cmd/wcmdmain.c
@@ -123,8 +123,8 @@ static char *get_file_buffer(void)
* and hence required WriteConsoleW to output it, however if file i/o is
* redirected, it needs to be WriteFile'd using OEM (not ANSI) format
*/
-static void WCMD_output_asis_len(const WCHAR *message, int len, HANDLE device) {
-
+static void WCMD_output_asis_len(const WCHAR *message, DWORD len, HANDLE device)
+{
DWORD nOut= 0;
DWORD res = 0;
@@ -169,7 +169,7 @@ void WCMD_output (const WCHAR *format, ...) {
va_list ap;
WCHAR string[1024];
- int ret;
+ DWORD ret;
va_start(ap,format);
ret = vsnprintfW(string, sizeof(string)/sizeof(WCHAR), format, ap);
@@ -191,7 +191,7 @@ void WCMD_output_stderr (const WCHAR *format, ...) {
va_list ap;
WCHAR string[1024];
- int ret;
+ DWORD ret;
va_start(ap,format);
ret = vsnprintfW(string, sizeof(string)/sizeof(WCHAR), format, ap);
--
1.7.7.1
More information about the wine-patches
mailing list