The R Project SVN R

Rev

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

Rev 90294 Rev 90308
Line 652... Line 652...
652
		dcall = CHAR(STRING_ELT(deparse1s(VECTOR_ELT(R_Warnings, i)), 0));
652
		dcall = CHAR(STRING_ELT(deparse1s(VECTOR_ELT(R_Warnings, i)), 0));
653
		REprintf("%d: ", i + 1);
653
		REprintf("%d: ", i + 1);
654
		REprintf(_("In %s :"), dcall);
654
		REprintf(_("In %s :"), dcall);
655
		if (mbcslocale) {
655
		if (mbcslocale) {
656
		    int msgline1;
656
		    int msgline1;
657
		    char *p = (char *) strchr(msg, '\n');
657
		    if (strchr(msg, '\n')) {
-
 
658
			// this branch alters msg temporarily
-
 
659
			char msg1[strlen(msg) + 1];
658
		    if (p) {
660
			strcpy(msg1, msg);
-
 
661
			char *p = strchr(msg1, '\n');
659
			*p = '\0';
662
			*p = '\0';
660
			msgline1 = wd(msg);
663
			msgline1 = wd(msg1);
661
			*p = '\n';
-
 
662
		    } else msgline1 = wd(msg);
664
		    } else msgline1 = wd(msg);
663
		    if (10 + wd(dcall) + msgline1 > LONGWARN) {
665
		    if (10 + wd(dcall) + msgline1 > LONGWARN) {
664
			REprintf("\n ");
666
			REprintf("\n ");
665
		    }
667
		    }
666
		} else {
668
		} else {
667
		    size_t msgline1 = strlen(msg);
669
		    size_t msgline1 = strlen(msg);
668
		    char *p = (char *) strchr(msg, '\n');
670
		    const char *p = strchr(msg, '\n');
669
		    if (p) msgline1 = (int)(p - msg);
671
		    if (p) msgline1 = (int)(p - msg);
670
		    if (10 + strlen(dcall) + msgline1 > LONGWARN) {
672
		    if (10 + strlen(dcall) + msgline1 > LONGWARN) {
671
			REprintf("\n ");
673
			REprintf("\n ");
672
		    }
674
		    }
673
		}
675
		}
Line 823... Line 825...
823
				   _("Error in %s (from %s) : "),
825
				   _("Error in %s (from %s) : "),
824
				   dcall, CHAR(STRING_ELT(srcloc, 0)));
826
				   dcall, CHAR(STRING_ELT(srcloc, 0)));
825
	    else Rsnprintf_mbcs(errbuf, BUFSIZE,  _("Error in %s : "), dcall);
827
	    else Rsnprintf_mbcs(errbuf, BUFSIZE,  _("Error in %s : "), dcall);
826
	    if (mbcslocale) {
828
	    if (mbcslocale) {
827
		int msgline1;
829
		int msgline1;
-
 
830
		// tmp is local array, so OK to temporaily edit in place
828
		char *p = strchr(tmp, '\n');
831
		char *p = strchr(tmp, '\n');
829
		if (p) {
832
		if (p) {
830
		    *p = '\0';
833
		    *p = '\0';
831
		    msgline1 = wd(tmp);
834
		    msgline1 = wd(tmp);
832
		    *p = '\n';
835
		    *p = '\n';
Line 836... Line 839...
836
		// but truncation is intentional.
839
		// but truncation is intentional.
837
		if (14 + wd(dcall) + msgline1 > LONGWARN)
840
		if (14 + wd(dcall) + msgline1 > LONGWARN)
838
		    ERRBUFCAT(tail);
841
		    ERRBUFCAT(tail);
839
	    } else {
842
	    } else {
840
		size_t msgline1 = strlen(tmp);
843
		size_t msgline1 = strlen(tmp);
841
		char *p = strchr(tmp, '\n');
844
		const char *p = strchr(tmp, '\n');
842
		if (p) msgline1 = (int)(p - tmp);
845
		if (p) msgline1 = (int)(p - tmp);
843
		if (14 + strlen(dcall) + msgline1 > LONGWARN)
846
		if (14 + strlen(dcall) + msgline1 > LONGWARN)
844
		    ERRBUFCAT(tail);
847
		    ERRBUFCAT(tail);
845
	    }
848
	    }
846
	    ERRBUFCAT(tmp);
849
	    ERRBUFCAT(tmp);