The R Project SVN R

Rev

Rev 88133 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 88133 Rev 89795
Line 1... Line 1...
1
/*
1
/*
2
 *  R : A Computer Language for Statistical Data Analysis
2
 *  R : A Computer Language for Statistical Data Analysis
3
 *  Copyright (C) 1999--2025  The R Core Team
3
 *  Copyright (C) 1999--2026  The R Core Team
4
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
4
 *  Copyright (C) 1995, 1996  Robert Gentleman and Ross Ihaka
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
8
 *  the Free Software Foundation; either version 2 of the License, or
8
 *  the Free Software Foundation; either version 2 of the License, or
Line 954... Line 954...
954
    if(res >= R_BUFSIZE) { /* res is the desired output length */
954
    if(res >= R_BUFSIZE) { /* res is the desired output length */
955
	usedRalloc = TRUE;
955
	usedRalloc = TRUE;
956
	/* dummy_vfprintf protects against `res` being counted short; we do not
956
	/* dummy_vfprintf protects against `res` being counted short; we do not
957
	   do that here */
957
	   do that here */
958
	p = R_alloc(res+1, sizeof(char));
958
	p = R_alloc(res+1, sizeof(char));
959
	vnsprintf(p, res + 1, format, arg);
959
	vsnprintf(p, res + 1, format, arg);
960
    } else if(res < 0) {
960
    } else if(res < 0) {
961
	/* Some non-C99 conforming vsnprintf implementations return -1 on
961
	/* Some non-C99 conforming vsnprintf implementations return -1 on
962
	   truncation instead of only on error. */
962
	   truncation instead of only on error. */
963
	usedRalloc = TRUE;
963
	usedRalloc = TRUE;
964
	p = R_alloc(10*R_BUFSIZE, sizeof(char));
964
	p = R_alloc(10*R_BUFSIZE, sizeof(char));