[PATCH] DLD upload

Miika Turkia miika.turkia at gmail.com
Wed Mar 13 21:50:51 PDT 2013


On Thu, Mar 14, 2013 at 5:41 AM, Dirk Hohndel <dirk at hohndel.org> wrote:
> "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.

Good, my one file test confirmed that the upload works. The freeing
memory too early did bite me also. However, I think I got usually
crashes related to that.

I have one question. How should we handle languages with e.g. Cyrillic
letters? They are not supported in divelogs.de and display as question
marks currently in there. The current encoding of the XMLs in .DLD is
iso-8859-1 but utf-8 is not any better. Of course if divelogs.de would
support utf-8 we would not have to worry about it...

miika


More information about the subsurface mailing list