Skip to content

Commit

Permalink
src/decode.c, src/encode.c, src/load.c, src/luaamf.c, src/save.c: cur…
Browse files Browse the repository at this point in the history
…ly brackets added
  • Loading branch information
vladfedin committed Apr 26, 2010
1 parent 8cb6463 commit 25c72eb
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 7 deletions.
10 changes: 8 additions & 2 deletions src/decode.c
Expand Up @@ -18,7 +18,10 @@ int decode_double(const unsigned char *byte_ref, double *val)
char string[8];
} d;

if (!byte_ref) return LUAAMF_EBADDATA;
if (!byte_ref)
{
return LUAAMF_EBADDATA;
}

/* Flip */
d.string[0] = byte_ref[7];
Expand All @@ -40,7 +43,10 @@ int decode_int(const unsigned char *byte_ref, int *val)
int result = 0;
int byte_cnt = 0;
char byte;
if (!byte_ref) return LUAAMF_EBADDATA;
if (!byte_ref)
{
return LUAAMF_EBADDATA;
}
byte = byte_ref[0];

/* If 0x80 is set, int includes the next byte, up to 4 total bytes */
Expand Down
5 changes: 4 additions & 1 deletion src/encode.c
Expand Up @@ -25,7 +25,10 @@ int encode_double(luaamf_SaveBuffer *sb, double value)
int i;
unsigned char context[9];
context[0] = LUAAMF_DOUBLE;
for(i = 1; i <= 8; i++) context[i] = char_value[8 - i];
for(i = 1; i <= 8; i++)
{
context[i] = char_value[8 - i];
}
sb_write(sb, context, 9);
}
return LUAAMF_ESUCCESS;
Expand Down
5 changes: 4 additions & 1 deletion src/load.c
Expand Up @@ -137,7 +137,10 @@ int luaamf_load(
unsigned int value = 0;
unsigned int byte_cnt = 0;
char byte;
if (ls.pos == NULL) return LUAAMF_EBADDATA;
if (ls.pos == NULL)
{
return LUAAMF_EBADDATA;
}
byte = ls.pos[0];

/* If 0x80 is set, int includes the next byte, up to 4 total bytes */
Expand Down
5 changes: 4 additions & 1 deletion src/luaamf.c
Expand Up @@ -38,7 +38,10 @@ static int l_load(lua_State * L)

lua_pushboolean(L, 1);

if (!luaamf_load(L, data, len)) return 1;
if (!luaamf_load(L, data, len))
{
return 1;
}

lua_pushnil(L);
lua_replace(L, -3); /* Put nil before error message on stack */
Expand Down
10 changes: 8 additions & 2 deletions src/save.c
Expand Up @@ -67,7 +67,10 @@ static int save_table(
/* Remove value from stack, leave key for the next iteration. */
lua_pop(L, 1);
}
else return result;
else
{
return result;
}
}

/* write serilization here */
Expand Down Expand Up @@ -113,7 +116,10 @@ static int save_value(
{
size_t len;
const char * buf = lua_tolstring(L, index, &len);
if(use_code) sb_writechar(sb, LUAAMF_STRING);
if(use_code)
{
sb_writechar(sb, LUAAMF_STRING);
}
result = encode_string(sb, buf, len);
break;
}
Expand Down

0 comments on commit 25c72eb

Please sign in to comment.