info-mac@uw-beaver (08/31/85)
From: shebanow%ucbernie@Berkeley (Mike Shebanow) I discovered an interesting bug in MDS Edit, while developing a midsized application. I noticed that my source files seemed awfully large considering the size of the documents they contained. After some examination, I found that MDS Edit (Version 1.0, as distributed with MDS), has a bug which causes it to write duplicate resources (of types EFNT and ETAB) EACH time a 'Save' operation is done. Although the resources themselves are small, the cumulative affect is quite large. My source files, which previously amassed an amazing 200K, are now only 70K long! Since I have a floppy system, that 130K makes a big difference. What's strange is that all of these resources have the same ID. I didn't even know you could do that. Anyway, I fixed my files by copying each file's contents to a New file, saving with the same name using 'Save As', which was a real pain in the neck. So I wrote a small program to purge all duplicate resources from a file. Here is the source and a '.hqx' version of the application, called 'munge'. Have fun... Andrew Shebanow shebanow@ucbernie ----------------------- CUT HERE --------------------------------- (This file must be converted with BinHex 4.0) :"@eeEQGP!%&38%a098j(!*!)+J#mrJ#3"!%!N!-S!*!$*`#3"%S!N2-B!*!$+!! !!Ni!N!-)!*!$)!0L2c`!!DR`!!!P4!#3!`%J3#m3,`%[!Mm$,`3["5m'2c`!!UR U6R8m2!!63HhqX%+B8Flrr%T"C`Bl3Il'B!3V32l#3HhqX+!96R91G8j@rqSY6[r m)$`!!2rrS$+S8%KZrr3r2!"N2c`!C+L!3IS#*b!)6VS*dN(k!P%J#%kk#FK"qJ' T)!K1ZJQq3IS#Kb!)6VS*Y%(k!F`J#%kk#DT1ZJFm5'lrp#!I3S&#JLBm!*!$!8K YrP3S(d+&5'hqCL`I6VVr6"iYrQCQ!!!%UI3b,IjX5-&#J%kkrdj#CdKYrR#TPc! I28$rmJa!rrpQ!!!13IS##5!)6VS*6Q#Q3QF[2%9'6P5TR$!I28$rm$)Zrr")`8( k!@BJ#%kk#5`pE[r`rqi-EJ!"rqj[!!"53UF[2%9'6P3r,[rZUCdJAbe)rqSZ#'B !!"Bb,[rZ5-&"qJ(D)!K1ZJMb6[S!(M)Zrqj)`8(k!HdJ#%kk#0i[,[rUUDdJE[r US#06E[rZB+C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8T!!)!JJ3#!3$)!!N!-bEJa1ZKJ!5N" X!N*!6R8L3"!46R8[!'(H-J!J(cm"BE``(dje,`"KcK3!$!!!$@F!!!K1Z[fNC`B J&f'JB1S3!PL26R8[!$m"BD`b(l)!CJSJ(f')-$`!!8je@)p#3%je)%%L%!b"!*! $-Q)%B!$qj#*"%X"#%5#*6R8%!!!`)JB: -------------------------- CUT HERE --------------------------- /* * munge.c 8/26/85 Andrew G. Shebanow * * Edit file compaction routine. Wipes out unwanted copies of * resources stored in EDIT files. This is a horrid bug in EDIT which * causes expansion of text files by 1/2K per Save operation!!!!. * * May have a slight problem compiling this, since it depends * on my own slightly tweeked MacC environment. Ther shouldn't be too * many problems though. * * Code written using Consulair's MacC. Portions of this code * Copyright Consulair Corp. * * Mods: * 8/28/85 Removed duplicate label & cleanup in SetVol * 8/29/85 Changed loop to start high and end low on RmveResource calls * * link file: * * !START * /Type 'APPL' 'MUNG' * Munge * stdlib * stdfileio * stdioprim * $ */ #include "stdio.h" #include "memory.h" #include "resource.h" #include "osio.h" /* * IMPORTANT NOTE: * * Assumes that "packages.h" has been fixed to have a correct struct * definition for SFReply type, as defined in Inside Mac. */ #include "packages.h" /* the StdFile type list */ SFTypeList typeList = { { 'TEXT', 0, 0, 0 }, 0 }; /* the reply to the last StdFile command */ SFReply reply; /* SFGetFile from MacC Library example */ SFGetFile(where, prompt, fileFilter, numTypes, typeList, dlgHook, reply) long *where; /* really address of a point */ Str255 *prompt; int (*fileFilter)(); short numTypes; SFTypeList *typeList; int (*dlgHook)(); SFReply *reply; { #asm MOVE.L D0,A0 MOVE.L (A0),-(SP) ; WHERE MOVE.L D1,-(SP) ; PROMPT MOVE.L D2,-(SP) ; FILTER PROC MOVE.W D3,-(SP) ; numTypes MOVE.L D4,-(SP) ; typeList MOVE.L D5,-(SP) ; dlgHook MOVE.L D6,-(SP) ; reply MOVE #2,-(SP) ; PARM DC.W $A9EA ; PACK3 #endasm } SetVol(fileName,vRefNum) Str255 *fileName; short vRefNum; { #asm ; Adapted from: ; FileManager.ASM ; Russ Wetmore for Star Systems Software, Inc. ; Version 2.1 24 June 1985 Include SysEqu.D ; I need system equates Include MacTraps.D ; I need (want) trap macros ; Global variables XDEF paramBlock .ALIGN 2 paramBlock: ds.L 20,0 ; OSErr SetVol(volName, vRefNum) ; char *volName; (D0.L) ; short vRefNum; (D1.W) ; Clear parameter block to zeroes move #20-1,D6 lea paramBlock(A5),A0 @3: clr.L (A0)+ dbra D6,@3 ; handle different argument types tst D1 ;vRefNum supplied? beq.S @1 ;Nope, go on ; if vRefNum is non-zero, use it to determine volume move D1,paramBlock+ioVRefNum(A5) bra.S @2 @1: ; else, use volName to determine volume move.L D0,paramBlock+ioFileName(A5) @2: lea paramBlock(A5),A0 _SetVol rts #endasm } main() { Point where; short refnum; short numRes; short cntr; Handle theRes; FlushEvents(0x0ffffl); InitCursor(); SetPt(&where,100,100); printf("Munge is a program which is designed to throw away\n"); printf("unnecessary resources from TEXT files created by\n"); printf("the MDS Edit program. Choose cancel from the Standard\n"); printf("File Dialog to quit\n"); printf("Hit return to continue:"); getchar(); while (1) { SFGetFile(&where,NULL,NULL,1,&typeList,NULL,&reply); if (reply.good == 0) ExitToShell(); /* munge the file */ SetVol(0,reply.vRefNum); if ((refnum = (short) OpenResFile(reply.fName)) == -1) { printf("Couldnt open rsrc file\n"); continue; } numRes = CountResources('EFNT'); printf("%d resources of type EFNT\n",numRes); for (cntr = numRes; cntr > 1; cntr--) { if ((theRes = GetIndResource('EFNT',cntr)) == 0) { printf("Couldn't GetIndRsrc: typ EFNT, idx %d\n",cntr); } else { printf("Removed resource with index %d\n",cntr); RmveResource(theRes); DisposHandle(theRes); } } numRes = CountResources('ETAB'); printf("%d resources of type ETAB\n",numRes); for (cntr = numRes; cntr > 1; cntr--) { if ((theRes = GetIndResource('ETAB',cntr)) == 0) { printf("Couldn't GetIndRsrc: typ EFNT, idx %d\n",cntr); } else { printf("Removed resource with index %d\n",cntr); RmveResource(theRes); DisposHandle(theRes); } } UpdateResFile(refnum); CloseResFile(refnum); } }