@@ -1121,7 +1121,7 @@ static size_t file_write(const void *ptr, size_t size, size_t nitems,
11211121}
11221122
11231123static Rconnection newfile (const char * description , int enc , const char * mode ,
1124- int raw )
1124+ Rboolean raw )
11251125{
11261126 Rconnection new ;
11271127 new = (Rconnection ) malloc (sizeof (struct Rconn ));
@@ -1575,7 +1575,8 @@ attribute_hidden SEXP do_fifo(SEXP call, SEXP op, SEXP args, SEXP env)
15751575#if (defined(HAVE_MKFIFO ) && defined(HAVE_FCNTL_H )) || defined(_WIN32 )
15761576 SEXP sfile , sopen , ans , class , enc ;
15771577 const char * file , * open ;
1578- int ncon , block ;
1578+ int ncon ;
1579+ Rboolean block ;
15791580 Rconnection con = NULL ;
15801581
15811582 checkArity (op , args );
@@ -1589,7 +1590,7 @@ attribute_hidden SEXP do_fifo(SEXP call, SEXP op, SEXP args, SEXP env)
15891590 sopen = CADR (args );
15901591 if (!isString (sopen ) || LENGTH (sopen ) != 1 )
15911592 error (_ ("invalid '%s' argument" ), "open" );
1592- block = asLogical (CADDR (args ));
1593+ block = asRbool (CADDR (args ), call );
15931594 if (block == NA_LOGICAL )
15941595 error (_ ("invalid '%s' argument" ), "block" );
15951596 enc = CADDDR (args );
@@ -3937,7 +3938,8 @@ attribute_hidden SEXP do_sockconn(SEXP call, SEXP op, SEXP args, SEXP env)
39373938{
39383939 SEXP scmd , sopen , ans , class , enc ;
39393940 const char * host , * open ;
3940- int ncon , port , server , blocking , timeout , serverfd , options = 0 ;
3941+ int ncon , port , server , timeout , serverfd , options = 0 ;
3942+ Rboolean blocking ;
39413943 Rconnection con = NULL ;
39423944 Rservsockconn scon = NULL ;
39433945
@@ -3964,7 +3966,7 @@ attribute_hidden SEXP do_sockconn(SEXP call, SEXP op, SEXP args, SEXP env)
39643966 serverfd = scon -> fd ;
39653967 }
39663968 args = CDR (args );
3967- blocking = asLogical (CAR (args ));
3969+ blocking = asRbool (CAR (args ), call );
39683970 if (blocking == NA_LOGICAL )
39693971 error (_ ("invalid '%s' argument" ), "blocking" );
39703972 args = CDR (args );
@@ -4070,11 +4072,11 @@ attribute_hidden SEXP do_unz(SEXP call, SEXP op, SEXP args, SEXP env)
40704072
40714073attribute_hidden SEXP do_open (SEXP call , SEXP op , SEXP args , SEXP env )
40724074{
4073- int i , block ;
4075+ int i ;
40744076 Rconnection con = NULL ;
40754077 SEXP sopen ;
40764078 const char * open ;
4077- Rboolean success ;
4079+ Rboolean success , block ;
40784080
40794081 checkArity (op , args );
40804082 if (!inherits (CAR (args ), "connection" ))
@@ -4089,7 +4091,7 @@ attribute_hidden SEXP do_open(SEXP call, SEXP op, SEXP args, SEXP env)
40894091 sopen = CADR (args );
40904092 if (!isString (sopen ) || LENGTH (sopen ) != 1 )
40914093 error (_ ("invalid '%s' argument" ), "open" );
4092- block = asLogical (CADDR (args ));
4094+ block = asRbool (CADDR (args ), call );
40934095 if (block == NA_LOGICAL )
40944096 error (_ ("invalid '%s' argument" ), "blocking" );
40954097 open = CHAR (STRING_ELT (sopen , 0 )); /* ASCII */
@@ -5874,11 +5876,12 @@ attribute_hidden SEXP do_url(SEXP call, SEXP op, SEXP args, SEXP env)
58745876#endif
58755877 char * class2 = "url" ;
58765878 const char * url , * open ;
5877- int ncon , block , raw = 0 , defmeth ,
5879+ int ncon , block , defmeth ,
58785880 meth = 0 , // 0: "internal" | "wininet", 1: "libcurl"
58795881 winmeth = 0 ; // 0: "internal", 1: "wininet" (Windows only)
58805882 cetype_t ienc = CE_NATIVE ;
58815883 Rconnection con = NULL ;
5884+ Rboolean raw = FALSE;
58825885
58835886 checkArity (op , args );
58845887 // --------- description
@@ -5966,7 +5969,7 @@ attribute_hidden SEXP do_url(SEXP call, SEXP op, SEXP args, SEXP env)
59665969
59675970 // --------- raw, for file() only
59685971 if (PRIMVAL (op ) == 1 ) {
5969- raw = asLogical (CAD5R (args ));
5972+ raw = asRbool (CAD5R (args ), call );
59705973 if (raw == NA_LOGICAL )
59715974 error (_ ("invalid '%s' argument" ), "raw" );
59725975 }
@@ -6102,7 +6105,7 @@ attribute_hidden SEXP do_url(SEXP call, SEXP op, SEXP args, SEXP env)
61026105 }
61036106
61046107 Connections [ncon ] = con ;
6105- con -> blocking = block ;
6108+ con -> blocking = ( Rboolean ) block ;
61066109 strncpy (con -> encname , CHAR (STRING_ELT (enc , 0 )), 100 ); /* ASCII */
61076110 con -> encname [100 - 1 ] = '\0' ;
61086111
@@ -6421,7 +6424,7 @@ attribute_hidden SEXP do_gzcon(SEXP call, SEXP op, SEXP args, SEXP rho)
64216424 int icon , level , allow ;
64226425 Rconnection incon = NULL , new = NULL ;
64236426 char * m , * mode = NULL /* -Wall */ , description [1000 ];
6424- Rboolean text ;
6427+ int text ;
64256428
64266429 checkArity (op , args );
64276430 if (!inherits (CAR (args ), "connection" ))
@@ -6469,7 +6472,7 @@ attribute_hidden SEXP do_gzcon(SEXP call, SEXP op, SEXP args, SEXP rho)
64696472 /* for Solaris 12.5 */ new = NULL ;
64706473 }
64716474 init_con (new , description , CE_NATIVE , mode );
6472- new -> text = text ;
6475+ new -> text = ( Rboolean ) text ;
64736476 new -> isGzcon = TRUE;
64746477 new -> open = & gzcon_open ;
64756478 new -> close = & gzcon_close ;
@@ -6486,7 +6489,7 @@ attribute_hidden SEXP do_gzcon(SEXP call, SEXP op, SEXP args, SEXP rho)
64866489 ((Rgzconn )(new -> private ))-> con = incon ;
64876490 ((Rgzconn )(new -> private ))-> cp = level ;
64886491 ((Rgzconn )(new -> private ))-> nsaved = -1 ;
6489- ((Rgzconn )(new -> private ))-> allow = allow ;
6492+ ((Rgzconn )(new -> private ))-> allow = ( Rboolean ) allow ;
64906493
64916494 /* as there might not be an R-level reference to the wrapped connection */
64926495 R_PreserveObject (incon -> ex_ptr );
0 commit comments