void undump_font(int f) { int x, i; texfont *tt; charinfo *ci; char *s; grow_font_table (f); font_tables[f] = NULL; font_bytes += sizeof(texfont); tt = xmalloc(sizeof(texfont)); undump_things(*tt,1); font_tables[f] = tt; undump_font_string(set_font_name); undump_font_string(set_font_area); undump_font_string(set_font_filename); undump_font_string(set_font_fullname); undump_font_string(set_font_encodingname); undump_font_string(set_font_cidregistry); undump_font_string(set_font_cidordering); i = sizeof(*param_base(f))*(font_params(f)+1); font_bytes += i; param_base(f) = xmalloc (i); undump_things(*param_base(f), (font_params(f)+1)); font_tables[f]->_left_boundary = NULL; undump_int(x); if (x) { i = undump_charinfo(f); } /* left boundary */ font_tables[f]->_right_boundary = NULL; undump_int(x); if (x) { i = undump_charinfo(f); } /* right boundary */ font_tables[f]->characters = new_sa_tree(1, 0); /* stack size 1, default item value 0 */ ci = xcalloc(1,sizeof(charinfo)); set_charinfo_name(ci,xstrdup(".notdef")); font_tables[f]->charinfo = ci; i = font_bc(f); while(i<font_ec(f)) { i = undump_charinfo(f); } }
void undump_luac_registers(void) { int x; int k, n; unsigned int i; bytecode b; undump_int(luabytecode_max); if (luabytecode_max >= 0) { i = (unsigned) (luabytecode_max + 1); if ((int) (UINT_MAX32 / (int) sizeof(bytecode) + 1) <= i) { lua_fatal_error("Corrupt format file"); } lua_bytecode_registers = xmalloc((unsigned) (i * sizeof(bytecode))); luabytecode_bytes = (unsigned) (i * sizeof(bytecode)); for (i = 0; i <= (unsigned) luabytecode_max; i++) { lua_bytecode_registers[i].done = 0; lua_bytecode_registers[i].size = 0; lua_bytecode_registers[i].buf = NULL; } undump_int(n); for (i = 0; i < (unsigned) n; i++) { undump_int(k); undump_int(x); b.size = x; b.buf = xmalloc((unsigned) b.size); luabytecode_bytes += (unsigned) b.size; memset(b.buf, 0, (size_t) b.size); do_zundump((char *) b.buf, 1, b.size, DUMP_FILE); lua_bytecode_registers[k].size = b.size; lua_bytecode_registers[k].alloc = b.size; lua_bytecode_registers[k].buf = b.buf; } } for (k = 0; k < 65536; k++) { undump_int(x); if (x > 0) { char *s = xmalloc((unsigned) x); undump_things(*s, x); luanames[k] = s; } } }
void undump_primitives(void) { int p,q; for(p= 0;p<=prim_size;p++) undump_hh(prim[p]); for(p= 0;p<=prim_size;p++) undump_wd(prim_eqtb[p]); for(p= 0;p<=last_cmd;p++){ undump_int(prim_data[p].offset); undump_int(prim_data[p].subids); if(prim_data[p].subids> 0){ prim_data[p].names= (str_number*) xmalloc((unsigned) ((unsigned)prim_data[p].subids* sizeof(str_number*))); for(q= 0;q<prim_data[p].subids;q++) undump_int(prim_data[p].names[q]); } } }
int undump_charinfo (int f) { charinfo *co; int x,i; char *s = NULL; liginfo *lig = NULL; kerninfo *kern = NULL; real_eight_bits *packet = NULL; int top = 0, bot = 0, mid = 0, rep = 0; undump_int(i); co = get_charinfo(f,i); undump_int(x); set_charinfo_width(co,x); undump_int(x); set_charinfo_height(co,x); undump_int(x); set_charinfo_depth(co,x); undump_int(x); set_charinfo_italic(co,x); undump_int(x); set_charinfo_tag(co,x); undump_int(x); set_charinfo_ef(co,x); undump_int(x); set_charinfo_rp(co,x); undump_int(x); set_charinfo_lp(co,x); undump_int(x); set_charinfo_remainder(co,x); undump_int(x); set_charinfo_used(co,x); undump_int(x); set_charinfo_index(co,x); /* name */ undump_int (x); if (x>0) { font_bytes += x; s = xmalloc(x); undump_things(*s,x); } set_charinfo_name(co,s); /* tounicode */ undump_int (x); if (x>0) { font_bytes += x; s = xmalloc(x); undump_things(*s,x); } set_charinfo_tounicode(co,s); /* ligatures */ undump_int (x); if (x>0) { font_bytes += x*sizeof(liginfo); lig = xmalloc(x*sizeof(liginfo)); undump_things(*lig,x); } set_charinfo_ligatures(co,lig); /* kerns */ undump_int (x); if (x>0) { font_bytes += x*sizeof(kerninfo); kern = xmalloc(x*sizeof(kerninfo)); undump_things(*kern,x); } set_charinfo_kerns(co,kern); /* packets */ undump_int (x); if (x>0) { font_bytes += x; packet = xmalloc(x); undump_things(*packet,x); } set_charinfo_packets(co,packet); if (get_charinfo_tag(co)==ext_tag) { undump_int(top); undump_int(bot); undump_int(mid); undump_int(rep); set_charinfo_extensible(co,top,bot,mid,rep); } return i; }