[PATCH] DLD upload

Dirk Hohndel dirk at hohndel.org
Wed Mar 13 20:41:26 PDT 2013


"Lubomir I. Ivanov" <neolit123 at gmail.com> writes:

> On 13 March 2013 23:24, Dirk Hohndel <dirk at hohndel.org> wrote:
>> Dirk Hohndel <dirk at hohndel.org> writes:
>>
>>> "Lubomir I. Ivanov" <neolit123 at gmail.com> writes:
>>>
>>>> On 13 March 2013 16:51, Lubomir I. Ivanov <neolit123 at gmail.com> wrote:
>>>>>
>>>>> on the other hand, the libsoup re-write should be quite trivial, also
>>>>> if i'm no mistaken we get easy SSL support, but that has to be
>>>>> confirmed.
>>>>>
>>>>
>>>> here is a (untested) libsoup variant for reference. as you can see
>>>> it's more code even without the error checks, which seems typical for
>>>> the gnome folks, even if the library capabilities are overall smaller
>>>> in comparison to libcurl (as they say). but i really think we should
>>>> move both the zip packaging code and the upload code to a new pair
>>>> e.g. upload.c/upload.h. we then can use the same file to write a
>>>> dialog and the same dialog to upload to different website platforms.
>>>> but please, don't put this in divelist.c :-).
>>>
>>> Sadly you and I have written almost the same code at the same time - I
>>> have a working libsoup implementation right now - sadly the DLD file
>>> that we create is actually broken so the upload then fails. I'm
>>> debugging that part right now...
>>
>> The zip file is corrupted and I can't figure out why - the code reads
>> correct to me, but the first few bytes of each of the XML files inside
>> the ZIP are corrupted. Even after repairing this and uploading a
>> sane-looking "DLD" file to the website (using libsoup) the file still
>> isn't parsed correctly.
>>
>
> i can confirm the corrupted bytes at the beginning. but it works if i
> remove the two lines a the bottom of export_selected_dives_cb():
>
> if (membuf)
> 	free((void *)membuf);
>
> no idea why that happens. shouldn't we own the rights to the membuf
> pointer even after the zip_add(), zip_source_buffer() calls, given the
> memory there is allocated by us? huh...what's going on here.

zip_source_buffer apparently assumes that the memory stays around until
the file is closed - that's why it offers to free the memory for you.

Thank you for tracking this one down.

I have just committed a very simplistic patch that uses testing user /
password that Robert created. This obviously needs a UI. It needs more
testing and a bit more error handling, it also needs the ability to
download. But it's a first step and a proof of concept.

Not sure if I'll have time tonight to continue working on this - which
is why I pushed it out now.

/D


More information about the subsurface mailing list