Kévin Redon has uploaded this change for review. ( 
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(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/70/10670/1

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: newchange
Gerrit-Change-Id: Ib506a66f68712c6b3eeb5129a39abf47ec86a2a7
Gerrit-Change-Number: 10670
Gerrit-PatchSet: 1
Gerrit-Owner: Kévin Redon <kre...@sysmocom.de>

Reply via email to