--- a/FileOperation.st Fri Jun 18 12:35:13 2010 +0200
+++ b/FileOperation.st Mon Jun 21 22:11:16 2010 +0200
@@ -511,7 +511,7 @@
|in in2 out doWrite doRead fileSize offset buffer bufferSize nRead nWritten nSingle
lostStart lostEnd seekFailed|
- buffer := ByteArray new:1024*1024*8.
+ buffer := ByteArray new:(self bufferSize).
bufferSize := buffer size.
offset := 0.
fileSize := sourceFile fileSize.
@@ -553,18 +553,18 @@
] ifFalse:[
nRead == 0 ifTrue:[
"/ try reading single blocks for a while...
- nSingle := 16.
+ nSingle := self defectBlockRetryCount.
[
- nSingle > 0
+ nSingle > 0
and:[
- doRead value:256.
+ doRead value:(self defectBlockCopySize).
nRead > 0]
] whileTrue:[
lostStart notNil ifTrue:[
Transcript showCR:'CORRUPT: ',(lostStart printString),' .. ',(lostEnd printString).
lostStart := nil.
].
-Transcript showCR:'single block at ',offset printString.
+Transcript showCR:'single block at ',offset printString, 'size=',nRead printString.
doWrite value:nRead.
nSingle := nSingle - 1.
].
@@ -583,13 +583,13 @@
in2 position:offset.
].
seekFailed ifTrue:[
- buffer from:1 to:256 put:0.
+ buffer atAllPut:0.
Transcript showCR:'bad seek at ',offset printString.
- doWrite value:256.
+ doWrite value:(self defectBlockCopySize).
] ifFalse:[
in close.
in := in2.
- doRead value:256.
+ doRead value:(self defectBlockCopySize).
nRead > 0 ifTrue:[
Transcript showCR:'single after reopen at ',offset printString.
doWrite value:nRead.
@@ -599,10 +599,10 @@
] ifFalse:[
lostEnd := offset.
].
- buffer from:1 to:256 put:0.
+ buffer atAllPut:0.
Transcript showCR:'bad at ',offset printString.
- doWrite value:256.
- bufferSize := 256.
+ doWrite value:(self defectBlockCopySize).
+ bufferSize := (self defectBlockCopySize).
].
]
]
@@ -620,7 +620,30 @@
].
"Created: / 07-02-2007 / 18:40:32 / cg"
- "Modified: / 07-02-2007 / 21:40:24 / cg"
+ "Modified: / 21-06-2010 / 14:25:22 / cg"
+! !
+
+!FileOperation::CopyCorrupted methodsFor:'defaults'!
+
+bufferSize
+ ^ 1024*1024*1
+
+ "Created: / 21-06-2010 / 14:20:35 / cg"
+!
+
+defectBlockCopySize
+ "/ ^ 256
+ ^ 64*1024
+
+ "Created: / 21-06-2010 / 14:22:23 / cg"
+ "Modified: / 21-06-2010 / 18:04:36 / cg"
+!
+
+defectBlockRetryCount
+ ^ 2
+
+ "Created: / 21-06-2010 / 14:24:45 / cg"
+ "Modified: / 21-06-2010 / 17:56:35 / cg"
! !
!FileOperation::Create class methodsFor:'actions'!
@@ -1508,5 +1531,9 @@
!FileOperation class methodsFor:'documentation'!
version
- ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.83 2009-03-02 15:02:35 cg Exp $'
+ ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.84 2010-06-21 20:11:16 cg Exp $'
+!
+
+version_CVS
+ ^ '$Header: /cvs/stx/stx/libtool/FileOperation.st,v 1.84 2010-06-21 20:11:16 cg Exp $'
! !