Opened 10 years ago

Closed 2 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 8 years ago.
Patch to StyledEdit
styled_patch2.patch (7.8 KB) - added by hayarms 8 years ago.

Download all attachments as: .zip

Change History (20)

comment:1 Changed 10 years ago by diver

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

comment:2 Changed 10 years ago by korli

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 Changed 10 years ago by korli

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

comment:4 Changed 9 years ago by iddqd

could you please attach the file for test cases?

comment:5 Changed 9 years ago by iddqd

Cc: barzakouski@… added

comment:6 Changed 9 years ago by diver

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..

Changed 9 years ago by diver

Attachment: f1.txt added

comment:7 Changed 9 years ago by diver

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

comment:8 Changed 8 years ago by hayarms

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

Changed 8 years ago by hayarms

Attachment: styled_edit.patch added

Patch to StyledEdit

comment:9 Changed 8 years ago by humdinger

Has a Patch: set

comment:10 Changed 8 years ago by humdinger

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 Changed 8 years ago by hayarms

Thank you :)

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

Changed 8 years ago by hayarms

Attachment: styled_patch2.patch added

comment:12 Changed 8 years ago by hayarms

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 8 years ago by hayarms (previous) (diff)

comment:13 Changed 7 years ago by yourpalal

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 Changed 6 years ago by siarzhuk

Blocked By: 6447 added

Potential duplicate of #6447

comment:15 Changed 6 years ago by siarzhuk

Blocked By: 9395 added

comment:16 Changed 2 years ago by pulkomandy

Blocked By: 6447 removed

Fixed in hrev50552.

comment:17 Changed 2 years ago by pulkomandy

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