X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/1a570b0a6a76cbba50646a476a59da8faf628686..beb2ce1f2dd06501d2bc914d8b19a3ea65c02e8f:/client/pm3_binlib.c diff --git a/client/pm3_binlib.c b/client/pm3_binlib.c index 88cb289f..06fd39d2 100644 --- a/client/pm3_binlib.c +++ b/client/pm3_binlib.c @@ -48,8 +48,8 @@ static void badcode(lua_State *L, int c) static int doendian(int c) { - int x=1; - int e=*(char*)&x; + int x = 1; + int e = *(char*)&x; if (c==OP_LITTLEENDIAN) return !e; if (c==OP_BIGENDIAN) return e; if (c==OP_NATIVE) return 0; @@ -60,7 +60,7 @@ static void doswap(int swap, void *p, size_t n) { if (swap) { - char *a=(char*)p; + char *a = (char*)p; int i,j; for (i=0, j=n-1, n=n/2; n--; i++, j--) { @@ -87,14 +87,14 @@ static void doswap(int swap, void *p, size_t n) case OP: \ { \ T l; \ - int m=sizeof(l); \ - if (i+m>len) { done = 1; break; } \ - memcpy(&l,s+i,m); \ + int m = sizeof(l); \ + if (i + m > len) { done = 1; break; } \ + memcpy(&l, s+i, m); \ doswap(swap,&l,m); \ - if (i+m+l>len) { done = 1; break;} \ - i+=m; \ + if (i + m + l > len) { done = 1; break;} \ + i += m; \ lua_pushlstring(L,s+i,l); \ - i+=l; \ + i += l; \ ++n; \ break; \ } @@ -120,8 +120,8 @@ static int l_unpack(lua_State *L) /** unpack(f,s, [init]) */ lua_pushnil(L); while (*f && done == 0) { - int c=*f++; - int N=1; + int c = *f++; + int N = 1; if (isdigit((int) (unsigned char) *f)) { N=0; @@ -233,15 +233,15 @@ static int l_unpack(lua_State *L) /** unpack(f,s, [init]) */ static int l_pack(lua_State *L) /** pack(f,...) */ { - int i=2; - const char *f=luaL_checkstring(L,1); - int swap=0; + int i = 2; + const char *f = luaL_checkstring(L,1); + int swap = 0; luaL_Buffer b; luaL_buffinit(L,&b); while (*f) { - int c=*f++; - int N=1; + int c = *f++; + int N = 1; if (isdigit((int) (unsigned char) *f)) { N=0;