[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-core-devel
Subject:    Re: KDE 1.x: khtmlw, KURL & QString question
From:       Lars Knoll <Lars.Knoll () mpi-hd ! mpg ! de>
Date:       1999-08-19 14:21:04
[Download RAW message or body]

Hi Harri,

I remember the discussion we had about this. 

On Thu, 19 Aug 1999, Harri Porten wrote:
> I am in contact with the guy who packaged the KDE 1.1.1 HP-UX binaries.
> He (and another HP user) have problems with libkhtmlw. Here's a short
> description:
> 
> > As you described in the README.TXT file the kdehelp does not
> > follow links.
> > Did you try the file manager kfm? For me this did not work
> > either. Going with the mouse pointer onto any file in the kfm
> > view just displayed garbage in the kfm status bar. Clicking
> > on a file produced the error message 'Can't open file: (garbage)'
> 
> They tracked this down to the following code in khtmlw/html.cpp:
[...]
> One of them discovered that inserting a printf(""); after p+= 5 fixes
> the problem. This *might* only be a bug in their compiler, BUT I just
> want to make sure the code is really correct. I haven't been working
> with QStrings from 1.x for a long time now so I already forgot the
> details about their data sharing mechanisms.
>
> Is "tmpurl = u.url()" okay ? Will the sharing mechanism cope with the
> fact that KURL u is a temporary variable ?

I still think, the code is correct. 

> Unfortunately they didn't test my proposal to add detach() or copy()
> calls but the following patch solved their problem:
> 
> --- html.cpp.bak        Mon Aug 16 14:42:22 1999
> +++ html.cpp    Mon Aug 16 14:43:28 1999
> @@ -2614,18 +2614,18 @@
>             if ( strncasecmp( p, "href=", 5 ) == 0 )
>             {
>                 p += 5;
> +               KURL u;
>                 if ( *p == '#' )
>                 {// reference
> -                   KURL u( actualURL );
> +                   u = KURL( actualURL );
>                     u.setReference( p + 1 );
> -                   tmpurl = u.url();
>                 }
>                 else
>                 {
> -                    KURL u( baseURL, p );
> -                   tmpurl = u.url();
> +                    u = KURL( baseURL, p );
>                 }               
>  
> +               tmpurl = u.url();
>                 visited = URLVisited( tmpurl );
>             }
>             else if ( strncasecmp( p, "name=", 5 ) == 0 )
> 
> I hardly can imagine the code the be buggy as it exists in a similar
> form several times. What do you think ?

Funny, that aswell the printf("") as this change solves their problem. To
me this really sounds like a compiler bug. But anyway, I think the problem
should be fixed, and I see 2 possibilities for it:

1. You insert the printf("") inside an #ifdef HPUX

2. the patch above. 

I would vote for the patch, as I can't see how it could possibly break
anything.

Cheers,
Lars

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic