Path: utzoo!utgpu!water!watmath!clyde!att-cb!osu-cis!tut.cis.ohio-state.edu!rutgers!mtunx!whuts!homxb!antique!cjp From: cjp@antique.UUCP (Charles Poirier) Newsgroups: comp.sys.amiga Subject: Re: calling all gurus Summary: Size of preferences Message-ID: <2176@antique.UUCP> Date: 14 Apr 88 22:27:15 GMT References: <8804051628.AA27845@decwrl.dec.com| <3482@ece-csc.UUCP| <8190@oberon.USC.EDU| <3484@ece-csc.UUCP| <8214@oberon.USC.EDU> <2161@antique.UUCP> <8725@agate.BERKELEY.EDU> Reply-To: cjp@vax135.UUCP (Charles Poirier) Organization: AT&T Bell Labs, Holmdel, NJ Lines: 27 In article <8725@agate.BERKELEY.EDU> doug@eris.UUCP (Doug Merritt) writes: >In article <2161@antique.UUCP> cjp@vax135.UUCP (Charles Poirier) writes: >>In article <8214@oberon.USC.EDU> papa@pollux.usc.edu (Marco Papa) writes: >>|... You'll have to do a lot of checking... >> >>An easy hack would be to just check that the length of the file looks right. > >No! Remember that we're about to be blessed with 1.3, which is known to >have extensions to Preferences. They'll probably extend the length of the >file to store this new stuff. Everyone doing something with >sizeof(Preferences) or whatever will be ok. Anyone *depending* on the >old length remaining forever the same will be out of luck...broken >software under 1.3. Sigh...history repeats itself. I was deliberately vague about what length would "look right". Your guess, "sizeof(struct Preferences)", is wrong: that sizeof() would be compiled into your code as a constant which would NOT track changes to the Preferences struct. Wouldn't it be okay to assume "devs:system-configuration" as a permanent filename containing a valid Preferences? Then just stat that file and stat the one you want to SetPrefs from and compare their lengths. If unequal, either refuse to do it (my choice) or maybe give a requestor to proceed (in case devs:system-configuration is invalid for some reason). -- Charles Poirier (decvax,ihnp4,attmail)!vax135!cjp "Docking complete... Docking complete... Docking complete..."