[Rprotobuf-commits] r636 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Mon Dec 30 21:32:53 CET 2013


Author: murray
Date: 2013-12-30 21:32:52 +0100 (Mon, 30 Dec 2013)
New Revision: 636

Modified:
   pkg/src/ConnectionCopyingInputStream.cpp
   pkg/src/ConnectionCopyingOutputStream.cpp
   pkg/src/ConnectionInputStream.cpp
   pkg/src/ConnectionOutputStream.cpp
Log:
Whitespace change only.  From clang-format (see STYLE).



Modified: pkg/src/ConnectionCopyingInputStream.cpp
===================================================================
--- pkg/src/ConnectionCopyingInputStream.cpp	2013-12-30 20:30:29 UTC (rev 635)
+++ pkg/src/ConnectionCopyingInputStream.cpp	2013-12-30 20:32:52 UTC (rev 636)
@@ -1,27 +1,24 @@
 #include "rprotobuf.h"
 #include "ConnectionCopyingInputStream.h"
 
-namespace rprotobuf{
-	
-	ConnectionCopyingInputStream::ConnectionCopyingInputStream(SEXP con) : 
-		con(con), readBin("readBin") {}
-	
-	/** 
-	 * call readBin to read size bytes from R
-	 * 
-	 * @param buffer buffer to fill with at most size bytes
-	 * @param size maximum number of bytes
-	 *
-	 * @return the number of bytes actually read
-	 */
-	int	ConnectionCopyingInputStream::Read(void * buffer, int size){
-		
-		/* TODO: error handling */
-		Rcpp::RawVector res = readBin( con, Rcpp::RawVector( 0 ), size ) ;
-		memcpy( buffer, res.begin() , res.size() ) ;
-		return res.size() ;
-	}
-	
-	
-}
+namespace rprotobuf {
 
+ConnectionCopyingInputStream::ConnectionCopyingInputStream(SEXP con)
+    : con(con), readBin("readBin") {}
+
+/**
+ * call readBin to read size bytes from R
+ *
+ * @param buffer buffer to fill with at most size bytes
+ * @param size maximum number of bytes
+ *
+ * @return the number of bytes actually read
+ */
+int ConnectionCopyingInputStream::Read(void* buffer, int size) {
+
+    /* TODO: error handling */
+    Rcpp::RawVector res = readBin(con, Rcpp::RawVector(0), size);
+    memcpy(buffer, res.begin(), res.size());
+    return res.size();
+}
+}

Modified: pkg/src/ConnectionCopyingOutputStream.cpp
===================================================================
--- pkg/src/ConnectionCopyingOutputStream.cpp	2013-12-30 20:30:29 UTC (rev 635)
+++ pkg/src/ConnectionCopyingOutputStream.cpp	2013-12-30 20:32:52 UTC (rev 636)
@@ -1,19 +1,18 @@
 #include "rprotobuf.h"
 #include "ConnectionCopyingOutputStream.h"
 
-namespace rprotobuf{
-	
-	ConnectionCopyingOutputStream::ConnectionCopyingOutputStream(SEXP con) : con(con), writeBin("writeBin") {}
-	
-	bool ConnectionCopyingOutputStream::Write(const void * buffer, int size){
-		
-		/* we need to take care of error handling */
-		Rcpp::RawVector payload(size) ;
-		memcpy( payload.begin() , buffer, size ) ;
-		
-		writeBin( payload, con) ; 
-		return true ;
-	}
-	
-}
+namespace rprotobuf {
 
+ConnectionCopyingOutputStream::ConnectionCopyingOutputStream(SEXP con)
+    : con(con), writeBin("writeBin") {}
+
+bool ConnectionCopyingOutputStream::Write(const void* buffer, int size) {
+
+    /* we need to take care of error handling */
+    Rcpp::RawVector payload(size);
+    memcpy(payload.begin(), buffer, size);
+
+    writeBin(payload, con);
+    return true;
+}
+}

Modified: pkg/src/ConnectionInputStream.cpp
===================================================================
--- pkg/src/ConnectionInputStream.cpp	2013-12-30 20:30:29 UTC (rev 635)
+++ pkg/src/ConnectionInputStream.cpp	2013-12-30 20:32:52 UTC (rev 636)
@@ -2,27 +2,26 @@
 #include "ConnectionInputStream.h"
 #include "ConnectionCopyingInputStream.h"
 
-namespace rprotobuf{
-	
-	ConnectionInputStream::ConnectionInputStream(SEXP con, bool was_open): 
-		GPB::io::CopyingInputStreamAdaptor( new ConnectionCopyingInputStream( con ) ), 
-		was_open(was_open),
-		con(con)
-	{
-		/* clean the wrapped stream on delete */
-		SetOwnsCopyingStream(true) ;
-	}
-	
-	ConnectionInputStream::~ConnectionInputStream(){
-		if( ! was_open ){
-			/* then we need to close it */
-			SEXP call = PROTECT( Rf_lang2( Rf_install( "close" ) , con  ) ) ;
-			Rf_eval( call, R_GlobalEnv ) ;
-			UNPROTECT( 1 ) ; /* call */
-		}
-		/* con will be disposed by the R GC, it is
-		   protected as part of the protection of the 
-		   external pointer that wraps this */
-	}
-	
-} // namespace rprotobuf
+namespace rprotobuf {
+
+ConnectionInputStream::ConnectionInputStream(SEXP con, bool was_open)
+    : GPB::io::CopyingInputStreamAdaptor(new ConnectionCopyingInputStream(con)),
+      was_open(was_open),
+      con(con) {
+    /* clean the wrapped stream on delete */
+    SetOwnsCopyingStream(true);
+}
+
+ConnectionInputStream::~ConnectionInputStream() {
+    if (!was_open) {
+        /* then we need to close it */
+        SEXP call = PROTECT(Rf_lang2(Rf_install("close"), con));
+        Rf_eval(call, R_GlobalEnv);
+        UNPROTECT(1); /* call */
+    }
+    /* con will be disposed by the R GC, it is
+       protected as part of the protection of the
+       external pointer that wraps this */
+}
+
+}  // namespace rprotobuf

Modified: pkg/src/ConnectionOutputStream.cpp
===================================================================
--- pkg/src/ConnectionOutputStream.cpp	2013-12-30 20:30:29 UTC (rev 635)
+++ pkg/src/ConnectionOutputStream.cpp	2013-12-30 20:32:52 UTC (rev 636)
@@ -2,27 +2,27 @@
 #include "ConnectionOutputStream.h"
 #include "ConnectionCopyingOutputStream.h"
 
-namespace rprotobuf{
-	
-	ConnectionOutputStream::ConnectionOutputStream(SEXP con, bool was_open): 
-		GPB::io::CopyingOutputStreamAdaptor( new ConnectionCopyingOutputStream( con ) ), 
-		was_open(was_open),
-		con(con)
-	{
-		/* clean the wrapped stream on delete */
-		SetOwnsCopyingStream(true) ;
-	}
-	
-	ConnectionOutputStream::~ConnectionOutputStream(){
-		if( ! was_open ){
-			/* then we need to close it */
-			SEXP call = PROTECT( Rf_lang2( Rf_install( "close" ) , con  ) ) ;
-			Rf_eval( call, R_GlobalEnv ) ;
-			UNPROTECT( 1 ) ; /* call */
-		}
-		/* con will be disposed by the R GC, it is
-		   protected as part of the protection of the 
-		   external pointer that wraps this */
-	}
-	
-} // namespace rprotobuf
+namespace rprotobuf {
+
+ConnectionOutputStream::ConnectionOutputStream(SEXP con, bool was_open)
+    : GPB::io::CopyingOutputStreamAdaptor(
+          new ConnectionCopyingOutputStream(con)),
+      was_open(was_open),
+      con(con) {
+    /* clean the wrapped stream on delete */
+    SetOwnsCopyingStream(true);
+}
+
+ConnectionOutputStream::~ConnectionOutputStream() {
+    if (!was_open) {
+        /* then we need to close it */
+        SEXP call = PROTECT(Rf_lang2(Rf_install("close"), con));
+        Rf_eval(call, R_GlobalEnv);
+        UNPROTECT(1); /* call */
+    }
+    /* con will be disposed by the R GC, it is
+       protected as part of the protection of the
+       external pointer that wraps this */
+}
+
+}  // namespace rprotobuf



More information about the Rprotobuf-commits mailing list