This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch master
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=371662f160c4c71afe79eb6f277dc0a2419bee17

commit 371662f160c4c71afe79eb6f277dc0a2419bee17
Author: Guillem Jover <[email protected]>
AuthorDate: Sun Mar 25 05:08:22 2018 +0200

    dselect: Fix variable types to avoid needing old-style casts
    
    Warned-by: g++ -Wold-style-cast
---
 debian/changelog    | 1 +
 dselect/baselist.cc | 9 +++++----
 dselect/pkginfo.cc  | 3 ++-
 3 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 02d5247e5..ccbb41a42 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -191,6 +191,7 @@ dpkg (1.20.0) UNRELEASED; urgency=medium
     - dselect: Use nullptr instead of NULL.
     - dselect: Use static_cast<> instead of old-style type qualifier cast.
     - dselect: Do not use unnecessary old-style casts.
+    - dselect: Fix variable types to avoid needing old-style casts.
   * Build system:
     - Bump minimal Perl version to 5.24.1.
     - Add a serial versioning to the m4 files.
diff --git a/dselect/baselist.cc b/dselect/baselist.cc
index 9fc2733d9..fd96db3e1 100644
--- a/dselect/baselist.cc
+++ b/dselect/baselist.cc
@@ -404,14 +404,15 @@ void baselist::refreshinfo() {
 }
 
 void baselist::wordwrapinfo(int offset, const char *m) {
-  int usemax= xmax-5;
+  ssize_t usemax = xmax - 5;
   debug(dbg_general, "baselist[%p]::wordwrapinfo(%d, '%s')", this, offset, m);
   bool wrapping = false;
 
   for (;;) {
     int offleft=offset; while (*m == ' ' && offleft>0) { m++; offleft--; }
     const char *p = strchrnul(m, '\n');
-    int l = (int)(p - m);
+    ptrdiff_t l = p - m;
+
     while (l && c_isspace(m[l - 1]))
       l--;
     if (!l || (*m == '.' && l == 1)) {
@@ -436,11 +437,11 @@ void baselist::wordwrapinfo(int offset, const char *m) {
       }
       for (;;) {
         getyx(infopad, y,x);
-        int dosend= usemax-x;
+        ssize_t dosend = usemax - x;
         if (l <= dosend) {
           dosend=l;
         } else {
-          int i=dosend;
+          ssize_t i = dosend;
           while (i > 0 && m[i] != ' ') i--;
           if (i > 0 || x > 0) dosend=i;
         }
diff --git a/dselect/pkginfo.cc b/dselect/pkginfo.cc
index af21743e5..36313c699 100644
--- a/dselect/pkginfo.cc
+++ b/dselect/pkginfo.cc
@@ -115,7 +115,8 @@ void packagelist::itd_description() {
     if (str_is_unset(m))
       m = _("No description available.");
     const char *p = strchrnul(m, '\n');
-    int l = (int)(p - m);
+    ptrdiff_t l = p - m;
+
     wattrset(infopad, part_attr[info_head]);
     waddstr(infopad, table[cursorline]->pkg->set->name);
     waddstr(infopad," - ");

-- 
Dpkg.Org's dpkg

Reply via email to