Fossil

Check-in [6f523169]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Fix build on mingw-w64 (which DOES have strtok_r)
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 6f52316955f4ba148b241a58e3f82dc3112145f899fbe5ddefe87691c89fb8e3
User & Date: jan.nijtmans 2017-03-14 14:38:23
Context
2017-03-14
16:02
Fix by Natacha Porté for delimiter escape bug discovered by Mark Janssen. (fossil-users list) check-in: dd41f85a user: jan.nijtmans tags: trunk
14:38
Fix build on mingw-w64 (which DOES have strtok_r) check-in: 6f523169 user: jan.nijtmans tags: trunk
12:11
Fix Debian bug 847556: Cannot clone/sync over HTTPS check-in: 04168f51 user: jan.nijtmans tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to src/login.c.

47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
83
84
85
86
87
88
89

90
91
92
93
94
95
96
#  include <windows.h>           /* for Sleep */
#  if defined(__MINGW32__) || defined(_MSC_VER)
#    define sleep Sleep            /* windows does not have sleep, but Sleep */
#  endif
#endif
#include <time.h>

#if defined(__MINGW32__) || defined(_MSC_VER)
/*
** MinGW doesn't have strtok_r in its libc. Here's a public domain one
** found at StackOverflow as a work-around, with formatting adjusted to
** make it more like the usual style here. This is certainly the wrong
** place for it, which is emphasized by making the function static.
** 
** See http://stackoverflow.com/a/12979321/68204
** 
** public domain strtok_r() by Charlie Gordon
**   from comp.lang.c  9/14/2007
**   http://groups.google.com/group/comp.lang.c/msg/2ab1ecbb86646684
** (Declaration that it's public domain):
**   http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c
*/
static char* strtok_r(
  char *str, 
  const char *delim, 
  char **nextp
){
  char *ret;
  if( str == NULL ){
    str = *nextp;
  }
  str += strspn(str, delim);
................................................................................
  str += strcspn(str, delim);
  if( *str ){
    *str++ = '\0';
  }
  *nextp = str;
  return ret;
}

#endif

/*
** Return the login-group name.  Or return 0 if this repository is
** not a member of a login-group.
*/
const char *login_group_name(void){







|





|

|






|
|
|







 







>







47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
#  include <windows.h>           /* for Sleep */
#  if defined(__MINGW32__) || defined(_MSC_VER)
#    define sleep Sleep            /* windows does not have sleep, but Sleep */
#  endif
#endif
#include <time.h>

#ifdef _WIN32
/*
** MinGW doesn't have strtok_r in its libc. Here's a public domain one
** found at StackOverflow as a work-around, with formatting adjusted to
** make it more like the usual style here. This is certainly the wrong
** place for it, which is emphasized by making the function static.
**
** See http://stackoverflow.com/a/12979321/68204
**
** public domain strtok_r() by Charlie Gordon
**   from comp.lang.c  9/14/2007
**   http://groups.google.com/group/comp.lang.c/msg/2ab1ecbb86646684
** (Declaration that it's public domain):
**   http://groups.google.com/group/comp.lang.c/msg/7c7b39328fefab9c
*/
static char* win32_strtok_r(
  char *str,
  const char *delim,
  char **nextp
){
  char *ret;
  if( str == NULL ){
    str = *nextp;
  }
  str += strspn(str, delim);
................................................................................
  str += strcspn(str, delim);
  if( *str ){
    *str++ = '\0';
  }
  *nextp = str;
  return ret;
}
#define strtok_r win32_strtok_r
#endif

/*
** Return the login-group name.  Or return 0 if this repository is
** not a member of a login-group.
*/
const char *login_group_name(void){

Changes to src/stat.c.

398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
  style_header("Repository Schema");
  style_adunit_config(ADUNIT_RIGHT_OK);
  style_submenu_element("Stat", "stat");
  style_submenu_element("URLs", "urllist");
  if( sqlite3_compileoption_used("ENABLE_DBSTAT_VTAB") ){
    style_submenu_element("Table Sizes", "repo-tabsize");
  }
  blob_init(&sql, 
    "SELECT sql FROM repository.sqlite_master WHERE sql IS NOT NULL", -1);
  if( zArg ){
    style_submenu_element("All", "repo_schema");
    blob_appendf(&sql, " AND (tbl_name=%Q OR name=%Q)", zArg, zArg);
  }
  blob_appendf(&sql, " ORDER BY tbl_name, type<>'table', name");
  db_prepare(&q, "%s", blob_str(&sql)/*safe-for-%s*/);







|







398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
  style_header("Repository Schema");
  style_adunit_config(ADUNIT_RIGHT_OK);
  style_submenu_element("Stat", "stat");
  style_submenu_element("URLs", "urllist");
  if( sqlite3_compileoption_used("ENABLE_DBSTAT_VTAB") ){
    style_submenu_element("Table Sizes", "repo-tabsize");
  }
  blob_init(&sql,
    "SELECT sql FROM repository.sqlite_master WHERE sql IS NOT NULL", -1);
  if( zArg ){
    style_submenu_element("All", "repo_schema");
    blob_appendf(&sql, " AND (tbl_name=%Q OR name=%Q)", zArg, zArg);
  }
  blob_appendf(&sql, " ORDER BY tbl_name, type<>'table', name");
  db_prepare(&q, "%s", blob_str(&sql)/*safe-for-%s*/);