bradenbest/balance — pull request #11 by bradenshame (2014-05-20 16:08:09+00:00)
Title: Many fixes...

True code written by a true C programmer... Enjoy.

1. Correct types were chosen for the struct based upon the bitfield the original author selected. Unsigned long is guaranteed to be at least 32 bits wide. This resolves the issue described by the C standard as "The expression that specifies the width of a bit-field shall be an integer constant
expression with a nonnegative value that does not exceed the width of an object of the
type that would be specified were the colon and expression omitted."

unsigned int is not required to be longer than 16 bits.

2. Corrected format specifiers for new types.

3. Used non-floating point calculations in coin-to-dollar conversions to prevent undesirable rounding/floating point inaccuracies.

4. Removed a tonne of unnecessary code, including some very buggy code. This fixed at least two known problems:
* when char is unsigned, the conversion in the assignment in "while ((c = getc(f)) != EOF)" would cause the terminating condition to never occur; An infinite loop would cause stack overflow and probably segfault.
* out in fcopy was allocated x bytes, and then a null terminator placed at the x+1th byte (lol), resulting in an apparent "stack smashing" problem.