From: <ar...@us...> - 2010-06-29 20:40:21
|
Revision: 30418 http://xbmc4xbox.svn.sourceforge.net/xbmc4xbox/?rev=30418&view=rev Author: arnova Date: 2010-06-29 20:40:14 +0000 (Tue, 29 Jun 2010) Log Message: ----------- fixed: >4GiB files in FTP directories had incorrect filesize Modified Paths: -------------- trunk/xbmc/FileSystem/FTPParse.cpp trunk/xbmc/FileSystem/FTPParse.h Modified: trunk/xbmc/FileSystem/FTPParse.cpp =================================================================== --- trunk/xbmc/FileSystem/FTPParse.cpp 2010-06-29 14:57:03 UTC (rev 30417) +++ trunk/xbmc/FileSystem/FTPParse.cpp 2010-06-29 20:40:14 UTC (rev 30418) @@ -133,12 +133,20 @@ return u; } +static __int64 getint64(char *buf,int len) +{ + __int64 u = 0; + while (len-- > 0) + u = u * 10 + (*buf++ - '0'); + return u; +} + int ftpparse(struct ftpparse *fp,char *buf,int len) { int i; int j; int state; - long size; + __int64 size; long year; long month; long mday; @@ -186,7 +194,7 @@ break; case 's': fp->sizetype = FTPPARSE_SIZE_BINARY; - fp->size = getlong(buf + i + 1,j - i - 1); + fp->size = getint64(buf + i + 1,j - i - 1); break; case 'm': fp->mtimetype = FTPPARSE_MTIME_LOCAL; @@ -248,7 +256,7 @@ state = 4; break; case 4: /* getting tentative size */ - size = getlong(buf + i,j - i); + size = getint64(buf + i,j - i); state = 5; break; case 5: /* searching for month, otherwise getting tentative size */ @@ -256,7 +264,7 @@ if (month >= 0) state = 6; else - size = getlong(buf + i,j - i); + size = getint64(buf + i,j - i); break; case 6: /* have size and month */ mday = getlong(buf + i,j - i); @@ -424,7 +432,7 @@ else { i = j; while (buf[j] != ' ') if (++j == len) return 0; - fp->size = getlong(buf + i,j - i); + fp->size = getint64(buf + i,j - i); fp->sizetype = FTPPARSE_SIZE_BINARY; fp->flagtryretr = 1; } Modified: trunk/xbmc/FileSystem/FTPParse.h =================================================================== --- trunk/xbmc/FileSystem/FTPParse.h 2010-06-29 14:57:03 UTC (rev 30417) +++ trunk/xbmc/FileSystem/FTPParse.h 2010-06-29 20:40:14 UTC (rev 30418) @@ -22,7 +22,7 @@ int flagtrycwd; // 0 if cwd is definitely pointless, 1 otherwise int flagtryretr; // 0 if retr is definitely pointless, 1 otherwise int sizetype; - long size; // number of octets + __int64 size; // number of octets int mtimetype; time_t mtime; // modification time int idtype; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |