View | Details | Raw Unified | Return to bug 16932 | Differences between
and this patch

Collapse All | Expand All

(-)seq.c (-3 / +11 lines)
Lines 1-7 Link Here
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1995-1998  Robert Gentleman and Ross Ihaka
3
 *  Copyright (C) 1995-1998  Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 1998-2015  The R Core Team.
4
 *  Copyright (C) 1998-2016  The R Core Team.
5
 *
5
 *
6
 *  This program is free software; you can redistribute it and/or modify
6
 *  This program is free software; you can redistribute it and/or modify
7
 *  it under the terms of the GNU General Public License as published by
7
 *  it under the terms of the GNU General Public License as published by
Lines 334-340 Link Here
334
	      type2char(TYPEOF(s)));
334
	      type2char(TYPEOF(s)));
335
335
336
    nc = xlength(ncopy); // might be 0
336
    nc = xlength(ncopy); // might be 0
337
    if (nc == xlength(s))
337
    if (nc != 1 && nc == xlength(s))
338
	PROTECT(a = rep2(s, ncopy));
338
	PROTECT(a = rep2(s, ncopy));
339
    else {
339
    else {
340
	if (nc != 1) error(_("invalid '%s' value"), "times");
340
	if (nc != 1) error(_("invalid '%s' value"), "times");
Lines 658-666 Link Here
658
	if(nt != 1 && nt != lx * each)
658
	if(nt != 1 && nt != lx * each)
659
	    errorcall(call, _("invalid '%s' argument"), "times");
659
	    errorcall(call, _("invalid '%s' argument"), "times");
660
	if(nt == 1) {
660
	if(nt == 1) {
661
	    int it = INTEGER(times)[0];
661
	    R_xlen_t it;
662
#ifdef LONG_VECTOR_SUPPORT
663
	    double sit = asReal(CADR(args));
664
	    if (!R_FINITE(sit) || sit < 0)
665
		errorcall(call, _("invalid '%s' argument"), "times");
666
	    it = (R_xlen_t) sit;
667
#else
668
	    it = asInteger(CADR(args));
662
	    if (it == NA_INTEGER || it < 0)
669
	    if (it == NA_INTEGER || it < 0)
663
		errorcall(call, _("invalid '%s' argument"), "times");
670
		errorcall(call, _("invalid '%s' argument"), "times");
671
#endif
664
	    len = lx * it * each;
672
	    len = lx * it * each;
665
	} else {
673
	} else {
666
	    for(i = 0; i < nt; i++) {
674
	    for(i = 0; i < nt; i++) {

Return to bug 16932