diff options
| author | Alexey Melnichuk <mimir@newmail.ru> | 2014-08-13 18:18:42 +0500 |
|---|---|---|
| committer | Alexey Melnichuk <mimir@newmail.ru> | 2014-08-13 18:18:42 +0500 |
| commit | ebe20b66f095c8f89a5c1d16c5bd3cc98dad29ee (patch) | |
| tree | 198dad34e29f8c8ae8ffb7d4052b04218122f6b7 | |
| parent | 601b4e54981d685d0a3c6049622453e897e55c01 (diff) | |
| download | luafilesystem-ebe20b66f095c8f89a5c1d16c5bd3cc98dad29ee.tar.gz luafilesystem-ebe20b66f095c8f89a5c1d16c5bd3cc98dad29ee.tar.bz2 luafilesystem-ebe20b66f095c8f89a5c1d16c5bd3cc98dad29ee.zip | |
Fix. Compile with MSVC and with gcc without `-std=c99`
| -rw-r--r-- | src/lfs.c | 8 |
1 files changed, 6 insertions, 2 deletions
| @@ -438,6 +438,7 @@ static int make_dir (lua_State *L) { | |||
| 438 | return 1; | 438 | return 1; |
| 439 | } | 439 | } |
| 440 | 440 | ||
| 441 | |||
| 441 | /* | 442 | /* |
| 442 | ** Removes a directory. | 443 | ** Removes a directory. |
| 443 | ** @param #1 Directory path. | 444 | ** @param #1 Directory path. |
| @@ -457,6 +458,7 @@ static int remove_dir (lua_State *L) { | |||
| 457 | return 1; | 458 | return 1; |
| 458 | } | 459 | } |
| 459 | 460 | ||
| 461 | |||
| 460 | /* | 462 | /* |
| 461 | ** Directory iterator | 463 | ** Directory iterator |
| 462 | */ | 464 | */ |
| @@ -569,6 +571,7 @@ static int dir_create_meta (lua_State *L) { | |||
| 569 | return 1; | 571 | return 1; |
| 570 | } | 572 | } |
| 571 | 573 | ||
| 574 | |||
| 572 | /* | 575 | /* |
| 573 | ** Creates lock metatable. | 576 | ** Creates lock metatable. |
| 574 | */ | 577 | */ |
| @@ -790,6 +793,7 @@ struct _stat_members members[] = { | |||
| 790 | static int _file_info_ (lua_State *L, int (*st)(const char*, STAT_STRUCT*)) { | 793 | static int _file_info_ (lua_State *L, int (*st)(const char*, STAT_STRUCT*)) { |
| 791 | STAT_STRUCT info; | 794 | STAT_STRUCT info; |
| 792 | const char *file = luaL_checkstring (L, 1); | 795 | const char *file = luaL_checkstring (L, 1); |
| 796 | int i; | ||
| 793 | 797 | ||
| 794 | if (st(file, &info)) { | 798 | if (st(file, &info)) { |
| 795 | lua_pushnil (L); | 799 | lua_pushnil (L); |
| @@ -798,7 +802,7 @@ static int _file_info_ (lua_State *L, int (*st)(const char*, STAT_STRUCT*)) { | |||
| 798 | } | 802 | } |
| 799 | if (lua_isstring (L, 2)) { | 803 | if (lua_isstring (L, 2)) { |
| 800 | const char *member = lua_tostring (L, 2); | 804 | const char *member = lua_tostring (L, 2); |
| 801 | for (int i = 0; members[i].name; i++) { | 805 | for (i = 0; members[i].name; i++) { |
| 802 | if (strcmp(members[i].name, member) == 0) { | 806 | if (strcmp(members[i].name, member) == 0) { |
| 803 | /* push member value and return */ | 807 | /* push member value and return */ |
| 804 | members[i].push (L, &info); | 808 | members[i].push (L, &info); |
| @@ -813,7 +817,7 @@ static int _file_info_ (lua_State *L, int (*st)(const char*, STAT_STRUCT*)) { | |||
| 813 | lua_newtable (L); | 817 | lua_newtable (L); |
| 814 | } | 818 | } |
| 815 | /* stores all members in table on top of the stack */ | 819 | /* stores all members in table on top of the stack */ |
| 816 | for (int i = 0; members[i].name; i++) { | 820 | for (i = 0; members[i].name; i++) { |
| 817 | lua_pushstring (L, members[i].name); | 821 | lua_pushstring (L, members[i].name); |
| 818 | members[i].push (L, &info); | 822 | members[i].push (L, &info); |
| 819 | lua_rawset (L, -3); | 823 | lua_rawset (L, -3); |
