]> granicus.if.org Git - transmission/commitdiff
(1.1x) a little extra safety when determining space needed to download
authorMitchell Livingston <livings124@transmissionbt.com>
Wed, 9 Apr 2008 18:40:22 +0000 (18:40 +0000)
committerMitchell Livingston <livings124@transmissionbt.com>
Wed, 9 Apr 2008 18:40:22 +0000 (18:40 +0000)
macosx/Torrent.m
macosx/TorrentCell.m

index e64c0b895cbf1819f00182ab6ff24065b1cd1ba6..5151920c9e98a0cb026a4b361b28a05dac0f1a8d 100644 (file)
@@ -568,7 +568,13 @@ void completenessChangeCallback(tr_torrent * torrent, cp_status_t status, void *
                     NSDictionary * fileAttributes = onLeopard ? [fileManager attributesOfItemAtPath: path error: NULL]
                                                         : [fileManager fileAttributesAtPath: path traverseLink: NO];
                     if (fileAttributes)
-                        neededSpace -= [[fileAttributes objectForKey: NSFileSize] unsignedLongLongValue];
+                    {
+                        unsigned long long fileSize = [[fileAttributes objectForKey: NSFileSize] unsignedLongLongValue];
+                        if (fileSize < neededSpace)
+                            neededSpace -= fileSize;
+                        else
+                            neededSpace = 0;
+                    }
                 }
             }
             
index d294a9476a7fb97e6eec4377532ea175a183ce59..d5a258837fafc09e51d98aa7a9a3282e06d0eaf6 100644 (file)
         [fErrorImage drawInRect: errorRect fromRect: NSZeroRect operation: NSCompositeSourceOver fraction: 1.0];
     }
     
+    #warning alter
     //text color
     NSColor * titleColor, * statusColor;
     if ([NSApp isOnLeopardOrBetter] ? [self backgroundStyle] == NSBackgroundStyleDark : [self isHighlighted]