Fix some (harmless) cppcheck warnings.

[dwarf_getaranges.c:149]: (warning) Ineffective statement similar to '*A++;'.
Did you intend to write '(*A)++;'?

There was already an XXX statement that we weren't using the result.
Explicitly read the segment_size and check it is zero. And report an
error if it isn't, since we aren't prepared to handle such a case.

[arlib.c:62]: (error) Uninitialized variable: tmpbuf
[arlib.c:124]: (error) Uninitialized variable: tmpbuf

cppcheck is wrong. tmpbuf is initialized in the snprintf call whose result
is use in the same memcpy call. It does make the code less readable and
harder to understand. So explicitly split the snprintf and memcpy calls.

[nm.c:766]: (warning) Assert statement modifies 'cnt'.

The cnt variable was only used for this assert sanity check.
But it is bad style to do have side effects inside an assert statement.
Increase cnt after the assert.

Reported-by: David Binderman <dcb314@hotmail.com>
Signed-off-by: Mark Wielaard <mjw@redhat.com>
diff --git a/src/nm.c b/src/nm.c
index 7aae84b..d434f44 100644
--- a/src/nm.c
+++ b/src/nm.c
@@ -763,7 +763,8 @@
     {
       GElf_Shdr shdr_mem;
 
-      assert (elf_ndxscn (scn) == cnt++);
+      assert (elf_ndxscn (scn) == cnt);
+      cnt++;
 
       char *name = elf_strptr (ebl->elf, shstrndx,
 			       gelf_getshdr (scn, &shdr_mem)->sh_name);