Add missing cast in hid/gtk/gui-dialog.c
Change no-ops from self-assignments to (void) casts

This makes both clang and gcc happy (with nothing, both complain
about unused variables, and clang doesn't like the self-assignment).

splint still complains, but I think we'll have to live with that.
Remove superfluous check that unsigned int is nonnegative.

It seems to me that we'll sooner fix layer management altogether, than
change an index from an unsigned to signed variable. And in the meantime,
this check is unnecessary and potentially confusing.
Add missing const in res_parse.y
Remove empty if statement from change.c

git blame dates an empty-body if statement back to 2003, so
(presumably) the correct behavior is that it be empty. Therefore,
I removed the if to avoid confusing humans.

After this commit, pcb compiles completely and cleanly with:
  clang version 2.9 (tags/RELEASE_29/final)
  gcc version 4.6.2 20111027 (Red Hat 4.6.2-1)
Check sscanf() return value in GetValue().

In case the user passes something like "+" with no digits to
GetValue, sscanf fails and the function returns an indeterminate
result. This patch fixes that, returning 0 instead if sscanf
fails.
Allow '+' and '-' (without magnitudes) for user-preference in menu

This does not actually change any menu files, just adds
the capability to use the user's settings in the Increments
dialog for controlling pcb.
Change menus to use user's settings for increments
Add "px" to the units allowed for --rat-thickness

Add "px" to the set of units allowed for option --rat-thickness. The purpose is
to give thickness in terms of a fixed number of screen pixels. Internally, this
special unit is treated like nm. The drawing routine decides to go for fixed
width if rat thickness is below 100nm.

Commit by Andrew Poelstra.
Closes-bug: lp-927422
Collapse giant default increment table into only two

We now store two sets of increments - one for imperial and
one for metric. These will both be individually modifiable
by the user.
Add separate metric and imperial increment settings to Gtk gui.
Add grid-increment-mm (and similar) settings

Added the following settings:

  grid-increment-mm       grid-increment-mil
  size-increment-mm       size-increment-mil
  line-increment-mm       line-increment-mil
  clear-increment-mm     clear-increment-mil

These behave differently than the old settings of the same names (from
20090929 and earlier). They take a measure, not a real number. The -mm
versions affect the increment settings when the user is using a metric
grid, and the -mil versions affect the settings for imperial grids.

Old ~/.pcb/preferences files likely have lines like

  grid-increment-mil = 5

which have been hanging around for several pcb versions. These should
be safely ignored, since, for example, "5" is now read as "5nm", which
is well below the minimum allowed increment setting.

These settings can be read but (so far) not written out, either to the
pcb or to the preferences file.
Save CONFIG_Coord settings in Gtk

The "Safe board width as default" checkbox has not been working
since commit fa2a0e35 back in August, when I added HID_Coord and
CONFIG_Coord to a couple of enums and forgot to update a switch
statement.

This patch fixes that. :-}
Allow saving of user increment settings in Gtk.

It seems there is no clean way of implementing this without really
tearing up the setting-saving code and fixing the SettingType/PCBType
dichotomy, but at 26 lines, this was at least short.

Closes-bug: lp-699464
Add missing const in lesstif/main.c
Parse floating-point values without leading 0 correctly

Closes-bug: lp-916984
Make SelectLayer() respond to layer name as well as index

Closes-bug: lp-699470
Fix infinite loop on PCB::skip-drc attribute

When doing a DRC check, pcb skips checking any layers who have the
PCB::skip-drc attribute set. However, when determining whether the
check is complete (via the ListsEmpty()) function, it doesn't skip
these layers.

The result is an infinite loop, since if there is work to be done
on a skip-drc layer, the checker will keep running until it is done
-- i.e., will keep running forever.

This patch skips skip-drc layers in ListsEmpty().

Closes-bug: lp-829123
Wrap gcode_do_export in setlocale() calls

During gcode export, we temporarily switch locales to C to
ensure that output uses the proper decimal separator.

Closes-bug: lp-912077
Fix segfault when routing to non-straight pads

Since the autorouter does not handle non-manhattan lines, it will
not route to non-straight pads. Therefore, when the autorouter
searches for the pins/pads at the endpoints of a rat, it ignores
any non-straght pads, returning NULL from the search.

The autorouter then tries to dereference this pointer and crashes.

The rest of the code, it seems, works to avoid ever giving such
rats to the autorouter, but it can be done if the user explicitly
selects such a rat and selects "Auto-route selected rats".

This patch catches the NULL pointer and simply ignores the rat.

It is possible that this is the cause of bug lp-699255, but this
seems unlikely, since the backtrace on that report does not show
the same NULL dereference, and the reporter was using "10-pin
headers", which presumably have no pads that could be marked as
non-straight.

Affects-bug: lp-699255