Well, I've taken another look. What tsteven4 proposes is mostly right.
It looks like opt_* variables are always initialized (at least by some default
value), so the if (opt_*) condition does nothing at all.
As both of them are initialized to empty string, the *opt_set_location does
call the function if non-empty string is passed as parameter.
I also noticed, that skytraq_configure_logging does some strange stuff when
called with empty string, and skytraq_set_location does no checking on it's
input at all.
While I was at it, I made a bit bigger patch, that fixes the issue originally
submitted, and adds some input checking.
I also removed the non-necessary ifs, testing for opt_* == NULL, and replaced
them by asserts, just in case. Feel free to remove the asserts from the code, if
you don't like it (I'm unsure about the assert policy, but I've seen it used in
other places). As a bonus, these functions will now complain about wrong
parameters. Unfortunately, if you pass "configlog=", it's considered valid (as
it's the same as default).
I've tested configlog on my skytraq and it seems to work fine. Unforunately,
mine does not support target, so I can't test that.
Note that if we think patch originally removing "*opt_..." checking fixed
something, this may unfix it. I don't think it's something useful, as it might be
some side effect like writing junk to target on every gpsbabel invocation...
Post by Robert LipeThat *seems* like it should be right, but wasn't that one of the iterations
that didn't work for someone?
Ladisalav, Konrad, can you please comment?
diff --git a/skytraq.cc b/skytraq.cc
index 3130bf2..6516f85 100644
--- a/skytraq.cc
+++ b/skytraq.cc
@@ -1304,12 +1304,12 @@ skytraq_read(void)
{
int dlbaud;
- if (opt_set_location) {
+ if (opt_set_location && *opt_set_location) {
skytraq_set_location();
return;
}
- if (opt_configure_logging) {
+ if (opt_configure_logging && *opt_configure_logging) {
skytraq_configure_logging();
return;
}
Hi, and welcome.
So we don't keep going back and forth on this, Ladislav and Konrad, can
you please work together that finds a solution that works for both of you?
Thanx,
RJL
Post by Ladislav LaskaHello!
I just noticed that on my skytraq, I can't use configlog=, as it always tries to
set new location beforehand, even if I didn't specify any. This worked before
https://github.com/gpsbabel/gpsbabel/commit/c927faac0a6304ee650d903cf8bd19518f416900
http://comments.gmane.org/gmane.comp.hardware.gps.gpsbabel.general/8263 )
It looks that for some reason, the code now checks for pointer only, not if
there's any data in it. I've added the dereference check, which will be true
only if the string is non-zero length or NULL pointer. This should work as
expected.
I'm not really sure how to run tests, as I've tried make check, with several
modifications, and never noticed a fault (and haven't found docs online on how
to do it, but I haven't invested too much time to check for this one line
patch).
Thoughts?
--
S pozdravem Ladislav Láska <
Katedra Aplikované Matematiky, MFF UK tel.: +420 739 464 167
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Gpsbabel-code mailing list http://www.gpsbabel.org
https://lists.sourceforge.net/lists/listinfo/gpsbabel-code
------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
--
S pozdravem Ladislav Láska <***@kam.mff.cuni.cz>
Katedra Aplikované Matematiky, MFF UK tel.: +420 739 464 167