Bug 470455 - test_database_sync_embed_visits.js leaks, r=sdwilsh
[wine-gecko.git] / media / liboggz / seek.patch
blob997d412bd0f78e42021d9afd3fc3701f6ef136ea
1 diff --git a/mozilla/media/liboggz/src/liboggz/oggz_seek.c b/mozilla/media/liboggz/src/liboggz/oggz_seek.c
2 index f933d4d..23ffb57 100644
3 --- a/mozilla/media/liboggz/src/liboggz/oggz_seek.c
4 +++ b/mozilla/media/liboggz/src/liboggz/oggz_seek.c
5 @@ -486,16 +486,18 @@ oggz_scan_for_page (OGGZ * oggz, ogg_page * og, ogg_int64_t unit_target,
6 serialno = ogg_page_serialno (og);
7 granule_at = ogg_page_granulepos (og);
8 unit_at = oggz_get_unit (oggz, serialno, granule_at);
10 break;
11 #else
12 do {
13 offset_at = oggz_get_prev_start_page(oggz, og, &granule_at, &serialno);
14 + if (offset_at == -1)
15 + return -1;
16 unit_at = oggz_get_unit(oggz, serialno, granule_at);
17 } while (unit_at > unit_target);
18 return offset_at;
19 #endif
20 } else if (unit_at == unit_target) {
21 #ifdef DEBUG
22 printf (" scan: (%lld) == (%lld)\n", unit_at, unit_target);
23 #endif
24 @@ -552,16 +554,19 @@ oggz_seek_guess (ogg_int64_t unit_at, ogg_int64_t unit_target,
25 printf ("oggz_seek_guess: unit_end <= unit_begin (ERROR)\n");
26 #endif
27 offset_guess = -1;
28 } else {
29 offset_guess = guess (unit_at, unit_target, unit_begin, unit_end,
30 offset_begin, offset_end);
33 + if (offset_end != -1 && guess >= offset_end)
34 + offset_guess = offset_begin + (offset_end - offset_begin)/2;
36 #ifdef DEBUG
37 printf ("oggz_seek_guess: guessed %" PRI_OGGZ_OFF_T "d\n", offset_guess);
38 #endif
40 return offset_guess;
43 static oggz_off_t
44 @@ -759,16 +764,18 @@ oggz_seek_set (OGGZ * oggz, ogg_int64_t unit_target)
45 } else {
46 break;
50 found:
51 do {
52 offset_at = oggz_get_prev_start_page (oggz, og, &granule_at, &serialno);
53 + if (offset_at == -1)
54 + break;
55 unit_at = oggz_get_unit (oggz, serialno, granule_at);
56 } while (unit_at > unit_target);
58 if (offset_at < 0) {
59 oggz_reset (oggz, offset_orig, -1, SEEK_SET);
60 return -1;