mirror of
https://github.com/subsurface/subsurface.git
synced 2025-02-19 22:16:15 +00:00
Code cleanup
Make precedence of && over || explicit. Explicitly convert between char * and unsigned char *. Don't assign potentially negative return code to an unsigend variable. Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
parent
e76675d4df
commit
b1538c809d
6 changed files with 18 additions and 15 deletions
|
|
@ -142,9 +142,9 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
|
|||
memcpy(location + len, ", ", 2);
|
||||
memcpy(location + len + 2, buf + ptr + len + 4, place_len);
|
||||
} else if (len) {
|
||||
location = strndup(buf + ptr, len);
|
||||
location = strndup((char *)buf + ptr, len);
|
||||
} else if (place_len) {
|
||||
location = strndup(buf + ptr + len + 4, place_len);
|
||||
location = strndup((char *)buf + ptr + len + 4, place_len);
|
||||
}
|
||||
|
||||
/* Store the location only if we have one */
|
||||
|
|
@ -160,8 +160,8 @@ static void parse_dives (int log_version, const unsigned char *buf, unsigned int
|
|||
ptr += 4;
|
||||
|
||||
// Blank notes are better than the default text
|
||||
if (len && strncmp(buf + ptr, "Comment ...", 11)) {
|
||||
dive->notes = strndup(buf + ptr, len);
|
||||
if (len && strncmp((char *)buf + ptr, "Comment ...", 11)) {
|
||||
dive->notes = strndup((char *)buf + ptr, len);
|
||||
}
|
||||
ptr += len;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue