Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strptime update #1133

Merged
merged 7 commits into from
Jun 30, 2023
Merged

Strptime update #1133

merged 7 commits into from
Jun 30, 2023

Conversation

tsteven4
Copy link
Collaborator

@tsteven4 tsteven4 commented Jun 25, 2023

This update strptime to glibc 2.37.

The license for strptime is now LGPL 2.1 instead of LGPL 2.0. If this is not acceptable we may be able to license it under GPL 2.0.

See strptime/README.GPSBabel.

The modifications required are in strptime/strptime_l.c.patch:

  1. langinfo.h may not exist, don't include it.
  2. __strncasecmp_l may not exist. we aren't using passed locales anyway, so just use strncasecmp.
  3. sntrncasecmp may not exist. add a function to replace it. this is the same as we have done previously.
  4. tm->tm_gmtoff may not exist. don't use it.
  5. era handling. we don't have information on the era structure. remove this code as we did previously (although the code is slightly different).

This solves warnings from clang 15 about -Wdeprecated-non-prototype related to upcoming changes in C23. With the MSVC compiler a number of other warnings crop up and are disabled in strptime.cmake.

Copy link
Collaborator

@robertlipe robertlipe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM++
Thank you.
Was this really easier than flushing out our shim to QDateTime's toStrting/fromString?


#include <assert.h>
#include <ctype.h>
-#include <langinfo.h>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

c++17 has
#if has_include <langinfo.h>
#include <langinfo.h.>
#endif
...but if we don't need it, we don't need it. {shrug}

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice idea, but this is c.

+/* now now, don't need to be rude .... */
+static
+int
+case_ignore_strncmp(const char *s1, const char *s2, int n)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think I wrote the above (it does sound like me...) but in case this is for MS (and it always is) SO says that the current wisdom to #define a passthrough to _strnicmp

It really is pretty embarrassing how crude the string functions are in C 50 years later. Just sayin'

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

now using _strnicmp

@tsteven4 tsteven4 merged commit 7088c7e into GPSBabel:master Jun 30, 2023
@tsteven4 tsteven4 deleted the strptime_update branch June 30, 2023 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants