view paraspace/tools.py @ 134:3dee4d929e1f

Wrap _DEX_TypeList to _DEX_TypeList_align before append to list. - Fix the issue described by map_verify_error_test(). - When inject a _DEX_ClassDef, dexfile_insert_classdefs_relative() should also inject related _DEX_TypeList. - But, dex_append_obj_list() does not known that _DEX_TypeList should be wrapped to to _DEX_TypeList_align and appended to DEXFile.typeLists. We add a special case in dex_append_obj_list() to wrap _DEX_TypeList before trying to insert to a list.
author Thinker K.F. Li <thinker@codemud.net>
date Tue, 09 Aug 2011 17:23:01 +0800
parents ff6f869273b7
children
line wrap: on
line source

base = 65521

adler32_init_value = 1

def adler32(adler, buf, offset, sz):
    sum1 = adler & 0xffff
    sum2 = (adler >> 16) & 0xffff
    for off in range(offset, offset + sz):
        sum1 = (sum1 + ord(buf[off])) % base
        sum2 = (sum2 + sum1) % base
        pass
    r = (sum2 << 16) | sum1
    return r