The R Project SVN R

Rev

Rev 62637 | Rev 64374 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 62637 Rev 64246
Line 109... Line 109...
109
    if (miss_nr && miss_nc) {
109
    if (miss_nr && miss_nc) {
110
	if (lendat > INT_MAX) error("data is too long");
110
	if (lendat > INT_MAX) error("data is too long");
111
	nr = (int) lendat;
111
	nr = (int) lendat;
112
    } else if (miss_nr) {
112
    } else if (miss_nr) {
113
	if (lendat > (double) nc * INT_MAX) error("data is too long");
113
	if (lendat > (double) nc * INT_MAX) error("data is too long");
-
 
114
	// avoid division by zero
-
 
115
	if (nc == 0) {
-
 
116
	    if (lendat) error(_("nc = 0 for non-null data"));
-
 
117
	    else nr = 0;
-
 
118
	} else
114
	nr = (int) ceil((double) lendat / (double) nc);
119
	    nr = (int) ceil((double) lendat / (double) nc);
115
    } else if (miss_nc) {
120
    } else if (miss_nc) {
116
	if (lendat > (double) nr * INT_MAX) error("data is too long");
121
	if (lendat > (double) nr * INT_MAX) error("data is too long");
-
 
122
	// avoid division by zero
-
 
123
	if (nr == 0) {
-
 
124
	    if (lendat) error(_("nr = 0 for non-null data"));
-
 
125
	    else nc = 0;
-
 
126
	} else
117
	nc = (int) ceil((double) lendat / (double) nr);
127
	    nc = (int) ceil((double) lendat / (double) nr);
118
    }
128
    }
119
 
129
 
120
    if(lendat > 0) {
130
    if(lendat > 0) {
121
	R_xlen_t nrc = (R_xlen_t) nr * nc;
131
	R_xlen_t nrc = (R_xlen_t) nr * nc;
122
	if (lendat > 1 && nrc % lendat != 0) {
132
	if (lendat > 1 && nrc % lendat != 0) {