Fossil SCM
Merge from trunk.
Commit
b5ccc136aee4cdb92ea4101af4ed77d9044ad882
Parent
0160d40b5d0c345…
11 files changed
+14
+1
-1
+46
-10
+4
-4
+3
-3
-17
+2
-1
+1
+20
-9
+2
-1
+7
+14
| --- src/cgi.c | ||
| +++ src/cgi.c | ||
| @@ -40,10 +40,14 @@ | ||
| 40 | 40 | #include <time.h> |
| 41 | 41 | #include <stdio.h> |
| 42 | 42 | #include <stdlib.h> |
| 43 | 43 | #include <unistd.h> |
| 44 | 44 | #include "cgi.h" |
| 45 | +#ifdef __CYGWIN__ | |
| 46 | + __declspec(dllimport) extern __stdcall int ShellExecuteW(void *, void *, | |
| 47 | + void *, void *, void *, int); | |
| 48 | +#endif | |
| 45 | 49 | |
| 46 | 50 | #if INTERFACE |
| 47 | 51 | /* |
| 48 | 52 | ** Shortcuts for cgi_parameter. P("x") returns the value of query parameter |
| 49 | 53 | ** or cookie "x", or NULL if there is no such parameter or cookie. PD("x","y") |
| @@ -1435,10 +1439,20 @@ | ||
| 1435 | 1439 | (flags & HTTP_SERVER_SCGI)!=0?"SCGI":"HTTP", iPort); |
| 1436 | 1440 | fflush(stdout); |
| 1437 | 1441 | } |
| 1438 | 1442 | if( zBrowser ){ |
| 1439 | 1443 | zBrowser = mprintf(zBrowser, iPort); |
| 1444 | +#if defined(__CYGWIN__) | |
| 1445 | + /* On Cygwin, we can do better than "echo" */ | |
| 1446 | + if( memcmp(zBrowser, "echo ", 5)==0 ){ | |
| 1447 | + wchar_t *wUrl = fossil_utf8_to_unicode(zBrowser+5); | |
| 1448 | + wUrl[wcslen(wUrl)-2] = 0; /* Strip terminating " &" */ | |
| 1449 | + if( ShellExecuteW(0, L"open", wUrl, 0, 0, 1)<33 ){ | |
| 1450 | + fossil_warning("cannot start browser\n"); | |
| 1451 | + } | |
| 1452 | + }else | |
| 1453 | +#endif | |
| 1440 | 1454 | if( system(zBrowser)<0 ){ |
| 1441 | 1455 | fossil_warning("cannot start browser: %s\n", zBrowser); |
| 1442 | 1456 | } |
| 1443 | 1457 | } |
| 1444 | 1458 | while( 1 ){ |
| 1445 | 1459 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -40,10 +40,14 @@ | |
| 40 | #include <time.h> |
| 41 | #include <stdio.h> |
| 42 | #include <stdlib.h> |
| 43 | #include <unistd.h> |
| 44 | #include "cgi.h" |
| 45 | |
| 46 | #if INTERFACE |
| 47 | /* |
| 48 | ** Shortcuts for cgi_parameter. P("x") returns the value of query parameter |
| 49 | ** or cookie "x", or NULL if there is no such parameter or cookie. PD("x","y") |
| @@ -1435,10 +1439,20 @@ | |
| 1435 | (flags & HTTP_SERVER_SCGI)!=0?"SCGI":"HTTP", iPort); |
| 1436 | fflush(stdout); |
| 1437 | } |
| 1438 | if( zBrowser ){ |
| 1439 | zBrowser = mprintf(zBrowser, iPort); |
| 1440 | if( system(zBrowser)<0 ){ |
| 1441 | fossil_warning("cannot start browser: %s\n", zBrowser); |
| 1442 | } |
| 1443 | } |
| 1444 | while( 1 ){ |
| 1445 |
| --- src/cgi.c | |
| +++ src/cgi.c | |
| @@ -40,10 +40,14 @@ | |
| 40 | #include <time.h> |
| 41 | #include <stdio.h> |
| 42 | #include <stdlib.h> |
| 43 | #include <unistd.h> |
| 44 | #include "cgi.h" |
| 45 | #ifdef __CYGWIN__ |
| 46 | __declspec(dllimport) extern __stdcall int ShellExecuteW(void *, void *, |
| 47 | void *, void *, void *, int); |
| 48 | #endif |
| 49 | |
| 50 | #if INTERFACE |
| 51 | /* |
| 52 | ** Shortcuts for cgi_parameter. P("x") returns the value of query parameter |
| 53 | ** or cookie "x", or NULL if there is no such parameter or cookie. PD("x","y") |
| @@ -1435,10 +1439,20 @@ | |
| 1439 | (flags & HTTP_SERVER_SCGI)!=0?"SCGI":"HTTP", iPort); |
| 1440 | fflush(stdout); |
| 1441 | } |
| 1442 | if( zBrowser ){ |
| 1443 | zBrowser = mprintf(zBrowser, iPort); |
| 1444 | #if defined(__CYGWIN__) |
| 1445 | /* On Cygwin, we can do better than "echo" */ |
| 1446 | if( memcmp(zBrowser, "echo ", 5)==0 ){ |
| 1447 | wchar_t *wUrl = fossil_utf8_to_unicode(zBrowser+5); |
| 1448 | wUrl[wcslen(wUrl)-2] = 0; /* Strip terminating " &" */ |
| 1449 | if( ShellExecuteW(0, L"open", wUrl, 0, 0, 1)<33 ){ |
| 1450 | fossil_warning("cannot start browser\n"); |
| 1451 | } |
| 1452 | }else |
| 1453 | #endif |
| 1454 | if( system(zBrowser)<0 ){ |
| 1455 | fossil_warning("cannot start browser: %s\n", zBrowser); |
| 1456 | } |
| 1457 | } |
| 1458 | while( 1 ){ |
| 1459 |
+1
-1
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -714,11 +714,11 @@ | ||
| 714 | 714 | char *zInit, |
| 715 | 715 | CheckinInfo *p, |
| 716 | 716 | int parent_rid |
| 717 | 717 | ){ |
| 718 | 718 | Blob prompt; |
| 719 | -#ifdef _WIN32 | |
| 719 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 720 | 720 | int bomSize; |
| 721 | 721 | const unsigned char *bom = get_utf8_bom(&bomSize); |
| 722 | 722 | blob_init(&prompt, (const char *) bom, bomSize); |
| 723 | 723 | if( zInit && zInit[0]) { |
| 724 | 724 | blob_append(&prompt, zInit, -1); |
| 725 | 725 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -714,11 +714,11 @@ | |
| 714 | char *zInit, |
| 715 | CheckinInfo *p, |
| 716 | int parent_rid |
| 717 | ){ |
| 718 | Blob prompt; |
| 719 | #ifdef _WIN32 |
| 720 | int bomSize; |
| 721 | const unsigned char *bom = get_utf8_bom(&bomSize); |
| 722 | blob_init(&prompt, (const char *) bom, bomSize); |
| 723 | if( zInit && zInit[0]) { |
| 724 | blob_append(&prompt, zInit, -1); |
| 725 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -714,11 +714,11 @@ | |
| 714 | char *zInit, |
| 715 | CheckinInfo *p, |
| 716 | int parent_rid |
| 717 | ){ |
| 718 | Blob prompt; |
| 719 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 720 | int bomSize; |
| 721 | const unsigned char *bom = get_utf8_bom(&bomSize); |
| 722 | blob_init(&prompt, (const char *) bom, bomSize); |
| 723 | if( zInit && zInit[0]) { |
| 724 | blob_append(&prompt, zInit, -1); |
| 725 |
+46
-10
| --- src/cson_amalgamation.c | ||
| +++ src/cson_amalgamation.c | ||
| @@ -1576,14 +1576,29 @@ | ||
| 1576 | 1576 | }; |
| 1577 | 1577 | #define cson_string_empty_m {0/*length*/} |
| 1578 | 1578 | static const cson_string cson_string_empty = cson_string_empty_m; |
| 1579 | 1579 | |
| 1580 | 1580 | |
| 1581 | - | |
| 1581 | +/** | |
| 1582 | + Assumes V is a (cson_value*) ans V->value is a (T*). Returns | |
| 1583 | + V->value cast to a (T*). | |
| 1584 | +*/ | |
| 1582 | 1585 | #define CSON_CAST(T,V) ((T*)((V)->value)) |
| 1586 | +/** | |
| 1587 | + Assumes V is a pointer to memory which is allocated as part of a | |
| 1588 | + cson_value instance (the bytes immediately after that part). | |
| 1589 | + Returns a pointer a a cson_value by subtracting sizeof(cson_value) | |
| 1590 | + from that address and casting it to a (cson_value*) | |
| 1591 | +*/ | |
| 1583 | 1592 | #define CSON_VCAST(V) ((cson_value *)(((unsigned char *)(V))-sizeof(cson_value))) |
| 1584 | 1593 | |
| 1594 | +/** | |
| 1595 | + CSON_INT(V) assumes that V is a (cson_value*) of type | |
| 1596 | + CSON_TYPE_INTEGER. This macro returns a (cson_int_t*) representing | |
| 1597 | + its value (how that is stored depends on whether we are running in | |
| 1598 | + 32- or 64-bit mode). | |
| 1599 | + */ | |
| 1585 | 1600 | #if CSON_VOID_PTR_IS_BIG |
| 1586 | 1601 | # define CSON_INT(V) ((cson_int_t*)(&((V)->value))) |
| 1587 | 1602 | #else |
| 1588 | 1603 | # define CSON_INT(V) ((cson_int_t*)(V)->value) |
| 1589 | 1604 | #endif |
| @@ -1592,14 +1607,12 @@ | ||
| 1592 | 1607 | #define CSON_STR(V) CSON_CAST(cson_string,(V)) |
| 1593 | 1608 | #define CSON_OBJ(V) CSON_CAST(cson_object,(V)) |
| 1594 | 1609 | #define CSON_ARRAY(V) CSON_CAST(cson_array,(V)) |
| 1595 | 1610 | |
| 1596 | 1611 | /** |
| 1597 | - | |
| 1598 | 1612 | Holds special shared "constant" (though they are non-const) |
| 1599 | - values. | |
| 1600 | - | |
| 1613 | + values. | |
| 1601 | 1614 | */ |
| 1602 | 1615 | static struct CSON_EMPTY_HOLDER_ |
| 1603 | 1616 | { |
| 1604 | 1617 | char trueValue; |
| 1605 | 1618 | cson_string stringValue; |
| @@ -1809,11 +1822,11 @@ | ||
| 1809 | 1822 | Frees any resources owned by val, but does not free val itself |
| 1810 | 1823 | (which may be stack-allocated). If !val or val->api or |
| 1811 | 1824 | val->api->cleanup are NULL then this is a no-op. |
| 1812 | 1825 | |
| 1813 | 1826 | If v is a container type (object or array) its children are also |
| 1814 | - cleaned up (BUT NOT FREED), recursively. | |
| 1827 | + cleaned up, recursively. | |
| 1815 | 1828 | |
| 1816 | 1829 | After calling this, val will have the special "undefined" type. |
| 1817 | 1830 | */ |
| 1818 | 1831 | static void cson_value_clean( cson_value * val ); |
| 1819 | 1832 | |
| @@ -1889,11 +1902,11 @@ | ||
| 1889 | 1902 | |
| 1890 | 1903 | |
| 1891 | 1904 | /** |
| 1892 | 1905 | Fetches v's string value as a non-const string. |
| 1893 | 1906 | |
| 1894 | - cson_strings are supposed to be immutable, but this form provides | |
| 1907 | + cson_strings are intended to be immutable, but this form provides | |
| 1895 | 1908 | access to the immutable bits, which are v->length bytes long. A |
| 1896 | 1909 | length-0 string is returned as NULL from here, as opposed to |
| 1897 | 1910 | "". (This is a side-effect of the string allocation mechanism.) |
| 1898 | 1911 | Returns NULL if !v or if v is the internal empty-string singleton. |
| 1899 | 1912 | */ |
| @@ -3781,11 +3794,31 @@ | ||
| 3781 | 3794 | assert( next > pos ); |
| 3782 | 3795 | clen = next - pos; |
| 3783 | 3796 | assert( clen ); |
| 3784 | 3797 | if( 1 == clen ) |
| 3785 | 3798 | { /* ASCII */ |
| 3786 | - assert( *pos == ch ); | |
| 3799 | +#if defined(CSON_FOSSIL_MODE) | |
| 3800 | + /* Workaround for fossil repo artifact | |
| 3801 | + f460839cff85d4e4f1360b366bb2858cef1411ea, | |
| 3802 | + which has what appears to be latin1-encoded | |
| 3803 | + text. file(1) thinks it's a FORTRAN program. | |
| 3804 | + */ | |
| 3805 | + if(0xfffd==ch){ | |
| 3806 | + assert(*pos != ch); | |
| 3807 | + /* MARKER("ch=%04x, *pos=%04x\n", ch, *pos); */ | |
| 3808 | + ch = *pos | |
| 3809 | + /* We should arguably translate to '?', and | |
| 3810 | + will if this problem ever comes up with a | |
| 3811 | + non-latin1 encoding. For latin1 this | |
| 3812 | + workaround incidentally corrects the output | |
| 3813 | + to proper UTF8-escaped characters, and only | |
| 3814 | + for that reason is it being kept around. | |
| 3815 | + */; | |
| 3816 | + goto assume_latin1; | |
| 3817 | + } | |
| 3818 | +#endif | |
| 3819 | + assert( (*pos == ch) && "Invalid UTF8" ); | |
| 3787 | 3820 | escChar[1] = 0; |
| 3788 | 3821 | switch(ch) |
| 3789 | 3822 | { |
| 3790 | 3823 | case '\t': escChar[1] = 't'; break; |
| 3791 | 3824 | case '\r': escChar[1] = 'r'; break; |
| @@ -3836,10 +3869,13 @@ | ||
| 3836 | 3869 | } |
| 3837 | 3870 | continue; |
| 3838 | 3871 | } |
| 3839 | 3872 | else |
| 3840 | 3873 | { /* UTF: transform it to \uXXXX */ |
| 3874 | +#if defined(CSON_FOSSIL_MODE) | |
| 3875 | + assume_latin1: | |
| 3876 | +#endif | |
| 3841 | 3877 | memset(ubuf,0,UBLen); |
| 3842 | 3878 | rc = sprintf(ubuf, "\\u%04x",ch); |
| 3843 | 3879 | if( rc != 6 ) |
| 3844 | 3880 | { |
| 3845 | 3881 | rc = cson_rc.RangeError; |
| @@ -4105,11 +4141,11 @@ | ||
| 4105 | 4141 | rc = f(state, ",", 1); |
| 4106 | 4142 | if( 0 == rc ) |
| 4107 | 4143 | { |
| 4108 | 4144 | rc = doIndent |
| 4109 | 4145 | ? cson_output_indent( f, state, fmt->indentation, level ) |
| 4110 | - : f( state, " ", 1 ); | |
| 4146 | + : 0 /*f( state, " ", 1 )*/; | |
| 4111 | 4147 | } |
| 4112 | 4148 | } |
| 4113 | 4149 | } |
| 4114 | 4150 | } |
| 4115 | 4151 | --level; |
| @@ -4183,11 +4219,11 @@ | ||
| 4183 | 4219 | rc = f(state, ",", 1); |
| 4184 | 4220 | if( 0 == rc ) |
| 4185 | 4221 | { |
| 4186 | 4222 | rc = doIndent |
| 4187 | 4223 | ? cson_output_indent( f, state, fmt->indentation, level ) |
| 4188 | - : f( state, " ", 1 ); | |
| 4224 | + : 0 /*f( state, " ", 1 )*/; | |
| 4189 | 4225 | } |
| 4190 | 4226 | } |
| 4191 | 4227 | } |
| 4192 | 4228 | } |
| 4193 | 4229 | --level; |
| @@ -4396,11 +4432,11 @@ | ||
| 4396 | 4432 | const cson_size_t oldCap = sb->capacity; |
| 4397 | 4433 | const cson_size_t asz = npos * 2; |
| 4398 | 4434 | if( asz < npos ) return cson_rc.ArgError; /* overflow */ |
| 4399 | 4435 | else if( 0 != cson_buffer_reserve( sb, asz ) ) return cson_rc.AllocError; |
| 4400 | 4436 | assert( (sb->capacity > oldCap) && "Internal error in memory buffer management!" ); |
| 4401 | - /* make sure it gets NULL terminated. */ | |
| 4437 | + /* make sure it gets NUL terminated. */ | |
| 4402 | 4438 | memset( sb->mem + oldCap, 0, (sb->capacity - oldCap) ); |
| 4403 | 4439 | } |
| 4404 | 4440 | for( i = 0; i < n; ++i, ++sb->used ) |
| 4405 | 4441 | { |
| 4406 | 4442 | sb->mem[sb->used] = data[i]; |
| 4407 | 4443 |
| --- src/cson_amalgamation.c | |
| +++ src/cson_amalgamation.c | |
| @@ -1576,14 +1576,29 @@ | |
| 1576 | }; |
| 1577 | #define cson_string_empty_m {0/*length*/} |
| 1578 | static const cson_string cson_string_empty = cson_string_empty_m; |
| 1579 | |
| 1580 | |
| 1581 | |
| 1582 | #define CSON_CAST(T,V) ((T*)((V)->value)) |
| 1583 | #define CSON_VCAST(V) ((cson_value *)(((unsigned char *)(V))-sizeof(cson_value))) |
| 1584 | |
| 1585 | #if CSON_VOID_PTR_IS_BIG |
| 1586 | # define CSON_INT(V) ((cson_int_t*)(&((V)->value))) |
| 1587 | #else |
| 1588 | # define CSON_INT(V) ((cson_int_t*)(V)->value) |
| 1589 | #endif |
| @@ -1592,14 +1607,12 @@ | |
| 1592 | #define CSON_STR(V) CSON_CAST(cson_string,(V)) |
| 1593 | #define CSON_OBJ(V) CSON_CAST(cson_object,(V)) |
| 1594 | #define CSON_ARRAY(V) CSON_CAST(cson_array,(V)) |
| 1595 | |
| 1596 | /** |
| 1597 | |
| 1598 | Holds special shared "constant" (though they are non-const) |
| 1599 | values. |
| 1600 | |
| 1601 | */ |
| 1602 | static struct CSON_EMPTY_HOLDER_ |
| 1603 | { |
| 1604 | char trueValue; |
| 1605 | cson_string stringValue; |
| @@ -1809,11 +1822,11 @@ | |
| 1809 | Frees any resources owned by val, but does not free val itself |
| 1810 | (which may be stack-allocated). If !val or val->api or |
| 1811 | val->api->cleanup are NULL then this is a no-op. |
| 1812 | |
| 1813 | If v is a container type (object or array) its children are also |
| 1814 | cleaned up (BUT NOT FREED), recursively. |
| 1815 | |
| 1816 | After calling this, val will have the special "undefined" type. |
| 1817 | */ |
| 1818 | static void cson_value_clean( cson_value * val ); |
| 1819 | |
| @@ -1889,11 +1902,11 @@ | |
| 1889 | |
| 1890 | |
| 1891 | /** |
| 1892 | Fetches v's string value as a non-const string. |
| 1893 | |
| 1894 | cson_strings are supposed to be immutable, but this form provides |
| 1895 | access to the immutable bits, which are v->length bytes long. A |
| 1896 | length-0 string is returned as NULL from here, as opposed to |
| 1897 | "". (This is a side-effect of the string allocation mechanism.) |
| 1898 | Returns NULL if !v or if v is the internal empty-string singleton. |
| 1899 | */ |
| @@ -3781,11 +3794,31 @@ | |
| 3781 | assert( next > pos ); |
| 3782 | clen = next - pos; |
| 3783 | assert( clen ); |
| 3784 | if( 1 == clen ) |
| 3785 | { /* ASCII */ |
| 3786 | assert( *pos == ch ); |
| 3787 | escChar[1] = 0; |
| 3788 | switch(ch) |
| 3789 | { |
| 3790 | case '\t': escChar[1] = 't'; break; |
| 3791 | case '\r': escChar[1] = 'r'; break; |
| @@ -3836,10 +3869,13 @@ | |
| 3836 | } |
| 3837 | continue; |
| 3838 | } |
| 3839 | else |
| 3840 | { /* UTF: transform it to \uXXXX */ |
| 3841 | memset(ubuf,0,UBLen); |
| 3842 | rc = sprintf(ubuf, "\\u%04x",ch); |
| 3843 | if( rc != 6 ) |
| 3844 | { |
| 3845 | rc = cson_rc.RangeError; |
| @@ -4105,11 +4141,11 @@ | |
| 4105 | rc = f(state, ",", 1); |
| 4106 | if( 0 == rc ) |
| 4107 | { |
| 4108 | rc = doIndent |
| 4109 | ? cson_output_indent( f, state, fmt->indentation, level ) |
| 4110 | : f( state, " ", 1 ); |
| 4111 | } |
| 4112 | } |
| 4113 | } |
| 4114 | } |
| 4115 | --level; |
| @@ -4183,11 +4219,11 @@ | |
| 4183 | rc = f(state, ",", 1); |
| 4184 | if( 0 == rc ) |
| 4185 | { |
| 4186 | rc = doIndent |
| 4187 | ? cson_output_indent( f, state, fmt->indentation, level ) |
| 4188 | : f( state, " ", 1 ); |
| 4189 | } |
| 4190 | } |
| 4191 | } |
| 4192 | } |
| 4193 | --level; |
| @@ -4396,11 +4432,11 @@ | |
| 4396 | const cson_size_t oldCap = sb->capacity; |
| 4397 | const cson_size_t asz = npos * 2; |
| 4398 | if( asz < npos ) return cson_rc.ArgError; /* overflow */ |
| 4399 | else if( 0 != cson_buffer_reserve( sb, asz ) ) return cson_rc.AllocError; |
| 4400 | assert( (sb->capacity > oldCap) && "Internal error in memory buffer management!" ); |
| 4401 | /* make sure it gets NULL terminated. */ |
| 4402 | memset( sb->mem + oldCap, 0, (sb->capacity - oldCap) ); |
| 4403 | } |
| 4404 | for( i = 0; i < n; ++i, ++sb->used ) |
| 4405 | { |
| 4406 | sb->mem[sb->used] = data[i]; |
| 4407 |
| --- src/cson_amalgamation.c | |
| +++ src/cson_amalgamation.c | |
| @@ -1576,14 +1576,29 @@ | |
| 1576 | }; |
| 1577 | #define cson_string_empty_m {0/*length*/} |
| 1578 | static const cson_string cson_string_empty = cson_string_empty_m; |
| 1579 | |
| 1580 | |
| 1581 | /** |
| 1582 | Assumes V is a (cson_value*) ans V->value is a (T*). Returns |
| 1583 | V->value cast to a (T*). |
| 1584 | */ |
| 1585 | #define CSON_CAST(T,V) ((T*)((V)->value)) |
| 1586 | /** |
| 1587 | Assumes V is a pointer to memory which is allocated as part of a |
| 1588 | cson_value instance (the bytes immediately after that part). |
| 1589 | Returns a pointer a a cson_value by subtracting sizeof(cson_value) |
| 1590 | from that address and casting it to a (cson_value*) |
| 1591 | */ |
| 1592 | #define CSON_VCAST(V) ((cson_value *)(((unsigned char *)(V))-sizeof(cson_value))) |
| 1593 | |
| 1594 | /** |
| 1595 | CSON_INT(V) assumes that V is a (cson_value*) of type |
| 1596 | CSON_TYPE_INTEGER. This macro returns a (cson_int_t*) representing |
| 1597 | its value (how that is stored depends on whether we are running in |
| 1598 | 32- or 64-bit mode). |
| 1599 | */ |
| 1600 | #if CSON_VOID_PTR_IS_BIG |
| 1601 | # define CSON_INT(V) ((cson_int_t*)(&((V)->value))) |
| 1602 | #else |
| 1603 | # define CSON_INT(V) ((cson_int_t*)(V)->value) |
| 1604 | #endif |
| @@ -1592,14 +1607,12 @@ | |
| 1607 | #define CSON_STR(V) CSON_CAST(cson_string,(V)) |
| 1608 | #define CSON_OBJ(V) CSON_CAST(cson_object,(V)) |
| 1609 | #define CSON_ARRAY(V) CSON_CAST(cson_array,(V)) |
| 1610 | |
| 1611 | /** |
| 1612 | Holds special shared "constant" (though they are non-const) |
| 1613 | values. |
| 1614 | */ |
| 1615 | static struct CSON_EMPTY_HOLDER_ |
| 1616 | { |
| 1617 | char trueValue; |
| 1618 | cson_string stringValue; |
| @@ -1809,11 +1822,11 @@ | |
| 1822 | Frees any resources owned by val, but does not free val itself |
| 1823 | (which may be stack-allocated). If !val or val->api or |
| 1824 | val->api->cleanup are NULL then this is a no-op. |
| 1825 | |
| 1826 | If v is a container type (object or array) its children are also |
| 1827 | cleaned up, recursively. |
| 1828 | |
| 1829 | After calling this, val will have the special "undefined" type. |
| 1830 | */ |
| 1831 | static void cson_value_clean( cson_value * val ); |
| 1832 | |
| @@ -1889,11 +1902,11 @@ | |
| 1902 | |
| 1903 | |
| 1904 | /** |
| 1905 | Fetches v's string value as a non-const string. |
| 1906 | |
| 1907 | cson_strings are intended to be immutable, but this form provides |
| 1908 | access to the immutable bits, which are v->length bytes long. A |
| 1909 | length-0 string is returned as NULL from here, as opposed to |
| 1910 | "". (This is a side-effect of the string allocation mechanism.) |
| 1911 | Returns NULL if !v or if v is the internal empty-string singleton. |
| 1912 | */ |
| @@ -3781,11 +3794,31 @@ | |
| 3794 | assert( next > pos ); |
| 3795 | clen = next - pos; |
| 3796 | assert( clen ); |
| 3797 | if( 1 == clen ) |
| 3798 | { /* ASCII */ |
| 3799 | #if defined(CSON_FOSSIL_MODE) |
| 3800 | /* Workaround for fossil repo artifact |
| 3801 | f460839cff85d4e4f1360b366bb2858cef1411ea, |
| 3802 | which has what appears to be latin1-encoded |
| 3803 | text. file(1) thinks it's a FORTRAN program. |
| 3804 | */ |
| 3805 | if(0xfffd==ch){ |
| 3806 | assert(*pos != ch); |
| 3807 | /* MARKER("ch=%04x, *pos=%04x\n", ch, *pos); */ |
| 3808 | ch = *pos |
| 3809 | /* We should arguably translate to '?', and |
| 3810 | will if this problem ever comes up with a |
| 3811 | non-latin1 encoding. For latin1 this |
| 3812 | workaround incidentally corrects the output |
| 3813 | to proper UTF8-escaped characters, and only |
| 3814 | for that reason is it being kept around. |
| 3815 | */; |
| 3816 | goto assume_latin1; |
| 3817 | } |
| 3818 | #endif |
| 3819 | assert( (*pos == ch) && "Invalid UTF8" ); |
| 3820 | escChar[1] = 0; |
| 3821 | switch(ch) |
| 3822 | { |
| 3823 | case '\t': escChar[1] = 't'; break; |
| 3824 | case '\r': escChar[1] = 'r'; break; |
| @@ -3836,10 +3869,13 @@ | |
| 3869 | } |
| 3870 | continue; |
| 3871 | } |
| 3872 | else |
| 3873 | { /* UTF: transform it to \uXXXX */ |
| 3874 | #if defined(CSON_FOSSIL_MODE) |
| 3875 | assume_latin1: |
| 3876 | #endif |
| 3877 | memset(ubuf,0,UBLen); |
| 3878 | rc = sprintf(ubuf, "\\u%04x",ch); |
| 3879 | if( rc != 6 ) |
| 3880 | { |
| 3881 | rc = cson_rc.RangeError; |
| @@ -4105,11 +4141,11 @@ | |
| 4141 | rc = f(state, ",", 1); |
| 4142 | if( 0 == rc ) |
| 4143 | { |
| 4144 | rc = doIndent |
| 4145 | ? cson_output_indent( f, state, fmt->indentation, level ) |
| 4146 | : 0 /*f( state, " ", 1 )*/; |
| 4147 | } |
| 4148 | } |
| 4149 | } |
| 4150 | } |
| 4151 | --level; |
| @@ -4183,11 +4219,11 @@ | |
| 4219 | rc = f(state, ",", 1); |
| 4220 | if( 0 == rc ) |
| 4221 | { |
| 4222 | rc = doIndent |
| 4223 | ? cson_output_indent( f, state, fmt->indentation, level ) |
| 4224 | : 0 /*f( state, " ", 1 )*/; |
| 4225 | } |
| 4226 | } |
| 4227 | } |
| 4228 | } |
| 4229 | --level; |
| @@ -4396,11 +4432,11 @@ | |
| 4432 | const cson_size_t oldCap = sb->capacity; |
| 4433 | const cson_size_t asz = npos * 2; |
| 4434 | if( asz < npos ) return cson_rc.ArgError; /* overflow */ |
| 4435 | else if( 0 != cson_buffer_reserve( sb, asz ) ) return cson_rc.AllocError; |
| 4436 | assert( (sb->capacity > oldCap) && "Internal error in memory buffer management!" ); |
| 4437 | /* make sure it gets NUL terminated. */ |
| 4438 | memset( sb->mem + oldCap, 0, (sb->capacity - oldCap) ); |
| 4439 | } |
| 4440 | for( i = 0; i < n; ++i, ++sb->used ) |
| 4441 | { |
| 4442 | sb->mem[sb->used] = data[i]; |
| 4443 |
+4
-4
| --- src/diffcmd.c | ||
| +++ src/diffcmd.c | ||
| @@ -642,12 +642,12 @@ | ||
| 642 | 642 | @ proc colType {c} { |
| 643 | 643 | @ regexp {[a-z]+} $c type |
| 644 | 644 | @ return $type |
| 645 | 645 | @ } |
| 646 | 646 | @ |
| 647 | -@ proc readDiffs {cmd} { | |
| 648 | -@ set in [open $cmd r] | |
| 647 | +@ proc readDiffs {fossilcmd} { | |
| 648 | +@ set in [open $fossilcmd r] | |
| 649 | 649 | @ fconfigure $in -encoding utf-8 |
| 650 | 650 | @ set nDiffs 0 |
| 651 | 651 | @ array set widths {txt 0 ln 0 mkr 0} |
| 652 | 652 | @ while {[gets $in line] != -1} { |
| 653 | 653 | @ if {![regexp {^=+\s+(.*?)\s+=+$} $line all fn]} { |
| @@ -883,11 +883,11 @@ | ||
| 883 | 883 | @ ::ttk::scrollbar .sby -command {.txtA yview} -orient vertical |
| 884 | 884 | @ ::ttk::scrollbar .sbxA -command {.txtA xview} -orient horizontal |
| 885 | 885 | @ ::ttk::scrollbar .sbxB -command {.txtB xview} -orient horizontal |
| 886 | 886 | @ frame .spacer |
| 887 | 887 | @ |
| 888 | -@ if {[readDiffs $cmd] == 0} { | |
| 888 | +@ if {[readDiffs $fossilcmd] == 0} { | |
| 889 | 889 | @ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes" |
| 890 | 890 | @ exit |
| 891 | 891 | @ } |
| 892 | 892 | @ update idletasks |
| 893 | 893 | @ |
| @@ -918,11 +918,11 @@ | ||
| 918 | 918 | int i; |
| 919 | 919 | Blob script; |
| 920 | 920 | char *zTempFile; |
| 921 | 921 | char *zCmd; |
| 922 | 922 | blob_zero(&script); |
| 923 | - blob_appendf(&script, "set cmd {| \"%/\" %s --html -y -i -v", | |
| 923 | + blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v", | |
| 924 | 924 | g.nameOfExe, zSubCmd); |
| 925 | 925 | for(i=firstArg; i<g.argc; i++){ |
| 926 | 926 | const char *z = g.argv[i]; |
| 927 | 927 | if( z[0]=='-' ){ |
| 928 | 928 | if( strglob("*-html",z) ) continue; |
| 929 | 929 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -642,12 +642,12 @@ | |
| 642 | @ proc colType {c} { |
| 643 | @ regexp {[a-z]+} $c type |
| 644 | @ return $type |
| 645 | @ } |
| 646 | @ |
| 647 | @ proc readDiffs {cmd} { |
| 648 | @ set in [open $cmd r] |
| 649 | @ fconfigure $in -encoding utf-8 |
| 650 | @ set nDiffs 0 |
| 651 | @ array set widths {txt 0 ln 0 mkr 0} |
| 652 | @ while {[gets $in line] != -1} { |
| 653 | @ if {![regexp {^=+\s+(.*?)\s+=+$} $line all fn]} { |
| @@ -883,11 +883,11 @@ | |
| 883 | @ ::ttk::scrollbar .sby -command {.txtA yview} -orient vertical |
| 884 | @ ::ttk::scrollbar .sbxA -command {.txtA xview} -orient horizontal |
| 885 | @ ::ttk::scrollbar .sbxB -command {.txtB xview} -orient horizontal |
| 886 | @ frame .spacer |
| 887 | @ |
| 888 | @ if {[readDiffs $cmd] == 0} { |
| 889 | @ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes" |
| 890 | @ exit |
| 891 | @ } |
| 892 | @ update idletasks |
| 893 | @ |
| @@ -918,11 +918,11 @@ | |
| 918 | int i; |
| 919 | Blob script; |
| 920 | char *zTempFile; |
| 921 | char *zCmd; |
| 922 | blob_zero(&script); |
| 923 | blob_appendf(&script, "set cmd {| \"%/\" %s --html -y -i -v", |
| 924 | g.nameOfExe, zSubCmd); |
| 925 | for(i=firstArg; i<g.argc; i++){ |
| 926 | const char *z = g.argv[i]; |
| 927 | if( z[0]=='-' ){ |
| 928 | if( strglob("*-html",z) ) continue; |
| 929 |
| --- src/diffcmd.c | |
| +++ src/diffcmd.c | |
| @@ -642,12 +642,12 @@ | |
| 642 | @ proc colType {c} { |
| 643 | @ regexp {[a-z]+} $c type |
| 644 | @ return $type |
| 645 | @ } |
| 646 | @ |
| 647 | @ proc readDiffs {fossilcmd} { |
| 648 | @ set in [open $fossilcmd r] |
| 649 | @ fconfigure $in -encoding utf-8 |
| 650 | @ set nDiffs 0 |
| 651 | @ array set widths {txt 0 ln 0 mkr 0} |
| 652 | @ while {[gets $in line] != -1} { |
| 653 | @ if {![regexp {^=+\s+(.*?)\s+=+$} $line all fn]} { |
| @@ -883,11 +883,11 @@ | |
| 883 | @ ::ttk::scrollbar .sby -command {.txtA yview} -orient vertical |
| 884 | @ ::ttk::scrollbar .sbxA -command {.txtA xview} -orient horizontal |
| 885 | @ ::ttk::scrollbar .sbxB -command {.txtB xview} -orient horizontal |
| 886 | @ frame .spacer |
| 887 | @ |
| 888 | @ if {[readDiffs $fossilcmd] == 0} { |
| 889 | @ tk_messageBox -type ok -title $CFG(TITLE) -message "No changes" |
| 890 | @ exit |
| 891 | @ } |
| 892 | @ update idletasks |
| 893 | @ |
| @@ -918,11 +918,11 @@ | |
| 918 | int i; |
| 919 | Blob script; |
| 920 | char *zTempFile; |
| 921 | char *zCmd; |
| 922 | blob_zero(&script); |
| 923 | blob_appendf(&script, "set fossilcmd {| \"%/\" %s --html -y -i -v", |
| 924 | g.nameOfExe, zSubCmd); |
| 925 | for(i=firstArg; i<g.argc; i++){ |
| 926 | const char *z = g.argv[i]; |
| 927 | if( z[0]=='-' ){ |
| 928 | if( strglob("*-html",z) ) continue; |
| 929 |
+3
-3
| --- src/json_artifact.c | ||
| +++ src/json_artifact.c | ||
| @@ -131,11 +131,11 @@ | ||
| 131 | 131 | zEUser = db_text(0, |
| 132 | 132 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 133 | 133 | TAG_USER, rid); |
| 134 | 134 | if(zEUser){ |
| 135 | 135 | SET("user", json_new_string(zEUser)); |
| 136 | - if(0!=strcmp(zEUser,zUser)){ | |
| 136 | + if(0!=fossil_strcmp(zEUser,zUser)){ | |
| 137 | 137 | SET("originUser",json_new_string(zUser)); |
| 138 | 138 | } |
| 139 | 139 | free(zEUser); |
| 140 | 140 | }else{ |
| 141 | 141 | SET("user",json_new_string(zUser)); |
| @@ -145,11 +145,11 @@ | ||
| 145 | 145 | zEComment = db_text(0, |
| 146 | 146 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 147 | 147 | TAG_COMMENT, rid); |
| 148 | 148 | if(zEComment){ |
| 149 | 149 | SET("comment",json_new_string(zEComment)); |
| 150 | - if(0 != strcmp(zEComment,zComment)){ | |
| 150 | + if(0 != fossil_strcmp(zEComment,zComment)){ | |
| 151 | 151 | SET("originComment", json_new_string(zComment)); |
| 152 | 152 | } |
| 153 | 153 | free(zEComment); |
| 154 | 154 | }else{ |
| 155 | 155 | SET("comment",json_new_string(zComment)); |
| @@ -470,11 +470,11 @@ | ||
| 470 | 470 | |
| 471 | 471 | handle_entry: |
| 472 | 472 | pay = cson_new_object(); |
| 473 | 473 | assert( (NULL != zType) && "Internal dispatching error." ); |
| 474 | 474 | for( ; dispatcher->name; ++dispatcher ){ |
| 475 | - if(0!=strcmp(dispatcher->name, zType)){ | |
| 475 | + if(0!=fossil_strcmp(dispatcher->name, zType)){ | |
| 476 | 476 | continue; |
| 477 | 477 | }else{ |
| 478 | 478 | entry = (*dispatcher->func)(pay, rid); |
| 479 | 479 | break; |
| 480 | 480 | } |
| 481 | 481 |
| --- src/json_artifact.c | |
| +++ src/json_artifact.c | |
| @@ -131,11 +131,11 @@ | |
| 131 | zEUser = db_text(0, |
| 132 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 133 | TAG_USER, rid); |
| 134 | if(zEUser){ |
| 135 | SET("user", json_new_string(zEUser)); |
| 136 | if(0!=strcmp(zEUser,zUser)){ |
| 137 | SET("originUser",json_new_string(zUser)); |
| 138 | } |
| 139 | free(zEUser); |
| 140 | }else{ |
| 141 | SET("user",json_new_string(zUser)); |
| @@ -145,11 +145,11 @@ | |
| 145 | zEComment = db_text(0, |
| 146 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 147 | TAG_COMMENT, rid); |
| 148 | if(zEComment){ |
| 149 | SET("comment",json_new_string(zEComment)); |
| 150 | if(0 != strcmp(zEComment,zComment)){ |
| 151 | SET("originComment", json_new_string(zComment)); |
| 152 | } |
| 153 | free(zEComment); |
| 154 | }else{ |
| 155 | SET("comment",json_new_string(zComment)); |
| @@ -470,11 +470,11 @@ | |
| 470 | |
| 471 | handle_entry: |
| 472 | pay = cson_new_object(); |
| 473 | assert( (NULL != zType) && "Internal dispatching error." ); |
| 474 | for( ; dispatcher->name; ++dispatcher ){ |
| 475 | if(0!=strcmp(dispatcher->name, zType)){ |
| 476 | continue; |
| 477 | }else{ |
| 478 | entry = (*dispatcher->func)(pay, rid); |
| 479 | break; |
| 480 | } |
| 481 |
| --- src/json_artifact.c | |
| +++ src/json_artifact.c | |
| @@ -131,11 +131,11 @@ | |
| 131 | zEUser = db_text(0, |
| 132 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 133 | TAG_USER, rid); |
| 134 | if(zEUser){ |
| 135 | SET("user", json_new_string(zEUser)); |
| 136 | if(0!=fossil_strcmp(zEUser,zUser)){ |
| 137 | SET("originUser",json_new_string(zUser)); |
| 138 | } |
| 139 | free(zEUser); |
| 140 | }else{ |
| 141 | SET("user",json_new_string(zUser)); |
| @@ -145,11 +145,11 @@ | |
| 145 | zEComment = db_text(0, |
| 146 | "SELECT value FROM tagxref WHERE tagid=%d AND rid=%d", |
| 147 | TAG_COMMENT, rid); |
| 148 | if(zEComment){ |
| 149 | SET("comment",json_new_string(zEComment)); |
| 150 | if(0 != fossil_strcmp(zEComment,zComment)){ |
| 151 | SET("originComment", json_new_string(zComment)); |
| 152 | } |
| 153 | free(zEComment); |
| 154 | }else{ |
| 155 | SET("comment",json_new_string(zComment)); |
| @@ -470,11 +470,11 @@ | |
| 470 | |
| 471 | handle_entry: |
| 472 | pay = cson_new_object(); |
| 473 | assert( (NULL != zType) && "Internal dispatching error." ); |
| 474 | for( ; dispatcher->name; ++dispatcher ){ |
| 475 | if(0!=fossil_strcmp(dispatcher->name, zType)){ |
| 476 | continue; |
| 477 | }else{ |
| 478 | entry = (*dispatcher->func)(pay, rid); |
| 479 | break; |
| 480 | } |
| 481 |
-17
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -1859,28 +1859,11 @@ | ||
| 1859 | 1859 | zBrowser = db_get("web-browser", 0); |
| 1860 | 1860 | if( zBrowser==0 ){ |
| 1861 | 1861 | static const char *const azBrowserProg[] = |
| 1862 | 1862 | { "xdg-open", "gnome-open", "firefox", "google-chrome" }; |
| 1863 | 1863 | int i; |
| 1864 | -#if defined(__CYGWIN__) | |
| 1865 | - const char *path = fossil_getenv("ProgramFiles(x86)"); | |
| 1866 | - if( !path ){ | |
| 1867 | - path = fossil_getenv("PROGRAMFILES"); | |
| 1868 | - } | |
| 1869 | - path = fossil_utf8_to_filename(path); | |
| 1870 | - zBrowser = mprintf("%s/Google/Chrome/Application/chrome.exe", path); | |
| 1871 | - if( file_access(zBrowser, X_OK) ){ | |
| 1872 | - zBrowser = mprintf("%s/Mozilla Firefox/firefox.exe", path); | |
| 1873 | - } | |
| 1874 | - if( file_access(zBrowser, X_OK) ){ | |
| 1875 | - path = fossil_utf8_to_filename(fossil_getenv("PROGRAMFILES")); | |
| 1876 | - zBrowser = mprintf("%s/Internet Explorer/iexplore.exe", path); | |
| 1877 | - } | |
| 1878 | - zBrowser = mprintf("\"%s\"", zBrowser); | |
| 1879 | -#else | |
| 1880 | 1864 | zBrowser = "echo"; |
| 1881 | -#endif | |
| 1882 | 1865 | for(i=0; i<sizeof(azBrowserProg)/sizeof(azBrowserProg[0]); i++){ |
| 1883 | 1866 | if( binaryOnPath(azBrowserProg[i]) ){ |
| 1884 | 1867 | zBrowser = azBrowserProg[i]; |
| 1885 | 1868 | break; |
| 1886 | 1869 | } |
| 1887 | 1870 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1859,28 +1859,11 @@ | |
| 1859 | zBrowser = db_get("web-browser", 0); |
| 1860 | if( zBrowser==0 ){ |
| 1861 | static const char *const azBrowserProg[] = |
| 1862 | { "xdg-open", "gnome-open", "firefox", "google-chrome" }; |
| 1863 | int i; |
| 1864 | #if defined(__CYGWIN__) |
| 1865 | const char *path = fossil_getenv("ProgramFiles(x86)"); |
| 1866 | if( !path ){ |
| 1867 | path = fossil_getenv("PROGRAMFILES"); |
| 1868 | } |
| 1869 | path = fossil_utf8_to_filename(path); |
| 1870 | zBrowser = mprintf("%s/Google/Chrome/Application/chrome.exe", path); |
| 1871 | if( file_access(zBrowser, X_OK) ){ |
| 1872 | zBrowser = mprintf("%s/Mozilla Firefox/firefox.exe", path); |
| 1873 | } |
| 1874 | if( file_access(zBrowser, X_OK) ){ |
| 1875 | path = fossil_utf8_to_filename(fossil_getenv("PROGRAMFILES")); |
| 1876 | zBrowser = mprintf("%s/Internet Explorer/iexplore.exe", path); |
| 1877 | } |
| 1878 | zBrowser = mprintf("\"%s\"", zBrowser); |
| 1879 | #else |
| 1880 | zBrowser = "echo"; |
| 1881 | #endif |
| 1882 | for(i=0; i<sizeof(azBrowserProg)/sizeof(azBrowserProg[0]); i++){ |
| 1883 | if( binaryOnPath(azBrowserProg[i]) ){ |
| 1884 | zBrowser = azBrowserProg[i]; |
| 1885 | break; |
| 1886 | } |
| 1887 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -1859,28 +1859,11 @@ | |
| 1859 | zBrowser = db_get("web-browser", 0); |
| 1860 | if( zBrowser==0 ){ |
| 1861 | static const char *const azBrowserProg[] = |
| 1862 | { "xdg-open", "gnome-open", "firefox", "google-chrome" }; |
| 1863 | int i; |
| 1864 | zBrowser = "echo"; |
| 1865 | for(i=0; i<sizeof(azBrowserProg)/sizeof(azBrowserProg[0]); i++){ |
| 1866 | if( binaryOnPath(azBrowserProg[i]) ){ |
| 1867 | zBrowser = azBrowserProg[i]; |
| 1868 | break; |
| 1869 | } |
| 1870 |
+2
-1
| --- src/stash.c | ||
| +++ src/stash.c | ||
| @@ -158,11 +158,11 @@ | ||
| 158 | 158 | zComment = find_option("comment", "m", 1); |
| 159 | 159 | verify_all_options(); |
| 160 | 160 | if( zComment==0 ){ |
| 161 | 161 | Blob prompt; /* Prompt for stash comment */ |
| 162 | 162 | Blob comment; /* User comment reply */ |
| 163 | -#ifdef _WIN32 | |
| 163 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 164 | 164 | int bomSize; |
| 165 | 165 | const unsigned char *bom = get_utf8_bom(&bomSize); |
| 166 | 166 | blob_init(&prompt, (const char *) bom, bomSize); |
| 167 | 167 | #else |
| 168 | 168 | blob_zero(&prompt); |
| @@ -639,10 +639,11 @@ | ||
| 639 | 639 | } |
| 640 | 640 | if( find_option("internal","i",0)==0 ){ |
| 641 | 641 | zDiffCmd = diff_command_external(0); |
| 642 | 642 | } |
| 643 | 643 | diffFlags = diff_options(); |
| 644 | + if( find_option("verbose","v",0)!=0 ) diffFlags |= DIFF_VERBOSE; | |
| 644 | 645 | if( g.argc>4 ) usage(mprintf("%s STASHID", zCmd)); |
| 645 | 646 | if( zDiffCmd ){ |
| 646 | 647 | zBinGlob = diff_get_binary_glob(); |
| 647 | 648 | fIncludeBinary = diff_include_binary_files(); |
| 648 | 649 | } |
| 649 | 650 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -158,11 +158,11 @@ | |
| 158 | zComment = find_option("comment", "m", 1); |
| 159 | verify_all_options(); |
| 160 | if( zComment==0 ){ |
| 161 | Blob prompt; /* Prompt for stash comment */ |
| 162 | Blob comment; /* User comment reply */ |
| 163 | #ifdef _WIN32 |
| 164 | int bomSize; |
| 165 | const unsigned char *bom = get_utf8_bom(&bomSize); |
| 166 | blob_init(&prompt, (const char *) bom, bomSize); |
| 167 | #else |
| 168 | blob_zero(&prompt); |
| @@ -639,10 +639,11 @@ | |
| 639 | } |
| 640 | if( find_option("internal","i",0)==0 ){ |
| 641 | zDiffCmd = diff_command_external(0); |
| 642 | } |
| 643 | diffFlags = diff_options(); |
| 644 | if( g.argc>4 ) usage(mprintf("%s STASHID", zCmd)); |
| 645 | if( zDiffCmd ){ |
| 646 | zBinGlob = diff_get_binary_glob(); |
| 647 | fIncludeBinary = diff_include_binary_files(); |
| 648 | } |
| 649 |
| --- src/stash.c | |
| +++ src/stash.c | |
| @@ -158,11 +158,11 @@ | |
| 158 | zComment = find_option("comment", "m", 1); |
| 159 | verify_all_options(); |
| 160 | if( zComment==0 ){ |
| 161 | Blob prompt; /* Prompt for stash comment */ |
| 162 | Blob comment; /* User comment reply */ |
| 163 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 164 | int bomSize; |
| 165 | const unsigned char *bom = get_utf8_bom(&bomSize); |
| 166 | blob_init(&prompt, (const char *) bom, bomSize); |
| 167 | #else |
| 168 | blob_zero(&prompt); |
| @@ -639,10 +639,11 @@ | |
| 639 | } |
| 640 | if( find_option("internal","i",0)==0 ){ |
| 641 | zDiffCmd = diff_command_external(0); |
| 642 | } |
| 643 | diffFlags = diff_options(); |
| 644 | if( find_option("verbose","v",0)!=0 ) diffFlags |= DIFF_VERBOSE; |
| 645 | if( g.argc>4 ) usage(mprintf("%s STASHID", zCmd)); |
| 646 | if( zDiffCmd ){ |
| 647 | zBinGlob = diff_get_binary_glob(); |
| 648 | fIncludeBinary = diff_include_binary_files(); |
| 649 | } |
| 650 |
+1
| --- src/style.c | ||
| +++ src/style.c | ||
| @@ -263,10 +263,11 @@ | ||
| 263 | 263 | Th_Store("title", zTitle); |
| 264 | 264 | Th_Store("baseurl", g.zBaseURL); |
| 265 | 265 | Th_Store("home", g.zTop); |
| 266 | 266 | Th_Store("index_page", db_get("index-page","/home")); |
| 267 | 267 | Th_Store("current_page", local_zCurrentPage ? local_zCurrentPage : g.zPath); |
| 268 | + Th_Store("csrf_token", g.zCsrfToken); | |
| 268 | 269 | Th_Store("release_version", RELEASE_VERSION); |
| 269 | 270 | Th_Store("manifest_version", MANIFEST_VERSION); |
| 270 | 271 | Th_Store("manifest_date", MANIFEST_DATE); |
| 271 | 272 | Th_Store("compiler_name", COMPILER_NAME); |
| 272 | 273 | if( g.zLogin ){ |
| 273 | 274 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -263,10 +263,11 @@ | |
| 263 | Th_Store("title", zTitle); |
| 264 | Th_Store("baseurl", g.zBaseURL); |
| 265 | Th_Store("home", g.zTop); |
| 266 | Th_Store("index_page", db_get("index-page","/home")); |
| 267 | Th_Store("current_page", local_zCurrentPage ? local_zCurrentPage : g.zPath); |
| 268 | Th_Store("release_version", RELEASE_VERSION); |
| 269 | Th_Store("manifest_version", MANIFEST_VERSION); |
| 270 | Th_Store("manifest_date", MANIFEST_DATE); |
| 271 | Th_Store("compiler_name", COMPILER_NAME); |
| 272 | if( g.zLogin ){ |
| 273 |
| --- src/style.c | |
| +++ src/style.c | |
| @@ -263,10 +263,11 @@ | |
| 263 | Th_Store("title", zTitle); |
| 264 | Th_Store("baseurl", g.zBaseURL); |
| 265 | Th_Store("home", g.zTop); |
| 266 | Th_Store("index_page", db_get("index-page","/home")); |
| 267 | Th_Store("current_page", local_zCurrentPage ? local_zCurrentPage : g.zPath); |
| 268 | Th_Store("csrf_token", g.zCsrfToken); |
| 269 | Th_Store("release_version", RELEASE_VERSION); |
| 270 | Th_Store("manifest_version", MANIFEST_VERSION); |
| 271 | Th_Store("manifest_date", MANIFEST_DATE); |
| 272 | Th_Store("compiler_name", COMPILER_NAME); |
| 273 | if( g.zLogin ){ |
| 274 |
+20
-9
| --- src/xfer.c | ||
| +++ src/xfer.c | ||
| @@ -1318,10 +1318,17 @@ | ||
| 1318 | 1318 | #define SYNC_CLONE 0x0004 |
| 1319 | 1319 | #define SYNC_PRIVATE 0x0008 |
| 1320 | 1320 | #define SYNC_VERBOSE 0x0010 |
| 1321 | 1321 | #define SYNC_RESYNC 0x0020 |
| 1322 | 1322 | #endif |
| 1323 | + | |
| 1324 | +/* | |
| 1325 | +** Floating-point absolute value | |
| 1326 | +*/ | |
| 1327 | +static double fossil_fabs(double x){ | |
| 1328 | + return x>0.0 ? x : -x; | |
| 1329 | +} | |
| 1323 | 1330 | |
| 1324 | 1331 | /* |
| 1325 | 1332 | ** Sync to the host identified in g.urlName and g.urlPath. This |
| 1326 | 1333 | ** routine is called by the client. |
| 1327 | 1334 | ** |
| @@ -1356,10 +1363,11 @@ | ||
| 1356 | 1363 | int nErr = 0; /* Number of errors */ |
| 1357 | 1364 | int nRoundtrip= 0; /* Number of HTTP requests */ |
| 1358 | 1365 | int nArtifactSent = 0; /* Total artifacts sent */ |
| 1359 | 1366 | int nArtifactRcvd = 0; /* Total artifacts received */ |
| 1360 | 1367 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ |
| 1368 | + double rSkew = 0.0; /* Maximum time skew */ | |
| 1361 | 1369 | |
| 1362 | 1370 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 1363 | 1371 | if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE))==0 |
| 1364 | 1372 | && configRcvMask==0 && configSendMask==0 ) return 0; |
| 1365 | 1373 | |
| @@ -1554,19 +1562,12 @@ | ||
| 1554 | 1562 | double rDiff; |
| 1555 | 1563 | sqlite3_snprintf(sizeof(zTime), zTime, "%.19s", &zLine[12]); |
| 1556 | 1564 | rDiff = db_double(9e99, "SELECT julianday('%q') - %.17g", |
| 1557 | 1565 | zTime, rArrivalTime); |
| 1558 | 1566 | if( rDiff>9e98 || rDiff<-9e98 ) rDiff = 0.0; |
| 1559 | - if( (rDiff*24.0*3600.0) > 10.0 ){ | |
| 1560 | - fossil_warning("*** time skew *** server is fast by %s", | |
| 1561 | - db_timespan_name(rDiff)); | |
| 1562 | - g.clockSkewSeen = 1; | |
| 1563 | - }else if( rDiff*24.0*3600.0 < -(blob_size(&recv)/5000.0 + 20.0) ){ | |
| 1564 | - fossil_warning("*** time skew *** server is slow by %s", | |
| 1565 | - db_timespan_name(-rDiff)); | |
| 1566 | - g.clockSkewSeen = 1; | |
| 1567 | - } | |
| 1567 | + if( rDiff*24.0*3600.0 >= -(blob_size(&recv)/5000.0 + 20) ) rDiff = 0.0; | |
| 1568 | + if( fossil_fabs(rDiff)>fossil_fabs(rSkew) ) rSkew = rDiff; | |
| 1568 | 1569 | } |
| 1569 | 1570 | nCardRcvd++; |
| 1570 | 1571 | continue; |
| 1571 | 1572 | } |
| 1572 | 1573 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| @@ -1856,10 +1857,20 @@ | ||
| 1856 | 1857 | ** information which is only sent on the second round. |
| 1857 | 1858 | */ |
| 1858 | 1859 | if( cloneSeqno<=0 && nCycle>1 ) go = 0; |
| 1859 | 1860 | }; |
| 1860 | 1861 | transport_stats(&nSent, &nRcvd, 1); |
| 1862 | + if( (rSkew*24.0*3600.0) > 10.0 ){ | |
| 1863 | + fossil_warning("*** time skew *** server is fast by %s", | |
| 1864 | + db_timespan_name(rSkew)); | |
| 1865 | + g.clockSkewSeen = 1; | |
| 1866 | + }else if( rSkew*24.0*3600.0 < -10.0 ){ | |
| 1867 | + fossil_warning("*** time skew *** server is slow by %s", | |
| 1868 | + db_timespan_name(-rSkew)); | |
| 1869 | + g.clockSkewSeen = 1; | |
| 1870 | + } | |
| 1871 | + | |
| 1861 | 1872 | fossil_force_newline(); |
| 1862 | 1873 | fossil_print( |
| 1863 | 1874 | "%s finished with %lld bytes sent, %lld bytes received\n", |
| 1864 | 1875 | zOpType, nSent, nRcvd); |
| 1865 | 1876 | transport_close(); |
| 1866 | 1877 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1318,10 +1318,17 @@ | |
| 1318 | #define SYNC_CLONE 0x0004 |
| 1319 | #define SYNC_PRIVATE 0x0008 |
| 1320 | #define SYNC_VERBOSE 0x0010 |
| 1321 | #define SYNC_RESYNC 0x0020 |
| 1322 | #endif |
| 1323 | |
| 1324 | /* |
| 1325 | ** Sync to the host identified in g.urlName and g.urlPath. This |
| 1326 | ** routine is called by the client. |
| 1327 | ** |
| @@ -1356,10 +1363,11 @@ | |
| 1356 | int nErr = 0; /* Number of errors */ |
| 1357 | int nRoundtrip= 0; /* Number of HTTP requests */ |
| 1358 | int nArtifactSent = 0; /* Total artifacts sent */ |
| 1359 | int nArtifactRcvd = 0; /* Total artifacts received */ |
| 1360 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ |
| 1361 | |
| 1362 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 1363 | if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE))==0 |
| 1364 | && configRcvMask==0 && configSendMask==0 ) return 0; |
| 1365 | |
| @@ -1554,19 +1562,12 @@ | |
| 1554 | double rDiff; |
| 1555 | sqlite3_snprintf(sizeof(zTime), zTime, "%.19s", &zLine[12]); |
| 1556 | rDiff = db_double(9e99, "SELECT julianday('%q') - %.17g", |
| 1557 | zTime, rArrivalTime); |
| 1558 | if( rDiff>9e98 || rDiff<-9e98 ) rDiff = 0.0; |
| 1559 | if( (rDiff*24.0*3600.0) > 10.0 ){ |
| 1560 | fossil_warning("*** time skew *** server is fast by %s", |
| 1561 | db_timespan_name(rDiff)); |
| 1562 | g.clockSkewSeen = 1; |
| 1563 | }else if( rDiff*24.0*3600.0 < -(blob_size(&recv)/5000.0 + 20.0) ){ |
| 1564 | fossil_warning("*** time skew *** server is slow by %s", |
| 1565 | db_timespan_name(-rDiff)); |
| 1566 | g.clockSkewSeen = 1; |
| 1567 | } |
| 1568 | } |
| 1569 | nCardRcvd++; |
| 1570 | continue; |
| 1571 | } |
| 1572 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| @@ -1856,10 +1857,20 @@ | |
| 1856 | ** information which is only sent on the second round. |
| 1857 | */ |
| 1858 | if( cloneSeqno<=0 && nCycle>1 ) go = 0; |
| 1859 | }; |
| 1860 | transport_stats(&nSent, &nRcvd, 1); |
| 1861 | fossil_force_newline(); |
| 1862 | fossil_print( |
| 1863 | "%s finished with %lld bytes sent, %lld bytes received\n", |
| 1864 | zOpType, nSent, nRcvd); |
| 1865 | transport_close(); |
| 1866 |
| --- src/xfer.c | |
| +++ src/xfer.c | |
| @@ -1318,10 +1318,17 @@ | |
| 1318 | #define SYNC_CLONE 0x0004 |
| 1319 | #define SYNC_PRIVATE 0x0008 |
| 1320 | #define SYNC_VERBOSE 0x0010 |
| 1321 | #define SYNC_RESYNC 0x0020 |
| 1322 | #endif |
| 1323 | |
| 1324 | /* |
| 1325 | ** Floating-point absolute value |
| 1326 | */ |
| 1327 | static double fossil_fabs(double x){ |
| 1328 | return x>0.0 ? x : -x; |
| 1329 | } |
| 1330 | |
| 1331 | /* |
| 1332 | ** Sync to the host identified in g.urlName and g.urlPath. This |
| 1333 | ** routine is called by the client. |
| 1334 | ** |
| @@ -1356,10 +1363,11 @@ | |
| 1363 | int nErr = 0; /* Number of errors */ |
| 1364 | int nRoundtrip= 0; /* Number of HTTP requests */ |
| 1365 | int nArtifactSent = 0; /* Total artifacts sent */ |
| 1366 | int nArtifactRcvd = 0; /* Total artifacts received */ |
| 1367 | const char *zOpType = 0;/* Push, Pull, Sync, Clone */ |
| 1368 | double rSkew = 0.0; /* Maximum time skew */ |
| 1369 | |
| 1370 | if( db_get_boolean("dont-push", 0) ) syncFlags &= ~SYNC_PUSH; |
| 1371 | if( (syncFlags & (SYNC_PUSH|SYNC_PULL|SYNC_CLONE))==0 |
| 1372 | && configRcvMask==0 && configSendMask==0 ) return 0; |
| 1373 | |
| @@ -1554,19 +1562,12 @@ | |
| 1562 | double rDiff; |
| 1563 | sqlite3_snprintf(sizeof(zTime), zTime, "%.19s", &zLine[12]); |
| 1564 | rDiff = db_double(9e99, "SELECT julianday('%q') - %.17g", |
| 1565 | zTime, rArrivalTime); |
| 1566 | if( rDiff>9e98 || rDiff<-9e98 ) rDiff = 0.0; |
| 1567 | if( rDiff*24.0*3600.0 >= -(blob_size(&recv)/5000.0 + 20) ) rDiff = 0.0; |
| 1568 | if( fossil_fabs(rDiff)>fossil_fabs(rSkew) ) rSkew = rDiff; |
| 1569 | } |
| 1570 | nCardRcvd++; |
| 1571 | continue; |
| 1572 | } |
| 1573 | xfer.nToken = blob_tokenize(&xfer.line, xfer.aToken, count(xfer.aToken)); |
| @@ -1856,10 +1857,20 @@ | |
| 1857 | ** information which is only sent on the second round. |
| 1858 | */ |
| 1859 | if( cloneSeqno<=0 && nCycle>1 ) go = 0; |
| 1860 | }; |
| 1861 | transport_stats(&nSent, &nRcvd, 1); |
| 1862 | if( (rSkew*24.0*3600.0) > 10.0 ){ |
| 1863 | fossil_warning("*** time skew *** server is fast by %s", |
| 1864 | db_timespan_name(rSkew)); |
| 1865 | g.clockSkewSeen = 1; |
| 1866 | }else if( rSkew*24.0*3600.0 < -10.0 ){ |
| 1867 | fossil_warning("*** time skew *** server is slow by %s", |
| 1868 | db_timespan_name(-rSkew)); |
| 1869 | g.clockSkewSeen = 1; |
| 1870 | } |
| 1871 | |
| 1872 | fossil_force_newline(); |
| 1873 | fossil_print( |
| 1874 | "%s finished with %lld bytes sent, %lld bytes received\n", |
| 1875 | zOpType, nSent, nRcvd); |
| 1876 | transport_close(); |
| 1877 |
+2
-1
| --- test/release-checklist.wiki | ||
| +++ test/release-checklist.wiki | ||
| @@ -55,11 +55,12 @@ | ||
| 55 | 55 | <li> <b>valgrind fossil rebuild</b> |
| 56 | 56 | <li> <b>valgrind fossil sync</b> |
| 57 | 57 | </ol> |
| 58 | 58 | |
| 59 | 59 | <li><p> |
| 60 | -Inspect all code changes since the previous release, paying particular | |
| 60 | + | |
| 61 | +Inspect [http://www.fossil-scm.org/index.html/vdiff?from=release&to=trunk&sbs=1|all code changes since the previous release], paying particular | |
| 61 | 62 | attention to the following details: |
| 62 | 63 | <ol type="a"> |
| 63 | 64 | <li> Can a malicious HTTP request cause a buffer overrun. |
| 64 | 65 | <li> Can a malicious HTTP request expose privileged information to |
| 65 | 66 | unauthorized users. |
| 66 | 67 |
| --- test/release-checklist.wiki | |
| +++ test/release-checklist.wiki | |
| @@ -55,11 +55,12 @@ | |
| 55 | <li> <b>valgrind fossil rebuild</b> |
| 56 | <li> <b>valgrind fossil sync</b> |
| 57 | </ol> |
| 58 | |
| 59 | <li><p> |
| 60 | Inspect all code changes since the previous release, paying particular |
| 61 | attention to the following details: |
| 62 | <ol type="a"> |
| 63 | <li> Can a malicious HTTP request cause a buffer overrun. |
| 64 | <li> Can a malicious HTTP request expose privileged information to |
| 65 | unauthorized users. |
| 66 |
| --- test/release-checklist.wiki | |
| +++ test/release-checklist.wiki | |
| @@ -55,11 +55,12 @@ | |
| 55 | <li> <b>valgrind fossil rebuild</b> |
| 56 | <li> <b>valgrind fossil sync</b> |
| 57 | </ol> |
| 58 | |
| 59 | <li><p> |
| 60 | |
| 61 | Inspect [http://www.fossil-scm.org/index.html/vdiff?from=release&to=trunk&sbs=1|all code changes since the previous release], paying particular |
| 62 | attention to the following details: |
| 63 | <ol type="a"> |
| 64 | <li> Can a malicious HTTP request cause a buffer overrun. |
| 65 | <li> Can a malicious HTTP request expose privileged information to |
| 66 | unauthorized users. |
| 67 |
+7
| --- www/changes.wiki | ||
| +++ www/changes.wiki | ||
| @@ -15,10 +15,17 @@ | ||
| 15 | 15 | part of a repository database file, corrupting it. This problem has only |
| 16 | 16 | been seen once in the wild. |
| 17 | 17 | * Added support for unlimited line lengths in side-by-side diffs. |
| 18 | 18 | * New --close option to [/help?cmd=commit | fossil commit], which |
| 19 | 19 | immediately closes the branch being committed. |
| 20 | + * Added <tt>chart</tt> option to [/help?cmd=bisect | fossil bisect]. | |
| 21 | + * Improvements to the "human or bot?" determination. | |
| 22 | + * Reports errors about missing CGI-standard environment variables for HTTP | |
| 23 | + servers which do not support them. | |
| 24 | + * Minor improvements to sync support on Windows. | |
| 25 | + * Added <tt>--scgi</tt> option to [/help?cmd=server | fossil server]. | |
| 26 | + * Internal improvements to the sync process. | |
| 20 | 27 | |
| 21 | 28 | <h2>Changes For Version 1.26 (2013-06-18)</h2> |
| 22 | 29 | * The argument to the --port option for the [/help?cmd=ui | fossil ui] and |
| 23 | 30 | [/help?cmd=server | fossil server] commands can take an IP address in addition |
| 24 | 31 | to the port number, causing Fossil to bind to just that one IP address. |
| 25 | 32 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -15,10 +15,17 @@ | |
| 15 | part of a repository database file, corrupting it. This problem has only |
| 16 | been seen once in the wild. |
| 17 | * Added support for unlimited line lengths in side-by-side diffs. |
| 18 | * New --close option to [/help?cmd=commit | fossil commit], which |
| 19 | immediately closes the branch being committed. |
| 20 | |
| 21 | <h2>Changes For Version 1.26 (2013-06-18)</h2> |
| 22 | * The argument to the --port option for the [/help?cmd=ui | fossil ui] and |
| 23 | [/help?cmd=server | fossil server] commands can take an IP address in addition |
| 24 | to the port number, causing Fossil to bind to just that one IP address. |
| 25 |
| --- www/changes.wiki | |
| +++ www/changes.wiki | |
| @@ -15,10 +15,17 @@ | |
| 15 | part of a repository database file, corrupting it. This problem has only |
| 16 | been seen once in the wild. |
| 17 | * Added support for unlimited line lengths in side-by-side diffs. |
| 18 | * New --close option to [/help?cmd=commit | fossil commit], which |
| 19 | immediately closes the branch being committed. |
| 20 | * Added <tt>chart</tt> option to [/help?cmd=bisect | fossil bisect]. |
| 21 | * Improvements to the "human or bot?" determination. |
| 22 | * Reports errors about missing CGI-standard environment variables for HTTP |
| 23 | servers which do not support them. |
| 24 | * Minor improvements to sync support on Windows. |
| 25 | * Added <tt>--scgi</tt> option to [/help?cmd=server | fossil server]. |
| 26 | * Internal improvements to the sync process. |
| 27 | |
| 28 | <h2>Changes For Version 1.26 (2013-06-18)</h2> |
| 29 | * The argument to the --port option for the [/help?cmd=ui | fossil ui] and |
| 30 | [/help?cmd=server | fossil server] commands can take an IP address in addition |
| 31 | to the port number, causing Fossil to bind to just that one IP address. |
| 32 |