[PATCH] priceimpl improvements

Adrienne Ambrose <AAmbrose@...>


Again from list discussed with Damien -

15) Priceimpl.c - lld? Looks wrong in openmama.  

  • snprintf (buf, bufMaxLen, "%lld", integer);

Luckily, every version of VS since 2005 seems to support '%lld', but now changed to the PRIi64 Macro.



PATCH:- 0002-Correct-the-printing-of-64bit-integers

From fca1911f42012cd72628648895c24d05c4b8e268 Mon Sep 17 00:00:00 2001

From: Gary Molloy <gmolloy@...>

Date: Thu, 7 Aug 2014 15:58:18 +0100

Subject: [PATCH 2/4] Correct the printing of 64bit integers



Signed-off-by: Gary Molloy <gmolloy@...>


mama/c_cpp/src/c/priceimpl.c | 8 ++++----

1 file changed, 4 insertions(+), 4 deletions(-)


diff --git a/mama/c_cpp/src/c/priceimpl.c b/mama/c_cpp/src/c/priceimpl.c

index 58c3095..86d2ebd 100644

--- a/mama/c_cpp/src/c/priceimpl.c

+++ b/mama/c_cpp/src/c/priceimpl.c

@@ -103,7 +103,7 @@ void mamaPriceImpl_getAsStringInteger (double     value,

                                  mama_size_t     bufMaxLen)


     int64_t  integer    = (int64_t)value;

-    snprintf (buf, bufMaxLen, "%lld", integer);

+    snprintf (buf, bufMaxLen, "%"PRIi64, integer);



@@ -117,18 +117,18 @@ void mamaPriceImpl_getAsStringFraction (double    value,

     int64_t  numer    = (int64_t)((double)denom * fraction);

     if (numer == 0)


-        snprintf (buf, bufMaxLen, "%lld", integer);

+        snprintf (buf, bufMaxLen, "%"PRIi64, integer);


     else if (integer == 0)


                                        char formatSpecifier[20] = "";

-                                       sprintf(formatSpecifier, "%s/%s", "%lld", "%ld");

+                                      sprintf(formatSpecifier, "%s/%s", "%"PRIi64, "%ld");

         snprintf (buf, bufMaxLen, formatSpecifier, numer, denom);




                                        char formatSpecifier[20] = "";

-                                       sprintf(formatSpecifier, "%s %s/%s", "%lld", "%lld", "%ld");

+                                      sprintf(formatSpecifier, "%s %s/%s", "%"PRIi64, "%"PRIi64, "%ld");

         if (integer < 0)


             numer = -numer;



This message may contain confidential information and is intended for specific recipients unless explicitly noted otherwise. If you have reason to believe you are not an intended recipient of this message, please delete it and notify the sender. This message may not represent the opinion of Intercontinental Exchange, Inc. (ICE), Euronext or any of their subsidiaries or affiliates, and does not constitute a contract or guarantee. Unencrypted electronic mail is not secure and the recipient of this message is expected to provide safeguards from viruses and pursue alternate means of communication where privacy or a binding message is desired.