MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / find_marker

Function find_marker

src/phar.rs:149–161  ·  view source on GitHub ↗

Find the byte offset where `__HALT_COMPILER(); ?>` begins.

(data: &[u8])

Source from the content-addressed store, hash-verified

147
148/// Find the byte offset where `__HALT_COMPILER(); ?>` begins.
149fn find_marker(data: &[u8]) -> Option<usize> {
150 let marker = HALT_COMPILER_MARKER;
151 let len = marker.len();
152 if data.len() < len {
153 return None;
154 }
155 for i in 0..=data.len() - len {
156 if &data[i..i + len] == marker {
157 return Some(i);
158 }
159 }
160 None
161}
162
163/// Read a little-endian `u32` from `data` at `*cursor`, advancing the cursor.
164fn read_u32(data: &[u8], cursor: &mut usize) -> Option<u32> {

Callers 1

parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected