Permalink
Browse files

fix whitespace errors

  • Loading branch information...
1 parent f8ca6b3 commit 8c8534046c5ce25ad58cde5b71bc4a189e7fb7a8 @bmizerany bmizerany committed with ry Jun 30, 2010
@@ -28,7 +28,7 @@ http.createServer(function (req, res) {
if (command == "bytes") {
var n = parseInt(arg, 10)
if (n <= 0)
- throw "bytes called with n <= 0"
+ throw "bytes called with n <= 0"
if (stored[n] === undefined) {
console.log("create stored[n]");
stored[n] = "";
@@ -64,7 +64,7 @@ http.createServer(function (req, res) {
var content_length = body.length.toString();
- res.writeHead( status
+ res.writeHead( status
, { "Content-Type": "text/plain"
, "Content-Length": content_length
}
@@ -7,45 +7,45 @@ def fib(n)
def wait(seconds)
n = (seconds / 0.01).to_i
- n.times do
+ n.times do
sleep(0.01)
- #File.read(DIR + '/yahoo.html')
+ #File.read(DIR + '/yahoo.html')
end
end
class SimpleApp
@@responses = {}
-
+
def initialize
@count = 0
end
-
+
def deferred?(env)
false
end
-
+
def call(env)
path = env['PATH_INFO'] || env['REQUEST_URI']
commands = path.split('/')
-
+
@count += 1
if commands.include?('periodical_activity') and @count % 10 != 1
return [200, {'Content-Type'=>'text/plain'}, "quick response!\r\n"]
end
-
+
if commands.include?('fibonacci')
n = commands.last.to_i
raise "fibonacci called with n <= 0" if n <= 0
body = (1..n).to_a.map { |i| fib(i).to_s }.join(' ')
status = 200
-
+
elsif commands.include?('wait')
n = commands.last.to_f
raise "wait called with n <= 0" if n <= 0
wait(n)
body = "waited about #{n} seconds"
status = 200
-
+
elsif commands.include?('bytes')
n = commands.last.to_i
raise "bytes called with n <= 0" if n <= 0
@@ -56,17 +56,17 @@ def call(env)
n = 20 * 1024;
body = @@responses[n] || "C"*n
status = 200
-
+
elsif commands.include?('test_post_length')
input_body = ""
while chunk = env['rack.input'].read(512)
- input_body << chunk
+ input_body << chunk
end
if env['CONTENT_LENGTH'].to_i == input_body.length
body = "Content-Length matches input length"
status = 200
else
- body = "Content-Length doesn't matches input length!
+ body = "Content-Length doesn't matches input length!
content_length = #{env['CONTENT_LENGTH'].to_i}
input_body.length = #{input_body.length}"
status = 500
@@ -75,7 +75,7 @@ def call(env)
status = 404
body = "Undefined url"
end
-
+
body += "\r\n"
headers = {'Content-Type' => 'text/plain', 'Content-Length' => body.length.to_s }
[status, headers, [body]]
@@ -90,6 +90,6 @@ def call(env)
require 'thin'
require 'ebb'
# Rack::Handler::Mongrel.run(SimpleApp.new, :Port => 8000)
- Thin::Server.start("0.0.0.0", 8000, SimpleApp.new)
+ Thin::Server.start("0.0.0.0", 8000, SimpleApp.new)
# Ebb::start_server(SimpleApp.new, :port => 8000)
end
View
@@ -3596,7 +3596,7 @@ try {
var Verify = binding.Verify;
var crypto = true;
} catch (e) {
-
+
var crypto = false;
}
View
@@ -363,7 +363,7 @@ function setImplmentationMethods (self) {
return bytesWritten;
};
-
+
var oldRead = self._readImpl;
self._readImpl = function(buf, off, len, calledByIOWatcher) {
assert(self.secure);
View
@@ -164,7 +164,7 @@ Interface.prototype._ttyWrite = function (b) {
if (this.cursor === 0 && this.line.length === 0) {
this.close();
} else if (this.cursor < this.line.length) {
- this.line = this.line.slice(0, this.cursor)
+ this.line = this.line.slice(0, this.cursor)
+ this.line.slice(this.cursor+1, this.line.length)
;
this._refreshLine();
View
@@ -137,14 +137,14 @@ REPLServer.prototype.readline = function (cmd) {
/**
* Used to parse and execute the Node REPL commands.
- *
+ *
* @param {cmd} cmd The command entered to check
- * @returns {Boolean} If true it means don't continue parsing the command
+ * @returns {Boolean} If true it means don't continue parsing the command
*/
REPLServer.prototype.parseREPLKeyword = function (cmd) {
var self = this;
-
+
switch (cmd) {
case ".break":
self.buffered_cmd = '';
@@ -171,7 +171,7 @@ REPLServer.prototype.parseREPLKeyword = function (cmd) {
};
function trimWhitespace (cmd) {
- var trimmer = /^\s*(.+)\s*$/m,
+ var trimmer = /^\s*(.+)\s*$/m,
matches = trimmer.exec(cmd);
if (matches && matches.length === 2) {
@@ -183,26 +183,26 @@ function trimWhitespace (cmd) {
* Converts commands that use var and function <name>() to use the
* local exports.context when evaled. This provides a local context
* on the REPL.
- *
+ *
* @param {String} cmd The cmd to convert
* @returns {String} The converted command
*/
REPLServer.prototype.convertToContext = function (cmd) {
var self = this, matches,
scopeVar = /^\s*var\s*([_\w\$]+)(.*)$/m,
scopeFunc = /^\s*function\s*([_\w\$]+)/;
-
+
// Replaces: var foo = "bar"; with: self.context.foo = bar;
matches = scopeVar.exec(cmd);
if (matches && matches.length === 3) {
return "self.context." + matches[1] + matches[2];
}
-
+
// Replaces: function foo() {}; with: foo = function foo() {};
matches = scopeFunc.exec(self.buffered_cmd);
if (matches && matches.length === 2) {
return matches[1] + " = " + self.buffered_cmd;
}
-
+
return cmd;
};
@@ -11,7 +11,7 @@ var StringDecoder = exports.StringDecoder = function (encoding) {
StringDecoder.prototype.write = function (buffer) {
- // If not utf8...
+ // If not utf8...
if (this.encoding !== 'utf8') {
return buffer.toString(this.encoding);
}
View
@@ -1166,7 +1166,7 @@ static Handle<Value> SetGid(const Arguments& args) {
}
int gid;
-
+
if (args[0]->IsNumber()) {
gid = args[0]->Int32Value();
} else if (args[0]->IsString()) {
View
@@ -509,8 +509,8 @@ Handle<Value> Buffer::ByteLength(const Arguments &args) {
enum encoding e = ParseEncoding(args[1], UTF8);
Local<Integer> length =
- Integer::New(e == UTF8 ? s->Utf8Length() : s->Length());
-
+ Integer::New(e == UTF8 ? s->Utf8Length() : s->Length());
+
return scope.Close(length);
}
View
@@ -24,7 +24,7 @@ using namespace v8;
static Handle<Value> IsIP(const Arguments& args) {
HandleScope scope;
-
+
if (!args[0]->IsString()) {
return scope.Close(Integer::New(4));
}
View
@@ -1004,7 +1004,7 @@ class Cipher : public ObjectWrap {
delete [] buf;
Local<Value> outString;
- if (out_len==0) {
+ if (out_len==0) {
outString=String::New("");
} else {
if (args.Length() <= 2 || !args[2]->IsString()) {
View
@@ -432,7 +432,7 @@ static Handle<Value> MKDir(const Arguments& args) {
static Handle<Value> SendFile(const Arguments& args) {
HandleScope scope;
- if (args.Length() < 4 ||
+ if (args.Length() < 4 ||
!args[0]->IsInt32() ||
!args[1]->IsInt32() ||
!args[3]->IsNumber()) {
@@ -704,7 +704,7 @@ void File::Initialize(Handle<Object> target) {
NODE_SET_METHOD(target, "readlink", ReadLink);
NODE_SET_METHOD(target, "unlink", Unlink);
NODE_SET_METHOD(target, "write", Write);
-
+
NODE_SET_METHOD(target, "chmod", Chmod);
NODE_SET_METHOD(target, "chown", Chown);
@@ -21,7 +21,7 @@
// No copying is performed when slicing the buffer, only small reference
// allocations.
-
+
namespace node {
using namespace v8;
@@ -194,7 +194,7 @@ class Parser : public ObjectWrap {
String::Utf8Value type(args[0]->ToString());
- Parser *parser;
+ Parser *parser;
if (0 == strcasecmp(*type, "request")) {
parser = new Parser(HTTP_REQUEST);
@@ -257,7 +257,7 @@ class Parser : public ObjectWrap {
if (parser->got_exception_) return Local<Value>();
Local<Integer> nparsed_obj = Integer::New(nparsed);
- // If there was a parse error in one of the callbacks
+ // If there was a parse error in one of the callbacks
// TODO What if there is an error on EOF?
if (!parser->parser_.upgrade && nparsed != len) {
Local<Value> e = Exception::Error(String::NewSymbol("Parse Error"));
@@ -333,7 +333,7 @@ static Handle<Value> UrlDecode (const Arguments& args) {
enum { CHAR, HEX0, HEX1 } state = CHAR;
- int n, m, hexchar;
+ int n, m, hexchar;
size_t in_index = 0, out_index = 0;
char c;
for (; in_index <= l; in_index++) {
@@ -38,7 +38,7 @@ Handle<Value> IdleWatcher::SetPriority(const Arguments& args) {
HandleScope scope;
int priority = args[0]->Int32Value();
-
+
ev_set_priority(&idle->watcher_, priority);
return Undefined();
@@ -71,7 +71,7 @@ void IdleWatcher::Callback(EV_P_ ev_idle *w, int revents) {
}
-//
+//
// var idle = new process.IdleWatcher();
// idle.callback = function () { /* ... */ };
// idle.start();
@@ -61,7 +61,7 @@ void IOWatcher::Callback(EV_P_ ev_io *w, int revents) {
}
-//
+//
// var io = new process.IOWatcher();
// process.callback = function (readable, writable) { ... };
// io.set(fd, true, false);
View
@@ -214,7 +214,7 @@ static inline Handle<Value> ParseAddressArgs(Handle<Value> first,
memset(&in6, 0, sizeof in6);
int port = first->Int32Value();
- in.sin_port = in6.sin6_port = htons(port);
+ in.sin_port = in6.sin6_port = htons(port);
in.sin_family = AF_INET;
in6.sin6_family = AF_INET6;
@@ -241,7 +241,7 @@ static inline Handle<Value> ParseAddressArgs(Handle<Value> first,
}
-// Bind with UNIX
+// Bind with UNIX
// t.bind(fd, "/tmp/socket")
// Bind with TCP
// t.bind(fd, 80, "192.168.11.2")
@@ -486,7 +486,7 @@ static Handle<Value> SocketError(const Arguments& args) {
return ThrowException(ErrnoException(errno, "getsockopt"));
}
- return scope.Close(Integer::New(error));
+ return scope.Close(Integer::New(error));
}
@@ -572,7 +572,7 @@ static Handle<Value> RecvFrom(const Arguments& args) {
struct sockaddr_storage address_storage;
socklen_t addrlen = sizeof(struct sockaddr_storage);
- ssize_t bytes_read = recvfrom(fd, (char*)buffer->data() + off, len, flags,
+ ssize_t bytes_read = recvfrom(fd, (char*)buffer->data() + off, len, flags,
(struct sockaddr*) &address_storage, &addrlen);
if (bytes_read < 0) {
@@ -653,7 +653,7 @@ static Handle<Value> RecvMsg(const Arguments& args) {
//
// XXX: Some implementations can send multiple file descriptors in a
// single message. We should be using CMSG_NXTHDR() to walk the
- // chain to get at them all. This would require changing the
+ // chain to get at them all. This would require changing the
// API to hand these back up the caller, is a pain.
int received_fd = -1;
@@ -696,7 +696,7 @@ static Handle<Value> Write(const Arguments& args) {
FD_ARG(args[0])
- if (!Buffer::HasInstance(args[1])) {
+ if (!Buffer::HasInstance(args[1])) {
return ThrowException(Exception::TypeError(
String::New("Second argument should be a buffer")));
}
@@ -1177,7 +1177,7 @@ static Handle<Value> GetAddrInfo(const Arguments& args) {
static Handle<Value> IsIP(const Arguments& args) {
HandleScope scope;
-
+
if (!args[0]->IsString()) {
return scope.Close(Integer::New(4));
}
@@ -1206,7 +1206,7 @@ static Handle<Value> CreateErrnoException(const Arguments& args) {
int errorno = args[0]->Int32Value();
String::Utf8Value syscall(args[1]->ToString());
- Local<Value> exception = ErrnoException(errorno, *syscall);
+ Local<Value> exception = ErrnoException(errorno, *syscall);
return scope.Close(exception);
}
Oops, something went wrong.

0 comments on commit 8c85340

Please sign in to comment.