Tuesday, 22 October 2024

[netsurf-dev] Re: Pull request: CSS support for libsvgtiny

On Mon, 2024-10-21 at 20:36 +0100, Michael Drake wrote:
>
> This fixes it for DOM_NO_MEM_ERR, but in general I think the
> best approach is if a function returns an error code, we should
> handle any non-successful value.

No problem, I changed it.


> However I'm a bit uncomfortable about leaving the selection
> context with dangling sheet pointers, even if we are about to
> destroy it.... Also the error handling is not correct...
>
> I'd rather do something like this (untested):

Agreed, done.

One small concern: since we are looking for indices and sheets that the
API has just told us exist... if get_sheet() or remove_sheet() fail, an
svgtiny_LIBCSS_ERROR doesn't really do it justice. Maybe an assert()
for these as well?


> For this commit:
>
> https://gitweb.michael.orlitzky.com/?p=libsvgtiny.git;a=commit;h=29e40ed74de9f729755aa45459ff4f770b5be9ca
>
> I don't think that's the right fix. The real issue is that
> `_node_has_attribute_substring` has an early `return CSS_OK`
> (substrlen == 0) which doesn't assign a result to `*match`.
>

You're right, the other early return from that function is already
caught. Fixed!

No comments:

Post a Comment