]> andersk Git - splint.git/blobdiff - src/multiVal.c
Pushed back constraintResolve.c to the previous version.
[splint.git] / src / multiVal.c
index 58fc4285e7ff2ab3a82f4754d00a4cf2c9fb1f3f..96e79db571d9c2752e876f0147f726e8928e9710 100644 (file)
@@ -1,6 +1,6 @@
 /*
 ** Splint - annotation-assisted static program checker
-** Copyright (C) 1994-2002 University of Virginia,
+** Copyright (C) 1994-2003 University of Virginia,
 **         Massachusetts Institute of Technology
 **
 ** This program is free software; you can redistribute it and/or modify it
@@ -17,8 +17,8 @@
 ** the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
 ** MA 02111-1307, USA.
 **
-** For information on splint: splint@cs.virginia.edu
-** To report a bug: splint-bug@cs.virginia.edu
+** For information on splint: info@splint.org
+** To report a bug: splint-bug@splint.org
 ** For more information: http://www.splint.org
 */
 /*
@@ -351,9 +351,26 @@ multiVal multiVal_divide (multiVal m1, multiVal m2)
 
   switch (m1->kind)
     {
-    case MVLONG:   return (multiVal_makeInt (m1->value.ival / m2->value.ival));
-    case MVCHAR:   return (multiVal_makeChar ((char) (m1->value.cval / m2->value.cval)));
-    case MVDOUBLE: return (multiVal_makeDouble (m1->value.fval / m2->value.fval));
+    case MVLONG: 
+      if (m2->value.ival != 0)
+       {
+         return (multiVal_makeInt (m1->value.ival / m2->value.ival));
+       }
+      else
+       {
+         return multiVal_undefined;
+       }
+    case MVCHAR:   
+      if (m2->value.cval != (char) 0)
+       {
+         return (multiVal_makeChar ((char) (m1->value.cval / m2->value.cval)));
+       }
+      else
+       {
+         return multiVal_undefined;
+       }
+    case MVDOUBLE:
+      return multiVal_undefined; /* Don't attempt to divide floats */
     case MVSTRING: return multiVal_undefined;
     }
 
This page took 0.039479 seconds and 4 git commands to generate.