From 8ff6f0aa0e48a2cf4d82bd239573b91a53b67e01 Mon Sep 17 00:00:00 2001 From: Moritz Bunkus Date: Tue, 12 Aug 2003 16:15:41 +0000 Subject: [PATCH] Fixed a bug with files bigger than 2GB not being recognized. The accompanying error message was "File NAME has unknown type. Please have a look at the supported file types..." --- ChangeLog | 5 +++++ src/base64tool.cpp | 2 +- src/mkvmerge.cpp | 2 +- src/mm_io.cpp | 8 +++++--- 4 files changed, 12 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index faee4cfdd..bdccb3669 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2003-08-12 Moritz Bunkus + * Windows versions: Fixed a bug with files bigger than 2GB not + being recognized. The accompanying error message was "File NAME + has unknown type. Please have a look at the supported file + types..." + * all tools: Fixed a bug which would only allow Matroska files up to 4GB to be read. The accompanying error message was "No segment found" or something similar. diff --git a/src/base64tool.cpp b/src/base64tool.cpp index b8d0208a5..4ec62800f 100644 --- a/src/base64tool.cpp +++ b/src/base64tool.cpp @@ -43,7 +43,7 @@ void usage(int retval) { int main(int argc, char *argv[]) { int maxlen; - int64_t size; + uint64_t size; unsigned char *buffer; char mode; string s, line; diff --git a/src/mkvmerge.cpp b/src/mkvmerge.cpp index 7acd14934..1af9a1149 100644 --- a/src/mkvmerge.cpp +++ b/src/mkvmerge.cpp @@ -309,7 +309,7 @@ static void usage() { static int get_type(char *filename) { mm_io_c *mm_io; mm_text_io_c *mm_text_io; - off_t size; + uint64_t size; int type; try { diff --git a/src/mm_io.cpp b/src/mm_io.cpp index b6571e011..b5634c581 100644 --- a/src/mm_io.cpp +++ b/src/mm_io.cpp @@ -166,8 +166,10 @@ uint64 mm_io_c::getFilePointer() { DWORD low; low = SetFilePointer((HANDLE)file, 0, &high, FILE_CURRENT); - if ((low == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR)) + if ((low == INVALID_SET_FILE_POINTER) && (GetLastError() != NO_ERROR)) { + printf("nonono\n"); return (uint64)-1; + } return (((uint64)high) << 32) | (uint64)low; } @@ -188,8 +190,8 @@ void mm_io_c::setFilePointer(int64 offset, seek_mode mode) { break; } - high = offset >> 32; - SetFilePointer((HANDLE)file, offset & 0xffffffff, &high, method); + high = (LONG)(offset >> 32); + SetFilePointer((HANDLE)file, (LONG)(offset & 0xffffffff), &high, method); } uint32 mm_io_c::read(void *buffer, size_t size) {