Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: babf4842271818409ded265d7659d11841087bd1
Ticket: 1665628fffffffffffffffffffffffffffffffff
destructive scan of a ByteArray
User & Date: dkf on 2009-02-05 18:00:18
Changes

  1. icomment:
    If you convert a string with characters in the \u0100-\uffff range to a byte array, the high byte of that character is dropped. If you modify the byte array then (e.g. by Tcl_SetByteArrayLength) the string rep will be thrown away. At that point, you'll have lost information. By requiring that there be no string rep in the first place, that means that there cannot be any information to lose and the operation is safe. (Otherwise, the fallback approach of working with strings is used, which produces correct results but more slowly.) Theoretically, we could be more sophisticated and record whether the string rep is generated from the bytearray or vice versa and use that as the safety constraint - we do the equivalent with lists - but the change is more intrusive and complex, and most practical bytearrays won't have string reps anyway.
    
    
    
  2. login: "dkf"
  3. mimetype: "text/plain"
  4. username: "dkf"