View Single Post
Old 07-01-2020, 12:59 AM   #7
geek1011
Wizard
geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.geek1011 ought to be getting tired of karma fortunes by now.
 
Posts: 2,802
Karma: 7025947
Join Date: May 2016
Location: Ontario, Canada
Device: Kobo Mini, Aura Edition 2 v1, Clara HD
I might also be able to increase the number of history bookmarks stored with a patch.

Update: This seems doable. I'll test this and make a patch later:

Spoiler:
Code:
                            _ZN20BookmarkHistoryMixin12pushBookmarkERK8Bookmark:        // BookmarkHistoryMixin::pushBookmark(Bookmark const&)
0087bdb8 B0B5                   push       {r4, r5, r7, lr}
0087bdba 051D                   adds       r5, r0, #0x4
0087bdbc 0446                   mov        r4, r0
0087bdbe 00AF                   add        r7, sp, #0x0
0087bdc0 2846                   mov        r0, r5
0087bdc2 7BF414E8               blx        _ZN7QVectorI8BookmarkE6appendERKS0_@PLT ; QVector<Bookmark>::append(Bookmark const&)
0087bdc6 6368                   ldr        r3, [r4, #0x4]
0087bdc8 5968                   ldr        r1, [r3, #0x4]
0087bdca 0229                   cmp        r1, #0x2
0087bdcc 00DC                   bgt        loc_87bdd0

                            loc_87bdce:
0087bdce B0BD                   pop        {r4, r5, r7, pc}                     ; CODE XREF=_ZN20BookmarkHistoryMixin12pushBookmarkERK8Bookmark+32, _ZN20BookmarkHistoryMixin12pushBookmarkERK8Bookmark+96
                        ; endp

                            loc_87bdd0:
0087bdd0 9A68                   ldr        r2, [r3, #0x8]                       ; CODE XREF=_ZN20BookmarkHistoryMixin12pushBookmarkERK8Bookmark+20
0087bdd2 22F00040               bic        r0, r2, #0x80000000
0087bdd6 0028                   cmp        r0, #0x0
0087bdd8 F9D0                   beq        loc_87bdce

0087bdda 1868                   ldr        r0, [r3]
0087bddc 0128                   cmp        r0, #0x1
0087bdde 06D9                   bls        loc_87bdee

0087bde0 0023                   movs       r3, #0x0
0087bde2 22F00042               bic        r2, r2, #0x80000000
0087bde6 2846                   mov        r0, r5
0087bde8 76F4B0EC               blx        _ZN7QVectorI8BookmarkE11reallocDataEii6QFlagsIN10QArrayData16AllocationOptionEE@PLT ; QVector<Bookmark>::reallocData(int, int, QFlags<QArrayData::AllocationOption>)
0087bdec 6368                   ldr        r3, [r4, #0x4]

                            loc_87bdee:
0087bdee DD68                   ldr        r5, [r3, #0xc]                       ; CODE XREF=_ZN20BookmarkHistoryMixin12pushBookmarkERK8Bookmark+38
0087bdf0 5A59                   ldr        r2, [r3, r5]
0087bdf2 1D44                   add        r5, r3
0087bdf4 2846                   mov        r0, r5
0087bdf6 1368                   ldr        r3, [r2]
0087bdf8 9847                   blx        r3
0087bdfa 6368                   ldr        r3, [r4, #0x4]
0087bdfc 05F17001               add.w      r1, r5, #0x70                        ; argument "__src" for method memmove@PLT
0087be00 2846                   mov        r0, r5                               ; argument "__dest" for method memmove@PLT
0087be02 5B68                   ldr        r3, [r3, #0x4]
0087be04 013B                   subs       r3, #0x1
0087be06 DA01                   lsls       r2, r3, #0x7
0087be08 A2EB0312               sub.w      r2, r2, r3, lsl #4                   ; argument "__n" for method memmove@PLT
0087be0c 71F4EAE8               blx        memmove@PLT                          ; memmove
0087be10 6268                   ldr        r2, [r4, #0x4]
0087be12 5368                   ldr        r3, [r2, #0x4]
0087be14 013B                   subs       r3, #0x1
0087be16 5360                   str        r3, [r2, #0x4]
0087be18 D9E7                   b          loc_87bdce
0087be1a 00BF                   nop
This is where the history limit seems to be done (none of it's callers do any size checks), and it looks like a simple QVector::append followed by an inlined and optimized if (QVector::size() > 2) QVector::removeFirst(), which is actually a QVector::erase(start, start+1) (see https://code.woboq.org/qt5/qtbase/sr...E8iteratorES3_).

Last edited by geek1011; 07-01-2020 at 01:13 AM.
geek1011 is offline   Reply With Quote