All pastes #557498 Raw Edit

Unnamed

public text v1 · immutable
·published 2007-06-11 00:35 UTC
rendered paste body
diff -ur ktorrent-2.2beta1.orig/libktorrent/torrent/multifilecache.cpp ktorrent-2.2beta1/libktorrent/torrent/multifilecache.cpp
--- ktorrent-2.2beta1.orig/libktorrent/torrent/multifilecache.cpp	2007-05-24 19:38:59.000000000 +0200
+++ ktorrent-2.2beta1/libktorrent/torrent/multifilecache.cpp	2007-06-11 01:10:14.000000000 +0200
@@ -35,6 +35,7 @@
 #include "cachefile.h"
 #include "dndfile.h"
 #include "preallocationthread.h"
+#include "settings.h"
 
 
 
@@ -575,7 +576,7 @@
 			
 			if(! res)
 			{
-				bt::TruncateFile(output_file,tf->getSize());
+				bt::TruncateFile(output_file,tf->getSize(),!Settings::fullDiskPrealloc());
 			}
 		}
 		catch (bt::Error & e)
diff -ur ktorrent-2.2beta1.orig/libktorrent/util/fileops.cpp ktorrent-2.2beta1/libktorrent/util/fileops.cpp
--- ktorrent-2.2beta1.orig/libktorrent/util/fileops.cpp	2007-05-24 19:39:00.000000000 +0200
+++ ktorrent-2.2beta1/libktorrent/util/fileops.cpp	2007-06-11 01:09:24.000000000 +0200
@@ -390,7 +390,7 @@
 		}
 	}
 	
-	void TruncateFile(const QString & path,Uint64 size)
+	void TruncateFile(const QString & path,Uint64 size,bool quick)
 	{
 		int fd = ::open(QFile::encodeName(path),O_RDWR | O_LARGEFILE);
 		if (fd < 0)
@@ -398,7 +398,7 @@
 		
 		try
 		{
-			TruncateFile(fd,size,true);
+			TruncateFile(fd,size,quick);
 			close(fd);
 		}
 		catch (...)
diff -ur ktorrent-2.2beta1.orig/libktorrent/util/fileops.h ktorrent-2.2beta1/libktorrent/util/fileops.h
--- ktorrent-2.2beta1.orig/libktorrent/util/fileops.h	2007-05-24 19:39:00.000000000 +0200
+++ ktorrent-2.2beta1/libktorrent/util/fileops.h	2007-06-11 01:08:22.000000000 +0200
@@ -120,7 +120,7 @@
 	 * @param quick Use the quick way (doesn't prevent fragmentationt)
 	 * @throw Error if the file doesn't exist, or something else goes wrong
 	 */
-	void TruncateFile(const QString & path,Uint64 size);
+	void TruncateFile(const QString & path,Uint64 size,bool quick);
 	
 	/**
 	 * Special truncate for FAT file systems.