Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 0d48b160249c7d4cc93ecaef6898a44a21d4fb71
Ticket: 2895565fffffffffffffffffffffffffffffffff
Busyloop in vwait in innocent HTTP code
User & Date: andreas_kupries on 2009-11-11 09:08:46
Changes

  1. icomment:
    Ok, here my notes after reading CopyData and recursing into the related functions, i.e. Do*.
    
    DoReadChars
            Request: 'toRead' - Number of characters.
            Result:  Number of characters read
            Storage: A Tcl_Obj
            Does EOL translation (ReadBytes, ReadChars branches)
            Does encoding conversion -> Result is UTF8, ReadChars branch
    
    DoRead
            Request: 'toRead' - Number of _bytes_
            Result: Number of bytes read  - (Comment says chars, is in error)
            Storage: char* array (bytes).
            NOTE!           No encoding conversion applied.
            Does            EOL translation (GetInput + CopyAndTranslateBuffer)
    
    DoWriteChars
            Request:        #bytes to write
            Result:         #bytes written
            Storage:        char* array, utf8 encoded characters
            Does encoding conversion, does EOL translation
            (WriteChars (E, EOL), WriteBytes (EOL)).
    
    DoWrite
            Request:        #bytes to write.
            Result:         #bytes written
            Storage:        char* array
            Does EOL translation. No encodings applied.
    
    Use in CopyData seems to be byte-oriented all the way, making trouble
    for DoReadChars, DoWriteChars.
    
    I readily see places where #chars are compared to #bytes. Gah.  And
    then there is the possibility of EOL translations changing sizes
    unpredictably.
    
    I believe, whatever we have written should have no bearing on the
    number of things 'toRead' left ... We are to copy N chars/bytes, and
    it does not matter how many chars/bytes get written to the destination
    for K chars/bytes of the N for the counting down of how much is left.
    
    ~~~~
    
    We should maybe try to
    
       typedef IntChars int;
       typedef IntBytes int;
    
    and see if the compiler warns if we assign variables of different Int*
    types to each other. If fear it will not warn.
    
    Or change the varnames to reflect exactly what type of things they
    count.
    
    Or maybe split CopyData into four routines, one for each cominbation
    of in/outBinary//sameEncoding. Possibly easier, factor the read and
    write sections of CopyData into separate functions, and then split
    each of these into two, based on the encoding/binary settings. Then we
    could write each function to count properly, without lots of
    conditionals inside to switch between the possible variants.
    
    This part of tclIO feels a bit like one of the stables of augias(sp?).
    
    
    
  2. login: "andreas_kupries"
  3. mimetype: "text/plain"
  4. username: "andreas_kupries"