[Pkg] The Trunk: System-nice.675.mcz

commits at source.squeak.org commits at source.squeak.org
Fri Jul 18 00:12:36 UTC 2014

Nicolas Cellier uploaded a new version of System to project The Trunk:

==================== Summary ====================

Name: System-nice.675
Author: nice
Time: 18 July 2014, 2:11:27.391 am
UUID: 25986572-4961-455f-a11c-9fbd389fdeaa
Ancestors: System-nice.674

Remove a bit of ascii/binary dance.
This is possible
- in CodeLoader because ByteArray now understands unzipped
- in DataStream>>readString, because nextString will turn stream to binary right after we asked for ascii...
- in SmartRefStream>>appendClassDefns because we can forward the job to an asciiStream.
Beware, this last part was not WideString friendly, and still isn't really.
We should better use something like UTF8 but it's not a local change - we'll see later...

=============== Diff against System-nice.674 ===============

Item was changed:
  ----- Method: CodeLoader>>installSegment: (in category 'installing') -----
  installSegment: reqEntry
  	"Install the previously loaded segment"
  	| contentStream contents trusted |
  	contentStream := reqEntry value contentStream.
  	contentStream ifNil:[^self error:'No content to install: ', reqEntry key printString].
  	trusted := SecurityManager default positionToSecureContentsOf: contentStream.
  	trusted ifFalse:[(SecurityManager default enterRestrictedMode) ifFalse:[
  		contentStream close.
  		^self error:'Insecure content encountered: ', reqEntry key printString]].
+ 	contents := contentStream upToEnd unzipped asString.
- 	contents := contentStream ascii upToEnd unzipped.
  	(contentStream respondsTo: #close) ifTrue:[contentStream close].
  	^(RWBinaryOrTextStream with: contents) reset fileInObjectAndCode install.!

Item was changed:
  ----- Method: CodeLoader>>installSourceFile: (in category 'installing') -----
  installSourceFile: aStream
  	"Install the previously loaded source file"
  	| contents trusted |
  	aStream ifNil:[^self error:'No content to install'].
  	trusted := SecurityManager default positionToSecureContentsOf: aStream.
  	trusted ifFalse:[(SecurityManager default enterRestrictedMode) 
  					ifFalse:[ aStream close.
  							^ self error:'Insecure content encountered']].
+ 	contents := aStream upToEnd unzipped asString.
- 	contents := aStream ascii upToEnd unzipped.
  	(aStream respondsTo: #close) ifTrue:[aStream close].
+ 	^contents readStream fileIn!
- 	^(RWBinaryOrTextStream with: contents) reset fileIn!

Item was changed:
  ----- Method: DataStream>>readString (in category 'write and read') -----
+ 	^byteStream nextString
- 	| str |
- 	byteStream ascii.
- 	str := byteStream nextString.
- 	byteStream binary.
- 	^ str

Item was changed:
  ----- Method: SmartRefStream>>appendClassDefns (in category 'read write') -----
  	"Make this a fileOut format file.  For each UniClass mentioned, prepend its source code to the file.  Class name conflicts during reading will be resolved then.  Assume instVarInfo: has already been done."
+ | asciiStream |
+ asciiStream := (String new: 1024) writeStream.
- byteStream ascii.
  byteStream position = 0 ifTrue: [
  	byteStream setFileTypeToObject.
  		"Type and Creator not to be text, so can attach correctly to an email msg"
+ 	asciiStream header; timeStamp].
- 	byteStream header; timeStamp].
+ asciiStream cr; nextPutAll: '!!ObjectScanner new initialize!!'; cr; cr.
- byteStream cr; nextPutAll: '!!ObjectScanner new initialize!!'; cr; cr.
  self uniClasesDo: [:class | class
  		class sharedPools size > 0 ifTrue:  "This never happens"
  			[class shouldFileOutPools
  				ifTrue: [class fileOutSharedPoolsOn: self]].
+ 		class fileOutOn: asciiStream moveSource: false toFile: 0].	
- 		class fileOutOn: byteStream moveSource: false toFile: 0].	
  		"UniClasses are filed out normally, no special format."
+ 	asciiStream trailer.	"Does nothing for normal files.  
- 	byteStream trailer.	"Does nothing for normal files.  
  		HTML streams will have trouble with object data"
  	"Append the object's raw data"
+ 	asciiStream cr; cr; nextPutAll: '!!self smartRefStream!!'.
+ 	byteStream nextPutAll: asciiStream contents asByteArray.		"get ready for objects"
- 	byteStream cr; cr; nextPutAll: '!!self smartRefStream!!'.
- 	byteStream binary.		"get ready for objects"

More information about the Packages mailing list