gint hex_document_find_backward(HexDocument *doc, guint pos, guchar *what, gint len, guint *found) { while (pos > 0) { --pos; if (hex_document_compare_data(doc, what, pos, len) == 0) { *found = pos; return TRUE; } } return FALSE; }
gint hex_document_find_forward(HexDocument *doc, guint start, guchar *what, gint len, guint *found) { guint pos; pos = start; while(pos < doc->file_size) { if(hex_document_compare_data(doc, what, pos, len) == 0) { *found = pos; return TRUE; } pos++; } return FALSE; }
gint hex_document_find_backward(HexDocument *doc, guint start, guchar *what, gint len, guint *found) { guint pos; pos = start; if(pos == 0) return FALSE; do { pos--; if(hex_document_compare_data(doc, what, pos, len) == 0) { *found = pos; return TRUE; } } while(pos > 0); return FALSE; }