Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/torch7.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/File.c
diff options
context:
space:
mode:
authorRonan Collobert <ronan@collobert.com>2015-03-16 21:34:24 +0300
committerRonan Collobert <ronan@collobert.com>2015-03-16 21:34:24 +0300
commita3f379aa82dbff37cd6d1d0911b8361ddd9f6506 (patch)
tree1685c406305b8c608c04092012d6c005f5255950 /File.c
parente2ea9ba264b9e3c7a54b4cc7c0376c48482e7d2c (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.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/File.c b/File.c
index f3c63ab..e2f8e42 100644
--- a/File.c
+++ b/File.c
@@ -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)); \