Change in simtrace2[master]: stdio: add void 'l' format string qualifier

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Harald Welte gerrit-no-reply at lists.osmocom.org
Wed Aug 29 07:27:57 UTC 2018


Harald Welte has submitted this change and it was merged. ( https://gerrit.osmocom.org/10670 )

Change subject: stdio: add void 'l' format string qualifier
......................................................................

stdio: add void 'l' format string qualifier

Wformat requires uint32_t to be used in format string with the 'l'
qualifier (l = long = at least 32 bits).
this qualifier was not handled before.
since on ARM 32-bit int == long we can simply ignore it (stdio
already does not support 64-bit data).

Change-Id: Ib506a66f68712c6b3eeb5129a39abf47ec86a2a7
---
M firmware/libcommon/source/stdio.c
1 file changed, 16 insertions(+), 13 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/firmware/libcommon/source/stdio.c b/firmware/libcommon/source/stdio.c
index 04d73f0..2bfaed7 100644
--- a/firmware/libcommon/source/stdio.c
+++ b/firmware/libcommon/source/stdio.c
@@ -350,19 +350,22 @@
 			}
 		
 			// Parse type
-			switch (*pFormat) {
-			case 'd': 
-			case 'i': num = PutSignedInt(pStr, fill, width, va_arg(ap, signed int)); break;
-			case 'u': num = PutUnsignedInt(pStr, fill, width, va_arg(ap, unsigned int)); break;
-			case 'x': num = PutHexa(pStr, fill, width, 0, va_arg(ap, unsigned int)); break;
-			case 'X': num = PutHexa(pStr, fill, width, 1, va_arg(ap, unsigned int)); break;
-			case 's': num = PutString(pStr, va_arg(ap, char *)); break;
-			case 'c': num = PutChar(pStr, va_arg(ap, unsigned int)); break;
-			default:
-				return EOF;
-			}
-
-			pFormat++;
+			do {
+				num = 0;
+				switch (*pFormat) {
+				case 'l': num = -1; break; // ignore long qualifier since int == long (and long long is not supported)
+				case 'd':
+				case 'i': num = PutSignedInt(pStr, fill, width, va_arg(ap, signed int)); break;
+				case 'u': num = PutUnsignedInt(pStr, fill, width, va_arg(ap, unsigned int)); break;
+				case 'x': num = PutHexa(pStr, fill, width, 0, va_arg(ap, unsigned int)); break;
+				case 'X': num = PutHexa(pStr, fill, width, 1, va_arg(ap, unsigned int)); break;
+				case 's': num = PutString(pStr, va_arg(ap, char *)); break;
+				case 'c': num = PutChar(pStr, va_arg(ap, unsigned int)); break;
+				default:
+					return EOF;
+				}
+				pFormat++;
+			} while (num < 0);
 			pStr += num;
 			size += num;
 		}

-- 
To view, visit https://gerrit.osmocom.org/10670
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: Ib506a66f68712c6b3eeb5129a39abf47ec86a2a7
Gerrit-Change-Number: 10670
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kredon at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20180829/e833795d/attachment.htm>


More information about the gerrit-log mailing list