[Zodb-checkins] SVN: ZODB/trunk/src/BTrees/floatvaluemacros.h COPY_VALUE_FROM_ARG

Tim Peters tim.one at comcast.net
Thu Dec 9 16:47:08 EST 2004


Log message for revision 28615:
  COPY_VALUE_FROM_ARG
  
  Explicitly cast to float.  Else MSVC generated
  legit warnings everywhere this macro was used,
  warning about possible silent precision loss.
  

Changed:
  U   ZODB/trunk/src/BTrees/floatvaluemacros.h

-=-
Modified: ZODB/trunk/src/BTrees/floatvaluemacros.h
===================================================================
--- ZODB/trunk/src/BTrees/floatvaluemacros.h	2004-12-09 21:26:11 UTC (rev 28614)
+++ ZODB/trunk/src/BTrees/floatvaluemacros.h	2004-12-09 21:47:08 UTC (rev 28615)
@@ -12,8 +12,8 @@
 #define COPY_VALUE(V, E) (V=(E))
 #define COPY_VALUE_TO_OBJECT(O, K) O=PyFloat_FromDouble(K) 
 #define COPY_VALUE_FROM_ARG(TARGET, ARG, STATUS) \
-  if (PyFloat_Check(ARG)) TARGET = PyFloat_AsDouble(ARG); \
-  else if (PyInt_Check(ARG)) TARGET = PyInt_AsLong(ARG); \
+  if (PyFloat_Check(ARG)) TARGET = (float)PyFloat_AsDouble(ARG); \
+  else if (PyInt_Check(ARG)) TARGET = (float)PyInt_AsLong(ARG); \
   else { \
       PyErr_SetString(PyExc_TypeError, "expected float or int value"); \
       (STATUS)=0; (TARGET)=0; } 



More information about the Zodb-checkins mailing list