Re: LW for Windows - very good news!

new topic     » goto parent     » topic index » view thread      » older message » newer message

Rob,

dos_rescue.ew is interesting, however, I think you have a memory leak in
the call to DrawText, where you call allocate_string() instead of using
the already allocated pointer stored in 's':
global procedure putsxy(sequence pos, sequence string,
			integer fcolor, integer bcolor)
    atom s
    
    poke4(charRect, pos[1])
    poke4(charRect+CHAR_TOP, pos[2])
    poke4(charRect+CHAR_RIGHT, pos[1]+length(string)*8)
    poke4(charRect+CHAR_BOTTOM, pos[2]+18)
    s = allocate_string(string)  -- could reserve large space instead
    c_proc(SetTextColor, {hdc, color_map[1+fcolor]})
    
    c_proc(SetBkColor, {hdc, color_map[1+bcolor]})
    
    c_proc(SetBkMode, {hdc, OPAQUE})
    
c_proc(DrawText, {hdc, allocate_string(string), -1, charRect,
    DT_SINGLE_LINE})
    free(s)
end procedure


new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu