Skip to content

Cleanups and fixes - #14

Open
3x380V wants to merge 15 commits into
pkot:savannahfrom
3x380V:cleanups
Open

Cleanups and fixes#14
3x380V wants to merge 15 commits into
pkot:savannahfrom
3x380V:cleanups

Conversation

@3x380V

@3x380V 3x380V commented Jul 27, 2026

Copy link
Copy Markdown
Contributor

Fix some GCC warnings (mostly low hanging fruits) and add some actual fixes.

Comment thread gnokii/gnokii-monitor.c Outdated
Comment thread common/phones/nokia.c
memcpy(data->locks_info[1].data, tmp + 16, 4);
memcpy(data->locks_info[2].data, tmp + 20, 4);
memcpy(data->locks_info[3].data, tmp + 5, 10);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This changes the behavior.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How? Destination is already zeroed and tmp is hexdump.

Comment thread common/phones/atgen.c Outdated
Comment thread xgnokii/xgnokii_logos.c Outdated
Comment thread xgnokii/xgnokii_logos.c Outdated
Comment thread xgnokii/xgnokii_logos.c Outdated
phoneMonitor.call.callInProgress = CS_Waiting;
strncpy (phoneMonitor.call.callNum, call->remote_number, INCALL_NUMBER_LENGTH);
strncpy (phoneMonitor.call.callNum, call->remote_number, INCALL_NUMBER_LENGTH - 1);
phoneMonitor.call.callNum[INCALL_NUMBER_LENGTH - 1] = 0;

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This one is not same as above, call->remote_number is a bounded 49-char field, so snprintf into callNum[20] produces a new -Wformat-truncation warning.

@3x380V
3x380V marked this pull request as draft July 27, 2026 21:00
@3x380V
3x380V marked this pull request as ready for review July 27, 2026 21:28
3x380V added 9 commits July 27, 2026 23:35
- fix calculation of remaining space in the destination for strncat
- use sizeof to get size of buffer
- refactor first and last name concatenation
As locks_info fields are already zeroed use memcpy to transfer fixed-width
hex digits there. It is a bit more efficient and fixes stringop-truncation
warning.
Fixes stringop-truncation warning.
Also fixes format-truncation warning.
3x380V added 6 commits August 6, 2026 13:09
Let all serial_open() errors go through a single bail path, so the
instance_data allocated by serial_init() is released on every
failure path.
Let all irda_open() errors go through a single bail path, so the
WSACleanup is called on every relevant failure path.
The changespeed device operation is expected to return gn_error, so
propagate the serial_changespeed() result instead of discarding it.

Wire DTR/RTS handling.
Register a getfd method and query it on demand, which allows to drop
the cached fd from gn_device. Backends with no file descriptor to
offer leave the method unset and device_getfd() returns -1 for them.
@3x380V 3x380V changed the title Cleanups Cleanups and fixes Aug 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants