X-Git-Url: https://pintos-os.org/cgi-bin/gitweb.cgi?a=blobdiff_plain;f=src%2Flanguage%2Fexpressions%2Foperations.def;h=db71d2770339db273fa5114fe456afb83f106411;hb=f15c854d8500105766b2f5666bb62b983ff24f88;hp=ea640e18e194a27aa1d99cd6676eb495417186e7;hpb=c3ac5a8af9c449072c7e872ca70a78c1755ae309;p=pspp-builds.git diff --git a/src/language/expressions/operations.def b/src/language/expressions/operations.def index ea640e18..db71d277 100644 --- a/src/language/expressions/operations.def +++ b/src/language/expressions/operations.def @@ -1,7 +1,7 @@ // -*- c -*- // // PSPP - a program for statistical analysis. -// Copyright (C) 2005, 2006 Free Software Foundation, Inc. +// Copyright (C) 2005, 2006, 2009 Free Software Foundation, Inc. // // This program is free software: you can redistribute it and/or modify // it under the terms of the GNU General Public License as published by @@ -582,11 +582,15 @@ absorb_miss string function STRING (x, no_format f) { union value v; struct substring dst; + char *s; v.f = x; - dst = alloc_string (e, f->w); + assert (!fmt_is_string (f->type)); - data_out (&v, f, dst.string); + s = data_out (&v, f); + dst = alloc_string (e, strlen (s)); + strcpy (dst.string, s); + free (s); return dst; } @@ -988,7 +992,7 @@ no_opt string operator STR_VAR () no_opt perm_only function LAG (num_var v, pos_int n_before) dataset ds; { - struct ccase *c = lagged_case (ds, n_before); + const struct ccase *c = lagged_case (ds, n_before); if (c != NULL) { double x = case_num (c, v); @@ -1001,7 +1005,7 @@ no_opt perm_only function LAG (num_var v, pos_int n_before) no_opt perm_only function LAG (num_var v) dataset ds; { - struct ccase *c = lagged_case (ds, 1); + const struct ccase *c = lagged_case (ds, 1); if (c != NULL) { double x = case_num (c, v); @@ -1015,7 +1019,7 @@ no_opt perm_only string function LAG (str_var v, pos_int n_before) expression e; dataset ds; { - struct ccase *c = lagged_case (ds, n_before); + const struct ccase *c = lagged_case (ds, n_before); if (c != NULL) return copy_string (e, case_str (c, v), var_get_width (v)); else @@ -1026,7 +1030,7 @@ no_opt perm_only string function LAG (str_var v) expression e; dataset ds; { - struct ccase *c = lagged_case (ds, 1); + const struct ccase *c = lagged_case (ds, 1); if (c != NULL) return copy_string (e, case_str (c, v), var_get_width (v)); else