02110-1301, USA. */
#include <config.h>
-#include "message.h"
+#include <libpspp/message.h>
#include <ctype.h>
#include <math.h>
#include <float.h>
#include <stdlib.h>
#include <time.h>
#include "calendar.h"
-#include "message.h"
+#include <libpspp/assertion.h>
+#include <libpspp/message.h>
#include "format.h"
-#include "magic.h"
-#include "misc.h"
-#include "misc.h"
+#include <libpspp/magic.h>
+#include <libpspp/misc.h>
+#include <libpspp/misc.h>
#include "settings.h"
-#include "str.h"
+#include <libpspp/str.h>
#include "variable.h"
#include "gettext.h"
#define _(msgid) gettext (msgid)
-
-#include "debug-print.h"
\f
/* Public functions. */
break;
case FMT_A:
- assert (0);
- abort ();
+ NOT_REACHED ();
case FMT_AHEX:
- assert (0);
- abort ();
+ NOT_REACHED ();
case FMT_IB:
ok = convert_IB (s, fp, number);
break;
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
}
else
break;
default:
- assert (0);
- abort ();
+ NOT_REACHED ();
}
}
static int
convert_A (char *dst, const struct fmt_spec *fp, const char *string)
{
- memcpy (dst, string, fp->w);
+ memcpy(dst, string, fp->w);
return 1;
}
}
break;
default:
- assert (0);
+ NOT_REACHED ();
}
if (buf[0] == 0)
avoids wasting too much time formatting more
decimal places on the first try. */
int result = format_and_round (dst, number, fp, fp->d + 2);
+
if (result >= 0)
return result;
digits of the fraction.
Right-justify the integer part and sign. */
dst[0] = ' ';
- memcpy (dst + 1, buf, fp->w);
+ memcpy (dst + 1, buf, fp->w - 1);
return 1;
}