diff options
author | Ronan Collobert <ronan@collobert.com> | 2015-03-16 21:34:24 +0300 |
---|---|---|
committer | Ronan Collobert <ronan@collobert.com> | 2015-03-16 21:34:24 +0300 |
commit | a3f379aa82dbff37cd6d1d0911b8361ddd9f6506 (patch) | |
tree | 1685c406305b8c608c04092012d6c005f5255950 /File.c | |
parent | e2ea9ba264b9e3c7a54b4cc7c0376c48482e7d2c (diff) |
fixed long-standing bug in file
storage in quiet mode were not resized when reading less data than expected
Diffstat (limited to 'File.c')
-rw-r--r-- | File.c | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -74,13 +74,13 @@ IMPLEMENT_TORCH_FILE_FUNC(close) long nread; \ \ TH##TYPEC##Storage *storage = TH##TYPEC##Storage_newWithSize(size); \ - luaT_pushudata(L, storage, "torch." #TYPEC "Storage"); \ + luaT_pushudata(L, storage, "torch." #TYPEC "Storage"); \ nread = THFile_read##TYPEC(self, storage); \ if(nread != size) \ - TH##TYPEC##Storage_resize(storage, size); \ + TH##TYPEC##Storage_resize(storage, nread); \ return 1; \ } \ - else if(luaT_toudata(L, 2, "torch." #TYPEC "Storage")) \ + else if(luaT_toudata(L, 2, "torch." #TYPEC "Storage")) \ { \ TH##TYPEC##Storage *storage = luaT_toudata(L, 2, "torch." #TYPEC "Storage"); \ lua_pushnumber(L, THFile_read##TYPEC(self, storage)); \ |