Opened 16 years ago
Closed 16 years ago
#1353 closed Bug (Fixed)
_FileWriteToLine() excessively strict on input text type
| Reported by: | PsaltyDS | Owned by: | Jon |
|---|---|---|---|
| Milestone: | 3.3.3.3 | Component: | AutoIt |
| Version: | 3.3.2.0 | Severity: | None |
| Keywords: | Cc: |
Description
Reported by user anixon: http://www.autoitscript.com/forum/index.php?showtopic=107078
The input $sText parameter is currently tested with IsString() and fails with @error = 6 if False. That is way too strict for the AutoIt environment where you can generally pass integers, floats, HWNDs, etc. to FilelWriteLine() and other text based functions.
Recommend change the test to this:
Func _FileWriteToLine($sFile, $iLine, $sText, $fOverWrite = 0)
If $iLine <= 0 Then Return SetError(4, 0, 0)
If Not IsString($sText) Then
$sText = String($sText)
If $sText = "" Then Return SetError(6, 0, 0)
EndIf
; ...
EndFunc
Does conversion with String() but prevents a non-text value that returns "" from unexpectedly deleting the line if overwrite is True.
Attachments (0)
Change History (3)
comment:1 by , 16 years ago
comment:2 by , 16 years ago
There is no reason to force the data to be a string. If I want to write numbers to the file that's my business. There is no reason that behavior should not be supported.
comment:3 by , 16 years ago
| Milestone: | → 3.3.3.3 |
|---|---|
| Owner: | set to |
| Resolution: | → Fixed |
| Status: | new → closed |
Fixed by revision [5566] in version: 3.3.3.3

Perhaps I am wrong but as this UDF was design to receive String it is the use responsability to pass string.
So for me there is no bug.