?? imports.c
字號:
/* $Id: imports.c,v 1.2 2003/11/08 18:24:57 whamann Exp $ */#include <stdlib.h>#include <string.h>#include "imports.h"#include "method.h"intwriteSWFImportBlockToMethod(SWFBlock block, SWFByteOutputMethod method, void *data){ SWFImportBlock imports = (SWFImportBlock) block; struct importitem *ip; int length, count; char *p; length = 3 + strlen(imports->filename); for(ip = imports->importlist, count = 0 ; ip ; ip = ip->next) { length += 3 + strlen(ip->name); count++; } for(p = imports->filename ; *p ; ) method(*p++, data); method(0, data); methodWriteUInt16(count, method, data); for(ip = imports->importlist ; ip ; ip = ip->next) { methodWriteUInt16(ip->id, method, data); for(p = ip->name ; *p ; ) method(*p++, data); method(0, data); } return length;}intcompleteSWFImportBlock(SWFBlock block){ SWFImportBlock imports = (SWFImportBlock) block; struct importitem *ip; int length = 3 + strlen(imports->filename); for(ip = imports->importlist ; ip ; ip = ip->next) length += 3 + strlen(ip->name); return length;}voiddestroySWFImportBlock(SWFImportBlock importBlock){ struct importitem *ip, *nip; if(importBlock->filename) free(importBlock->filename); for(ip = importBlock->importlist ; ip ; ip = nip) { nip = ip->next; if(ip->name) free(ip->name); free(ip); } free(importBlock);}static char *cpy(const char *text){ char *res, *p; p = res = (char *)malloc(strlen(text)+1); while((*p++ = *text++)) ; return res;}SWFImportBlocknewSWFImportBlock(const char *filename){ SWFImportBlock iblock = (SWFImportBlock) malloc(sizeof(struct SWFImportBlock_s)); BLOCK(iblock)->type = SWF_IMPORTASSETS; BLOCK(iblock)->writeBlock = (writeSWFBlockMethod) writeSWFImportBlockToMethod; BLOCK(iblock)->complete = completeSWFImportBlock; BLOCK(iblock)->dtor = (destroySWFBlockMethod) destroySWFImportBlock; BLOCK(iblock)->isDefined = 0; BLOCK(iblock)->completed = 0; iblock->filename = cpy(filename); iblock->importlist = NULL; return iblock;}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -