#3555 closed Bug (Works For Me)
_GUICtrlRichEdit_StreamToVar with > 2048 characters
Reported by: | anthonyjr2 | Owned by: | |
---|---|---|---|
Milestone: | Component: | Standard UDFs | |
Version: | 3.3.14.2 | Severity: | None |
Keywords: | Cc: |
Description (last modified by mLipok)
This bug was discussed and solved here: https://www.autoitscript.com/forum/topic/188643-is-_guictrlrichedit_streamtovar-limited-to-2048-chars/
The problem happens when trying to stream a RichEdit with length > 2048 to a variable with _GUICtrlRichEdit_StreamToVar. The stream to file works correctly in this matter. The problem lies within this code which is called by the function:
Func __GCR_StreamToVarCallback($iCookie, $pBuf, $iBuflen, $pQbytes) #forceref $iCookie Local $tQbytes = DllStructCreate("long", $pQbytes) DllStructSetData($tQbytes, 1, 0) Local $tBuf = DllStructCreate("char[" & $iBuflen & "]", $pBuf) Local $s = DllStructGetData($tBuf, 1) $__g_pGRC_sStreamVar &= $s Return 0 EndFunc ;==>__GCR_StreamToVarCallback
The buffer is not updated correctly at the end of the function. The solution is to add a line before the return statement and modify the earlier struct set:
Func __GCR_StreamToVarCallback($iCookie, $pBuf, $iBuflen, $pQbytes) #forceref $iCookie Local $tQbytes = DllStructCreate("long", $pQbytes) DllStructSetData($tQbytes, 1, $iBuflen) ;Modified this line Local $tBuf = DllStructCreate("char[" & $iBuflen & "]", $pBuf) Local $s = DllStructGetData($tBuf, 1) $__g_pGRC_sStreamVar &= $s DllStructSetData($tQbytes, 1, StringLen($s)) ;Added this line Return 0 EndFunc ;==>__GCR_StreamToVarCallback
This correctly updates the struct and solves the character limit.
Attachments (0)
Change History (6)
comment:1 Changed 7 years ago by anonymous
comment:2 Changed 7 years ago by mLipok
- Description modified (diff)
comment:3 Changed 7 years ago by Jpm
I don't undertstand how updating an in parameter can solve any issue.
If I run the Help example and I paste more the 2048 char it works fine.
So can I have a repro script?
Thanks
comment:4 Changed 7 years ago by Jpm
- Resolution set to Works For Me
- Status changed from new to closed
closed as no info supplied
comment:5 Changed 6 years ago by anthonyjr2
Haven't checked autoIt in a while, but did you look at the issues and tests in the thread posted? It's been a long time so I can't exactly recall what caused the issue but it seemed to be related to the stream buffer. The fix I posted is just what we ended up with after some debugging.
comment:6 Changed 6 years ago by anthonyjr2
Can confirm this is fixed in AutoIt 3.3.15.1
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
I didn't realize the editor messed up my code a bit. This should be better.