[Scummvm-git-logs] scummvm master -> 9ebfceee1ea685ba9a2605392b6c05ee684c41db

digitall noreply at scummvm.org
Sun Feb 12 14:09:50 UTC 2023


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
9ebfceee1e TIMIDITY: Fix Format Truncation GCC Compiler Warning


Commit: 9ebfceee1ea685ba9a2605392b6c05ee684c41db
    https://github.com/scummvm/scummvm/commit/9ebfceee1ea685ba9a2605392b6c05ee684c41db
Author: D G Turner (digitall at scummvm.org)
Date: 2023-02-12T14:09:13Z

Commit Message:
TIMIDITY: Fix Format Truncation GCC Compiler Warning

Changed paths:
    backends/midi/timidity.cpp


diff --git a/backends/midi/timidity.cpp b/backends/midi/timidity.cpp
index 2014e830cbb..cacb1819d93 100644
--- a/backends/midi/timidity.cpp
+++ b/backends/midi/timidity.cpp
@@ -141,7 +141,6 @@ int MidiDriver_TIMIDITY::open() {
 	char *res;
 	char timidity_host[NI_MAXHOST];
 	char timidity_port[6], data_port[6];
-	int num;
 
 	/* count ourselves open */
 	if (_isOpen)
@@ -204,13 +203,13 @@ int MidiDriver_TIMIDITY::open() {
 	/*
 	 * open data connection
 	 */
-	num = atoi(res + 4);
+	uint num = atoi(res + 4);
 	if (num > 65535) {
 		warning("TiMidity: Invalid port %d given.\n", num);
 		close_all();
 		return -1;
 	}
-	snprintf(data_port, sizeof(data_port), "%d", num);
+	snprintf(data_port, sizeof(data_port), "%.5d", (uint16)num);
 	if ((_data_fd = connect_to_server(timidity_host, data_port)) < 0) {
 		warning("TiMidity: can't open data connection (host=%s, port=%s)", timidity_host, data_port);
 		close_all();




More information about the Scummvm-git-logs mailing list