mikalhart / TinyGPSPlus

A new, customizable Arduino NMEA parsing library
http://arduiniana.org
1.11k stars 494 forks source link

Compilation warning fixes and parse crash fix #1

Closed denravonska closed 11 years ago

denravonska commented 11 years ago

(Sorry for the multiple fixes in one request) This fixes a couple of build errors/warnings when building for AVR32 and for OSX using clang.

I am not 100% sure that I understood the custom handlers right, so my crash fix might be incorrect.

mikalhart commented 11 years ago

Hey, thanks! This is good stuff. Just a couple of quick questions before I pull:

  1. Why does ULONG_MAX generate an error?
  2. Why do some + lines in the patch appear to be identical to the - ones they replace?
  3. Your fix for the custom handler is much appreciated, and almost correct. I'm a bit new to Git. How can I pull your changes to my local repo so that I can tweak a tiny bit before pushing up to the Github master? Or is that the correct technique.

Again, thanks for the pull request!

Mikal

denravonska commented 11 years ago
  1. long is only required to be at least 32 bits. When building using clang in OSX it's set to 64 bits which causes a precision loss when it's returned as an uint32_t.
  2. That might be my editor removing stray whitespace at the line endings. I can submit a new patch if you want to.
  3. That's a good question. Try this one: https://help.github.com/articles/merging-a-pull-request (scroll down to Merging Locally). That seems to be what you're after.

Thanks for a great lib :)

mikalhart commented 11 years ago

I just folded in most of the changes. Had to reject the otherwise elegant numeric_limits::max() because the silly Arduino system #defines max. I replaced it with (uint32_t)ULONG_MAX. What do you think about that? In some ways, I might have preferred (uint32_t)(-1UL).

denravonska commented 11 years ago

Just tested the cast out and it seems to work. Go for it :)