Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 59de4677ca45da7d5b4fcce4de4de973daf793ce
Ticket: 1689385fffffffffffffffffffffffffffffffff
Tcl_SetObjLength documentation incomplete
User & Date: dgp on 2007-03-27 17:47:01
Changes

  1. assignee changed to: "msofer"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    
    The documentation for
    
      Tcl_SetObjLength(objPtr, newLength)
    
    suggests that it will leave
    objPtr->bytes pointing to a buffer
    of at least length newLength+1,
    that it will write a null byte
    at objPtr->bytes[newLength], and
    that it will leave objPtr->length
    with the new value of newLength.
    
    This is often true.
    
    However, when objPtr points to
    a pure unicode object with at least
    one multibyte character, or with
    some other history that leaves
    objPtr->bytes == NULL and
    stringPtr->hasUnicode != 0, then
    Tcl_SetObjLength() manipulates
    the unicode representation, growing
    it to hold at least newLength *characters*
    (not bytes).  It's possible that a
    caller expecting the documentation to be
    true might get a nasty surprise.
    
    The ability to grow the unicode rep
    is useful.  Perhaps that functionality
    should have its own API, rather than
    having undocumented, semi-magical modes
    of operation?
    
    
  4. foundin changed to: "obsolete: 8.5a6"
  5. is_private changed to: "0"
  6. priority changed to: "5 Medium"
  7. resolution changed to: "None"
  8. status changed to: "Open"
  9. submitter changed to: "dgp"
  10. subsystem changed to: "10. Objects"
  11. title changed to: "Tcl_SetObjLength documentation incomplete"
  12. type changed to: "Bug"