Opened 8 years ago

Closed 7 years ago

#5 closed task (fixed)

Add common functions to format and parse pathnames and numbers.

Reported by: gyoung Owned by:
Priority: minor Milestone: Release_3.7
Component: fm/2 base Version: 3.07
Keywords: Cc:

Description


Change History (5)

comment:1 Changed 8 years ago by stevenhl

  • Owner StevenHL deleted

comment:2 Changed 8 years ago by stevenhl

  • Milestone set to Release_3.5.9
  • Priority changed from major to minor
  • Summary changed from add common functions to format and parse pathnames and numbers to Add common functions to format and parse pathnames and numbers.

We need to come up with a decent naming convention for the .c file(s) and the function names themselves. Code of the form

      runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
	      hwnd, NULL, NULL, "%s %s%s%s", ad->info->test,
	      needs_quoting(ad->arcname) ? "\"" : NullStr,
	      ad->arcname,
	      needs_quoting(ad->arcname) ? "\"" : NullStr);

Is inefficient, hard to read and hard to maintain.

      runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
	      hwnd, NULL, NULL, "%s %s", ad->info->test,
	      quote_if_needed(ad->arcname));

is IMNSHO better. This is not as simple as it looks to implement. Any buffers allocated within the quoting function would need to be per thread. An simpler alternative add an additional argument and make the caller provide a work buffer

      runemf2(SEPARATEKEEP | WINDOWED | MAXIMIZED,
	      hwnd, NULL, NULL, "%s %s", ad->info->test,
	      quote_if_needed(ad->arcname, szBuf));

The buffer will only be used if quotes are needed. If quotes are not needed the function returns a pointer to the original string.

comment:3 Changed 8 years ago by stevenhl

  • Milestone Release_3.5.9 deleted

comment:4 Changed 7 years ago by gyoung

  • Milestone set to Release_3.7
  • Version set to 3.07

comment:5 Changed 7 years ago by gyoung

  • Resolution set to fixed
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.