[Rprotobuf-commits] r615 - pkg/src

noreply at r-forge.r-project.org noreply at r-forge.r-project.org
Sat Dec 28 00:36:35 CET 2013


Author: murray
Date: 2013-12-28 00:36:34 +0100 (Sat, 28 Dec 2013)
New Revision: 615

Modified:
   pkg/src/wrapper_ZeroCopyInputStream.cpp
Log:
Format through clang-format.

This file seemed to use tab indentation from the "namespace {" but many
other files don't indent within the namespace.

We are standardizing for now on 4-space indents instead of a mismatch
of tab stops and space indents.



Modified: pkg/src/wrapper_ZeroCopyInputStream.cpp
===================================================================
--- pkg/src/wrapper_ZeroCopyInputStream.cpp	2013-12-27 23:31:27 UTC (rev 614)
+++ pkg/src/wrapper_ZeroCopyInputStream.cpp	2013-12-27 23:36:34 UTC (rev 615)
@@ -1,43 +1,41 @@
 #include "rprotobuf.h"
 
-namespace rprotobuf{
+namespace rprotobuf {
 
-	
-	SEXP ZeroCopyInputStream_Next( SEXP xp ){
-		GPB::io::ZeroCopyInputStream* stream = GET_ZCIS(xp) ;
-		int s = 0 ;
-		const void* in ;
-		bool res = stream->Next( &in, &s );
-		Rcpp::RawVector result ;
-		if( !res ){
-			throw std::range_error( "cannot read from stream" ) ;
-		} else{
-			result.assign( reinterpret_cast<const Rbyte*>(in), reinterpret_cast<const Rbyte*>(in) + s ) ;
-		}
-		return result ;
-	}
-	
-	SEXP ZeroCopyInputStream_BackUp(SEXP xp, SEXP size){
-		GPB::io::ZeroCopyInputStream* stream = GET_ZCIS(xp);
-		int s = GET_int(size, 0) ;
-		if( s <= 0 ){
-			Rf_error( "can only BackUp with positive numbers" ) ;
-		}
-		stream->BackUp( s ) ;
-		return R_NilValue ;
-	}
-	
-	
-	SEXP ZeroCopyInputStream_Skip(SEXP xp, SEXP size){
-		GPB::io::ZeroCopyInputStream* stream = GET_ZCIS(xp);
-		int s = GET_int(size, 0) ;
-		bool res = stream->Skip(s) ;
-		return( Rf_ScalarLogical( res ? _TRUE_ : _FALSE_ ) ) ;
-	}
-	
-	SEXP ZeroCopyInputStream_ByteCount(SEXP xp){
-		GPB::io::ZeroCopyInputStream* stream = GET_ZCIS(xp);
-		return( Rf_ScalarReal((double)stream->ByteCount())) ;
-	}
+SEXP ZeroCopyInputStream_Next(SEXP xp) {
+    GPB::io::ZeroCopyInputStream* stream = GET_ZCIS(xp);
+    int s = 0;
+    const void* in;
+    bool res = stream->Next(&in, &s);
+    Rcpp::RawVector result;
+    if (!res) {
+        throw std::range_error("cannot read from stream");
+    } else {
+        result.assign(reinterpret_cast<const Rbyte*>(in),
+                      reinterpret_cast<const Rbyte*>(in) + s);
+    }
+    return result;
+}
 
+SEXP ZeroCopyInputStream_BackUp(SEXP xp, SEXP size) {
+    GPB::io::ZeroCopyInputStream* stream = GET_ZCIS(xp);
+    int s = GET_int(size, 0);
+    if (s <= 0) {
+        Rf_error("can only BackUp with positive numbers");
+    }
+    stream->BackUp(s);
+    return R_NilValue;
 }
+
+SEXP ZeroCopyInputStream_Skip(SEXP xp, SEXP size) {
+    GPB::io::ZeroCopyInputStream* stream = GET_ZCIS(xp);
+    int s = GET_int(size, 0);
+    bool res = stream->Skip(s);
+    return (Rf_ScalarLogical(res ? _TRUE_ : _FALSE_));
+}
+
+SEXP ZeroCopyInputStream_ByteCount(SEXP xp) {
+    GPB::io::ZeroCopyInputStream* stream = GET_ZCIS(xp);
+    return (Rf_ScalarReal((double)stream->ByteCount()));
+}
+}



More information about the Rprotobuf-commits mailing list