Path: utzoo!attcan!uunet!mailrus!umich!samsung!rex!uflorida!stat!sun13!gw.scri.fsu.edu!pepke From: pepke@gw.scri.fsu.edu (Eric Pepke) Newsgroups: comp.sys.mac.programmer Subject: Speaking of Munger... Message-ID: <233@sun13.scri.fsu.edu> Date: 11 Jul 90 14:54:11 GMT Sender: news@sun13.scri.fsu.edu Organization: Florida State University, but I don't speak for them Lines: 67 Speaking of Munger, it's a cute little routine, but what happens when it fails due to insufficient memory? I run this little test program: #include #include #include main() { unsigned char buffer[1000]; Handle block; long beforeLength, afterLength; printf("Yahoo!\n"); block = NewHandle(0L); for (;;) { beforeLength = GetHandleSize(block); Munger(block, GetHandleSize(block), (unsigned char *) 0, 0L, buffer, (long) sizeof(buffer)); afterLength = GetHandleSize(block); if (beforeLength + sizeof(buffer) > afterLength || MemError()) { printf("\nSize increased from %ld to %ld\n", beforeLength, afterLength); printf("MemError() == %d\n", MemError()); exit(-1); } else { printf("."); } } } and I get Yahoo! ........................................................................... ..... ........................................................................... ..... ........................................................................... ..... ....................................................................... Size increased from 311000 to 311000 MemError() == 0 So, when Munger fails due to lack of memory, you cannot tell from looking at MemError. In this case, at least, it left the handle unchanged. Can somebody who knows about the internals of Munger tell me if that is guaranteed to be the case, or is there a possibility that the handle will be corrupted in any way, such as being left larger than it was but not as large as is needed? Eric Pepke INTERNET: pepke@gw.scri.fsu.edu Supercomputer Computations Research Institute MFENET: pepke@fsu Florida State University SPAN: scri::pepke Tallahassee, FL 32306-4052 BITNET: pepke@fsu Disclaimer: My employers seldom even LISTEN to my opinions. Meta-disclaimer: Any society that needs disclaimers has too many lawyers.