Corinna Vinschen
2018-08-08 08:52:45 UTC
https://sourceware.org/git/gitweb.cgi?p=newlib-cygwin.git;h=37f4fea07c87973408e4ad231ba6c8bd57982b03
commit 37f4fea07c87973408e4ad231ba6c8bd57982b03
Author: Corinna Vinschen <***@vinschen.de>
Date: Wed Aug 8 09:25:12 2018 +0200
Cygwin: utils: change 3rd readlink param to size_t
Avoid gcc warnings
Signed-off-by: Corinna Vinschen <***@vinschen.de>
Diff:
---
winsup/utils/path.cc | 8 ++++----
winsup/utils/path.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/winsup/utils/path.cc b/winsup/utils/path.cc
index fcc5c07..17ea352 100644
--- a/winsup/utils/path.cc
+++ b/winsup/utils/path.cc
@@ -181,7 +181,7 @@ out:
/* Assumes is_symlink(fh) is true */
bool
-readlink (HANDLE fh, char *path, int maxlen)
+readlink (HANDLE fh, char *path, size_t maxlen)
{
DWORD rv;
char *buf, *cp;
@@ -225,7 +225,7 @@ readlink (HANDLE fh, char *path, int maxlen)
return false;
wcstombs (path, (wchar_t *) (cp + 2), wlen + 1);
}
- else if (len + 1 > maxlen)
+ else if ((size_t) (len + 1) > maxlen)
return false;
else
memcpy (path, cp, len);
@@ -243,7 +243,7 @@ readlink (HANDLE fh, char *path, int maxlen)
return false;
wcstombs (path, (wchar_t *) (cp + 2), wlen + 1);
}
- else if (fi.nFileSizeLow - strlen (SYMLINK_COOKIE) > (unsigned) maxlen)
+ else if (fi.nFileSizeLow - strlen (SYMLINK_COOKIE) > maxlen)
return false;
else
strcpy (path, cp);
@@ -778,7 +778,7 @@ rel_vconcat (const char *cwd, const char *s, va_list v)
cwd = pathbuf;
}
- int max_len = 0;
+ size_t max_len = 0;
mnt_t *m, *match = NULL;
for (m = mount_table; m->posix; m++)
diff --git a/winsup/utils/path.h b/winsup/utils/path.h
index 53ef4d2..ee7c28a 100644
--- a/winsup/utils/path.h
+++ b/winsup/utils/path.h
@@ -17,7 +17,7 @@ char *cygpath (const char *s, ...);
char *cygpath_rel (const char *cwd, const char *s, ...);
bool is_exe (HANDLE);
bool is_symlink (HANDLE);
-bool readlink (HANDLE, char *, int);
+bool readlink (HANDLE, char *, size_t);
int get_word (HANDLE, int);
int get_dword (HANDLE, int);
bool from_fstab_line (mnt_t *m, char *line, bool user);
commit 37f4fea07c87973408e4ad231ba6c8bd57982b03
Author: Corinna Vinschen <***@vinschen.de>
Date: Wed Aug 8 09:25:12 2018 +0200
Cygwin: utils: change 3rd readlink param to size_t
Avoid gcc warnings
Signed-off-by: Corinna Vinschen <***@vinschen.de>
Diff:
---
winsup/utils/path.cc | 8 ++++----
winsup/utils/path.h | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/winsup/utils/path.cc b/winsup/utils/path.cc
index fcc5c07..17ea352 100644
--- a/winsup/utils/path.cc
+++ b/winsup/utils/path.cc
@@ -181,7 +181,7 @@ out:
/* Assumes is_symlink(fh) is true */
bool
-readlink (HANDLE fh, char *path, int maxlen)
+readlink (HANDLE fh, char *path, size_t maxlen)
{
DWORD rv;
char *buf, *cp;
@@ -225,7 +225,7 @@ readlink (HANDLE fh, char *path, int maxlen)
return false;
wcstombs (path, (wchar_t *) (cp + 2), wlen + 1);
}
- else if (len + 1 > maxlen)
+ else if ((size_t) (len + 1) > maxlen)
return false;
else
memcpy (path, cp, len);
@@ -243,7 +243,7 @@ readlink (HANDLE fh, char *path, int maxlen)
return false;
wcstombs (path, (wchar_t *) (cp + 2), wlen + 1);
}
- else if (fi.nFileSizeLow - strlen (SYMLINK_COOKIE) > (unsigned) maxlen)
+ else if (fi.nFileSizeLow - strlen (SYMLINK_COOKIE) > maxlen)
return false;
else
strcpy (path, cp);
@@ -778,7 +778,7 @@ rel_vconcat (const char *cwd, const char *s, va_list v)
cwd = pathbuf;
}
- int max_len = 0;
+ size_t max_len = 0;
mnt_t *m, *match = NULL;
for (m = mount_table; m->posix; m++)
diff --git a/winsup/utils/path.h b/winsup/utils/path.h
index 53ef4d2..ee7c28a 100644
--- a/winsup/utils/path.h
+++ b/winsup/utils/path.h
@@ -17,7 +17,7 @@ char *cygpath (const char *s, ...);
char *cygpath_rel (const char *cwd, const char *s, ...);
bool is_exe (HANDLE);
bool is_symlink (HANDLE);
-bool readlink (HANDLE, char *, int);
+bool readlink (HANDLE, char *, size_t);
int get_word (HANDLE, int);
int get_dword (HANDLE, int);
bool from_fstab_line (mnt_t *m, char *line, bool user);