lib: reworked the bookmark parser
commit6023dfd5b5a73f50ca3d1936ff19bf5b56206487
authorChris Frey <cdfrey@foursquare.net>
Tue, 7 Dec 2010 08:31:44 +0000 (7 03:31 -0500)
committerChris Frey <cdfrey@foursquare.net>
Tue, 7 Dec 2010 08:31:44 +0000 (7 03:31 -0500)
tree67a2e9b2088f47d90bc093a10bfb82ace3c6bcf1
parentb824f4365da7b2a25ea25a6df785456634f62d6f
lib: reworked the bookmark parser

Some of the buffer limit checking seemed to be missing, so this
reworks the code so it does the following more consistently:

- advance begin pointer
- check limit
- abort if over
- use data

Also, in analyzing the records on my 9550, 8700, and 7750, I noticed
a new Index field, and some potential IDs that I haven't linked to
anything else yet.

Section 0x11 looks like this:
Section 0x11:
Starts with 0x85 or 0x87
- 4 byte record ID?
- 1 byte record index (00, 01, 02, 03, 04)
Code: 0x04
- 1 byte "present" flag... always 1 for 0x04, I think
- 2 byte big endian size
- string, no null terminator
Code? 0x81 always seems to follow
Consistent default folder IDs:
- 81 b9 fc f8 f6 c2 e3 a4 d5 08 01 05 00 (no icon)
- 81 b9 fc f8 f6 c2 e3 a4 d5 08 01 05 00 (no icon)
- 81 b9 fc f8 f6 c2 e3 a4 d5 08 00 05 01 (icon url)
- 81 b9 fc f8 f6 c2 e3 a4 d5 08 00 05 00 (no icon)
- 81 b9 fc f8 f6 c2 e3 a4 d5 08 00 05 00 (no icon)
- 81 b9 fc f8 f6 c2 e3 a4 d5 08 00 05 00 (no icon)
- 81 b9 fc f8 f6 c2 e3 a4 d5 08 00 05 01 (icon url)
- so:
- 4 byte ID
- another 4 byte ID
- 1 byte unknown
- 1 byte flag (seen 1 or 0)
Code: 0x05   (on older devices, this is code 01 as a terminator?)
- 1 byte "present" flag
- if 0, then size could be 0x00a5 which adds
  5 unknown bytes
- if 1, then size is length of string
- 2 byte big endian size
- string here (may be no bytes)
- 3 byte flags for display mode, javascript mode, and browser id
  at the end of the section

Needs testing with more device data.
src/protostructs.h
src/r_bookmark.cc
src/r_bookmark.h
src/s11n-boost.h