• MacTech Network:
  • Tech Support
  • |
  • MacForge.net
  • |
  • Apple News
  • |
  • Register Domains
  • |
  • SSL Certificates
  • |
  • iPod Deals
  • |
  • Mac Deals
  • |
  • Mac Book Shelf

MAC TECH

  • Home
  • Magazine
    • About MacTech in Print
    • Issue Table of Contents
    • Subscribe
    • Risk Free Sample
    • Back Issues
    • MacTech DVD
  • Archives
    • MacTech Print Archives
    • MacMod
    • MacTutor
    • FrameWorks
    • develop
  • Forums
  • News
    • MacTech News
    • MacTech Blog
    • MacTech Reviews and KoolTools
    • Whitepapers, Screencasts, Videos and Books
    • News Scanner
    • Rumors Scanner
    • Documentation Scanner
    • Submit News or PR
    • MacTech News List
  • Store
  • Apple Expo
    • by Category
    • by Company
    • by Product
  • Job Board
  • Editorial
    • Submit News or PR
    • Writer's Kit
    • Editorial Staff
    • Editorial Calendar
  • Advertising
    • Benefits of MacTech
    • Mechanicals and Submission
    • Dates and Deadlines
    • Submit Apple Expo Entry
  • User
    • Register for Ongoing Raffles
    • Register new user
    • Edit User Settings
    • Logout
  • Contact
    • Customer Service
    • Webmaster Feedback
    • Submit News or PR
    • Suggest an article
  • Connect Tools
    • MacTech Live Podcast
    • RSS Feeds
    • Twitter

ADVERTISEMENT

Volume Number: 14 (1998)
Issue Number: 5
Column Tag: Tips & Tidbits

May 98 - Tips & Tidbits

by Steve Sisak

Reducing CodeWarrior Disk Usage

Codewarrior is a product of many thousands of tiny files.

On a 2GB disk, each individual file will take up a minimum of 62k (even if it only contains a few bytes) because of the way HFS breaks up a disk. (HFS+ solves this problem, but until then...)

You could reformat your hard drive and create a smaller partition just for Codewarrior, but there is an easier way: Use Disk Copy 6.1.3 to make a 200 MB read/write disk image of an empty folder. (Actual size will need to be varied depending on what features you are installing.)

Mount the image to the desktop, install Codewarrior to the virtual volume, and then put the resulting image (or an alias to it) in your startup items folder. Because you are working with a smaller 'virtual volume' your block size will be reduced to around 6k per file, saving you tonnes of disk space.

Colin Foster,
cfoster@pobox.com


Wrapper for ParamText

Many people don't seem to realize that you can't pass nil arguments to ParamText. Here's a wrapper routine that lets you forget about this inconvenience, as well as about having to convert between Pascal- and C-string formats:

void ParamCText
 (
  char *Param0,
  char *Param1,
  char *Param2,
  char *Param3
 )
 {
  static Str255 Param[4];
#define CopyArg(n) \
  if (Param##n != nil) \
   { \
    strncpy((char *) Param[n], Param##n, 255); \
    Param[n][255] = 0; \
    c2pstr((char *) Param[n]); \
   } \
  else \
   { \
    Param[n][0] = 0; \
   } /*if*/
  CopyArg(0)
  CopyArg(1)
  CopyArg(2)
  CopyArg(3)
  ParamText(Param[0], Param[1], Param[2], Param[3]);
 } /*ParamCText*/

Just a couple of notes about the code:

  1. The local "Param" is declared static to minimize stack usage. But feel free to change this if you don't like it.
  2. The strings are copied using strncpy, instead of strcpy. This way, if you pass a string longer than 255 bytes, it will be truncated, rather than inadvertently writing over random memory. strcpy should probably be banned -- did you know that something like 90% of of the Unix security bugs that people keep finding on the Internet are caused by buffer overruns?

Lawrence D'Oliveiro,
ldo@geek-central.gen.nz


TCL SetItem Gotcha

Because of an obscure gotcha in the MenuManager routine SetItem, TCL users implementing 'Other Size..." support must beware. The traditional approach reserves one item on the size menu to dynamically display the 'other' size, but this item has no logical initial value, so the temptation is to leave it empty. In a TCL application one uses "#-1" as the text, and the #-1 is stripped by the CBartender before it calls SetItem to install the text, which in that case would be void, with dire 'unpredictable' results. Instead you can use a blank as a placeholder, ie " #-1".

Dana S Emery,
demery@ieaccess.net

 
MacTech Only Search:
Community Search:

 
 
 

 
 
 
 
 
  • SPREAD THE WORD:
  • Slashdot
  • Digg
  • Del.icio.us
  • Reddit
  • Newsvine
  • Generate a short URL for this page:



MacTech Magazine. www.mactech.com
Toll Free 877-MACTECH, Outside US/Canada: 805-494-9797
MacTech is a registered trademark of Xplain Corporation. Xplain, "The journal of Apple technology", Apple Expo, Explain It, MacDev, MacDev-1, THINK Reference, NetProfessional, Apple Expo, MacTech Central, MacTech Domains, MacNews, MacForge, and the MacTutorMan are trademarks or service marks of Xplain Corporation. Sprocket is a registered trademark of eSprocket Corporation. Other trademarks and copyrights appearing in this printing or software remain the property of their respective holders.
All contents are Copyright 1984-2010 by Xplain Corporation. All rights reserved. Theme designed by Icreon.
 
Nov. 20: Take Control of Syncing Data in Sow Leopard' released
Nov. 19: Cocktail 4.5 (Leopard Edition) released
Nov. 19: macProVideo offers new Cubase tutorials
Nov. 18: S Stardom anounces Safe Capsule, a companion piece for Apple's
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live
Nov. 17: Ableton releases Max for Live