From d40d166f9133e0ea658a553be11d455748a14d46 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 20 Dec 2010 13:37:26 +0000 Subject: [PATCH] Switch void* to char* arithmetic --- WHATS_NEW | 1 + lib/activate/activate.c | 2 +- tools/dmsetup.c | 6 +++--- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/WHATS_NEW b/WHATS_NEW index f107e41f3..41ddca9ee 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.79 - =================================== + Use char* arithmetic in target_version(), _process_all(), _targets(). Fixing const cast gcc warnings in the code. Check read() and close() results in _get_cmdline(). Add const for struct config_node usage. diff --git a/lib/activate/activate.c b/lib/activate/activate.c index 64c296bd9..174f09e73 100644 --- a/lib/activate/activate.c +++ b/lib/activate/activate.c @@ -398,7 +398,7 @@ int target_version(const char *target_name, uint32_t *maj, goto out; } - target = (void *) target + target->next; + target = (struct dm_versions *)((char *) target + target->next); } while (last_target != target); out: diff --git a/tools/dmsetup.c b/tools/dmsetup.c index 1a56d2418..56f157904 100644 --- a/tools/dmsetup.c +++ b/tools/dmsetup.c @@ -1288,8 +1288,8 @@ static int _process_all(int argc, char **argv, int silent, } do { - names = (void *) names + next; - if (!fn(argc, argv, (void *) names)) + names = (struct dm_names *)((char *) names + next); + if (!fn(argc, argv, names)) r = 0; next = names->next; } while (next); @@ -1632,7 +1632,7 @@ static int _targets(int argc __attribute__((unused)), char **argv __attribute__( printf("%-16s v%d.%d.%d\n", target->name, target->version[0], target->version[1], target->version[2]); - target = (void *) target + target->next; + target = (struct dm_versions *)((char *) target + target->next); } while (last_target != target); r = 1; -- 2.43.5