Tiny Core Extensions > TCE News
FlaxPDF pdf reader
curaga:
The behavior changes are fine, but there's some issues:
- crash when pressing page up or K on the first page
- the coding style is bad in places
- I don't understand why you divide MARGIN by the entire height in page up, did you mean to have parenthesis around floorf(yoff) + MARGIN?
I've applied the End hunk slightly edited, thanks.
hiro:
I cannot reproduce the crash on page up, can you send me your test pdf? Does it happen right after starting the program without other preceding action?
I'll look into the other issues. I felt like there should be an easier way without converting from and to multiple relative and multiple scaled absolute units so many times, but all intuitive changes I made at first resulted in overshoot over margins or so ;)
curaga:
It happened on bitcoin.pdf: https://github.com/benjyz/bitcoinArchive/blob/master/bitcoin.pdf
First thing after startup, no other actions needed. Though it looks like a normal "0 - 1" bug, so it should happen in every pdf.
You may want to run under valgrind in case it doesn't crash for you - under dirty memory it may not segfault immediately.
And yeah, there should be helper functions for converting between the default page-relative coordinate system and screen/data pixels, just haven't had a sudden burst of motivation when it already works ;)
edit: valgrind output confirms it's a 0-1 bug:
--- Code: ---==16490== Invalid read of size 1
==16490== at 0x40A175: pdfview::handle(int) (view.cpp:54)
==16490== by 0x40DCA0: Fl::handle_(int, Fl_Window*) (in /tiedostot/mv/c/flaxpdf/src/flaxpdf)
==16490== by 0x421F80: fl_handle(_XEvent const&) (in /tiedostot/mv/c/flaxpdf/src/flaxpdf)
==16490== by 0x423CC6: do_queued_events() (in /tiedostot/mv/c/flaxpdf/src/flaxpdf)
==16490== by 0x4240D6: fl_wait(double) (in /tiedostot/mv/c/flaxpdf/src/flaxpdf)
==16490== by 0x40D421: Fl::wait(double) (in /tiedostot/mv/c/flaxpdf/src/flaxpdf)
==16490== by 0x40D610: Fl::run() (in /tiedostot/mv/c/flaxpdf/src/flaxpdf)
==16490== by 0x407C2C: main (in /tiedostot/mv/c/flaxpdf/src/flaxpdf)
==16490== Address 0x28091e7c38 is not stack'd, malloc'd or (recently) free'd
--- End code ---
hiro:
Hey, here's my 2nd version, with new trust in myself I was able to simplify and it still works.
I hope the sanitization prevents any crashes now.
edit: use scroll-impr3.patch
curaga:
Sorry, but that's still buggy. Asking for page 4294967295 doesn't produce a NULL pointer, it produces a very big pointer. The function shouldn't try to paper over invalid arguments in any case, the caller should not call it with wrong pages (which I see you added).
The new logic is good. I still have style quips, and as pgrel cannot return negative values, it should be an u32. Maybe call it screenpixels instead?
- a space on both sides of +, -, ==, !=, and other such math operators
- a space between if and (
- a space after a cast
- moving the zoomedh line is not needed
edit: Above was for scroll2.patch, but also applies to v3.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version