Search buf[0..len-1] for the pattern: 0, 0, 0xff, 0xff. Return when found or when out of input. When called, *have is the number of pattern bytes found in order so far, in 0..3. On return *have is updated to the new state. If on return *have equals four, then the pattern was found and the return value is how many bytes were read including the last byte of the pattern. If *have
| 22850 | zero for the first call. |
| 22851 | */ |
| 22852 | local unsigned syncsearch (unsigned FAR *have, unsigned char FAR *buf, unsigned len) |
| 22853 | { |
| 22854 | unsigned got; |
| 22855 | unsigned next; |
| 22856 | |
| 22857 | got = *have; |
| 22858 | next = 0; |
| 22859 | while (next < len && got < 4) { |
| 22860 | if ((int)(buf[next]) == (got < 2 ? 0 : 0xff)) |
| 22861 | got++; |
| 22862 | else if (buf[next]) |
| 22863 | got = 0; |
| 22864 | else |
| 22865 | got = 4 - got; |
| 22866 | next++; |
| 22867 | } |
| 22868 | *have = got; |
| 22869 | return next; |
| 22870 | } |
| 22871 | |
| 22872 | int ZEXPORT inflateSync (z_streamp strm) |
| 22873 | { |
no outgoing calls
no test coverage detected