1 /* 2 Ming, an SWF output library 3 Copyright (C) 2001 Opaque Industries - http://www.opaque.net/ 4 5 3.3.2007 Klaus Rechert 6 7 This library is free software; you can redistribute it and/or 8 modify it under the terms of the GNU Lesser General Public 9 License as published by the Free Software Foundation; either 10 version 2.1 of the License, or (at your option) any later version. 11 12 This library is distributed in the hope that it will be useful, 13 but WITHOUT ANY WARRANTY; without even the implied warranty of 14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 15 Lesser General Public License for more details. 16 17 You should have received a copy of the GNU Lesser General Public 18 License along with this library; if not, write to the Free Software 19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 20 */ 21 #include <stdlib.h> 22 #include "ming.h" 23 #include "block.h" 24 #include "output.h" 25 #include "method.h" 26 #include "scriptlimits.h" 27 28 static void 29 writeSWFScriptLimitsToMethod(SWFBlock block, SWFByteOutputMethod method, void* data) 30 { 31 SWFScriptLimits sl = (SWFScriptLimits)block; 32 33 methodWriteUInt16(sl->maxRecursion, method, data); 34 methodWriteUInt16(sl->timeout, method, data); 35 } 36 37 static int 38 completeSWFScriptLimits(SWFBlock block) 39 { 40 return 4; 41 } 42 43 void 44 destroySWFScriptLimits(SWFScriptLimits sl) 45 { 46 free(sl); 47 } 48 49 void 50 SWFScriptLimits_maxRecursion(SWFScriptLimits sl, int count) 51 { 52 sl->maxRecursion = count; 53 } 54 55 void 56 SWFScriptLimits_setTimeout(SWFScriptLimits sl, int timeout) 57 { 58 sl->timeout = timeout; 59 } 60 61 SWFScriptLimits 62 newSWFScriptLimits() 63 { 64 SWFScriptLimits sl = (SWFScriptLimits)malloc(sizeof(struct SWFScriptLimits_s)); 65 66 SWFBlockInit(BLOCK(sl)); 67 BLOCK(sl)->type = SWF_SCRIPTLIMITS; 68 BLOCK(sl)->writeBlock = writeSWFScriptLimitsToMethod; 69 BLOCK(sl)->complete = completeSWFScriptLimits; 70 BLOCK(sl)->dtor = (destroySWFBlockMethod) destroySWFScriptLimits; 71 72 sl->maxRecursion = 265; 73 sl->timeout = 15; 74 return sl; 75 } 76 77