[comp.binaries.mac] Macintosh Technical Notes - 188 ChangedResource

bytebug@dhw68k.cts.com (Roger L. Long) (05/29/88)

[188: ChangedResource: Too much of a good thing]

The toolbox trap ChangedResource is used to inform  the  Resource
Manager  that  the contents of a resource have changed and should
be written to disk.  The actual write occurs on the next call  to
WriteResource  (for  the specific resource) or UpdateResFile (for
the resource  file  containing  the  specified  resource).   When
called, ChangedResource reserves enough disk space to contain the
changed resource.  A little-known "feature" of ChangedResource is
that it reserves disk space every time it is called.  Thus if you
call ChangedResource ten times on a  large  resource  before  the
resource is actually written out, you may unexpectedly run out of
disk space since ten times the  amount  of  disk  space  actually
needed will be reserved.

If your program frequently changes  the  contents  of  resources,
especially  large  ones,  then  you  should call WriteResource or
UpdateResFile immediately after  calling  ChangedResource.   Once
the  resource  is  actually  written,  the fileUs EOF will be set
correctly, and the first subsequent call to ChangedResource  will
work correctly.

---
(This file must be converted with BinHex 4.0)

:%c%i1#"$D'&ZCf9N8Q9cEh9bBf8!9dp54%e"3d%!N!3*2!!!!a&LVJ!'!!i!!J!
$!*!$r`$rrr`!!3!!#3`!-!!`!!!)P!!)!!J!!!I3!!J!!J#3!dJ!5!#3"!,D!LM
riIrL![N#4J-("5J$r!!#!*!$5!")!*!%!YS#+!!"!*!$C!#3!`%!!C!$!*!$!5F
2!!%!!3!#1&J!!MMJrrm!N!8C!C!!!*!K!J!c!!)!-`#3!`%!!!6b!$!!!!6L!"!
!$!$Yrr)!L2rb!6VrN!S!!3#3!`%!N!8"!!!&)J!J!!!#RJ!)rr)!([rb!1crmJ'
krj!+!!%!N!-"!*!&!3!!##`!i!!!"8)!N!$rmJ!Hrr)!l2rb!EVrN!8!#3!!&@*
jG'8JG!!*!Hm!!J#3!`N!driI!Hm"lf9b)'Pc)'4bB@GRD@iJ)(3!!3eP!!B!!!S
!!"8!-r9"bcI'S26P)3mMmamimim*j[Ca!*!$"G$c(`Rd1f2fFCp5'&pe6"!!"J!
!#J!!&3!Gp0E(-PL`p8(,0mDJp18K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