| <<<Back 1 day (to 2015/07/26) | 20150727 |
Robin | sebras: I think that's out of spec, but if pushed, I suspect that [ should clear the stack. | 03:46.54 |
| so 22222222 would be ignored. | 03:47.07 |
sebras | Robin: yeah, me too. | 07:25.52 |
| Robin: but wait! you are on vacation, are you not?! | 07:26.13 |
tor8 | morning. | 08:51.47 |
sebras | tor8: god morron. | 09:05.36 |
| tor8: there are a few patches over at sebras/master for you to look at if you want a slow start. :) | 09:06.23 |
chrisl | Howdie tor8 - happy to be back?? ;-) | 09:27.49 |
sebras | chrisl: I think he might have returned to bed again... :) | 09:28.36 |
chrisl | I wouldn't blame him at all! | 09:28.51 |
Dirrk | Hi. I've some questions about using mupdf for a simple program of my own. Basically, I'm confused about the reference counting, I don't know when to use drop/keep. | 09:28.58 |
| Also, I keep getting "warning: object out of range (0 0 R)" warnings. (Maybe these two things are related) | 09:29.59 |
| Any hints how to go about this/debug this? | 09:30.32 |
sebras | Dirrk: the reference counting works just like normal reference counting, i.e. if you need to keep a pointer to an object for some time, you need to do fz_keep_*() so the object is not freed by someone else. | 09:32.19 |
| Dirrk: and when you no longer need to object around, you do fz_drop_*(). | 09:32.50 |
Dirrk | So what do I do when I insert an object into a pdf document structure? | 09:33.57 |
| Does the pdf document now do the reference counting? | 09:34.12 |
sebras | Dirrk: in PDF objects are referred to with references like 13 0 R, where 13 is the object number and 0 is a generation number (almost always 0). | 09:34.14 |
Dirrk | sorry if I was unclear. This is about pdf_drop_obj/fz_drop_buffer etc. | 09:35.02 |
| the library source code often uses drop | 09:35.27 |
| sometimes it doesn't | 09:35.31 |
| so I'm confused | 09:35.34 |
sebras | if you create an object using say pdf_new_int() and add it to an object that belongs to an existing document using e.g. pdf_dict_put() then the dictionary itself will call pdf_keep_obj() to make sure it owns a reference to the object you added. | 09:36.33 |
Dirrk | so basically, it's save to always call drop when *I* don't want to use it anymore? | 09:37.11 |
| and I let the library do it's own thing? | 09:37.25 |
sebras | that means that after the call to pdf_dict_put() you need to call drop to get rid of the reference you created using pdf_new_int(). | 09:37.29 |
Dirrk | *it's safe | 09:37.31 |
sebras | Dirrk: I think so, yes. | 09:38.06 |
| Dirrk: I assume someone else here will complain loudly if I'm way wrong. :) | 09:38.29 |
Dirrk | Okay, I try this then. So where does the "object out of range" error come from? | 09:38.36 |
| it seems I have created some bogus object | 09:38.54 |
| or something | 09:38.57 |
sebras | I explained a bit about the object references before. now those object numbers start at 1 so if you see an object reference like 0 0 R then something is probably wrong. | 09:39.39 |
Dirrk | yeah, I figured that much :-) | 09:39.54 |
| it happens during pdf_write_document, if that helps | 09:40.03 |
| and I don't see this in the pdf, this is a warning | 09:40.19 |
sebras | Dirrk: when I debug these things in gdb I usually do "call pdf_print_obj(ctx, obj)" to print my object and have a look at it. | 09:40.34 |
Dirrk | I don't know which object it is, because it happends during writing | 09:40.58 |
sebras | Dirrk: maybe you could do this to the object before/after you are altering it..? | 09:41.02 |
Dirrk | if I knew which object it was ... | 09:41.13 |
sebras | Dirrk: but you know you are inserting some extra object into another object at some point..? | 09:41.49 |
Dirrk | yes, I'm inserting objects | 09:42.02 |
| maybe let me just print all. brb | 09:42.13 |
sebras | Dirrk: just to convince yourself that the objects are altered in the way you want them to be. | 09:42.34 |
Dirrk | hm, where is pdf_print_* declared? Can't find it. | 09:43.57 |
sebras | Dirrk: oh.. pdf_print_obj() is only compiled into the library if you compile it in debug mode. | 09:44.47 |
tor8 | Dirrk: short summary: if you create it (a function with new, load, open in the name) then you are responsible for dropping it at the end | 09:44.55 |
sebras | Dirrk: pdf_output_obj(ctx, stdout, obj, 0) would do the same thing though. | 09:45.11 |
tor8 | pdf_dict_put_drop will drop for you, for simple uses like pdf_dict_put_drop(ctx, dict, "hello", pdf_new_name(ctx, "world")); | 09:45.57 |
| chrisl: I think I might have forgotten how to type... :) | 09:46.40 |
chrisl | tor8: I can manage that over night! | 09:47.02 |
tor8 | chrisl: then imagine 8 weeks of no programming! what are all these *.c files for? | 09:47.33 |
Dirrk | segmentation fault. is "stdout" correct? | 09:48.14 |
tor8 | Dirrk: no, you should have gotten a compile warning about that. pdf_fprint_obj(ctx, stdout, obj, 0) | 09:49.21 |
| pdf_output_ is for use with fz_output objects | 09:49.35 |
sebras | discovers his typo and shuts up. | 09:50.05 |
chrisl | tor8: presumably that means a major mupdf revamp base on your new, fresh perspective?? ;-) | 09:52.51 |
Dirrk | how do I get it to follow a reference and print that, instead of "2 0 R" etc.? | 09:55.22 |
| ah, pdf_resolve_indirect | 09:58.21 |
tor8 | chrisl: first I need to see what shenanigans Robin's been up to ;) | 09:59.19 |
henrys | tor8: welcome back! You were missed. | 12:45.31 |
tor8 | henrys: thanks. | 12:53.22 |
sebras | tor8: rearranged the path drawing code a bit to make for a minimalistic bugfix. | 13:21.03 |
| tor8: fix the ternary-operator and fz_clampi() comments as well. | 13:21.48 |
| tor8: sebras/master has the updates. | 13:21.57 |
henrys | chrisl: went to see samantha fish this weekend, wow I was impressed. I thought you would have liked her. Some of her stuff on youtube has poor audio but she was great when I saw her. | 13:36.27 |
chrisl | henrys: cool - I'll check her out.... in the nicest possible way, of course. | 13:37.15 |
| training beckons - back in a couple of hours...... | 13:41.37 |
jogux | welcome back tor8 :) | 13:47.01 |
tor8 | sebras: all LGTM | 15:05.08 |
sebras | tor8: gr8 | 15:08.43 |
chrisl | I swear, gmail is going to give me a nervous breakdown :-( | 16:28.08 |
Robin | slept through tor8's first day :) | 16:47.38 |
mvrhel_laptop | It takes sometime to get to the Bahamas from here. Trying to figure out what best to do flight wise. Everything is a red-eye flight on the way there from here | 18:00.42 |
jogux | mvrhel_laptop: I bet it's longer for me/Pete ;-) | 18:06.36 |
mvrhel_laptop | I dont know | 18:06.45 |
| but likely yes | 18:07.02 |
| the shortest time wise I can fine is 8:30. But the one that I may end up getting is 11+ hours | 18:08.01 |
| just due to the fact that the longer one allows me to use miles for the kids | 18:08.24 |
| everything obviously has a layover | 18:08.37 |
jogux | I've not looked yet but I'm betting it's going to be 3 different airplanes each way for us | 18:08.46 |
mvrhel_laptop | right | 18:09.28 |
henrys | mvrhel_laptop, jogux I'd think just miami then bahamas right? | 19:22.16 |
jogux | henrys: I'm not confient of finding a Glasgow -> Miami flight ;-) | 19:22.34 |
mvrhel_laptop | henrys: delta goes atlanta and then bahamas | 19:23.37 |
| that is going to be a better fit for me I think | 19:23.50 |
henrys | jogux: new york? | 19:24.39 |
jogux | crikey, yep, there's allegedly one direct flight from Glasgow to New York each day. | 19:26.00 |
| there is a one stopover option to Freeport from Glasgow but it only flys on Saturdays during the summer. | 19:28.36 |
mvrhel_laptop | you would think the winter would be a bigger market for that sort of thing | 19:29.47 |
logikos | i have a scanner which scans documents to .pdf then a script (pypdfocr) that ocr's the documents creating a text layer, then users may wish to rotate some pages which on the backend uses pdftk, but after the rotation the document needs re-ocr'd .. is there a clean easy way to have ghostscript remove the previously applied text layer from the first ocr so that it can be re-ocr'd ? | 19:41.16 |
| or do you know of a better tool to accomplish this seemingly simple task? | 19:42.07 |
| Forward 1 day (to 2015/07/28)>>> | |