Opened 11 years ago

Closed 3 years ago

#3065 closed bug (fixed)

[StyledEdit] Bad argument type passed to function

Reported by: diver Owned by: korli
Priority: normal Milestone: R1
Component: Applications/StyledEdit Version: R1/pre-alpha1
Keywords: Cc: barzakouski@…
Blocked By: #9395 Blocking:
Has a Patch: yes Platform: All

Description

StyledEdit can't open isolinix/f1.txt from mounted Ubuntu 8.10 cd.
Error is:

Error loading "f1.txt":
Bad argument type passed to function

cat /Ubuntu\ 8.10\ 386/isolinix/f1.txt
shows file content, but doesn't exit itself, I have to hit return to go back to bash.

Attachments (3)

f1.txt (869 bytes ) - added by diver 9 years ago.
styled_edit.patch (4.5 KB ) - added by hayarms 9 years ago.
Patch to StyledEdit
styled_patch2.patch (7.8 KB ) - added by hayarms 9 years ago.

Download all attachments as: .zip

Change History (20)

comment:1 by diver, 11 years ago

Summary: [StyledEdit] Bad argument type passed to function[StyledEdit] Bad argument type passed to function (easy)

comment:2 by korli, 11 years ago

The file contains non ASCII characters. What should we do with it ? Should we accept text files containing like 90% of ASCII characters ?

About the cat which doesn't exit, it does. The file simply doesn't contain a new line at the end of the file.

comment:3 by korli, 11 years ago

In fact, using "file f1.text" on Linux doesn't recognize the file as ASCII text but only data.

comment:4 by iddqd, 9 years ago

could you please attach the file for test cases?

comment:5 by iddqd, 9 years ago

Cc: barzakouski@… added

comment:6 by diver, 9 years ago

Current (as of hrev38300) error is "Error loading f1.txt Unsupported format" which is more correct. I've just tried several linux editors (Kate, Kedit, Kwrite, Gedit) and all of them open this file ok, replacing non ASCII characters with different symbols..

by diver, 9 years ago

Attachment: f1.txt added

comment:7 by diver, 9 years ago

BTW, after displaying "Error loading f1.txt" StyledEdit opens with empty untitled window.

comment:8 by hayarms, 9 years ago

Hi, I tried to look into this problem a bit and it seems that the StyledText translator doesn't recognize this file as an ascii file because it contains special characters like 0x19, 0x14, 0x15 and 0x17.

This file, as already stated, is not recognized by the linux "file" utility as an ascii text file, but as data, so the translator is right in not considering it an ascii file it seems.

It's also true that most of text editors around show the content of the files even if it isn't a perfectly pure ascii file, and probably StyledEdit should do that too (maybe showing a warning message).

I've made a patch to StyledEdit that should make clear the idea I'm talking about (it's my first haiku patch, so please be kind to me :p )

Marcello

by hayarms, 9 years ago

Attachment: styled_edit.patch added

Patch to StyledEdit

comment:9 by humdinger, 9 years ago

Has a Patch: set

comment:10 by humdinger, 9 years ago

I leave the competent review to our experienced devs, just this much: you forgot to include the declaration of bool fDiscardFakeChanged; in StyledEditWindow.h in your patch. Also always generate a patch from trunk/ . Lastly, respect the 80 char width rule.
Apart from that, I can confirm that with your patch the example file does indeed open in StyledEdit. I have set the "patch" flag with this ticket, in the hopes that when you've uploaded an updated patch someone has a look and applies it.
Thanks very much, Marcello!

comment:11 by hayarms, 9 years ago

Thank you :)

Tomorrow I will post a patch that will follow your suggestions.

by hayarms, 9 years ago

Attachment: styled_patch2.patch added

comment:12 by hayarms, 9 years ago

I attached the corrected patch (I hope everything is ok now), but I made a mess with the attachment system. I wanted to attach the uncompressed patch, but ended up attaching the wrong version, and while trying to see if there was a way to remove it I accidentally uploaded it a second time :p

The StyledEditWindow.cpp file had a lot of problems with the style checker (most of them unrelated to my modifications), so I tried to correct as much of them as I could ignoring some of them inside comments.

Last edited 9 years ago by hayarms (previous) (diff)

comment:13 by yourpalal, 8 years ago

Summary: [StyledEdit] Bad argument type passed to function (easy)[StyledEdit] Bad argument type passed to function

Removing the '(easy)' from the title of this ticket, since this causes it to be shown in the list of tickets for people who want to start working on Haiku, and it's now just waiting for review, really.

comment:14 by siarzhuk, 7 years ago

Blocked By: 6447 added

Potential duplicate of #6447

comment:15 by siarzhuk, 7 years ago

Blocked By: 9395 added

comment:16 by pulkomandy, 3 years ago

Blocked By: 6447 removed

Fixed in hrev50552.

comment:17 by pulkomandy, 3 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.