Index: ext/fileinfo/libmagic/apprentice.c =================================================================== RCS file: /repository/php-src/ext/fileinfo/libmagic/apprentice.c,v retrieving revision 1.7 diff -u -p -r1.7 apprentice.c --- ext/fileinfo/libmagic/apprentice.c 25 Jul 2008 08:18:34 -0000 1.7 +++ ext/fileinfo/libmagic/apprentice.c 11 Aug 2008 10:20:58 -0000 @@ -2153,16 +2153,32 @@ swap8(uint64_t sv) private void bs1(struct magic *m) { - m->cont_level = swap2(m->cont_level); - m->offset = swap4((uint32_t)m->offset); - m->in_offset = swap4((uint32_t)m->in_offset); - m->lineno = swap4((uint32_t)m->lineno); + uint16_t cont_level; + uint32_t offset, in_offset, lineno, tmp_str_range, tmp_str_flags; + uint64_t q, tmp_num_mask; + + cont_level = swap2(m->cont_level); + m->cont_level = cont_level; + + offset = swap4((uint32_t)m->offset); + m->offset = offset; + + in_offset = swap4((uint32_t)m->in_offset); + m->in_offset = in_offset; + + lineno = swap4((uint32_t)m->lineno); + m->lineno = lineno; + if (IS_STRING(m->type)) { - m->str_range = swap4(m->str_range); - m->str_flags = swap4(m->str_flags); + tmp_str_range = swap4(m->str_range); + m->str_range = tmp_str_range; + tmp_str_flags = swap4(m->str_flags); + m->str_flags = tmp_str_flags; } else { - m->value.q = swap8(m->value.q); - m->num_mask = swap8(m->num_mask); + q = swap8(m->value.q); + m->value.q = q; + tmp_num_mask = swap8(m->num_mask); + m->num_mask = tmp_num_mask; } }