[redland-dev] raptor_uri_resolve_uri_reference()

Dave Beckett dave at dajobe.org
Sat Jul 26 12:08:51 EDT 2014


On 7/26/14, 8:07 AM, Victor Porton wrote:
> I am writing Ada bindings for Raptor.
> 
> I've stumbled with the function raptor_uri_resolve_uri_reference().
> 
> raptor_uri_resolve_uri_reference() has "length" argument. How to calculate this length? It seems a wrong API.

>From the source:

 * @base_uri: Base URI string
 * @reference_uri: Reference URI string
 * @buffer: Destination buffer URI
 * @length: Length of destination buffer

So it reads @base_uri and @reference_uri and outputs ( writes) to @buffer
which must be pre-allocated to @length bytes.

... although it seems that function doesn't check it.  Oops.

To be safe, you can use a buffer of size
  strlen(base_uri) + strlen(reference_uri) + 1
which is what raptor_new_uri_relative_to_base_counted() uses

Dave



More information about the redland-dev mailing list