Permalink
Browse files

Remove trailing whitespace

  • Loading branch information...
davisp committed Oct 31, 2011
1 parent 33afb92 commit e9b85b08c99f827e9a51d20ca66c201f8526e76e
View
@@ -1,4 +1,4 @@
-// This file is part of Jiffy released under the MIT license.
+// This file is part of Jiffy released under the MIT license.
// See the LICENSE file for more information.
#include <assert.h>
@@ -76,7 +76,7 @@ dec_init(Decoder* d, ErlNifEnv* env, ERL_NIF_TERM arg, ErlNifBinary* bin)
d->st_data = (char*) enif_alloc(STACK_SIZE_INC * sizeof(char));
d->st_size = STACK_SIZE_INC;
d->st_top = 0;
-
+
for(i = 0; i < d->st_size; i++) {
d->st_data[i] = st_invalid;
}
@@ -122,7 +122,7 @@ dec_push(Decoder* d, char val)
int i;
if(d->st_top >= d->st_size) {
- new_sz = d->st_size + STACK_SIZE_INC;
+ new_sz = d->st_size + STACK_SIZE_INC;
tmp = (char*) enif_alloc(new_sz * sizeof(char));
memcpy(tmp, d->st_data, d->st_size * sizeof(char));
enif_free(d->st_data);
@@ -523,7 +523,7 @@ dec_number(Decoder* d, ERL_NIF_TERM* value)
}
parse:
-
+
switch(state) {
case nst_init:
case nst_sign:
@@ -554,7 +554,7 @@ dec_number(Decoder* d, ERL_NIF_TERM* value)
}
}
}
-
+
if(!has_frac && !has_exp) {
num_type = d->atoms->atom_bignum;
} else if(has_exp) {
@@ -604,7 +604,7 @@ decode(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
{
Decoder dec;
Decoder* d = &dec;
-
+
ErlNifBinary bin;
ERL_NIF_TERM objs = enif_make_list(env, 0);
@@ -739,7 +739,7 @@ decode(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
curr = enif_make_list_cell(env, val, curr);
}
break;
-
+
case st_key:
switch(d->p[d->i]) {
case ' ':
View
@@ -1,4 +1,4 @@
-// This file is part of Jiffy released under the MIT license.
+// This file is part of Jiffy released under the MIT license.
// See the LICENSE file for more information.
#include <assert.h>
@@ -21,7 +21,7 @@ typedef struct {
int iolen;
ERL_NIF_TERM iolist;
ErlNifBinary* curr;
-
+
char* p;
unsigned char* u;
@@ -32,7 +32,7 @@ int
enc_init(Encoder* e, ErlNifEnv* env, ERL_NIF_TERM opts, ErlNifBinary* bin)
{
ERL_NIF_TERM val;
-
+
e->env = env;
e->atoms = enif_priv_data(env);
e->uescape = 0;
@@ -41,7 +41,7 @@ enc_init(Encoder* e, ErlNifEnv* env, ERL_NIF_TERM opts, ErlNifBinary* bin)
if(!enif_is_list(env, opts)) {
return 0;
}
-
+
while(enif_get_list_cell(env, opts, &val, &opts)) {
if(enif_compare(val, e->atoms->atom_uescape) == 0) {
e->uescape = 1;
@@ -148,7 +148,7 @@ enc_unknown(Encoder* e, ERL_NIF_TERM value)
e->iolist = enif_make_list_cell(e->env, curr, e->iolist);
e->iolen++;
}
-
+
e->iolist = enif_make_list_cell(e->env, value, e->iolist);
e->iolen++;
@@ -157,7 +157,7 @@ enc_unknown(Encoder* e, ERL_NIF_TERM value)
if(!enif_alloc_binary(BIN_INC_SIZE, e->curr)) {
return 0;
}
-
+
memset(e->curr->data, 0, e->curr->size);
e->p = (char*) e->curr->data;
@@ -176,7 +176,7 @@ enc_literal(Encoder* e, const char* literal, size_t len)
memcpy(&(e->p[e->i]), literal, len);
e->i += len;
- e->count++;
+ e->count++;
return 1;
}
@@ -305,13 +305,13 @@ enc_string(Encoder* e, ERL_NIF_TERM val)
if(uval < 0) {
return 0;
}
-
+
ulen = unicode_uescape(uval, &(e->p[e->i]));
if(ulen < 0) {
return 0;
}
e->i += ulen;
-
+
ulen = utf8_len(uval);
if(ulen < 0) {
return 0;
@@ -434,7 +434,7 @@ encode(ErlNifEnv* env, int argc, const ERL_NIF_TERM argv[])
if(argc != 2) {
return enif_make_badarg(env);
}
-
+
if(!enc_init(e, env, argv[1], &bin)) {
return enif_make_badarg(env);
}
View
@@ -1,4 +1,4 @@
-// This file is part of Jiffy released under the MIT license.
+// This file is part of Jiffy released under the MIT license.
// See the LICENSE file for more information.
#include "jiffy.h"
@@ -10,7 +10,7 @@ load(ErlNifEnv* env, void** priv, ERL_NIF_TERM info)
if(st == NULL) {
return 1;
}
-
+
st->atom_ok = make_atom(env, "ok");
st->atom_error = make_atom(env, "error");
st->atom_null = make_atom(env, "null");
View
@@ -1,4 +1,4 @@
-// This file is part of Jiffy released under the MIT license.
+// This file is part of Jiffy released under the MIT license.
// See the LICENSE file for more information.
#ifndef JIFFY_H
@@ -17,7 +17,7 @@ typedef struct {
ERL_NIF_TERM atom_bigdbl;
ERL_NIF_TERM atom_partial;
ERL_NIF_TERM atom_uescape;
-
+
ERL_NIF_TERM ref_object;
ERL_NIF_TERM ref_array;
} jiffy_st;
View
@@ -1,4 +1,4 @@
-// This file is part of Jiffy released under the MIT license.
+// This file is part of Jiffy released under the MIT license.
// See the LICENSE file for more information.
#include "jiffy.h"
#include <stdio.h>
@@ -93,7 +93,7 @@ utf8_validate(unsigned char* data, size_t size)
int ui;
if((data[0] & 0x80) == 0x00) {
- ulen = 1;
+ ulen = 1;
} if((data[0] & 0xE0) == 0xC0) {
ulen = 2;
} else if((data[0] & 0xF0) == 0xE0) {
@@ -104,12 +104,12 @@ utf8_validate(unsigned char* data, size_t size)
if(ulen < 0 || ulen > size) {
return -1;
}
-
+
// Check each continuation byte.
for(ui = 1; ui < ulen; ui++) {
if((data[ui] & 0xC0) != 0x80) return -1;
}
-
+
// Wikipedia says I have to check that a UTF-8 encoding
// uses as few bits as possible. This means that we
// can't do things like encode 't' in three bytes.
@@ -120,7 +120,7 @@ utf8_validate(unsigned char* data, size_t size)
// 2: 110xxxxy 10yyyyyy
// 3: 1110xxxx 10xyyyyy 10yyyyyy
// 4: 11110xxx 10xxyyyy 10yyyyyy 10yyyyyy
-
+
// ulen == 1 passes by definition
if(ulen == 2) {
if((data[0] & 0x1E) == 0)
View
@@ -1,4 +1,4 @@
-// This file is part of Jiffy released under the MIT license.
+// This file is part of Jiffy released under the MIT license.
// See the LICENSE file for more information.
#include "jiffy.h"
View
@@ -1,4 +1,4 @@
-% This file is part of Jiffy released under the MIT license.
+% This file is part of Jiffy released under the MIT license.
% See the LICENSE file for more information.
-module(jiffy).
View
@@ -1,11 +1,11 @@
#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
+% This file is part of Jiffy released under the MIT license.
% See the LICENSE file for more information.
main([]) ->
code:add_pathz("test"),
code:add_pathz("ebin"),
-
+
Cases = read_cases(),
etap:plan(length(Cases)),
View
@@ -1,18 +1,18 @@
#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
+% This file is part of Jiffy released under the MIT license.
% See the LICENSE file for more information.
main([]) ->
code:add_pathz("ebin"),
code:add_pathz("test"),
-
+
etap:plan(6),
etap:is(jiffy:decode(<<"true">>), true, "DEC: true -> true"),
etap:is(jiffy:encode(true), <<"true">>, "ENC: true -> true"),
-
+
etap:is(jiffy:decode(<<"false">>), false, "DEC: false -> false"),
etap:is(jiffy:encode(false), <<"false">>, "ENC: false -> false"),
-
+
etap:is(jiffy:decode(<<"null">>), null, "DEC: null -> null"),
etap:is(jiffy:encode(null), <<"null">>, "ENC: null -> null"),
View
@@ -1,11 +1,11 @@
#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
+% This file is part of Jiffy released under the MIT license.
% See the LICENSE file for more information.
main([]) ->
code:add_pathz("ebin"),
code:add_pathz("test"),
-
+
etap:plan(59),
util:test_good(good()),
util:test_errors(errors()),
View
@@ -1,18 +1,18 @@
#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
+% This file is part of Jiffy released under the MIT license.
% See the LICENSE file for more information.
main([]) ->
code:add_pathz("ebin"),
code:add_pathz("test"),
-
+
etap:plan(80),
util:test_good(good()),
util:test_good(uescaped(), [uescape]),
util:test_errors(errors()),
-
+
test_utf8(utf8_cases()),
-
+
etap:end_tests().
good() ->
@@ -76,13 +76,13 @@ utf8_cases() ->
% Invalid Unicode code points
<<239, 191, 190>>,
<<237, 160, 129>>,
-
+
% Not enough extension bytes
<<16#C0>>,
-
+
<<16#E0>>,
<<16#E0, 16#80>>,
-
+
<<16#F0>>,
<<16#F0, 16#80>>,
<<16#F0, 16#80, 16#80>>,
@@ -91,7 +91,7 @@ utf8_cases() ->
<<16#F8, 16#80>>,
<<16#F8, 16#80, 16#80>>,
<<16#F8, 16#80, 16#80, 16#80>>,
-
+
<<16#FC>>,
<<16#FC, 16#80>>,
<<16#FC, 16#80, 16#80>>,
@@ -101,16 +101,16 @@ utf8_cases() ->
% No data in high bits.
<<16#C0, 16#80>>,
<<16#C1, 16#80>>,
-
+
<<16#E0, 16#80, 16#80>>,
<<16#E0, 16#90, 16#80>>,
-
+
<<16#F0, 16#80, 16#80, 16#80>>,
<<16#F0, 16#88, 16#80, 16#80>>,
<<16#F8, 16#80, 16#80, 16#80, 16#80>>,
<<16#F8, 16#84, 16#80, 16#80, 16#80>>,
-
+
<<16#FC, 16#80, 16#80, 16#80, 16#80, 16#80>>,
<<16#FC, 16#82, 16#80, 16#80, 16#80, 16#80>>
].
View
@@ -1,11 +1,11 @@
#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
+% This file is part of Jiffy released under the MIT license.
% See the LICENSE file for more information.
main([]) ->
code:add_pathz("ebin"),
code:add_pathz("test"),
-
+
etap:plan(18),
util:test_good(good()),
util:test_errors(errors()),
View
@@ -1,11 +1,11 @@
#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
+% This file is part of Jiffy released under the MIT license.
% See the LICENSE file for more information.
main([]) ->
code:add_pathz("ebin"),
code:add_pathz("test"),
-
+
etap:plan(15),
util:test_good(good()),
util:test_errors(errors()),
View
@@ -1,11 +1,11 @@
#! /usr/bin/env escript
-% This file is part of Jiffy released under the MIT license.
+% This file is part of Jiffy released under the MIT license.
% See the LICENSE file for more information.
main([]) ->
code:add_pathz("ebin"),
code:add_pathz("test"),
-
+
etap:plan(12),
util:test_good(good()),
util:test_errors(errors()),
Oops, something went wrong.

0 comments on commit e9b85b0

Please sign in to comment.