Fossil SCM
merge trunk
Commit
7aa9f66f926c0317b6056a5577da90c609c7c343
Parent
1b61defd58092e3…
20 files changed
+5
-3
+20
-32
+22
-29
+22
-29
+66
-51
+1
-1
+2
-4
+1
-2
-2
-2
+1
-2
+1
-2
+1
-1
+1
-1
+51
-20
+2
-1
+1
-1
+35
-18
+2
-2
+2
-2
+5
-3
| --- src/blob.c | ||
| +++ src/blob.c | ||
| @@ -792,11 +792,11 @@ | ||
| 792 | 792 | } |
| 793 | 793 | nName = file_simplify_name(zName, nName, 0); |
| 794 | 794 | for(i=1; i<nName; i++){ |
| 795 | 795 | if( zName[i]=='/' ){ |
| 796 | 796 | zName[i] = 0; |
| 797 | -#if defined(_WIN32) | |
| 797 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 798 | 798 | /* |
| 799 | 799 | ** On Windows, local path looks like: C:/develop/project/file.txt |
| 800 | 800 | ** The if stops us from trying to create a directory of a drive letter |
| 801 | 801 | ** C: in this example. |
| 802 | 802 | */ |
| @@ -804,11 +804,11 @@ | ||
| 804 | 804 | #endif |
| 805 | 805 | if( file_mkdir(zName, 1) && file_isdir(zName)!=1 ){ |
| 806 | 806 | fossil_fatal_recursive("unable to create directory %s", zName); |
| 807 | 807 | return 0; |
| 808 | 808 | } |
| 809 | -#if defined(_WIN32) | |
| 809 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 810 | 810 | } |
| 811 | 811 | #endif |
| 812 | 812 | zName[i] = '/'; |
| 813 | 813 | } |
| 814 | 814 | } |
| @@ -1104,11 +1104,11 @@ | ||
| 1104 | 1104 | zUtf8 = blob_str(pBlob) + bomSize; |
| 1105 | 1105 | blob_zero(&temp); |
| 1106 | 1106 | blob_append(&temp, zUtf8, -1); |
| 1107 | 1107 | blob_swap(pBlob, &temp); |
| 1108 | 1108 | blob_reset(&temp); |
| 1109 | -#ifdef _WIN32 | |
| 1109 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 1110 | 1110 | }else if( starts_with_utf16_bom(pBlob, &bomSize, &bomReverse) ){ |
| 1111 | 1111 | zUtf8 = blob_buffer(pBlob); |
| 1112 | 1112 | if( bomReverse ){ |
| 1113 | 1113 | /* Found BOM, but with reversed bytes */ |
| 1114 | 1114 | unsigned int i = blob_size(pBlob); |
| @@ -1124,13 +1124,15 @@ | ||
| 1124 | 1124 | zUtf8 = blob_str(pBlob) + bomSize; |
| 1125 | 1125 | zUtf8 = fossil_unicode_to_utf8(zUtf8); |
| 1126 | 1126 | blob_zero(pBlob); |
| 1127 | 1127 | blob_append(pBlob, zUtf8, -1); |
| 1128 | 1128 | fossil_unicode_free(zUtf8); |
| 1129 | +#endif /* _WIN32 || __CYGWIN__ */ | |
| 1130 | +#if defined(_WIN32) | |
| 1129 | 1131 | }else if( useMbcs ){ |
| 1130 | 1132 | zUtf8 = fossil_mbcs_to_utf8(blob_str(pBlob)); |
| 1131 | 1133 | blob_reset(pBlob); |
| 1132 | 1134 | blob_append(pBlob, zUtf8, -1); |
| 1133 | 1135 | fossil_mbcs_free(zUtf8); |
| 1134 | 1136 | #endif /* _WIN32 */ |
| 1135 | 1137 | } |
| 1136 | 1138 | } |
| 1137 | 1139 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -792,11 +792,11 @@ | |
| 792 | } |
| 793 | nName = file_simplify_name(zName, nName, 0); |
| 794 | for(i=1; i<nName; i++){ |
| 795 | if( zName[i]=='/' ){ |
| 796 | zName[i] = 0; |
| 797 | #if defined(_WIN32) |
| 798 | /* |
| 799 | ** On Windows, local path looks like: C:/develop/project/file.txt |
| 800 | ** The if stops us from trying to create a directory of a drive letter |
| 801 | ** C: in this example. |
| 802 | */ |
| @@ -804,11 +804,11 @@ | |
| 804 | #endif |
| 805 | if( file_mkdir(zName, 1) && file_isdir(zName)!=1 ){ |
| 806 | fossil_fatal_recursive("unable to create directory %s", zName); |
| 807 | return 0; |
| 808 | } |
| 809 | #if defined(_WIN32) |
| 810 | } |
| 811 | #endif |
| 812 | zName[i] = '/'; |
| 813 | } |
| 814 | } |
| @@ -1104,11 +1104,11 @@ | |
| 1104 | zUtf8 = blob_str(pBlob) + bomSize; |
| 1105 | blob_zero(&temp); |
| 1106 | blob_append(&temp, zUtf8, -1); |
| 1107 | blob_swap(pBlob, &temp); |
| 1108 | blob_reset(&temp); |
| 1109 | #ifdef _WIN32 |
| 1110 | }else if( starts_with_utf16_bom(pBlob, &bomSize, &bomReverse) ){ |
| 1111 | zUtf8 = blob_buffer(pBlob); |
| 1112 | if( bomReverse ){ |
| 1113 | /* Found BOM, but with reversed bytes */ |
| 1114 | unsigned int i = blob_size(pBlob); |
| @@ -1124,13 +1124,15 @@ | |
| 1124 | zUtf8 = blob_str(pBlob) + bomSize; |
| 1125 | zUtf8 = fossil_unicode_to_utf8(zUtf8); |
| 1126 | blob_zero(pBlob); |
| 1127 | blob_append(pBlob, zUtf8, -1); |
| 1128 | fossil_unicode_free(zUtf8); |
| 1129 | }else if( useMbcs ){ |
| 1130 | zUtf8 = fossil_mbcs_to_utf8(blob_str(pBlob)); |
| 1131 | blob_reset(pBlob); |
| 1132 | blob_append(pBlob, zUtf8, -1); |
| 1133 | fossil_mbcs_free(zUtf8); |
| 1134 | #endif /* _WIN32 */ |
| 1135 | } |
| 1136 | } |
| 1137 |
| --- src/blob.c | |
| +++ src/blob.c | |
| @@ -792,11 +792,11 @@ | |
| 792 | } |
| 793 | nName = file_simplify_name(zName, nName, 0); |
| 794 | for(i=1; i<nName; i++){ |
| 795 | if( zName[i]=='/' ){ |
| 796 | zName[i] = 0; |
| 797 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 798 | /* |
| 799 | ** On Windows, local path looks like: C:/develop/project/file.txt |
| 800 | ** The if stops us from trying to create a directory of a drive letter |
| 801 | ** C: in this example. |
| 802 | */ |
| @@ -804,11 +804,11 @@ | |
| 804 | #endif |
| 805 | if( file_mkdir(zName, 1) && file_isdir(zName)!=1 ){ |
| 806 | fossil_fatal_recursive("unable to create directory %s", zName); |
| 807 | return 0; |
| 808 | } |
| 809 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 810 | } |
| 811 | #endif |
| 812 | zName[i] = '/'; |
| 813 | } |
| 814 | } |
| @@ -1104,11 +1104,11 @@ | |
| 1104 | zUtf8 = blob_str(pBlob) + bomSize; |
| 1105 | blob_zero(&temp); |
| 1106 | blob_append(&temp, zUtf8, -1); |
| 1107 | blob_swap(pBlob, &temp); |
| 1108 | blob_reset(&temp); |
| 1109 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 1110 | }else if( starts_with_utf16_bom(pBlob, &bomSize, &bomReverse) ){ |
| 1111 | zUtf8 = blob_buffer(pBlob); |
| 1112 | if( bomReverse ){ |
| 1113 | /* Found BOM, but with reversed bytes */ |
| 1114 | unsigned int i = blob_size(pBlob); |
| @@ -1124,13 +1124,15 @@ | |
| 1124 | zUtf8 = blob_str(pBlob) + bomSize; |
| 1125 | zUtf8 = fossil_unicode_to_utf8(zUtf8); |
| 1126 | blob_zero(pBlob); |
| 1127 | blob_append(pBlob, zUtf8, -1); |
| 1128 | fossil_unicode_free(zUtf8); |
| 1129 | #endif /* _WIN32 || __CYGWIN__ */ |
| 1130 | #if defined(_WIN32) |
| 1131 | }else if( useMbcs ){ |
| 1132 | zUtf8 = fossil_mbcs_to_utf8(blob_str(pBlob)); |
| 1133 | blob_reset(pBlob); |
| 1134 | blob_append(pBlob, zUtf8, -1); |
| 1135 | fossil_mbcs_free(zUtf8); |
| 1136 | #endif /* _WIN32 */ |
| 1137 | } |
| 1138 | } |
| 1139 |
+20
-32
| --- src/checkin.c | ||
| +++ src/checkin.c | ||
| @@ -203,10 +203,13 @@ | ||
| 203 | 203 | int vid; |
| 204 | 204 | db_must_be_within_tree(); |
| 205 | 205 | /* 012345678901234 */ |
| 206 | 206 | fossil_print("repository: %s\n", db_repository_filename()); |
| 207 | 207 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 208 | + if( g.zConfigDbName ){ | |
| 209 | + fossil_print("config-db: %s\n", g.zConfigDbName); | |
| 210 | + } | |
| 208 | 211 | vid = db_lget_int("checkout", 0); |
| 209 | 212 | if( vid ){ |
| 210 | 213 | show_common_info(vid, "checkout:", 1, 1); |
| 211 | 214 | } |
| 212 | 215 | db_record_repository_filename(0); |
| @@ -902,83 +905,68 @@ | ||
| 902 | 905 | int encodingOk, /* Non-zero if encoding warnings should be disabled. */ |
| 903 | 906 | const char *zFilename /* The full name of the file being committed. */ |
| 904 | 907 | ){ |
| 905 | 908 | int eType; /* return value of looks_like_utf8/utf16() */ |
| 906 | 909 | int fUnicode; /* return value of starts_with_utf16_bom() */ |
| 910 | + int lookFlags; /* output flags from looks_like_utf8/utf16() */ | |
| 911 | + int fHasCrLf; /* the blob contains one or more CR/LF pairs */ | |
| 912 | + int fHasLength; /* the blob contains an overly long line */ | |
| 907 | 913 | char *zMsg; /* Warning message */ |
| 908 | 914 | Blob fname; /* Relative pathname of the file */ |
| 909 | 915 | static int allOk = 0; /* Set to true to disable this routine */ |
| 910 | 916 | |
| 911 | 917 | if( allOk ) return 0; |
| 912 | 918 | fUnicode = starts_with_utf16_bom(p, 0, 0); |
| 913 | - eType = fUnicode ? looks_like_utf16(p) : looks_like_utf8(p); | |
| 914 | - if( eType==-4){ | |
| 915 | - const char *zWarning; | |
| 916 | - const char *zDisable; | |
| 917 | - Blob ans; | |
| 918 | - char cReply; | |
| 919 | - | |
| 920 | - if (!binOk) { | |
| 921 | - zWarning = "long lines"; | |
| 922 | - zDisable = "\"binary-glob\" setting"; | |
| 923 | - blob_zero(&ans); | |
| 924 | - file_relative_name(zFilename, &fname, 0); | |
| 925 | - zMsg = mprintf( | |
| 926 | - "%s appears to be text, but contains %s. Use --no-warnings or the" | |
| 927 | - " %s to disable this warning.\nCommit anyhow (a=all/y/N)? ", | |
| 928 | - blob_str(&fname), zWarning, zDisable); | |
| 929 | - prompt_user(zMsg, &ans); | |
| 930 | - fossil_free(zMsg); | |
| 931 | - cReply = blob_str(&ans)[0]; | |
| 932 | - if( cReply!='y' && cReply!='Y' ){ | |
| 933 | - fossil_fatal("Abandoning commit due to %s in %s", | |
| 934 | - zWarning, blob_str(&fname)); | |
| 935 | - } | |
| 936 | - blob_reset(&ans); | |
| 937 | - } | |
| 938 | - } | |
| 939 | - if( eType==0 || eType==-1 || fUnicode ){ | |
| 919 | + eType = fUnicode ? looks_like_utf16(p, &lookFlags) : | |
| 920 | + looks_like_utf8(p, &lookFlags); | |
| 921 | + fHasCrLf = (lookFlags & LOOK_CRLF); | |
| 922 | + fHasLength = (lookFlags & LOOK_LENGTH); | |
| 923 | + if( eType==0 || fHasCrLf || fUnicode ){ | |
| 940 | 924 | const char *zWarning; |
| 941 | 925 | const char *zDisable; |
| 942 | 926 | const char *zConvert = "c=convert/"; |
| 943 | 927 | Blob ans; |
| 944 | 928 | char cReply; |
| 945 | 929 | |
| 946 | - if( eType==-1 && fUnicode ){ | |
| 930 | + if( fHasCrLf && fUnicode ){ | |
| 947 | 931 | if ( crnlOk && encodingOk ){ |
| 948 | 932 | return 0; /* We don't want CR/NL and Unicode warnings for this file. */ |
| 949 | 933 | } |
| 950 | 934 | zWarning = "CR/NL line endings and Unicode"; |
| 951 | 935 | zDisable = "\"crnl-glob\" and \"encoding-glob\" settings"; |
| 952 | - }else if( eType==-1 ){ | |
| 936 | + }else if( fHasCrLf ){ | |
| 953 | 937 | if( crnlOk ){ |
| 954 | 938 | return 0; /* We don't want CR/NL warnings for this file. */ |
| 955 | 939 | } |
| 956 | 940 | zWarning = "CR/NL line endings"; |
| 957 | 941 | zDisable = "\"crnl-glob\" setting"; |
| 958 | 942 | }else if( eType==0 ){ |
| 959 | 943 | if( binOk ){ |
| 960 | 944 | return 0; /* We don't want binary warnings for this file. */ |
| 961 | 945 | } |
| 962 | - zWarning = "binary data"; | |
| 946 | + if( fHasLength ){ | |
| 947 | + zWarning = "long lines"; | |
| 948 | + }else{ | |
| 949 | + zWarning = "binary data"; | |
| 950 | + } | |
| 963 | 951 | zDisable = "\"binary-glob\" setting"; |
| 964 | 952 | zConvert = ""; /* We cannot convert binary files. */ |
| 965 | 953 | }else{ |
| 966 | 954 | if ( encodingOk ){ |
| 967 | 955 | return 0; /* We don't want encoding warnings for this file. */ |
| 968 | 956 | } |
| 969 | 957 | zWarning = "Unicode"; |
| 970 | 958 | zDisable = "\"encoding-glob\" setting"; |
| 971 | -#ifndef _WIN32 | |
| 959 | +#if !defined(_WIN32) && !defined(__CYGWIN__) | |
| 972 | 960 | zConvert = ""; /* On Unix, we cannot easily convert Unicode files. */ |
| 973 | 961 | #endif |
| 974 | 962 | } |
| 975 | 963 | file_relative_name(zFilename, &fname, 0); |
| 976 | 964 | blob_zero(&ans); |
| 977 | 965 | zMsg = mprintf( |
| 978 | 966 | "%s contains %s. Use --no-warnings or the %s to disable this warning.\n" |
| 979 | - "Commit anyhow (a=all/%sy/N)? ", | |
| 967 | + "Commit anyhow (a=all/%sy/N)? ", | |
| 980 | 968 | blob_str(&fname), zWarning, zDisable, zConvert); |
| 981 | 969 | prompt_user(zMsg, &ans); |
| 982 | 970 | fossil_free(zMsg); |
| 983 | 971 | cReply = blob_str(&ans)[0]; |
| 984 | 972 | if( cReply=='a' || cReply=='A' ){ |
| 985 | 973 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -203,10 +203,13 @@ | |
| 203 | int vid; |
| 204 | db_must_be_within_tree(); |
| 205 | /* 012345678901234 */ |
| 206 | fossil_print("repository: %s\n", db_repository_filename()); |
| 207 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 208 | vid = db_lget_int("checkout", 0); |
| 209 | if( vid ){ |
| 210 | show_common_info(vid, "checkout:", 1, 1); |
| 211 | } |
| 212 | db_record_repository_filename(0); |
| @@ -902,83 +905,68 @@ | |
| 902 | int encodingOk, /* Non-zero if encoding warnings should be disabled. */ |
| 903 | const char *zFilename /* The full name of the file being committed. */ |
| 904 | ){ |
| 905 | int eType; /* return value of looks_like_utf8/utf16() */ |
| 906 | int fUnicode; /* return value of starts_with_utf16_bom() */ |
| 907 | char *zMsg; /* Warning message */ |
| 908 | Blob fname; /* Relative pathname of the file */ |
| 909 | static int allOk = 0; /* Set to true to disable this routine */ |
| 910 | |
| 911 | if( allOk ) return 0; |
| 912 | fUnicode = starts_with_utf16_bom(p, 0, 0); |
| 913 | eType = fUnicode ? looks_like_utf16(p) : looks_like_utf8(p); |
| 914 | if( eType==-4){ |
| 915 | const char *zWarning; |
| 916 | const char *zDisable; |
| 917 | Blob ans; |
| 918 | char cReply; |
| 919 | |
| 920 | if (!binOk) { |
| 921 | zWarning = "long lines"; |
| 922 | zDisable = "\"binary-glob\" setting"; |
| 923 | blob_zero(&ans); |
| 924 | file_relative_name(zFilename, &fname, 0); |
| 925 | zMsg = mprintf( |
| 926 | "%s appears to be text, but contains %s. Use --no-warnings or the" |
| 927 | " %s to disable this warning.\nCommit anyhow (a=all/y/N)? ", |
| 928 | blob_str(&fname), zWarning, zDisable); |
| 929 | prompt_user(zMsg, &ans); |
| 930 | fossil_free(zMsg); |
| 931 | cReply = blob_str(&ans)[0]; |
| 932 | if( cReply!='y' && cReply!='Y' ){ |
| 933 | fossil_fatal("Abandoning commit due to %s in %s", |
| 934 | zWarning, blob_str(&fname)); |
| 935 | } |
| 936 | blob_reset(&ans); |
| 937 | } |
| 938 | } |
| 939 | if( eType==0 || eType==-1 || fUnicode ){ |
| 940 | const char *zWarning; |
| 941 | const char *zDisable; |
| 942 | const char *zConvert = "c=convert/"; |
| 943 | Blob ans; |
| 944 | char cReply; |
| 945 | |
| 946 | if( eType==-1 && fUnicode ){ |
| 947 | if ( crnlOk && encodingOk ){ |
| 948 | return 0; /* We don't want CR/NL and Unicode warnings for this file. */ |
| 949 | } |
| 950 | zWarning = "CR/NL line endings and Unicode"; |
| 951 | zDisable = "\"crnl-glob\" and \"encoding-glob\" settings"; |
| 952 | }else if( eType==-1 ){ |
| 953 | if( crnlOk ){ |
| 954 | return 0; /* We don't want CR/NL warnings for this file. */ |
| 955 | } |
| 956 | zWarning = "CR/NL line endings"; |
| 957 | zDisable = "\"crnl-glob\" setting"; |
| 958 | }else if( eType==0 ){ |
| 959 | if( binOk ){ |
| 960 | return 0; /* We don't want binary warnings for this file. */ |
| 961 | } |
| 962 | zWarning = "binary data"; |
| 963 | zDisable = "\"binary-glob\" setting"; |
| 964 | zConvert = ""; /* We cannot convert binary files. */ |
| 965 | }else{ |
| 966 | if ( encodingOk ){ |
| 967 | return 0; /* We don't want encoding warnings for this file. */ |
| 968 | } |
| 969 | zWarning = "Unicode"; |
| 970 | zDisable = "\"encoding-glob\" setting"; |
| 971 | #ifndef _WIN32 |
| 972 | zConvert = ""; /* On Unix, we cannot easily convert Unicode files. */ |
| 973 | #endif |
| 974 | } |
| 975 | file_relative_name(zFilename, &fname, 0); |
| 976 | blob_zero(&ans); |
| 977 | zMsg = mprintf( |
| 978 | "%s contains %s. Use --no-warnings or the %s to disable this warning.\n" |
| 979 | "Commit anyhow (a=all/%sy/N)? ", |
| 980 | blob_str(&fname), zWarning, zDisable, zConvert); |
| 981 | prompt_user(zMsg, &ans); |
| 982 | fossil_free(zMsg); |
| 983 | cReply = blob_str(&ans)[0]; |
| 984 | if( cReply=='a' || cReply=='A' ){ |
| 985 |
| --- src/checkin.c | |
| +++ src/checkin.c | |
| @@ -203,10 +203,13 @@ | |
| 203 | int vid; |
| 204 | db_must_be_within_tree(); |
| 205 | /* 012345678901234 */ |
| 206 | fossil_print("repository: %s\n", db_repository_filename()); |
| 207 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 208 | if( g.zConfigDbName ){ |
| 209 | fossil_print("config-db: %s\n", g.zConfigDbName); |
| 210 | } |
| 211 | vid = db_lget_int("checkout", 0); |
| 212 | if( vid ){ |
| 213 | show_common_info(vid, "checkout:", 1, 1); |
| 214 | } |
| 215 | db_record_repository_filename(0); |
| @@ -902,83 +905,68 @@ | |
| 905 | int encodingOk, /* Non-zero if encoding warnings should be disabled. */ |
| 906 | const char *zFilename /* The full name of the file being committed. */ |
| 907 | ){ |
| 908 | int eType; /* return value of looks_like_utf8/utf16() */ |
| 909 | int fUnicode; /* return value of starts_with_utf16_bom() */ |
| 910 | int lookFlags; /* output flags from looks_like_utf8/utf16() */ |
| 911 | int fHasCrLf; /* the blob contains one or more CR/LF pairs */ |
| 912 | int fHasLength; /* the blob contains an overly long line */ |
| 913 | char *zMsg; /* Warning message */ |
| 914 | Blob fname; /* Relative pathname of the file */ |
| 915 | static int allOk = 0; /* Set to true to disable this routine */ |
| 916 | |
| 917 | if( allOk ) return 0; |
| 918 | fUnicode = starts_with_utf16_bom(p, 0, 0); |
| 919 | eType = fUnicode ? looks_like_utf16(p, &lookFlags) : |
| 920 | looks_like_utf8(p, &lookFlags); |
| 921 | fHasCrLf = (lookFlags & LOOK_CRLF); |
| 922 | fHasLength = (lookFlags & LOOK_LENGTH); |
| 923 | if( eType==0 || fHasCrLf || fUnicode ){ |
| 924 | const char *zWarning; |
| 925 | const char *zDisable; |
| 926 | const char *zConvert = "c=convert/"; |
| 927 | Blob ans; |
| 928 | char cReply; |
| 929 | |
| 930 | if( fHasCrLf && fUnicode ){ |
| 931 | if ( crnlOk && encodingOk ){ |
| 932 | return 0; /* We don't want CR/NL and Unicode warnings for this file. */ |
| 933 | } |
| 934 | zWarning = "CR/NL line endings and Unicode"; |
| 935 | zDisable = "\"crnl-glob\" and \"encoding-glob\" settings"; |
| 936 | }else if( fHasCrLf ){ |
| 937 | if( crnlOk ){ |
| 938 | return 0; /* We don't want CR/NL warnings for this file. */ |
| 939 | } |
| 940 | zWarning = "CR/NL line endings"; |
| 941 | zDisable = "\"crnl-glob\" setting"; |
| 942 | }else if( eType==0 ){ |
| 943 | if( binOk ){ |
| 944 | return 0; /* We don't want binary warnings for this file. */ |
| 945 | } |
| 946 | if( fHasLength ){ |
| 947 | zWarning = "long lines"; |
| 948 | }else{ |
| 949 | zWarning = "binary data"; |
| 950 | } |
| 951 | zDisable = "\"binary-glob\" setting"; |
| 952 | zConvert = ""; /* We cannot convert binary files. */ |
| 953 | }else{ |
| 954 | if ( encodingOk ){ |
| 955 | return 0; /* We don't want encoding warnings for this file. */ |
| 956 | } |
| 957 | zWarning = "Unicode"; |
| 958 | zDisable = "\"encoding-glob\" setting"; |
| 959 | #if !defined(_WIN32) && !defined(__CYGWIN__) |
| 960 | zConvert = ""; /* On Unix, we cannot easily convert Unicode files. */ |
| 961 | #endif |
| 962 | } |
| 963 | file_relative_name(zFilename, &fname, 0); |
| 964 | blob_zero(&ans); |
| 965 | zMsg = mprintf( |
| 966 | "%s contains %s. Use --no-warnings or the %s to disable this warning.\n" |
| 967 | "Commit anyhow (a=all/%sy/N)? ", |
| 968 | blob_str(&fname), zWarning, zDisable, zConvert); |
| 969 | prompt_user(zMsg, &ans); |
| 970 | fossil_free(zMsg); |
| 971 | cReply = blob_str(&ans)[0]; |
| 972 | if( cReply=='a' || cReply=='A' ){ |
| 973 |
M
src/db.c
+22
-29
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -221,11 +221,11 @@ | ||
| 221 | 221 | ** rolls back rather than commit. It is the responsibility of the |
| 222 | 222 | ** hooks themselves to issue any error messages. |
| 223 | 223 | */ |
| 224 | 224 | void db_commit_hook(int (*x)(void), int sequence){ |
| 225 | 225 | int i; |
| 226 | - assert( db.nCommitHook < sizeof(db.aHook)/sizeof(db.aHook[1]) ); | |
| 226 | + assert( db.nCommitHook < count(db.aHook) ); | |
| 227 | 227 | for(i=0; i<db.nCommitHook; i++){ |
| 228 | 228 | assert( x!=db.aHook[i].xHook ); |
| 229 | 229 | if( db.aHook[i].sequence>sequence ){ |
| 230 | 230 | int s = sequence; |
| 231 | 231 | int (*xS)(void) = x; |
| @@ -792,11 +792,11 @@ | ||
| 792 | 792 | ** case, invoke this routine with useAttach as 1. |
| 793 | 793 | */ |
| 794 | 794 | void db_open_config(int useAttach){ |
| 795 | 795 | char *zDbName; |
| 796 | 796 | char *zHome; |
| 797 | - if( g.configOpen ) return; | |
| 797 | + if( g.zConfigDbName ) return; | |
| 798 | 798 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 799 | 799 | zHome = fossil_getenv("LOCALAPPDATA"); |
| 800 | 800 | if( zHome==0 ){ |
| 801 | 801 | zHome = fossil_getenv("APPDATA"); |
| 802 | 802 | if( zHome==0 ){ |
| @@ -803,18 +803,10 @@ | ||
| 803 | 803 | char *zDrive = fossil_getenv("HOMEDRIVE"); |
| 804 | 804 | zHome = fossil_getenv("HOMEPATH"); |
| 805 | 805 | if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome); |
| 806 | 806 | } |
| 807 | 807 | } |
| 808 | -#if defined(__CYGWIN__) | |
| 809 | - if( zHome!=0 ){ | |
| 810 | - /* We now have the win32 path, but we need the Cygwin equivalent. */ | |
| 811 | - char *zPath = fossil_utf8_to_filename(zHome); | |
| 812 | - fossil_filename_free(zHome); | |
| 813 | - zHome = zPath; | |
| 814 | - } | |
| 815 | -#endif | |
| 816 | 808 | if( zHome==0 ){ |
| 817 | 809 | fossil_fatal("cannot locate home directory - " |
| 818 | 810 | "please set the LOCALAPPDATA or APPDATA or HOMEPATH " |
| 819 | 811 | "environment variables"); |
| 820 | 812 | } |
| @@ -826,35 +818,37 @@ | ||
| 826 | 818 | } |
| 827 | 819 | #endif |
| 828 | 820 | if( file_isdir(zHome)!=1 ){ |
| 829 | 821 | fossil_fatal("invalid home directory: %s", zHome); |
| 830 | 822 | } |
| 831 | - if( file_access(zHome, W_OK) ){ | |
| 832 | - fossil_fatal("home directory %s must be writeable", zHome); | |
| 833 | - } | |
| 834 | - g.zHome = mprintf("%/", zHome); | |
| 835 | 823 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 836 | 824 | /* . filenames give some window systems problems and many apps problems */ |
| 837 | 825 | zDbName = mprintf("%//_fossil", zHome); |
| 838 | 826 | #else |
| 827 | + if( file_access(zHome, W_OK) ){ | |
| 828 | + fossil_fatal("home directory %s must be writeable", zHome); | |
| 829 | + } | |
| 839 | 830 | zDbName = mprintf("%s/.fossil", zHome); |
| 840 | 831 | #endif |
| 841 | 832 | if( file_size(zDbName)<1024*3 ){ |
| 842 | 833 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 843 | 834 | } |
| 835 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 836 | + if( file_access(zDbName, W_OK) ){ | |
| 837 | + fossil_fatal("configuration file %s must be writeable", zDbName); | |
| 838 | + } | |
| 839 | +#endif | |
| 844 | 840 | if( useAttach ){ |
| 845 | 841 | db_open_or_attach(zDbName, "configdb", &g.useAttach); |
| 846 | 842 | g.dbConfig = 0; |
| 847 | 843 | g.zConfigDbType = 0; |
| 848 | 844 | }else{ |
| 849 | 845 | g.useAttach = 0; |
| 850 | 846 | g.dbConfig = db_open(zDbName); |
| 851 | 847 | g.zConfigDbType = "configdb"; |
| 852 | 848 | } |
| 853 | - g.configOpen = 1; | |
| 854 | - free(zDbName); | |
| 855 | - fossil_filename_free(zHome); | |
| 849 | + g.zConfigDbName = zDbName; | |
| 856 | 850 | } |
| 857 | 851 | |
| 858 | 852 | |
| 859 | 853 | /* |
| 860 | 854 | ** Returns TRUE if zTable exists in the local database but lacks column |
| @@ -926,32 +920,31 @@ | ||
| 926 | 920 | ** that contains a valid repository database. |
| 927 | 921 | ** |
| 928 | 922 | ** For legacy, also look for ".fos". The use of ".fos" is deprecated |
| 929 | 923 | ** since "fos" has negative connotations in Hungarian, we are told. |
| 930 | 924 | ** |
| 931 | -** If no valid _FOSSIL_ or .fos file is found, we move up one level and | |
| 925 | +** If no valid _FOSSIL_ or .fslckout file is found, we move up one level and | |
| 932 | 926 | ** try again. Once the file is found, the g.zLocalRoot variable is set |
| 933 | 927 | ** to the root of the repository tree and this routine returns 1. If |
| 934 | 928 | ** no database is found, then this routine return 0. |
| 935 | 929 | ** |
| 936 | 930 | ** This routine always opens the user database regardless of whether or |
| 937 | -** not the repository database is found. If the _FOSSIL_ or .fos file | |
| 931 | +** not the repository database is found. If the _FOSSIL_ or .fslckout file | |
| 938 | 932 | ** is found, it is attached to the open database connection too. |
| 939 | 933 | */ |
| 940 | 934 | int db_open_local(const char *zDbName){ |
| 941 | 935 | int i, n; |
| 942 | 936 | char zPwd[2000]; |
| 943 | - static const char *const aDbName[] = { "/_FOSSIL_", "/.fslckout", "/.fos" }; | |
| 937 | + static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" }; | |
| 944 | 938 | |
| 945 | 939 | if( g.localOpen) return 1; |
| 946 | 940 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 947 | 941 | n = strlen(zPwd); |
| 948 | 942 | if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.'; |
| 949 | 943 | while( n>0 ){ |
| 950 | - if( file_access(zPwd, W_OK) ) break; | |
| 951 | - for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ | |
| 952 | - sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]); | |
| 944 | + for(i=0; i<count(aDbName); i++){ | |
| 945 | + sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]); | |
| 953 | 946 | if( isValidLocalDb(zPwd) ){ |
| 954 | 947 | /* Found a valid checkout database file */ |
| 955 | 948 | zPwd[n] = 0; |
| 956 | 949 | while( n>1 && zPwd[n-1]=='/' ){ |
| 957 | 950 | n--; |
| @@ -1210,11 +1203,11 @@ | ||
| 1210 | 1203 | fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt)); |
| 1211 | 1204 | } |
| 1212 | 1205 | } |
| 1213 | 1206 | g.repositoryOpen = 0; |
| 1214 | 1207 | g.localOpen = 0; |
| 1215 | - g.configOpen = 0; | |
| 1208 | + g.zConfigDbName = NULL; | |
| 1216 | 1209 | sqlite3_wal_checkpoint(g.db, 0); |
| 1217 | 1210 | sqlite3_close(g.db); |
| 1218 | 1211 | g.db = 0; |
| 1219 | 1212 | g.zMainDbType = 0; |
| 1220 | 1213 | if( g.dbConfig ){ |
| @@ -1634,19 +1627,19 @@ | ||
| 1634 | 1627 | ** Return true if the string zVal represents "true" (or "false"). |
| 1635 | 1628 | */ |
| 1636 | 1629 | int is_truth(const char *zVal){ |
| 1637 | 1630 | static const char *const azOn[] = { "on", "yes", "true", "1" }; |
| 1638 | 1631 | int i; |
| 1639 | - for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){ | |
| 1632 | + for(i=0; i<count(azOn); i++){ | |
| 1640 | 1633 | if( fossil_stricmp(zVal,azOn[i])==0 ) return 1; |
| 1641 | 1634 | } |
| 1642 | 1635 | return 0; |
| 1643 | 1636 | } |
| 1644 | 1637 | int is_false(const char *zVal){ |
| 1645 | 1638 | static const char *const azOff[] = { "off", "no", "false", "0" }; |
| 1646 | 1639 | int i; |
| 1647 | - for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){ | |
| 1640 | + for(i=0; i<count(azOff); i++){ | |
| 1648 | 1641 | if( fossil_stricmp(zVal,azOff[i])==0 ) return 1; |
| 1649 | 1642 | } |
| 1650 | 1643 | return 0; |
| 1651 | 1644 | } |
| 1652 | 1645 | |
| @@ -1773,11 +1766,11 @@ | ||
| 1773 | 1766 | } |
| 1774 | 1767 | } |
| 1775 | 1768 | if( g.repositoryOpen ){ |
| 1776 | 1769 | z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName); |
| 1777 | 1770 | } |
| 1778 | - if( z==0 && g.configOpen ){ | |
| 1771 | + if( z==0 && g.zConfigDbName ){ | |
| 1779 | 1772 | db_swap_connections(); |
| 1780 | 1773 | z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1781 | 1774 | db_swap_connections(); |
| 1782 | 1775 | } |
| 1783 | 1776 | if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){ |
| @@ -1820,11 +1813,11 @@ | ||
| 1820 | 1813 | } |
| 1821 | 1814 | db_end_transaction(0); |
| 1822 | 1815 | } |
| 1823 | 1816 | int db_is_global(const char *zName){ |
| 1824 | 1817 | int rc = 0; |
| 1825 | - if( g.configOpen ){ | |
| 1818 | + if( g.zConfigDbName ){ | |
| 1826 | 1819 | db_swap_connections(); |
| 1827 | 1820 | rc = db_exists("SELECT 1 FROM global_config WHERE name=%Q", zName); |
| 1828 | 1821 | db_swap_connections(); |
| 1829 | 1822 | } |
| 1830 | 1823 | return rc; |
| @@ -1841,11 +1834,11 @@ | ||
| 1841 | 1834 | } |
| 1842 | 1835 | db_finalize(&q); |
| 1843 | 1836 | }else{ |
| 1844 | 1837 | rc = SQLITE_DONE; |
| 1845 | 1838 | } |
| 1846 | - if( rc==SQLITE_DONE && g.configOpen ){ | |
| 1839 | + if( rc==SQLITE_DONE && g.zConfigDbName ){ | |
| 1847 | 1840 | db_swap_connections(); |
| 1848 | 1841 | v = db_int(dflt, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1849 | 1842 | db_swap_connections(); |
| 1850 | 1843 | } |
| 1851 | 1844 | return v; |
| 1852 | 1845 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -221,11 +221,11 @@ | |
| 221 | ** rolls back rather than commit. It is the responsibility of the |
| 222 | ** hooks themselves to issue any error messages. |
| 223 | */ |
| 224 | void db_commit_hook(int (*x)(void), int sequence){ |
| 225 | int i; |
| 226 | assert( db.nCommitHook < sizeof(db.aHook)/sizeof(db.aHook[1]) ); |
| 227 | for(i=0; i<db.nCommitHook; i++){ |
| 228 | assert( x!=db.aHook[i].xHook ); |
| 229 | if( db.aHook[i].sequence>sequence ){ |
| 230 | int s = sequence; |
| 231 | int (*xS)(void) = x; |
| @@ -792,11 +792,11 @@ | |
| 792 | ** case, invoke this routine with useAttach as 1. |
| 793 | */ |
| 794 | void db_open_config(int useAttach){ |
| 795 | char *zDbName; |
| 796 | char *zHome; |
| 797 | if( g.configOpen ) return; |
| 798 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 799 | zHome = fossil_getenv("LOCALAPPDATA"); |
| 800 | if( zHome==0 ){ |
| 801 | zHome = fossil_getenv("APPDATA"); |
| 802 | if( zHome==0 ){ |
| @@ -803,18 +803,10 @@ | |
| 803 | char *zDrive = fossil_getenv("HOMEDRIVE"); |
| 804 | zHome = fossil_getenv("HOMEPATH"); |
| 805 | if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome); |
| 806 | } |
| 807 | } |
| 808 | #if defined(__CYGWIN__) |
| 809 | if( zHome!=0 ){ |
| 810 | /* We now have the win32 path, but we need the Cygwin equivalent. */ |
| 811 | char *zPath = fossil_utf8_to_filename(zHome); |
| 812 | fossil_filename_free(zHome); |
| 813 | zHome = zPath; |
| 814 | } |
| 815 | #endif |
| 816 | if( zHome==0 ){ |
| 817 | fossil_fatal("cannot locate home directory - " |
| 818 | "please set the LOCALAPPDATA or APPDATA or HOMEPATH " |
| 819 | "environment variables"); |
| 820 | } |
| @@ -826,35 +818,37 @@ | |
| 826 | } |
| 827 | #endif |
| 828 | if( file_isdir(zHome)!=1 ){ |
| 829 | fossil_fatal("invalid home directory: %s", zHome); |
| 830 | } |
| 831 | if( file_access(zHome, W_OK) ){ |
| 832 | fossil_fatal("home directory %s must be writeable", zHome); |
| 833 | } |
| 834 | g.zHome = mprintf("%/", zHome); |
| 835 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 836 | /* . filenames give some window systems problems and many apps problems */ |
| 837 | zDbName = mprintf("%//_fossil", zHome); |
| 838 | #else |
| 839 | zDbName = mprintf("%s/.fossil", zHome); |
| 840 | #endif |
| 841 | if( file_size(zDbName)<1024*3 ){ |
| 842 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 843 | } |
| 844 | if( useAttach ){ |
| 845 | db_open_or_attach(zDbName, "configdb", &g.useAttach); |
| 846 | g.dbConfig = 0; |
| 847 | g.zConfigDbType = 0; |
| 848 | }else{ |
| 849 | g.useAttach = 0; |
| 850 | g.dbConfig = db_open(zDbName); |
| 851 | g.zConfigDbType = "configdb"; |
| 852 | } |
| 853 | g.configOpen = 1; |
| 854 | free(zDbName); |
| 855 | fossil_filename_free(zHome); |
| 856 | } |
| 857 | |
| 858 | |
| 859 | /* |
| 860 | ** Returns TRUE if zTable exists in the local database but lacks column |
| @@ -926,32 +920,31 @@ | |
| 926 | ** that contains a valid repository database. |
| 927 | ** |
| 928 | ** For legacy, also look for ".fos". The use of ".fos" is deprecated |
| 929 | ** since "fos" has negative connotations in Hungarian, we are told. |
| 930 | ** |
| 931 | ** If no valid _FOSSIL_ or .fos file is found, we move up one level and |
| 932 | ** try again. Once the file is found, the g.zLocalRoot variable is set |
| 933 | ** to the root of the repository tree and this routine returns 1. If |
| 934 | ** no database is found, then this routine return 0. |
| 935 | ** |
| 936 | ** This routine always opens the user database regardless of whether or |
| 937 | ** not the repository database is found. If the _FOSSIL_ or .fos file |
| 938 | ** is found, it is attached to the open database connection too. |
| 939 | */ |
| 940 | int db_open_local(const char *zDbName){ |
| 941 | int i, n; |
| 942 | char zPwd[2000]; |
| 943 | static const char *const aDbName[] = { "/_FOSSIL_", "/.fslckout", "/.fos" }; |
| 944 | |
| 945 | if( g.localOpen) return 1; |
| 946 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 947 | n = strlen(zPwd); |
| 948 | if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.'; |
| 949 | while( n>0 ){ |
| 950 | if( file_access(zPwd, W_OK) ) break; |
| 951 | for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ |
| 952 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]); |
| 953 | if( isValidLocalDb(zPwd) ){ |
| 954 | /* Found a valid checkout database file */ |
| 955 | zPwd[n] = 0; |
| 956 | while( n>1 && zPwd[n-1]=='/' ){ |
| 957 | n--; |
| @@ -1210,11 +1203,11 @@ | |
| 1210 | fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt)); |
| 1211 | } |
| 1212 | } |
| 1213 | g.repositoryOpen = 0; |
| 1214 | g.localOpen = 0; |
| 1215 | g.configOpen = 0; |
| 1216 | sqlite3_wal_checkpoint(g.db, 0); |
| 1217 | sqlite3_close(g.db); |
| 1218 | g.db = 0; |
| 1219 | g.zMainDbType = 0; |
| 1220 | if( g.dbConfig ){ |
| @@ -1634,19 +1627,19 @@ | |
| 1634 | ** Return true if the string zVal represents "true" (or "false"). |
| 1635 | */ |
| 1636 | int is_truth(const char *zVal){ |
| 1637 | static const char *const azOn[] = { "on", "yes", "true", "1" }; |
| 1638 | int i; |
| 1639 | for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){ |
| 1640 | if( fossil_stricmp(zVal,azOn[i])==0 ) return 1; |
| 1641 | } |
| 1642 | return 0; |
| 1643 | } |
| 1644 | int is_false(const char *zVal){ |
| 1645 | static const char *const azOff[] = { "off", "no", "false", "0" }; |
| 1646 | int i; |
| 1647 | for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){ |
| 1648 | if( fossil_stricmp(zVal,azOff[i])==0 ) return 1; |
| 1649 | } |
| 1650 | return 0; |
| 1651 | } |
| 1652 | |
| @@ -1773,11 +1766,11 @@ | |
| 1773 | } |
| 1774 | } |
| 1775 | if( g.repositoryOpen ){ |
| 1776 | z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName); |
| 1777 | } |
| 1778 | if( z==0 && g.configOpen ){ |
| 1779 | db_swap_connections(); |
| 1780 | z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1781 | db_swap_connections(); |
| 1782 | } |
| 1783 | if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){ |
| @@ -1820,11 +1813,11 @@ | |
| 1820 | } |
| 1821 | db_end_transaction(0); |
| 1822 | } |
| 1823 | int db_is_global(const char *zName){ |
| 1824 | int rc = 0; |
| 1825 | if( g.configOpen ){ |
| 1826 | db_swap_connections(); |
| 1827 | rc = db_exists("SELECT 1 FROM global_config WHERE name=%Q", zName); |
| 1828 | db_swap_connections(); |
| 1829 | } |
| 1830 | return rc; |
| @@ -1841,11 +1834,11 @@ | |
| 1841 | } |
| 1842 | db_finalize(&q); |
| 1843 | }else{ |
| 1844 | rc = SQLITE_DONE; |
| 1845 | } |
| 1846 | if( rc==SQLITE_DONE && g.configOpen ){ |
| 1847 | db_swap_connections(); |
| 1848 | v = db_int(dflt, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1849 | db_swap_connections(); |
| 1850 | } |
| 1851 | return v; |
| 1852 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -221,11 +221,11 @@ | |
| 221 | ** rolls back rather than commit. It is the responsibility of the |
| 222 | ** hooks themselves to issue any error messages. |
| 223 | */ |
| 224 | void db_commit_hook(int (*x)(void), int sequence){ |
| 225 | int i; |
| 226 | assert( db.nCommitHook < count(db.aHook) ); |
| 227 | for(i=0; i<db.nCommitHook; i++){ |
| 228 | assert( x!=db.aHook[i].xHook ); |
| 229 | if( db.aHook[i].sequence>sequence ){ |
| 230 | int s = sequence; |
| 231 | int (*xS)(void) = x; |
| @@ -792,11 +792,11 @@ | |
| 792 | ** case, invoke this routine with useAttach as 1. |
| 793 | */ |
| 794 | void db_open_config(int useAttach){ |
| 795 | char *zDbName; |
| 796 | char *zHome; |
| 797 | if( g.zConfigDbName ) return; |
| 798 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 799 | zHome = fossil_getenv("LOCALAPPDATA"); |
| 800 | if( zHome==0 ){ |
| 801 | zHome = fossil_getenv("APPDATA"); |
| 802 | if( zHome==0 ){ |
| @@ -803,18 +803,10 @@ | |
| 803 | char *zDrive = fossil_getenv("HOMEDRIVE"); |
| 804 | zHome = fossil_getenv("HOMEPATH"); |
| 805 | if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome); |
| 806 | } |
| 807 | } |
| 808 | if( zHome==0 ){ |
| 809 | fossil_fatal("cannot locate home directory - " |
| 810 | "please set the LOCALAPPDATA or APPDATA or HOMEPATH " |
| 811 | "environment variables"); |
| 812 | } |
| @@ -826,35 +818,37 @@ | |
| 818 | } |
| 819 | #endif |
| 820 | if( file_isdir(zHome)!=1 ){ |
| 821 | fossil_fatal("invalid home directory: %s", zHome); |
| 822 | } |
| 823 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 824 | /* . filenames give some window systems problems and many apps problems */ |
| 825 | zDbName = mprintf("%//_fossil", zHome); |
| 826 | #else |
| 827 | if( file_access(zHome, W_OK) ){ |
| 828 | fossil_fatal("home directory %s must be writeable", zHome); |
| 829 | } |
| 830 | zDbName = mprintf("%s/.fossil", zHome); |
| 831 | #endif |
| 832 | if( file_size(zDbName)<1024*3 ){ |
| 833 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 834 | } |
| 835 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 836 | if( file_access(zDbName, W_OK) ){ |
| 837 | fossil_fatal("configuration file %s must be writeable", zDbName); |
| 838 | } |
| 839 | #endif |
| 840 | if( useAttach ){ |
| 841 | db_open_or_attach(zDbName, "configdb", &g.useAttach); |
| 842 | g.dbConfig = 0; |
| 843 | g.zConfigDbType = 0; |
| 844 | }else{ |
| 845 | g.useAttach = 0; |
| 846 | g.dbConfig = db_open(zDbName); |
| 847 | g.zConfigDbType = "configdb"; |
| 848 | } |
| 849 | g.zConfigDbName = zDbName; |
| 850 | } |
| 851 | |
| 852 | |
| 853 | /* |
| 854 | ** Returns TRUE if zTable exists in the local database but lacks column |
| @@ -926,32 +920,31 @@ | |
| 920 | ** that contains a valid repository database. |
| 921 | ** |
| 922 | ** For legacy, also look for ".fos". The use of ".fos" is deprecated |
| 923 | ** since "fos" has negative connotations in Hungarian, we are told. |
| 924 | ** |
| 925 | ** If no valid _FOSSIL_ or .fslckout file is found, we move up one level and |
| 926 | ** try again. Once the file is found, the g.zLocalRoot variable is set |
| 927 | ** to the root of the repository tree and this routine returns 1. If |
| 928 | ** no database is found, then this routine return 0. |
| 929 | ** |
| 930 | ** This routine always opens the user database regardless of whether or |
| 931 | ** not the repository database is found. If the _FOSSIL_ or .fslckout file |
| 932 | ** is found, it is attached to the open database connection too. |
| 933 | */ |
| 934 | int db_open_local(const char *zDbName){ |
| 935 | int i, n; |
| 936 | char zPwd[2000]; |
| 937 | static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" }; |
| 938 | |
| 939 | if( g.localOpen) return 1; |
| 940 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 941 | n = strlen(zPwd); |
| 942 | if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.'; |
| 943 | while( n>0 ){ |
| 944 | for(i=0; i<count(aDbName); i++){ |
| 945 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]); |
| 946 | if( isValidLocalDb(zPwd) ){ |
| 947 | /* Found a valid checkout database file */ |
| 948 | zPwd[n] = 0; |
| 949 | while( n>1 && zPwd[n-1]=='/' ){ |
| 950 | n--; |
| @@ -1210,11 +1203,11 @@ | |
| 1203 | fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt)); |
| 1204 | } |
| 1205 | } |
| 1206 | g.repositoryOpen = 0; |
| 1207 | g.localOpen = 0; |
| 1208 | g.zConfigDbName = NULL; |
| 1209 | sqlite3_wal_checkpoint(g.db, 0); |
| 1210 | sqlite3_close(g.db); |
| 1211 | g.db = 0; |
| 1212 | g.zMainDbType = 0; |
| 1213 | if( g.dbConfig ){ |
| @@ -1634,19 +1627,19 @@ | |
| 1627 | ** Return true if the string zVal represents "true" (or "false"). |
| 1628 | */ |
| 1629 | int is_truth(const char *zVal){ |
| 1630 | static const char *const azOn[] = { "on", "yes", "true", "1" }; |
| 1631 | int i; |
| 1632 | for(i=0; i<count(azOn); i++){ |
| 1633 | if( fossil_stricmp(zVal,azOn[i])==0 ) return 1; |
| 1634 | } |
| 1635 | return 0; |
| 1636 | } |
| 1637 | int is_false(const char *zVal){ |
| 1638 | static const char *const azOff[] = { "off", "no", "false", "0" }; |
| 1639 | int i; |
| 1640 | for(i=0; i<count(azOff); i++){ |
| 1641 | if( fossil_stricmp(zVal,azOff[i])==0 ) return 1; |
| 1642 | } |
| 1643 | return 0; |
| 1644 | } |
| 1645 | |
| @@ -1773,11 +1766,11 @@ | |
| 1766 | } |
| 1767 | } |
| 1768 | if( g.repositoryOpen ){ |
| 1769 | z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName); |
| 1770 | } |
| 1771 | if( z==0 && g.zConfigDbName ){ |
| 1772 | db_swap_connections(); |
| 1773 | z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1774 | db_swap_connections(); |
| 1775 | } |
| 1776 | if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){ |
| @@ -1820,11 +1813,11 @@ | |
| 1813 | } |
| 1814 | db_end_transaction(0); |
| 1815 | } |
| 1816 | int db_is_global(const char *zName){ |
| 1817 | int rc = 0; |
| 1818 | if( g.zConfigDbName ){ |
| 1819 | db_swap_connections(); |
| 1820 | rc = db_exists("SELECT 1 FROM global_config WHERE name=%Q", zName); |
| 1821 | db_swap_connections(); |
| 1822 | } |
| 1823 | return rc; |
| @@ -1841,11 +1834,11 @@ | |
| 1834 | } |
| 1835 | db_finalize(&q); |
| 1836 | }else{ |
| 1837 | rc = SQLITE_DONE; |
| 1838 | } |
| 1839 | if( rc==SQLITE_DONE && g.zConfigDbName ){ |
| 1840 | db_swap_connections(); |
| 1841 | v = db_int(dflt, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1842 | db_swap_connections(); |
| 1843 | } |
| 1844 | return v; |
| 1845 |
M
src/db.c
+22
-29
| --- src/db.c | ||
| +++ src/db.c | ||
| @@ -221,11 +221,11 @@ | ||
| 221 | 221 | ** rolls back rather than commit. It is the responsibility of the |
| 222 | 222 | ** hooks themselves to issue any error messages. |
| 223 | 223 | */ |
| 224 | 224 | void db_commit_hook(int (*x)(void), int sequence){ |
| 225 | 225 | int i; |
| 226 | - assert( db.nCommitHook < sizeof(db.aHook)/sizeof(db.aHook[1]) ); | |
| 226 | + assert( db.nCommitHook < count(db.aHook) ); | |
| 227 | 227 | for(i=0; i<db.nCommitHook; i++){ |
| 228 | 228 | assert( x!=db.aHook[i].xHook ); |
| 229 | 229 | if( db.aHook[i].sequence>sequence ){ |
| 230 | 230 | int s = sequence; |
| 231 | 231 | int (*xS)(void) = x; |
| @@ -792,11 +792,11 @@ | ||
| 792 | 792 | ** case, invoke this routine with useAttach as 1. |
| 793 | 793 | */ |
| 794 | 794 | void db_open_config(int useAttach){ |
| 795 | 795 | char *zDbName; |
| 796 | 796 | char *zHome; |
| 797 | - if( g.configOpen ) return; | |
| 797 | + if( g.zConfigDbName ) return; | |
| 798 | 798 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 799 | 799 | zHome = fossil_getenv("LOCALAPPDATA"); |
| 800 | 800 | if( zHome==0 ){ |
| 801 | 801 | zHome = fossil_getenv("APPDATA"); |
| 802 | 802 | if( zHome==0 ){ |
| @@ -803,18 +803,10 @@ | ||
| 803 | 803 | char *zDrive = fossil_getenv("HOMEDRIVE"); |
| 804 | 804 | zHome = fossil_getenv("HOMEPATH"); |
| 805 | 805 | if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome); |
| 806 | 806 | } |
| 807 | 807 | } |
| 808 | -#if defined(__CYGWIN__) | |
| 809 | - if( zHome!=0 ){ | |
| 810 | - /* We now have the win32 path, but we need the Cygwin equivalent. */ | |
| 811 | - char *zPath = fossil_utf8_to_filename(zHome); | |
| 812 | - fossil_filename_free(zHome); | |
| 813 | - zHome = zPath; | |
| 814 | - } | |
| 815 | -#endif | |
| 816 | 808 | if( zHome==0 ){ |
| 817 | 809 | fossil_fatal("cannot locate home directory - " |
| 818 | 810 | "please set the LOCALAPPDATA or APPDATA or HOMEPATH " |
| 819 | 811 | "environment variables"); |
| 820 | 812 | } |
| @@ -826,35 +818,37 @@ | ||
| 826 | 818 | } |
| 827 | 819 | #endif |
| 828 | 820 | if( file_isdir(zHome)!=1 ){ |
| 829 | 821 | fossil_fatal("invalid home directory: %s", zHome); |
| 830 | 822 | } |
| 831 | - if( file_access(zHome, W_OK) ){ | |
| 832 | - fossil_fatal("home directory %s must be writeable", zHome); | |
| 833 | - } | |
| 834 | - g.zHome = mprintf("%/", zHome); | |
| 835 | 823 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 836 | 824 | /* . filenames give some window systems problems and many apps problems */ |
| 837 | 825 | zDbName = mprintf("%//_fossil", zHome); |
| 838 | 826 | #else |
| 827 | + if( file_access(zHome, W_OK) ){ | |
| 828 | + fossil_fatal("home directory %s must be writeable", zHome); | |
| 829 | + } | |
| 839 | 830 | zDbName = mprintf("%s/.fossil", zHome); |
| 840 | 831 | #endif |
| 841 | 832 | if( file_size(zDbName)<1024*3 ){ |
| 842 | 833 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 843 | 834 | } |
| 835 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 836 | + if( file_access(zDbName, W_OK) ){ | |
| 837 | + fossil_fatal("configuration file %s must be writeable", zDbName); | |
| 838 | + } | |
| 839 | +#endif | |
| 844 | 840 | if( useAttach ){ |
| 845 | 841 | db_open_or_attach(zDbName, "configdb", &g.useAttach); |
| 846 | 842 | g.dbConfig = 0; |
| 847 | 843 | g.zConfigDbType = 0; |
| 848 | 844 | }else{ |
| 849 | 845 | g.useAttach = 0; |
| 850 | 846 | g.dbConfig = db_open(zDbName); |
| 851 | 847 | g.zConfigDbType = "configdb"; |
| 852 | 848 | } |
| 853 | - g.configOpen = 1; | |
| 854 | - free(zDbName); | |
| 855 | - fossil_filename_free(zHome); | |
| 849 | + g.zConfigDbName = zDbName; | |
| 856 | 850 | } |
| 857 | 851 | |
| 858 | 852 | |
| 859 | 853 | /* |
| 860 | 854 | ** Returns TRUE if zTable exists in the local database but lacks column |
| @@ -926,32 +920,31 @@ | ||
| 926 | 920 | ** that contains a valid repository database. |
| 927 | 921 | ** |
| 928 | 922 | ** For legacy, also look for ".fos". The use of ".fos" is deprecated |
| 929 | 923 | ** since "fos" has negative connotations in Hungarian, we are told. |
| 930 | 924 | ** |
| 931 | -** If no valid _FOSSIL_ or .fos file is found, we move up one level and | |
| 925 | +** If no valid _FOSSIL_ or .fslckout file is found, we move up one level and | |
| 932 | 926 | ** try again. Once the file is found, the g.zLocalRoot variable is set |
| 933 | 927 | ** to the root of the repository tree and this routine returns 1. If |
| 934 | 928 | ** no database is found, then this routine return 0. |
| 935 | 929 | ** |
| 936 | 930 | ** This routine always opens the user database regardless of whether or |
| 937 | -** not the repository database is found. If the _FOSSIL_ or .fos file | |
| 931 | +** not the repository database is found. If the _FOSSIL_ or .fslckout file | |
| 938 | 932 | ** is found, it is attached to the open database connection too. |
| 939 | 933 | */ |
| 940 | 934 | int db_open_local(const char *zDbName){ |
| 941 | 935 | int i, n; |
| 942 | 936 | char zPwd[2000]; |
| 943 | - static const char *const aDbName[] = { "/_FOSSIL_", "/.fslckout", "/.fos" }; | |
| 937 | + static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" }; | |
| 944 | 938 | |
| 945 | 939 | if( g.localOpen) return 1; |
| 946 | 940 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 947 | 941 | n = strlen(zPwd); |
| 948 | 942 | if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.'; |
| 949 | 943 | while( n>0 ){ |
| 950 | - if( file_access(zPwd, W_OK) ) break; | |
| 951 | - for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ | |
| 952 | - sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]); | |
| 944 | + for(i=0; i<count(aDbName); i++){ | |
| 945 | + sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]); | |
| 953 | 946 | if( isValidLocalDb(zPwd) ){ |
| 954 | 947 | /* Found a valid checkout database file */ |
| 955 | 948 | zPwd[n] = 0; |
| 956 | 949 | while( n>1 && zPwd[n-1]=='/' ){ |
| 957 | 950 | n--; |
| @@ -1210,11 +1203,11 @@ | ||
| 1210 | 1203 | fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt)); |
| 1211 | 1204 | } |
| 1212 | 1205 | } |
| 1213 | 1206 | g.repositoryOpen = 0; |
| 1214 | 1207 | g.localOpen = 0; |
| 1215 | - g.configOpen = 0; | |
| 1208 | + g.zConfigDbName = NULL; | |
| 1216 | 1209 | sqlite3_wal_checkpoint(g.db, 0); |
| 1217 | 1210 | sqlite3_close(g.db); |
| 1218 | 1211 | g.db = 0; |
| 1219 | 1212 | g.zMainDbType = 0; |
| 1220 | 1213 | if( g.dbConfig ){ |
| @@ -1634,19 +1627,19 @@ | ||
| 1634 | 1627 | ** Return true if the string zVal represents "true" (or "false"). |
| 1635 | 1628 | */ |
| 1636 | 1629 | int is_truth(const char *zVal){ |
| 1637 | 1630 | static const char *const azOn[] = { "on", "yes", "true", "1" }; |
| 1638 | 1631 | int i; |
| 1639 | - for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){ | |
| 1632 | + for(i=0; i<count(azOn); i++){ | |
| 1640 | 1633 | if( fossil_stricmp(zVal,azOn[i])==0 ) return 1; |
| 1641 | 1634 | } |
| 1642 | 1635 | return 0; |
| 1643 | 1636 | } |
| 1644 | 1637 | int is_false(const char *zVal){ |
| 1645 | 1638 | static const char *const azOff[] = { "off", "no", "false", "0" }; |
| 1646 | 1639 | int i; |
| 1647 | - for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){ | |
| 1640 | + for(i=0; i<count(azOff); i++){ | |
| 1648 | 1641 | if( fossil_stricmp(zVal,azOff[i])==0 ) return 1; |
| 1649 | 1642 | } |
| 1650 | 1643 | return 0; |
| 1651 | 1644 | } |
| 1652 | 1645 | |
| @@ -1773,11 +1766,11 @@ | ||
| 1773 | 1766 | } |
| 1774 | 1767 | } |
| 1775 | 1768 | if( g.repositoryOpen ){ |
| 1776 | 1769 | z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName); |
| 1777 | 1770 | } |
| 1778 | - if( z==0 && g.configOpen ){ | |
| 1771 | + if( z==0 && g.zConfigDbName ){ | |
| 1779 | 1772 | db_swap_connections(); |
| 1780 | 1773 | z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1781 | 1774 | db_swap_connections(); |
| 1782 | 1775 | } |
| 1783 | 1776 | if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){ |
| @@ -1820,11 +1813,11 @@ | ||
| 1820 | 1813 | } |
| 1821 | 1814 | db_end_transaction(0); |
| 1822 | 1815 | } |
| 1823 | 1816 | int db_is_global(const char *zName){ |
| 1824 | 1817 | int rc = 0; |
| 1825 | - if( g.configOpen ){ | |
| 1818 | + if( g.zConfigDbName ){ | |
| 1826 | 1819 | db_swap_connections(); |
| 1827 | 1820 | rc = db_exists("SELECT 1 FROM global_config WHERE name=%Q", zName); |
| 1828 | 1821 | db_swap_connections(); |
| 1829 | 1822 | } |
| 1830 | 1823 | return rc; |
| @@ -1841,11 +1834,11 @@ | ||
| 1841 | 1834 | } |
| 1842 | 1835 | db_finalize(&q); |
| 1843 | 1836 | }else{ |
| 1844 | 1837 | rc = SQLITE_DONE; |
| 1845 | 1838 | } |
| 1846 | - if( rc==SQLITE_DONE && g.configOpen ){ | |
| 1839 | + if( rc==SQLITE_DONE && g.zConfigDbName ){ | |
| 1847 | 1840 | db_swap_connections(); |
| 1848 | 1841 | v = db_int(dflt, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1849 | 1842 | db_swap_connections(); |
| 1850 | 1843 | } |
| 1851 | 1844 | return v; |
| 1852 | 1845 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -221,11 +221,11 @@ | |
| 221 | ** rolls back rather than commit. It is the responsibility of the |
| 222 | ** hooks themselves to issue any error messages. |
| 223 | */ |
| 224 | void db_commit_hook(int (*x)(void), int sequence){ |
| 225 | int i; |
| 226 | assert( db.nCommitHook < sizeof(db.aHook)/sizeof(db.aHook[1]) ); |
| 227 | for(i=0; i<db.nCommitHook; i++){ |
| 228 | assert( x!=db.aHook[i].xHook ); |
| 229 | if( db.aHook[i].sequence>sequence ){ |
| 230 | int s = sequence; |
| 231 | int (*xS)(void) = x; |
| @@ -792,11 +792,11 @@ | |
| 792 | ** case, invoke this routine with useAttach as 1. |
| 793 | */ |
| 794 | void db_open_config(int useAttach){ |
| 795 | char *zDbName; |
| 796 | char *zHome; |
| 797 | if( g.configOpen ) return; |
| 798 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 799 | zHome = fossil_getenv("LOCALAPPDATA"); |
| 800 | if( zHome==0 ){ |
| 801 | zHome = fossil_getenv("APPDATA"); |
| 802 | if( zHome==0 ){ |
| @@ -803,18 +803,10 @@ | |
| 803 | char *zDrive = fossil_getenv("HOMEDRIVE"); |
| 804 | zHome = fossil_getenv("HOMEPATH"); |
| 805 | if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome); |
| 806 | } |
| 807 | } |
| 808 | #if defined(__CYGWIN__) |
| 809 | if( zHome!=0 ){ |
| 810 | /* We now have the win32 path, but we need the Cygwin equivalent. */ |
| 811 | char *zPath = fossil_utf8_to_filename(zHome); |
| 812 | fossil_filename_free(zHome); |
| 813 | zHome = zPath; |
| 814 | } |
| 815 | #endif |
| 816 | if( zHome==0 ){ |
| 817 | fossil_fatal("cannot locate home directory - " |
| 818 | "please set the LOCALAPPDATA or APPDATA or HOMEPATH " |
| 819 | "environment variables"); |
| 820 | } |
| @@ -826,35 +818,37 @@ | |
| 826 | } |
| 827 | #endif |
| 828 | if( file_isdir(zHome)!=1 ){ |
| 829 | fossil_fatal("invalid home directory: %s", zHome); |
| 830 | } |
| 831 | if( file_access(zHome, W_OK) ){ |
| 832 | fossil_fatal("home directory %s must be writeable", zHome); |
| 833 | } |
| 834 | g.zHome = mprintf("%/", zHome); |
| 835 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 836 | /* . filenames give some window systems problems and many apps problems */ |
| 837 | zDbName = mprintf("%//_fossil", zHome); |
| 838 | #else |
| 839 | zDbName = mprintf("%s/.fossil", zHome); |
| 840 | #endif |
| 841 | if( file_size(zDbName)<1024*3 ){ |
| 842 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 843 | } |
| 844 | if( useAttach ){ |
| 845 | db_open_or_attach(zDbName, "configdb", &g.useAttach); |
| 846 | g.dbConfig = 0; |
| 847 | g.zConfigDbType = 0; |
| 848 | }else{ |
| 849 | g.useAttach = 0; |
| 850 | g.dbConfig = db_open(zDbName); |
| 851 | g.zConfigDbType = "configdb"; |
| 852 | } |
| 853 | g.configOpen = 1; |
| 854 | free(zDbName); |
| 855 | fossil_filename_free(zHome); |
| 856 | } |
| 857 | |
| 858 | |
| 859 | /* |
| 860 | ** Returns TRUE if zTable exists in the local database but lacks column |
| @@ -926,32 +920,31 @@ | |
| 926 | ** that contains a valid repository database. |
| 927 | ** |
| 928 | ** For legacy, also look for ".fos". The use of ".fos" is deprecated |
| 929 | ** since "fos" has negative connotations in Hungarian, we are told. |
| 930 | ** |
| 931 | ** If no valid _FOSSIL_ or .fos file is found, we move up one level and |
| 932 | ** try again. Once the file is found, the g.zLocalRoot variable is set |
| 933 | ** to the root of the repository tree and this routine returns 1. If |
| 934 | ** no database is found, then this routine return 0. |
| 935 | ** |
| 936 | ** This routine always opens the user database regardless of whether or |
| 937 | ** not the repository database is found. If the _FOSSIL_ or .fos file |
| 938 | ** is found, it is attached to the open database connection too. |
| 939 | */ |
| 940 | int db_open_local(const char *zDbName){ |
| 941 | int i, n; |
| 942 | char zPwd[2000]; |
| 943 | static const char *const aDbName[] = { "/_FOSSIL_", "/.fslckout", "/.fos" }; |
| 944 | |
| 945 | if( g.localOpen) return 1; |
| 946 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 947 | n = strlen(zPwd); |
| 948 | if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.'; |
| 949 | while( n>0 ){ |
| 950 | if( file_access(zPwd, W_OK) ) break; |
| 951 | for(i=0; i<sizeof(aDbName)/sizeof(aDbName[0]); i++){ |
| 952 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "%s", aDbName[i]); |
| 953 | if( isValidLocalDb(zPwd) ){ |
| 954 | /* Found a valid checkout database file */ |
| 955 | zPwd[n] = 0; |
| 956 | while( n>1 && zPwd[n-1]=='/' ){ |
| 957 | n--; |
| @@ -1210,11 +1203,11 @@ | |
| 1210 | fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt)); |
| 1211 | } |
| 1212 | } |
| 1213 | g.repositoryOpen = 0; |
| 1214 | g.localOpen = 0; |
| 1215 | g.configOpen = 0; |
| 1216 | sqlite3_wal_checkpoint(g.db, 0); |
| 1217 | sqlite3_close(g.db); |
| 1218 | g.db = 0; |
| 1219 | g.zMainDbType = 0; |
| 1220 | if( g.dbConfig ){ |
| @@ -1634,19 +1627,19 @@ | |
| 1634 | ** Return true if the string zVal represents "true" (or "false"). |
| 1635 | */ |
| 1636 | int is_truth(const char *zVal){ |
| 1637 | static const char *const azOn[] = { "on", "yes", "true", "1" }; |
| 1638 | int i; |
| 1639 | for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){ |
| 1640 | if( fossil_stricmp(zVal,azOn[i])==0 ) return 1; |
| 1641 | } |
| 1642 | return 0; |
| 1643 | } |
| 1644 | int is_false(const char *zVal){ |
| 1645 | static const char *const azOff[] = { "off", "no", "false", "0" }; |
| 1646 | int i; |
| 1647 | for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){ |
| 1648 | if( fossil_stricmp(zVal,azOff[i])==0 ) return 1; |
| 1649 | } |
| 1650 | return 0; |
| 1651 | } |
| 1652 | |
| @@ -1773,11 +1766,11 @@ | |
| 1773 | } |
| 1774 | } |
| 1775 | if( g.repositoryOpen ){ |
| 1776 | z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName); |
| 1777 | } |
| 1778 | if( z==0 && g.configOpen ){ |
| 1779 | db_swap_connections(); |
| 1780 | z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1781 | db_swap_connections(); |
| 1782 | } |
| 1783 | if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){ |
| @@ -1820,11 +1813,11 @@ | |
| 1820 | } |
| 1821 | db_end_transaction(0); |
| 1822 | } |
| 1823 | int db_is_global(const char *zName){ |
| 1824 | int rc = 0; |
| 1825 | if( g.configOpen ){ |
| 1826 | db_swap_connections(); |
| 1827 | rc = db_exists("SELECT 1 FROM global_config WHERE name=%Q", zName); |
| 1828 | db_swap_connections(); |
| 1829 | } |
| 1830 | return rc; |
| @@ -1841,11 +1834,11 @@ | |
| 1841 | } |
| 1842 | db_finalize(&q); |
| 1843 | }else{ |
| 1844 | rc = SQLITE_DONE; |
| 1845 | } |
| 1846 | if( rc==SQLITE_DONE && g.configOpen ){ |
| 1847 | db_swap_connections(); |
| 1848 | v = db_int(dflt, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1849 | db_swap_connections(); |
| 1850 | } |
| 1851 | return v; |
| 1852 |
| --- src/db.c | |
| +++ src/db.c | |
| @@ -221,11 +221,11 @@ | |
| 221 | ** rolls back rather than commit. It is the responsibility of the |
| 222 | ** hooks themselves to issue any error messages. |
| 223 | */ |
| 224 | void db_commit_hook(int (*x)(void), int sequence){ |
| 225 | int i; |
| 226 | assert( db.nCommitHook < count(db.aHook) ); |
| 227 | for(i=0; i<db.nCommitHook; i++){ |
| 228 | assert( x!=db.aHook[i].xHook ); |
| 229 | if( db.aHook[i].sequence>sequence ){ |
| 230 | int s = sequence; |
| 231 | int (*xS)(void) = x; |
| @@ -792,11 +792,11 @@ | |
| 792 | ** case, invoke this routine with useAttach as 1. |
| 793 | */ |
| 794 | void db_open_config(int useAttach){ |
| 795 | char *zDbName; |
| 796 | char *zHome; |
| 797 | if( g.zConfigDbName ) return; |
| 798 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 799 | zHome = fossil_getenv("LOCALAPPDATA"); |
| 800 | if( zHome==0 ){ |
| 801 | zHome = fossil_getenv("APPDATA"); |
| 802 | if( zHome==0 ){ |
| @@ -803,18 +803,10 @@ | |
| 803 | char *zDrive = fossil_getenv("HOMEDRIVE"); |
| 804 | zHome = fossil_getenv("HOMEPATH"); |
| 805 | if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome); |
| 806 | } |
| 807 | } |
| 808 | if( zHome==0 ){ |
| 809 | fossil_fatal("cannot locate home directory - " |
| 810 | "please set the LOCALAPPDATA or APPDATA or HOMEPATH " |
| 811 | "environment variables"); |
| 812 | } |
| @@ -826,35 +818,37 @@ | |
| 818 | } |
| 819 | #endif |
| 820 | if( file_isdir(zHome)!=1 ){ |
| 821 | fossil_fatal("invalid home directory: %s", zHome); |
| 822 | } |
| 823 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 824 | /* . filenames give some window systems problems and many apps problems */ |
| 825 | zDbName = mprintf("%//_fossil", zHome); |
| 826 | #else |
| 827 | if( file_access(zHome, W_OK) ){ |
| 828 | fossil_fatal("home directory %s must be writeable", zHome); |
| 829 | } |
| 830 | zDbName = mprintf("%s/.fossil", zHome); |
| 831 | #endif |
| 832 | if( file_size(zDbName)<1024*3 ){ |
| 833 | db_init_database(zDbName, zConfigSchema, (char*)0); |
| 834 | } |
| 835 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 836 | if( file_access(zDbName, W_OK) ){ |
| 837 | fossil_fatal("configuration file %s must be writeable", zDbName); |
| 838 | } |
| 839 | #endif |
| 840 | if( useAttach ){ |
| 841 | db_open_or_attach(zDbName, "configdb", &g.useAttach); |
| 842 | g.dbConfig = 0; |
| 843 | g.zConfigDbType = 0; |
| 844 | }else{ |
| 845 | g.useAttach = 0; |
| 846 | g.dbConfig = db_open(zDbName); |
| 847 | g.zConfigDbType = "configdb"; |
| 848 | } |
| 849 | g.zConfigDbName = zDbName; |
| 850 | } |
| 851 | |
| 852 | |
| 853 | /* |
| 854 | ** Returns TRUE if zTable exists in the local database but lacks column |
| @@ -926,32 +920,31 @@ | |
| 920 | ** that contains a valid repository database. |
| 921 | ** |
| 922 | ** For legacy, also look for ".fos". The use of ".fos" is deprecated |
| 923 | ** since "fos" has negative connotations in Hungarian, we are told. |
| 924 | ** |
| 925 | ** If no valid _FOSSIL_ or .fslckout file is found, we move up one level and |
| 926 | ** try again. Once the file is found, the g.zLocalRoot variable is set |
| 927 | ** to the root of the repository tree and this routine returns 1. If |
| 928 | ** no database is found, then this routine return 0. |
| 929 | ** |
| 930 | ** This routine always opens the user database regardless of whether or |
| 931 | ** not the repository database is found. If the _FOSSIL_ or .fslckout file |
| 932 | ** is found, it is attached to the open database connection too. |
| 933 | */ |
| 934 | int db_open_local(const char *zDbName){ |
| 935 | int i, n; |
| 936 | char zPwd[2000]; |
| 937 | static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" }; |
| 938 | |
| 939 | if( g.localOpen) return 1; |
| 940 | file_getcwd(zPwd, sizeof(zPwd)-20); |
| 941 | n = strlen(zPwd); |
| 942 | if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.'; |
| 943 | while( n>0 ){ |
| 944 | for(i=0; i<count(aDbName); i++){ |
| 945 | sqlite3_snprintf(sizeof(zPwd)-n, &zPwd[n], "/%s", aDbName[i]); |
| 946 | if( isValidLocalDb(zPwd) ){ |
| 947 | /* Found a valid checkout database file */ |
| 948 | zPwd[n] = 0; |
| 949 | while( n>1 && zPwd[n-1]=='/' ){ |
| 950 | n--; |
| @@ -1210,11 +1203,11 @@ | |
| 1203 | fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt)); |
| 1204 | } |
| 1205 | } |
| 1206 | g.repositoryOpen = 0; |
| 1207 | g.localOpen = 0; |
| 1208 | g.zConfigDbName = NULL; |
| 1209 | sqlite3_wal_checkpoint(g.db, 0); |
| 1210 | sqlite3_close(g.db); |
| 1211 | g.db = 0; |
| 1212 | g.zMainDbType = 0; |
| 1213 | if( g.dbConfig ){ |
| @@ -1634,19 +1627,19 @@ | |
| 1627 | ** Return true if the string zVal represents "true" (or "false"). |
| 1628 | */ |
| 1629 | int is_truth(const char *zVal){ |
| 1630 | static const char *const azOn[] = { "on", "yes", "true", "1" }; |
| 1631 | int i; |
| 1632 | for(i=0; i<count(azOn); i++){ |
| 1633 | if( fossil_stricmp(zVal,azOn[i])==0 ) return 1; |
| 1634 | } |
| 1635 | return 0; |
| 1636 | } |
| 1637 | int is_false(const char *zVal){ |
| 1638 | static const char *const azOff[] = { "off", "no", "false", "0" }; |
| 1639 | int i; |
| 1640 | for(i=0; i<count(azOff); i++){ |
| 1641 | if( fossil_stricmp(zVal,azOff[i])==0 ) return 1; |
| 1642 | } |
| 1643 | return 0; |
| 1644 | } |
| 1645 | |
| @@ -1773,11 +1766,11 @@ | |
| 1766 | } |
| 1767 | } |
| 1768 | if( g.repositoryOpen ){ |
| 1769 | z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName); |
| 1770 | } |
| 1771 | if( z==0 && g.zConfigDbName ){ |
| 1772 | db_swap_connections(); |
| 1773 | z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1774 | db_swap_connections(); |
| 1775 | } |
| 1776 | if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){ |
| @@ -1820,11 +1813,11 @@ | |
| 1813 | } |
| 1814 | db_end_transaction(0); |
| 1815 | } |
| 1816 | int db_is_global(const char *zName){ |
| 1817 | int rc = 0; |
| 1818 | if( g.zConfigDbName ){ |
| 1819 | db_swap_connections(); |
| 1820 | rc = db_exists("SELECT 1 FROM global_config WHERE name=%Q", zName); |
| 1821 | db_swap_connections(); |
| 1822 | } |
| 1823 | return rc; |
| @@ -1841,11 +1834,11 @@ | |
| 1834 | } |
| 1835 | db_finalize(&q); |
| 1836 | }else{ |
| 1837 | rc = SQLITE_DONE; |
| 1838 | } |
| 1839 | if( rc==SQLITE_DONE && g.zConfigDbName ){ |
| 1840 | db_swap_connections(); |
| 1841 | v = db_int(dflt, "SELECT value FROM global_config WHERE name=%Q", zName); |
| 1842 | db_swap_connections(); |
| 1843 | } |
| 1844 | return v; |
| 1845 |
+66
-51
| --- src/diff.c | ||
| +++ src/diff.c | ||
| @@ -57,11 +57,25 @@ | ||
| 57 | 57 | "more than 10,000 changes\n" |
| 58 | 58 | |
| 59 | 59 | #define DIFF_TOO_MANY_CHANGES_HTML \ |
| 60 | 60 | "<p class='generalError'>More than 10,000 changes</p>\n" |
| 61 | 61 | |
| 62 | -#define looks_like_binary(blob) ((looks_like_utf8((blob))&3) == 0) | |
| 62 | +/* | |
| 63 | +** This macro is designed to return non-zero if the specified blob contains | |
| 64 | +** data that MAY be binary in nature; otherwise, zero will be returned. | |
| 65 | +*/ | |
| 66 | +#define looks_like_binary(blob) (looks_like_utf8((blob), 0) == 0) | |
| 67 | + | |
| 68 | +/* | |
| 69 | +** Output flags for the looks_like_utf8() and looks_like_utf16() routines used | |
| 70 | +** to convey status information about the blob content. | |
| 71 | +*/ | |
| 72 | +#define LOOK_NONE ((int)0x00000000) /* Nothing special was found. */ | |
| 73 | +#define LOOK_NUL ((int)0x00000001) /* One or more NUL chars were found. */ | |
| 74 | +#define LOOK_LF ((int)0x00000002) /* One or more LF chars were found. */ | |
| 75 | +#define LOOK_CRLF ((int)0x00000004) /* One or more CR/LF pairs were found. */ | |
| 76 | +#define LOOK_LENGTH ((int)0x00000008) /* An over length line was found. */ | |
| 63 | 77 | #endif /* INTERFACE */ |
| 64 | 78 | |
| 65 | 79 | /* |
| 66 | 80 | ** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes) |
| 67 | 81 | */ |
| @@ -186,27 +200,18 @@ | ||
| 186 | 200 | /* |
| 187 | 201 | ** This function attempts to scan each logical line within the blob to |
| 188 | 202 | ** determine the type of content it appears to contain. Possible return |
| 189 | 203 | ** values are: |
| 190 | 204 | ** |
| 191 | -** (1) -- The content appears to consist entirely of text, with lines | |
| 192 | -** delimited by line-feed characters; however, the encoding may | |
| 193 | -** not be UTF-8. | |
| 205 | +** (1) -- The content appears to consist entirely of text; however, the | |
| 206 | +** encoding may not be UTF-8. | |
| 194 | 207 | ** |
| 195 | 208 | ** (0) -- The content appears to be binary because it contains embedded |
| 196 | 209 | ** NUL characters or an extremely long line. Since this function |
| 197 | 210 | ** does not understand UTF-16, it may falsely consider UTF-16 text |
| 198 | 211 | ** to be binary. |
| 199 | 212 | ** |
| 200 | -** (-1) -- The content appears to consist entirely of text, with lines | |
| 201 | -** delimited by carriage-return, line-feed pairs; however, the | |
| 202 | -** encoding may not be UTF-8. | |
| 203 | -** | |
| 204 | -** (-4) -- The same as 0, but the determination is based on the fact that | |
| 205 | -** the blob might be text (any encoding) but it has a line length | |
| 206 | -** bigger than the diff logic in fossil can handle. | |
| 207 | -** | |
| 208 | 213 | ************************************ WARNING ********************************** |
| 209 | 214 | ** |
| 210 | 215 | ** This function does not validate that the blob content is properly formed |
| 211 | 216 | ** UTF-8. It assumes that all code points are the same size. It does not |
| 212 | 217 | ** validate any code points. It makes no attempt to detect if any [invalid] |
| @@ -215,39 +220,49 @@ | ||
| 215 | 220 | ** The only code points that this function cares about are the NUL character, |
| 216 | 221 | ** carriage-return, and line-feed. |
| 217 | 222 | ** |
| 218 | 223 | ************************************ WARNING ********************************** |
| 219 | 224 | */ |
| 220 | -int looks_like_utf8(const Blob *pContent){ | |
| 225 | +int looks_like_utf8(const Blob *pContent, int *pFlags){ | |
| 221 | 226 | const char *z = blob_buffer(pContent); |
| 222 | 227 | unsigned int n = blob_size(pContent); |
| 223 | 228 | int j, c; |
| 224 | - int flags = 0; /* bit 0 = long lines found, 1 = CR/NL found. */ | |
| 225 | 229 | |
| 226 | - /* Check individual lines. | |
| 227 | - */ | |
| 230 | + if( pFlags ) *pFlags = LOOK_NONE; | |
| 228 | 231 | if( n==0 ) return 1; /* Empty file -> text */ |
| 229 | 232 | c = *z; |
| 230 | - if( c==0 ) return 0; /* Zero byte in a file -> binary */ | |
| 233 | + if( c==0 ){ | |
| 234 | + if( pFlags ) *pFlags |= LOOK_NUL; | |
| 235 | + return 0; /* NUL character in a file -> binary */ | |
| 236 | + } | |
| 231 | 237 | j = (c!='\n'); |
| 232 | 238 | while( --n>0 ){ |
| 233 | 239 | c = *++z; ++j; |
| 234 | - if( c==0 ) return 0; /* Zero byte in a file -> binary */ | |
| 240 | + if( c==0 ){ | |
| 241 | + if( pFlags ) *pFlags |= LOOK_NUL; | |
| 242 | + return 0; /* NUL character in a file -> binary */ | |
| 243 | + } | |
| 235 | 244 | if( c=='\n' ){ |
| 236 | - if( z[-1]=='\r' ){ | |
| 237 | - flags |= 2; /* Contains CR/NL, continue */ | |
| 245 | + int c2 = z[-1]; | |
| 246 | + if( pFlags ){ | |
| 247 | + *pFlags |= LOOK_LF; | |
| 248 | + if( c2=='\r' ){ | |
| 249 | + *pFlags |= LOOK_CRLF; | |
| 250 | + } | |
| 238 | 251 | } |
| 239 | 252 | if( j>LENGTH_MASK ){ |
| 240 | - flags |= 1; /* Very long line, continue */ | |
| 253 | + if( pFlags ) *pFlags |= LOOK_LENGTH; | |
| 254 | + return 0; /* Very long line -> binary */ | |
| 241 | 255 | } |
| 242 | 256 | j = 0; |
| 243 | 257 | } |
| 244 | 258 | } |
| 245 | - if( (flags&1) || (j>LENGTH_MASK) ){ | |
| 246 | - return -4; /* Very long line -> binary */ | |
| 259 | + if( j>LENGTH_MASK ){ | |
| 260 | + if( pFlags ) *pFlags |= LOOK_LENGTH; | |
| 261 | + return 0; /* Very long line -> binary */ | |
| 247 | 262 | } |
| 248 | - return 1-flags; /* No problems seen -> not binary */ | |
| 263 | + return 1; /* No problems seen -> not binary */ | |
| 249 | 264 | } |
| 250 | 265 | |
| 251 | 266 | /* |
| 252 | 267 | ** Define the type needed to represent a Unicode (UTF-16) character. |
| 253 | 268 | */ |
| @@ -279,27 +294,18 @@ | ||
| 279 | 294 | /* |
| 280 | 295 | ** This function attempts to scan each logical line within the blob to |
| 281 | 296 | ** determine the type of content it appears to contain. Possible return |
| 282 | 297 | ** values are: |
| 283 | 298 | ** |
| 284 | -** (1) -- The content appears to consist entirely of text, with lines | |
| 285 | -** delimited by line-feed characters; however, the encoding may | |
| 286 | -** not be UTF-16. | |
| 299 | +** (1) -- The content appears to consist entirely of text; however, the | |
| 300 | +** encoding may not be UTF-16. | |
| 287 | 301 | ** |
| 288 | 302 | ** (0) -- The content appears to be binary because it contains embedded |
| 289 | 303 | ** NUL characters or an extremely long line. Since this function |
| 290 | 304 | ** does not understand UTF-8, it may falsely consider UTF-8 text |
| 291 | 305 | ** to be binary. |
| 292 | 306 | ** |
| 293 | -** (-1) -- The content appears to consist entirely of text, with lines | |
| 294 | -** delimited by carriage-return, line-feed pairs; however, the | |
| 295 | -** encoding may not be UTF-16. | |
| 296 | -** | |
| 297 | -** (-4) -- The same as 0, but the determination is based on the fact that | |
| 298 | -** the blob might be text (any encoding) but it has a line length | |
| 299 | -** bigger than the diff logic in fossil can handle. | |
| 300 | -** | |
| 301 | 307 | ************************************ WARNING ********************************** |
| 302 | 308 | ** |
| 303 | 309 | ** This function does not validate that the blob content is properly formed |
| 304 | 310 | ** UTF-16. It assumes that all code points are the same size. It does not |
| 305 | 311 | ** validate any code points. It makes no attempt to detect if any [invalid] |
| @@ -308,41 +314,50 @@ | ||
| 308 | 314 | ** The only code points that this function cares about are the NUL character, |
| 309 | 315 | ** carriage-return, and line-feed. |
| 310 | 316 | ** |
| 311 | 317 | ************************************ WARNING ********************************** |
| 312 | 318 | */ |
| 313 | -int looks_like_utf16(const Blob *pContent){ | |
| 319 | +int looks_like_utf16(const Blob *pContent, int *pFlags){ | |
| 314 | 320 | const WCHAR_T *z = (WCHAR_T *)blob_buffer(pContent); |
| 315 | 321 | unsigned int n = blob_size(pContent); |
| 316 | 322 | int j, c; |
| 317 | - int flags = 0; /* bit 0 = long lines found, 1 = CR/NL found. */ | |
| 318 | 323 | |
| 319 | - /* Check individual lines. | |
| 320 | - */ | |
| 324 | + if( pFlags ) *pFlags = LOOK_NONE; | |
| 321 | 325 | if( n==0 ) return 1; /* Empty file -> text */ |
| 322 | 326 | if( n%2 ) return 0; /* Odd number of bytes -> binary (or UTF-8) */ |
| 323 | 327 | c = *z; |
| 324 | - if( c==0 ) return 0; /* NUL character in a file -> binary */ | |
| 328 | + if( c==0 ){ | |
| 329 | + if( pFlags ) *pFlags |= LOOK_NUL; | |
| 330 | + return 0; /* NUL character in a file -> binary */ | |
| 331 | + } | |
| 325 | 332 | j = ((c!=UTF16BE_LF) && (c!=UTF16LE_LF)); |
| 326 | 333 | while( (n-=2)>0 ){ |
| 327 | 334 | c = *++z; ++j; |
| 328 | - if( c==0 ) return 0; /* NUL character in a file -> binary */ | |
| 335 | + if( c==0 ){ | |
| 336 | + if( pFlags ) *pFlags |= LOOK_NUL; | |
| 337 | + return 0; /* NUL character in a file -> binary */ | |
| 338 | + } | |
| 329 | 339 | if( c==UTF16BE_LF || c==UTF16LE_LF ){ |
| 330 | 340 | int c2 = z[-1]; |
| 331 | - if( c2==UTF16BE_CR || c2==UTF16LE_CR ){ | |
| 332 | - flags |= 2; /* Contains CR/NL, continue */ | |
| 341 | + if( pFlags ){ | |
| 342 | + *pFlags |= LOOK_LF; | |
| 343 | + if( c2==UTF16BE_CR || c2==UTF16LE_CR ){ | |
| 344 | + *pFlags |= LOOK_CRLF; | |
| 345 | + } | |
| 333 | 346 | } |
| 334 | 347 | if( j>UTF16_LENGTH_MASK ){ |
| 335 | - flags |= 1; /* Very long line, continue */ | |
| 348 | + if( pFlags ) *pFlags |= LOOK_LENGTH; | |
| 349 | + return 0; /* Very long line -> binary */ | |
| 336 | 350 | } |
| 337 | 351 | j = 0; |
| 338 | 352 | } |
| 339 | 353 | } |
| 340 | - if( (flags&1) || (j>UTF16_LENGTH_MASK) ){ | |
| 341 | - return -4; /* Very long line -> binary */ | |
| 354 | + if( j>UTF16_LENGTH_MASK ){ | |
| 355 | + if( pFlags ) *pFlags |= LOOK_LENGTH; | |
| 356 | + return 0; /* Very long line -> binary */ | |
| 342 | 357 | } |
| 343 | - return 1-flags; /* No problems seen -> not binary */ | |
| 358 | + return 1; /* No problems seen -> not binary */ | |
| 344 | 359 | } |
| 345 | 360 | |
| 346 | 361 | /* |
| 347 | 362 | ** This function returns an array of bytes representing the byte-order-mark |
| 348 | 363 | ** for UTF-8. |
| @@ -1408,11 +1423,11 @@ | ||
| 1408 | 1423 | /* Delete one line from the left */ |
| 1409 | 1424 | s.n = 0; |
| 1410 | 1425 | sbsWriteLineno(&s, a); |
| 1411 | 1426 | s.iStart = 0; |
| 1412 | 1427 | s.zStart = "<span class=\"diffrm\">"; |
| 1413 | - s.iEnd = s.width; | |
| 1428 | + s.iEnd = LENGTH(&A[a]); | |
| 1414 | 1429 | sbsWriteText(&s, &A[a], SBS_PAD); |
| 1415 | 1430 | if( s.escHtml ){ |
| 1416 | 1431 | sbsWrite(&s, " <\n", 6); |
| 1417 | 1432 | }else{ |
| 1418 | 1433 | sbsWrite(&s, " <\n", 3); |
| @@ -1441,11 +1456,11 @@ | ||
| 1441 | 1456 | sbsWrite(&s, " > ", 3); |
| 1442 | 1457 | } |
| 1443 | 1458 | sbsWriteLineno(&s, b); |
| 1444 | 1459 | s.iStart = 0; |
| 1445 | 1460 | s.zStart = "<span class=\"diffadd\">"; |
| 1446 | - s.iEnd = s.width; | |
| 1461 | + s.iEnd = LENGTH(&B[b]); | |
| 1447 | 1462 | sbsWriteText(&s, &B[b], SBS_NEWLINE); |
| 1448 | 1463 | blob_append(pOut, s.zLine, s.n); |
| 1449 | 1464 | assert( mb>0 ); |
| 1450 | 1465 | mb--; |
| 1451 | 1466 | b++; |
| @@ -1453,17 +1468,17 @@ | ||
| 1453 | 1468 | /* Delete from the left and insert on the right */ |
| 1454 | 1469 | s.n = 0; |
| 1455 | 1470 | sbsWriteLineno(&s, a); |
| 1456 | 1471 | s.iStart = 0; |
| 1457 | 1472 | s.zStart = "<span class=\"diffrm\">"; |
| 1458 | - s.iEnd = s.width; | |
| 1473 | + s.iEnd = LENGTH(&A[a]); | |
| 1459 | 1474 | sbsWriteText(&s, &A[a], SBS_PAD); |
| 1460 | 1475 | sbsWrite(&s, " | ", 3); |
| 1461 | 1476 | sbsWriteLineno(&s, b); |
| 1462 | 1477 | s.iStart = 0; |
| 1463 | 1478 | s.zStart = "<span class=\"diffadd\">"; |
| 1464 | - s.iEnd = s.width; | |
| 1479 | + s.iEnd = LENGTH(&B[b]); | |
| 1465 | 1480 | sbsWriteText(&s, &B[b], SBS_NEWLINE); |
| 1466 | 1481 | blob_append(pOut, s.zLine, s.n); |
| 1467 | 1482 | ma--; |
| 1468 | 1483 | mb--; |
| 1469 | 1484 | a++; |
| 1470 | 1485 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -57,11 +57,25 @@ | |
| 57 | "more than 10,000 changes\n" |
| 58 | |
| 59 | #define DIFF_TOO_MANY_CHANGES_HTML \ |
| 60 | "<p class='generalError'>More than 10,000 changes</p>\n" |
| 61 | |
| 62 | #define looks_like_binary(blob) ((looks_like_utf8((blob))&3) == 0) |
| 63 | #endif /* INTERFACE */ |
| 64 | |
| 65 | /* |
| 66 | ** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes) |
| 67 | */ |
| @@ -186,27 +200,18 @@ | |
| 186 | /* |
| 187 | ** This function attempts to scan each logical line within the blob to |
| 188 | ** determine the type of content it appears to contain. Possible return |
| 189 | ** values are: |
| 190 | ** |
| 191 | ** (1) -- The content appears to consist entirely of text, with lines |
| 192 | ** delimited by line-feed characters; however, the encoding may |
| 193 | ** not be UTF-8. |
| 194 | ** |
| 195 | ** (0) -- The content appears to be binary because it contains embedded |
| 196 | ** NUL characters or an extremely long line. Since this function |
| 197 | ** does not understand UTF-16, it may falsely consider UTF-16 text |
| 198 | ** to be binary. |
| 199 | ** |
| 200 | ** (-1) -- The content appears to consist entirely of text, with lines |
| 201 | ** delimited by carriage-return, line-feed pairs; however, the |
| 202 | ** encoding may not be UTF-8. |
| 203 | ** |
| 204 | ** (-4) -- The same as 0, but the determination is based on the fact that |
| 205 | ** the blob might be text (any encoding) but it has a line length |
| 206 | ** bigger than the diff logic in fossil can handle. |
| 207 | ** |
| 208 | ************************************ WARNING ********************************** |
| 209 | ** |
| 210 | ** This function does not validate that the blob content is properly formed |
| 211 | ** UTF-8. It assumes that all code points are the same size. It does not |
| 212 | ** validate any code points. It makes no attempt to detect if any [invalid] |
| @@ -215,39 +220,49 @@ | |
| 215 | ** The only code points that this function cares about are the NUL character, |
| 216 | ** carriage-return, and line-feed. |
| 217 | ** |
| 218 | ************************************ WARNING ********************************** |
| 219 | */ |
| 220 | int looks_like_utf8(const Blob *pContent){ |
| 221 | const char *z = blob_buffer(pContent); |
| 222 | unsigned int n = blob_size(pContent); |
| 223 | int j, c; |
| 224 | int flags = 0; /* bit 0 = long lines found, 1 = CR/NL found. */ |
| 225 | |
| 226 | /* Check individual lines. |
| 227 | */ |
| 228 | if( n==0 ) return 1; /* Empty file -> text */ |
| 229 | c = *z; |
| 230 | if( c==0 ) return 0; /* Zero byte in a file -> binary */ |
| 231 | j = (c!='\n'); |
| 232 | while( --n>0 ){ |
| 233 | c = *++z; ++j; |
| 234 | if( c==0 ) return 0; /* Zero byte in a file -> binary */ |
| 235 | if( c=='\n' ){ |
| 236 | if( z[-1]=='\r' ){ |
| 237 | flags |= 2; /* Contains CR/NL, continue */ |
| 238 | } |
| 239 | if( j>LENGTH_MASK ){ |
| 240 | flags |= 1; /* Very long line, continue */ |
| 241 | } |
| 242 | j = 0; |
| 243 | } |
| 244 | } |
| 245 | if( (flags&1) || (j>LENGTH_MASK) ){ |
| 246 | return -4; /* Very long line -> binary */ |
| 247 | } |
| 248 | return 1-flags; /* No problems seen -> not binary */ |
| 249 | } |
| 250 | |
| 251 | /* |
| 252 | ** Define the type needed to represent a Unicode (UTF-16) character. |
| 253 | */ |
| @@ -279,27 +294,18 @@ | |
| 279 | /* |
| 280 | ** This function attempts to scan each logical line within the blob to |
| 281 | ** determine the type of content it appears to contain. Possible return |
| 282 | ** values are: |
| 283 | ** |
| 284 | ** (1) -- The content appears to consist entirely of text, with lines |
| 285 | ** delimited by line-feed characters; however, the encoding may |
| 286 | ** not be UTF-16. |
| 287 | ** |
| 288 | ** (0) -- The content appears to be binary because it contains embedded |
| 289 | ** NUL characters or an extremely long line. Since this function |
| 290 | ** does not understand UTF-8, it may falsely consider UTF-8 text |
| 291 | ** to be binary. |
| 292 | ** |
| 293 | ** (-1) -- The content appears to consist entirely of text, with lines |
| 294 | ** delimited by carriage-return, line-feed pairs; however, the |
| 295 | ** encoding may not be UTF-16. |
| 296 | ** |
| 297 | ** (-4) -- The same as 0, but the determination is based on the fact that |
| 298 | ** the blob might be text (any encoding) but it has a line length |
| 299 | ** bigger than the diff logic in fossil can handle. |
| 300 | ** |
| 301 | ************************************ WARNING ********************************** |
| 302 | ** |
| 303 | ** This function does not validate that the blob content is properly formed |
| 304 | ** UTF-16. It assumes that all code points are the same size. It does not |
| 305 | ** validate any code points. It makes no attempt to detect if any [invalid] |
| @@ -308,41 +314,50 @@ | |
| 308 | ** The only code points that this function cares about are the NUL character, |
| 309 | ** carriage-return, and line-feed. |
| 310 | ** |
| 311 | ************************************ WARNING ********************************** |
| 312 | */ |
| 313 | int looks_like_utf16(const Blob *pContent){ |
| 314 | const WCHAR_T *z = (WCHAR_T *)blob_buffer(pContent); |
| 315 | unsigned int n = blob_size(pContent); |
| 316 | int j, c; |
| 317 | int flags = 0; /* bit 0 = long lines found, 1 = CR/NL found. */ |
| 318 | |
| 319 | /* Check individual lines. |
| 320 | */ |
| 321 | if( n==0 ) return 1; /* Empty file -> text */ |
| 322 | if( n%2 ) return 0; /* Odd number of bytes -> binary (or UTF-8) */ |
| 323 | c = *z; |
| 324 | if( c==0 ) return 0; /* NUL character in a file -> binary */ |
| 325 | j = ((c!=UTF16BE_LF) && (c!=UTF16LE_LF)); |
| 326 | while( (n-=2)>0 ){ |
| 327 | c = *++z; ++j; |
| 328 | if( c==0 ) return 0; /* NUL character in a file -> binary */ |
| 329 | if( c==UTF16BE_LF || c==UTF16LE_LF ){ |
| 330 | int c2 = z[-1]; |
| 331 | if( c2==UTF16BE_CR || c2==UTF16LE_CR ){ |
| 332 | flags |= 2; /* Contains CR/NL, continue */ |
| 333 | } |
| 334 | if( j>UTF16_LENGTH_MASK ){ |
| 335 | flags |= 1; /* Very long line, continue */ |
| 336 | } |
| 337 | j = 0; |
| 338 | } |
| 339 | } |
| 340 | if( (flags&1) || (j>UTF16_LENGTH_MASK) ){ |
| 341 | return -4; /* Very long line -> binary */ |
| 342 | } |
| 343 | return 1-flags; /* No problems seen -> not binary */ |
| 344 | } |
| 345 | |
| 346 | /* |
| 347 | ** This function returns an array of bytes representing the byte-order-mark |
| 348 | ** for UTF-8. |
| @@ -1408,11 +1423,11 @@ | |
| 1408 | /* Delete one line from the left */ |
| 1409 | s.n = 0; |
| 1410 | sbsWriteLineno(&s, a); |
| 1411 | s.iStart = 0; |
| 1412 | s.zStart = "<span class=\"diffrm\">"; |
| 1413 | s.iEnd = s.width; |
| 1414 | sbsWriteText(&s, &A[a], SBS_PAD); |
| 1415 | if( s.escHtml ){ |
| 1416 | sbsWrite(&s, " <\n", 6); |
| 1417 | }else{ |
| 1418 | sbsWrite(&s, " <\n", 3); |
| @@ -1441,11 +1456,11 @@ | |
| 1441 | sbsWrite(&s, " > ", 3); |
| 1442 | } |
| 1443 | sbsWriteLineno(&s, b); |
| 1444 | s.iStart = 0; |
| 1445 | s.zStart = "<span class=\"diffadd\">"; |
| 1446 | s.iEnd = s.width; |
| 1447 | sbsWriteText(&s, &B[b], SBS_NEWLINE); |
| 1448 | blob_append(pOut, s.zLine, s.n); |
| 1449 | assert( mb>0 ); |
| 1450 | mb--; |
| 1451 | b++; |
| @@ -1453,17 +1468,17 @@ | |
| 1453 | /* Delete from the left and insert on the right */ |
| 1454 | s.n = 0; |
| 1455 | sbsWriteLineno(&s, a); |
| 1456 | s.iStart = 0; |
| 1457 | s.zStart = "<span class=\"diffrm\">"; |
| 1458 | s.iEnd = s.width; |
| 1459 | sbsWriteText(&s, &A[a], SBS_PAD); |
| 1460 | sbsWrite(&s, " | ", 3); |
| 1461 | sbsWriteLineno(&s, b); |
| 1462 | s.iStart = 0; |
| 1463 | s.zStart = "<span class=\"diffadd\">"; |
| 1464 | s.iEnd = s.width; |
| 1465 | sbsWriteText(&s, &B[b], SBS_NEWLINE); |
| 1466 | blob_append(pOut, s.zLine, s.n); |
| 1467 | ma--; |
| 1468 | mb--; |
| 1469 | a++; |
| 1470 |
| --- src/diff.c | |
| +++ src/diff.c | |
| @@ -57,11 +57,25 @@ | |
| 57 | "more than 10,000 changes\n" |
| 58 | |
| 59 | #define DIFF_TOO_MANY_CHANGES_HTML \ |
| 60 | "<p class='generalError'>More than 10,000 changes</p>\n" |
| 61 | |
| 62 | /* |
| 63 | ** This macro is designed to return non-zero if the specified blob contains |
| 64 | ** data that MAY be binary in nature; otherwise, zero will be returned. |
| 65 | */ |
| 66 | #define looks_like_binary(blob) (looks_like_utf8((blob), 0) == 0) |
| 67 | |
| 68 | /* |
| 69 | ** Output flags for the looks_like_utf8() and looks_like_utf16() routines used |
| 70 | ** to convey status information about the blob content. |
| 71 | */ |
| 72 | #define LOOK_NONE ((int)0x00000000) /* Nothing special was found. */ |
| 73 | #define LOOK_NUL ((int)0x00000001) /* One or more NUL chars were found. */ |
| 74 | #define LOOK_LF ((int)0x00000002) /* One or more LF chars were found. */ |
| 75 | #define LOOK_CRLF ((int)0x00000004) /* One or more CR/LF pairs were found. */ |
| 76 | #define LOOK_LENGTH ((int)0x00000008) /* An over length line was found. */ |
| 77 | #endif /* INTERFACE */ |
| 78 | |
| 79 | /* |
| 80 | ** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes) |
| 81 | */ |
| @@ -186,27 +200,18 @@ | |
| 200 | /* |
| 201 | ** This function attempts to scan each logical line within the blob to |
| 202 | ** determine the type of content it appears to contain. Possible return |
| 203 | ** values are: |
| 204 | ** |
| 205 | ** (1) -- The content appears to consist entirely of text; however, the |
| 206 | ** encoding may not be UTF-8. |
| 207 | ** |
| 208 | ** (0) -- The content appears to be binary because it contains embedded |
| 209 | ** NUL characters or an extremely long line. Since this function |
| 210 | ** does not understand UTF-16, it may falsely consider UTF-16 text |
| 211 | ** to be binary. |
| 212 | ** |
| 213 | ************************************ WARNING ********************************** |
| 214 | ** |
| 215 | ** This function does not validate that the blob content is properly formed |
| 216 | ** UTF-8. It assumes that all code points are the same size. It does not |
| 217 | ** validate any code points. It makes no attempt to detect if any [invalid] |
| @@ -215,39 +220,49 @@ | |
| 220 | ** The only code points that this function cares about are the NUL character, |
| 221 | ** carriage-return, and line-feed. |
| 222 | ** |
| 223 | ************************************ WARNING ********************************** |
| 224 | */ |
| 225 | int looks_like_utf8(const Blob *pContent, int *pFlags){ |
| 226 | const char *z = blob_buffer(pContent); |
| 227 | unsigned int n = blob_size(pContent); |
| 228 | int j, c; |
| 229 | |
| 230 | if( pFlags ) *pFlags = LOOK_NONE; |
| 231 | if( n==0 ) return 1; /* Empty file -> text */ |
| 232 | c = *z; |
| 233 | if( c==0 ){ |
| 234 | if( pFlags ) *pFlags |= LOOK_NUL; |
| 235 | return 0; /* NUL character in a file -> binary */ |
| 236 | } |
| 237 | j = (c!='\n'); |
| 238 | while( --n>0 ){ |
| 239 | c = *++z; ++j; |
| 240 | if( c==0 ){ |
| 241 | if( pFlags ) *pFlags |= LOOK_NUL; |
| 242 | return 0; /* NUL character in a file -> binary */ |
| 243 | } |
| 244 | if( c=='\n' ){ |
| 245 | int c2 = z[-1]; |
| 246 | if( pFlags ){ |
| 247 | *pFlags |= LOOK_LF; |
| 248 | if( c2=='\r' ){ |
| 249 | *pFlags |= LOOK_CRLF; |
| 250 | } |
| 251 | } |
| 252 | if( j>LENGTH_MASK ){ |
| 253 | if( pFlags ) *pFlags |= LOOK_LENGTH; |
| 254 | return 0; /* Very long line -> binary */ |
| 255 | } |
| 256 | j = 0; |
| 257 | } |
| 258 | } |
| 259 | if( j>LENGTH_MASK ){ |
| 260 | if( pFlags ) *pFlags |= LOOK_LENGTH; |
| 261 | return 0; /* Very long line -> binary */ |
| 262 | } |
| 263 | return 1; /* No problems seen -> not binary */ |
| 264 | } |
| 265 | |
| 266 | /* |
| 267 | ** Define the type needed to represent a Unicode (UTF-16) character. |
| 268 | */ |
| @@ -279,27 +294,18 @@ | |
| 294 | /* |
| 295 | ** This function attempts to scan each logical line within the blob to |
| 296 | ** determine the type of content it appears to contain. Possible return |
| 297 | ** values are: |
| 298 | ** |
| 299 | ** (1) -- The content appears to consist entirely of text; however, the |
| 300 | ** encoding may not be UTF-16. |
| 301 | ** |
| 302 | ** (0) -- The content appears to be binary because it contains embedded |
| 303 | ** NUL characters or an extremely long line. Since this function |
| 304 | ** does not understand UTF-8, it may falsely consider UTF-8 text |
| 305 | ** to be binary. |
| 306 | ** |
| 307 | ************************************ WARNING ********************************** |
| 308 | ** |
| 309 | ** This function does not validate that the blob content is properly formed |
| 310 | ** UTF-16. It assumes that all code points are the same size. It does not |
| 311 | ** validate any code points. It makes no attempt to detect if any [invalid] |
| @@ -308,41 +314,50 @@ | |
| 314 | ** The only code points that this function cares about are the NUL character, |
| 315 | ** carriage-return, and line-feed. |
| 316 | ** |
| 317 | ************************************ WARNING ********************************** |
| 318 | */ |
| 319 | int looks_like_utf16(const Blob *pContent, int *pFlags){ |
| 320 | const WCHAR_T *z = (WCHAR_T *)blob_buffer(pContent); |
| 321 | unsigned int n = blob_size(pContent); |
| 322 | int j, c; |
| 323 | |
| 324 | if( pFlags ) *pFlags = LOOK_NONE; |
| 325 | if( n==0 ) return 1; /* Empty file -> text */ |
| 326 | if( n%2 ) return 0; /* Odd number of bytes -> binary (or UTF-8) */ |
| 327 | c = *z; |
| 328 | if( c==0 ){ |
| 329 | if( pFlags ) *pFlags |= LOOK_NUL; |
| 330 | return 0; /* NUL character in a file -> binary */ |
| 331 | } |
| 332 | j = ((c!=UTF16BE_LF) && (c!=UTF16LE_LF)); |
| 333 | while( (n-=2)>0 ){ |
| 334 | c = *++z; ++j; |
| 335 | if( c==0 ){ |
| 336 | if( pFlags ) *pFlags |= LOOK_NUL; |
| 337 | return 0; /* NUL character in a file -> binary */ |
| 338 | } |
| 339 | if( c==UTF16BE_LF || c==UTF16LE_LF ){ |
| 340 | int c2 = z[-1]; |
| 341 | if( pFlags ){ |
| 342 | *pFlags |= LOOK_LF; |
| 343 | if( c2==UTF16BE_CR || c2==UTF16LE_CR ){ |
| 344 | *pFlags |= LOOK_CRLF; |
| 345 | } |
| 346 | } |
| 347 | if( j>UTF16_LENGTH_MASK ){ |
| 348 | if( pFlags ) *pFlags |= LOOK_LENGTH; |
| 349 | return 0; /* Very long line -> binary */ |
| 350 | } |
| 351 | j = 0; |
| 352 | } |
| 353 | } |
| 354 | if( j>UTF16_LENGTH_MASK ){ |
| 355 | if( pFlags ) *pFlags |= LOOK_LENGTH; |
| 356 | return 0; /* Very long line -> binary */ |
| 357 | } |
| 358 | return 1; /* No problems seen -> not binary */ |
| 359 | } |
| 360 | |
| 361 | /* |
| 362 | ** This function returns an array of bytes representing the byte-order-mark |
| 363 | ** for UTF-8. |
| @@ -1408,11 +1423,11 @@ | |
| 1423 | /* Delete one line from the left */ |
| 1424 | s.n = 0; |
| 1425 | sbsWriteLineno(&s, a); |
| 1426 | s.iStart = 0; |
| 1427 | s.zStart = "<span class=\"diffrm\">"; |
| 1428 | s.iEnd = LENGTH(&A[a]); |
| 1429 | sbsWriteText(&s, &A[a], SBS_PAD); |
| 1430 | if( s.escHtml ){ |
| 1431 | sbsWrite(&s, " <\n", 6); |
| 1432 | }else{ |
| 1433 | sbsWrite(&s, " <\n", 3); |
| @@ -1441,11 +1456,11 @@ | |
| 1456 | sbsWrite(&s, " > ", 3); |
| 1457 | } |
| 1458 | sbsWriteLineno(&s, b); |
| 1459 | s.iStart = 0; |
| 1460 | s.zStart = "<span class=\"diffadd\">"; |
| 1461 | s.iEnd = LENGTH(&B[b]); |
| 1462 | sbsWriteText(&s, &B[b], SBS_NEWLINE); |
| 1463 | blob_append(pOut, s.zLine, s.n); |
| 1464 | assert( mb>0 ); |
| 1465 | mb--; |
| 1466 | b++; |
| @@ -1453,17 +1468,17 @@ | |
| 1468 | /* Delete from the left and insert on the right */ |
| 1469 | s.n = 0; |
| 1470 | sbsWriteLineno(&s, a); |
| 1471 | s.iStart = 0; |
| 1472 | s.zStart = "<span class=\"diffrm\">"; |
| 1473 | s.iEnd = LENGTH(&A[a]); |
| 1474 | sbsWriteText(&s, &A[a], SBS_PAD); |
| 1475 | sbsWrite(&s, " | ", 3); |
| 1476 | sbsWriteLineno(&s, b); |
| 1477 | s.iStart = 0; |
| 1478 | s.zStart = "<span class=\"diffadd\">"; |
| 1479 | s.iEnd = LENGTH(&B[b]); |
| 1480 | sbsWriteText(&s, &B[b], SBS_NEWLINE); |
| 1481 | blob_append(pOut, s.zLine, s.n); |
| 1482 | ma--; |
| 1483 | mb--; |
| 1484 | a++; |
| 1485 |
+1
-1
| --- src/glob.c | ||
| +++ src/glob.c | ||
| @@ -54,11 +54,11 @@ | ||
| 54 | 54 | cTerm = zGlobList[0]; |
| 55 | 55 | zGlobList++; |
| 56 | 56 | }else{ |
| 57 | 57 | cTerm = ','; |
| 58 | 58 | } |
| 59 | - for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){} | |
| 59 | + for(i=0; zGlobList[i] && zGlobList[i]!=cTerm && zGlobList[i]!='\n'; i++){} | |
| 60 | 60 | if( cTerm==',' ){ |
| 61 | 61 | while( i>0 && fossil_isspace(zGlobList[i-1]) ){ i--; } |
| 62 | 62 | } |
| 63 | 63 | blob_appendf(&expr, "%s%s GLOB '%#q'", zSep, zVal, i, zGlobList); |
| 64 | 64 | zSep = " OR "; |
| 65 | 65 |
| --- src/glob.c | |
| +++ src/glob.c | |
| @@ -54,11 +54,11 @@ | |
| 54 | cTerm = zGlobList[0]; |
| 55 | zGlobList++; |
| 56 | }else{ |
| 57 | cTerm = ','; |
| 58 | } |
| 59 | for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){} |
| 60 | if( cTerm==',' ){ |
| 61 | while( i>0 && fossil_isspace(zGlobList[i-1]) ){ i--; } |
| 62 | } |
| 63 | blob_appendf(&expr, "%s%s GLOB '%#q'", zSep, zVal, i, zGlobList); |
| 64 | zSep = " OR "; |
| 65 |
| --- src/glob.c | |
| +++ src/glob.c | |
| @@ -54,11 +54,11 @@ | |
| 54 | cTerm = zGlobList[0]; |
| 55 | zGlobList++; |
| 56 | }else{ |
| 57 | cTerm = ','; |
| 58 | } |
| 59 | for(i=0; zGlobList[i] && zGlobList[i]!=cTerm && zGlobList[i]!='\n'; i++){} |
| 60 | if( cTerm==',' ){ |
| 61 | while( i>0 && fossil_isspace(zGlobList[i-1]) ){ i--; } |
| 62 | } |
| 63 | blob_appendf(&expr, "%s%s GLOB '%#q'", zSep, zVal, i, zGlobList); |
| 64 | zSep = " OR "; |
| 65 |
+2
-4
| --- src/info.c | ||
| +++ src/info.c | ||
| @@ -198,15 +198,13 @@ | ||
| 198 | 198 | if( g.localOpen ){ |
| 199 | 199 | fossil_print("repository: %s\n", db_repository_filename()); |
| 200 | 200 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 201 | 201 | } |
| 202 | 202 | if( bDetail ) extraRepoInfo(); |
| 203 | -#if defined(_WIN32) | |
| 204 | - if( g.zHome ){ | |
| 205 | - fossil_print("user-home: %s\n", g.zHome); | |
| 203 | + if( g.zConfigDbName ){ | |
| 204 | + fossil_print("config-db: %s\n", g.zConfigDbName); | |
| 206 | 205 | } |
| 207 | -#endif | |
| 208 | 206 | fossil_print("project-code: %s\n", db_get("project-code", "")); |
| 209 | 207 | vid = g.localOpen ? db_lget_int("checkout", 0) : 0; |
| 210 | 208 | if( vid ){ |
| 211 | 209 | show_common_info(vid, "checkout:", 1, 1); |
| 212 | 210 | } |
| 213 | 211 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -198,15 +198,13 @@ | |
| 198 | if( g.localOpen ){ |
| 199 | fossil_print("repository: %s\n", db_repository_filename()); |
| 200 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 201 | } |
| 202 | if( bDetail ) extraRepoInfo(); |
| 203 | #if defined(_WIN32) |
| 204 | if( g.zHome ){ |
| 205 | fossil_print("user-home: %s\n", g.zHome); |
| 206 | } |
| 207 | #endif |
| 208 | fossil_print("project-code: %s\n", db_get("project-code", "")); |
| 209 | vid = g.localOpen ? db_lget_int("checkout", 0) : 0; |
| 210 | if( vid ){ |
| 211 | show_common_info(vid, "checkout:", 1, 1); |
| 212 | } |
| 213 |
| --- src/info.c | |
| +++ src/info.c | |
| @@ -198,15 +198,13 @@ | |
| 198 | if( g.localOpen ){ |
| 199 | fossil_print("repository: %s\n", db_repository_filename()); |
| 200 | fossil_print("local-root: %s\n", g.zLocalRoot); |
| 201 | } |
| 202 | if( bDetail ) extraRepoInfo(); |
| 203 | if( g.zConfigDbName ){ |
| 204 | fossil_print("config-db: %s\n", g.zConfigDbName); |
| 205 | } |
| 206 | fossil_print("project-code: %s\n", db_get("project-code", "")); |
| 207 | vid = g.localOpen ? db_lget_int("checkout", 0) : 0; |
| 208 | if( vid ){ |
| 209 | show_common_info(vid, "checkout:", 1, 1); |
| 210 | } |
| 211 |
+1
-2
| --- src/json.c | ||
| +++ src/json.c | ||
| @@ -1372,11 +1372,11 @@ | ||
| 1372 | 1372 | #define VAL(K,V) cson_object_set(o, #K, (V) ? (V) : cson_value_null()) |
| 1373 | 1373 | VAL(capabilities, json_cap_value()); |
| 1374 | 1374 | INT(g, argc); |
| 1375 | 1375 | INT(g, isConst); |
| 1376 | 1376 | INT(g, useAttach); |
| 1377 | - INT(g, configOpen); | |
| 1377 | + CSTR(g, zConfigDbName); | |
| 1378 | 1378 | INT(g, repositoryOpen); |
| 1379 | 1379 | INT(g, localOpen); |
| 1380 | 1380 | INT(g, minPrefix); |
| 1381 | 1381 | INT(g, fSqlTrace); |
| 1382 | 1382 | INT(g, fSqlStats); |
| @@ -1410,11 +1410,10 @@ | ||
| 1410 | 1410 | INT(g, nAux); |
| 1411 | 1411 | INT(g, allowSymlinks); |
| 1412 | 1412 | |
| 1413 | 1413 | CSTR(g, zMainDbType); |
| 1414 | 1414 | CSTR(g, zConfigDbType); |
| 1415 | - CSTR(g, zHome); | |
| 1416 | 1415 | CSTR(g, zLocalRoot); |
| 1417 | 1416 | CSTR(g, zPath); |
| 1418 | 1417 | CSTR(g, zExtra); |
| 1419 | 1418 | CSTR(g, zBaseURL); |
| 1420 | 1419 | CSTR(g, zTop); |
| 1421 | 1420 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -1372,11 +1372,11 @@ | |
| 1372 | #define VAL(K,V) cson_object_set(o, #K, (V) ? (V) : cson_value_null()) |
| 1373 | VAL(capabilities, json_cap_value()); |
| 1374 | INT(g, argc); |
| 1375 | INT(g, isConst); |
| 1376 | INT(g, useAttach); |
| 1377 | INT(g, configOpen); |
| 1378 | INT(g, repositoryOpen); |
| 1379 | INT(g, localOpen); |
| 1380 | INT(g, minPrefix); |
| 1381 | INT(g, fSqlTrace); |
| 1382 | INT(g, fSqlStats); |
| @@ -1410,11 +1410,10 @@ | |
| 1410 | INT(g, nAux); |
| 1411 | INT(g, allowSymlinks); |
| 1412 | |
| 1413 | CSTR(g, zMainDbType); |
| 1414 | CSTR(g, zConfigDbType); |
| 1415 | CSTR(g, zHome); |
| 1416 | CSTR(g, zLocalRoot); |
| 1417 | CSTR(g, zPath); |
| 1418 | CSTR(g, zExtra); |
| 1419 | CSTR(g, zBaseURL); |
| 1420 | CSTR(g, zTop); |
| 1421 |
| --- src/json.c | |
| +++ src/json.c | |
| @@ -1372,11 +1372,11 @@ | |
| 1372 | #define VAL(K,V) cson_object_set(o, #K, (V) ? (V) : cson_value_null()) |
| 1373 | VAL(capabilities, json_cap_value()); |
| 1374 | INT(g, argc); |
| 1375 | INT(g, isConst); |
| 1376 | INT(g, useAttach); |
| 1377 | CSTR(g, zConfigDbName); |
| 1378 | INT(g, repositoryOpen); |
| 1379 | INT(g, localOpen); |
| 1380 | INT(g, minPrefix); |
| 1381 | INT(g, fSqlTrace); |
| 1382 | INT(g, fSqlStats); |
| @@ -1410,11 +1410,10 @@ | |
| 1410 | INT(g, nAux); |
| 1411 | INT(g, allowSymlinks); |
| 1412 | |
| 1413 | CSTR(g, zMainDbType); |
| 1414 | CSTR(g, zConfigDbType); |
| 1415 | CSTR(g, zLocalRoot); |
| 1416 | CSTR(g, zPath); |
| 1417 | CSTR(g, zExtra); |
| 1418 | CSTR(g, zBaseURL); |
| 1419 | CSTR(g, zTop); |
| 1420 |
-2
| --- src/json_status.c | ||
| +++ src/json_status.c | ||
| @@ -37,11 +37,10 @@ | ||
| 37 | 37 | /* |
| 38 | 38 | ** Implementation of the /json/status page. |
| 39 | 39 | ** |
| 40 | 40 | */ |
| 41 | 41 | cson_value * json_page_status(){ |
| 42 | - char const * zSql = NULL; | |
| 43 | 42 | Stmt q = empty_Stmt; |
| 44 | 43 | cson_object * oPay; |
| 45 | 44 | /*cson_object * files;*/ |
| 46 | 45 | int vid, nErr = 0; |
| 47 | 46 | cson_object * tmpO; |
| @@ -101,11 +100,10 @@ | ||
| 101 | 100 | " WHERE is_selected(id)" |
| 102 | 101 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1" |
| 103 | 102 | ); |
| 104 | 103 | while( db_step(&q)==SQLITE_ROW ){ |
| 105 | 104 | const char *zPathname = db_column_text(&q,0); |
| 106 | - const char *zDisplayName = zPathname; | |
| 107 | 105 | int isDeleted = db_column_int(&q, 1); |
| 108 | 106 | int isChnged = db_column_int(&q,2); |
| 109 | 107 | int isNew = db_column_int(&q,3)==0; |
| 110 | 108 | int isRenamed = db_column_int(&q,4); |
| 111 | 109 | cson_object * oFile; |
| 112 | 110 |
| --- src/json_status.c | |
| +++ src/json_status.c | |
| @@ -37,11 +37,10 @@ | |
| 37 | /* |
| 38 | ** Implementation of the /json/status page. |
| 39 | ** |
| 40 | */ |
| 41 | cson_value * json_page_status(){ |
| 42 | char const * zSql = NULL; |
| 43 | Stmt q = empty_Stmt; |
| 44 | cson_object * oPay; |
| 45 | /*cson_object * files;*/ |
| 46 | int vid, nErr = 0; |
| 47 | cson_object * tmpO; |
| @@ -101,11 +100,10 @@ | |
| 101 | " WHERE is_selected(id)" |
| 102 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1" |
| 103 | ); |
| 104 | while( db_step(&q)==SQLITE_ROW ){ |
| 105 | const char *zPathname = db_column_text(&q,0); |
| 106 | const char *zDisplayName = zPathname; |
| 107 | int isDeleted = db_column_int(&q, 1); |
| 108 | int isChnged = db_column_int(&q,2); |
| 109 | int isNew = db_column_int(&q,3)==0; |
| 110 | int isRenamed = db_column_int(&q,4); |
| 111 | cson_object * oFile; |
| 112 |
| --- src/json_status.c | |
| +++ src/json_status.c | |
| @@ -37,11 +37,10 @@ | |
| 37 | /* |
| 38 | ** Implementation of the /json/status page. |
| 39 | ** |
| 40 | */ |
| 41 | cson_value * json_page_status(){ |
| 42 | Stmt q = empty_Stmt; |
| 43 | cson_object * oPay; |
| 44 | /*cson_object * files;*/ |
| 45 | int vid, nErr = 0; |
| 46 | cson_object * tmpO; |
| @@ -101,11 +100,10 @@ | |
| 100 | " WHERE is_selected(id)" |
| 101 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1" |
| 102 | ); |
| 103 | while( db_step(&q)==SQLITE_ROW ){ |
| 104 | const char *zPathname = db_column_text(&q,0); |
| 105 | int isDeleted = db_column_int(&q, 1); |
| 106 | int isChnged = db_column_int(&q,2); |
| 107 | int isNew = db_column_int(&q,3)==0; |
| 108 | int isRenamed = db_column_int(&q,4); |
| 109 | cson_object * oFile; |
| 110 |
-2
| --- src/json_status.c | ||
| +++ src/json_status.c | ||
| @@ -37,11 +37,10 @@ | ||
| 37 | 37 | /* |
| 38 | 38 | ** Implementation of the /json/status page. |
| 39 | 39 | ** |
| 40 | 40 | */ |
| 41 | 41 | cson_value * json_page_status(){ |
| 42 | - char const * zSql = NULL; | |
| 43 | 42 | Stmt q = empty_Stmt; |
| 44 | 43 | cson_object * oPay; |
| 45 | 44 | /*cson_object * files;*/ |
| 46 | 45 | int vid, nErr = 0; |
| 47 | 46 | cson_object * tmpO; |
| @@ -101,11 +100,10 @@ | ||
| 101 | 100 | " WHERE is_selected(id)" |
| 102 | 101 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1" |
| 103 | 102 | ); |
| 104 | 103 | while( db_step(&q)==SQLITE_ROW ){ |
| 105 | 104 | const char *zPathname = db_column_text(&q,0); |
| 106 | - const char *zDisplayName = zPathname; | |
| 107 | 105 | int isDeleted = db_column_int(&q, 1); |
| 108 | 106 | int isChnged = db_column_int(&q,2); |
| 109 | 107 | int isNew = db_column_int(&q,3)==0; |
| 110 | 108 | int isRenamed = db_column_int(&q,4); |
| 111 | 109 | cson_object * oFile; |
| 112 | 110 |
| --- src/json_status.c | |
| +++ src/json_status.c | |
| @@ -37,11 +37,10 @@ | |
| 37 | /* |
| 38 | ** Implementation of the /json/status page. |
| 39 | ** |
| 40 | */ |
| 41 | cson_value * json_page_status(){ |
| 42 | char const * zSql = NULL; |
| 43 | Stmt q = empty_Stmt; |
| 44 | cson_object * oPay; |
| 45 | /*cson_object * files;*/ |
| 46 | int vid, nErr = 0; |
| 47 | cson_object * tmpO; |
| @@ -101,11 +100,10 @@ | |
| 101 | " WHERE is_selected(id)" |
| 102 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1" |
| 103 | ); |
| 104 | while( db_step(&q)==SQLITE_ROW ){ |
| 105 | const char *zPathname = db_column_text(&q,0); |
| 106 | const char *zDisplayName = zPathname; |
| 107 | int isDeleted = db_column_int(&q, 1); |
| 108 | int isChnged = db_column_int(&q,2); |
| 109 | int isNew = db_column_int(&q,3)==0; |
| 110 | int isRenamed = db_column_int(&q,4); |
| 111 | cson_object * oFile; |
| 112 |
| --- src/json_status.c | |
| +++ src/json_status.c | |
| @@ -37,11 +37,10 @@ | |
| 37 | /* |
| 38 | ** Implementation of the /json/status page. |
| 39 | ** |
| 40 | */ |
| 41 | cson_value * json_page_status(){ |
| 42 | Stmt q = empty_Stmt; |
| 43 | cson_object * oPay; |
| 44 | /*cson_object * files;*/ |
| 45 | int vid, nErr = 0; |
| 46 | cson_object * tmpO; |
| @@ -101,11 +100,10 @@ | |
| 100 | " WHERE is_selected(id)" |
| 101 | " AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1" |
| 102 | ); |
| 103 | while( db_step(&q)==SQLITE_ROW ){ |
| 104 | const char *zPathname = db_column_text(&q,0); |
| 105 | int isDeleted = db_column_int(&q, 1); |
| 106 | int isChnged = db_column_int(&q,2); |
| 107 | int isNew = db_column_int(&q,3)==0; |
| 108 | int isRenamed = db_column_int(&q,4); |
| 109 | cson_object * oFile; |
| 110 |
+1
-2
| --- src/main.c | ||
| +++ src/main.c | ||
| @@ -114,17 +114,16 @@ | ||
| 114 | 114 | char *nameOfExe; /* Full path of executable. */ |
| 115 | 115 | int isConst; /* True if the output is unchanging */ |
| 116 | 116 | sqlite3 *db; /* The connection to the databases */ |
| 117 | 117 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 118 | 118 | int useAttach; /* True if global_config is attached to repository */ |
| 119 | - int configOpen; /* True if the config database is open */ | |
| 119 | + const char *zConfigDbName;/* Path of the config database. NULL if not open */ | |
| 120 | 120 | sqlite3_int64 now; /* Seconds since 1970 */ |
| 121 | 121 | int repositoryOpen; /* True if the main repository database is open */ |
| 122 | 122 | char *zRepositoryName; /* Name of the repository database */ |
| 123 | 123 | const char *zMainDbType;/* "configdb", "localdb", or "repository" */ |
| 124 | 124 | const char *zConfigDbType; /* "configdb", "localdb", or "repository" */ |
| 125 | - const char *zHome; /* Name of user home directory */ | |
| 126 | 125 | int localOpen; /* True if the local database is open */ |
| 127 | 126 | char *zLocalRoot; /* The directory holding the local database */ |
| 128 | 127 | int minPrefix; /* Number of digits needed for a distinct UUID */ |
| 129 | 128 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 130 | 129 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 131 | 130 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -114,17 +114,16 @@ | |
| 114 | char *nameOfExe; /* Full path of executable. */ |
| 115 | int isConst; /* True if the output is unchanging */ |
| 116 | sqlite3 *db; /* The connection to the databases */ |
| 117 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 118 | int useAttach; /* True if global_config is attached to repository */ |
| 119 | int configOpen; /* True if the config database is open */ |
| 120 | sqlite3_int64 now; /* Seconds since 1970 */ |
| 121 | int repositoryOpen; /* True if the main repository database is open */ |
| 122 | char *zRepositoryName; /* Name of the repository database */ |
| 123 | const char *zMainDbType;/* "configdb", "localdb", or "repository" */ |
| 124 | const char *zConfigDbType; /* "configdb", "localdb", or "repository" */ |
| 125 | const char *zHome; /* Name of user home directory */ |
| 126 | int localOpen; /* True if the local database is open */ |
| 127 | char *zLocalRoot; /* The directory holding the local database */ |
| 128 | int minPrefix; /* Number of digits needed for a distinct UUID */ |
| 129 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 130 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 131 |
| --- src/main.c | |
| +++ src/main.c | |
| @@ -114,17 +114,16 @@ | |
| 114 | char *nameOfExe; /* Full path of executable. */ |
| 115 | int isConst; /* True if the output is unchanging */ |
| 116 | sqlite3 *db; /* The connection to the databases */ |
| 117 | sqlite3 *dbConfig; /* Separate connection for global_config table */ |
| 118 | int useAttach; /* True if global_config is attached to repository */ |
| 119 | const char *zConfigDbName;/* Path of the config database. NULL if not open */ |
| 120 | sqlite3_int64 now; /* Seconds since 1970 */ |
| 121 | int repositoryOpen; /* True if the main repository database is open */ |
| 122 | char *zRepositoryName; /* Name of the repository database */ |
| 123 | const char *zMainDbType;/* "configdb", "localdb", or "repository" */ |
| 124 | const char *zConfigDbType; /* "configdb", "localdb", or "repository" */ |
| 125 | int localOpen; /* True if the local database is open */ |
| 126 | char *zLocalRoot; /* The directory holding the local database */ |
| 127 | int minPrefix; /* Number of digits needed for a distinct UUID */ |
| 128 | int fSqlTrace; /* True if --sqltrace flag is present */ |
| 129 | int fSqlStats; /* True if --sqltrace or --sqlstats are present */ |
| 130 |
+1
-2
| --- src/md5.c | ||
| +++ src/md5.c | ||
| @@ -258,12 +258,11 @@ | ||
| 258 | 258 | memset(p, 0, count-8); |
| 259 | 259 | } |
| 260 | 260 | byteReverse(ctx->in, 14); |
| 261 | 261 | |
| 262 | 262 | /* Append length in bits and transform */ |
| 263 | - ((uint32 *)ctx->in)[ 14 ] = ctx->bits[0]; | |
| 264 | - ((uint32 *)ctx->in)[ 15 ] = ctx->bits[1]; | |
| 263 | + memcpy(&ctx->in[14*sizeof(uint32)], ctx->bits, 2*sizeof(uint32)); | |
| 265 | 264 | |
| 266 | 265 | MD5Transform(ctx->buf, (uint32 *)ctx->in); |
| 267 | 266 | byteReverse((unsigned char *)ctx->buf, 4); |
| 268 | 267 | memcpy(digest, ctx->buf, 16); |
| 269 | 268 | memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ |
| 270 | 269 |
| --- src/md5.c | |
| +++ src/md5.c | |
| @@ -258,12 +258,11 @@ | |
| 258 | memset(p, 0, count-8); |
| 259 | } |
| 260 | byteReverse(ctx->in, 14); |
| 261 | |
| 262 | /* Append length in bits and transform */ |
| 263 | ((uint32 *)ctx->in)[ 14 ] = ctx->bits[0]; |
| 264 | ((uint32 *)ctx->in)[ 15 ] = ctx->bits[1]; |
| 265 | |
| 266 | MD5Transform(ctx->buf, (uint32 *)ctx->in); |
| 267 | byteReverse((unsigned char *)ctx->buf, 4); |
| 268 | memcpy(digest, ctx->buf, 16); |
| 269 | memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ |
| 270 |
| --- src/md5.c | |
| +++ src/md5.c | |
| @@ -258,12 +258,11 @@ | |
| 258 | memset(p, 0, count-8); |
| 259 | } |
| 260 | byteReverse(ctx->in, 14); |
| 261 | |
| 262 | /* Append length in bits and transform */ |
| 263 | memcpy(&ctx->in[14*sizeof(uint32)], ctx->bits, 2*sizeof(uint32)); |
| 264 | |
| 265 | MD5Transform(ctx->buf, (uint32 *)ctx->in); |
| 266 | byteReverse((unsigned char *)ctx->buf, 4); |
| 267 | memcpy(digest, ctx->buf, 16); |
| 268 | memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */ |
| 269 |
+1
-1
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -1678,11 +1678,11 @@ | ||
| 1678 | 1678 | @ |
| 1679 | 1679 | @ <p>Only a the first statement in the entry box will be run. |
| 1680 | 1680 | @ Any subsequent statements will be silently ignored.</p> |
| 1681 | 1681 | @ |
| 1682 | 1682 | @ <p>Database names:<ul><li>repository → %s(db_name("repository")) |
| 1683 | - if( g.configOpen ){ | |
| 1683 | + if( g.zConfigDbName ){ | |
| 1684 | 1684 | @ <li>config → %s(db_name("configdb")) |
| 1685 | 1685 | } |
| 1686 | 1686 | if( g.localOpen ){ |
| 1687 | 1687 | @ <li>local-checkout → %s(db_name("localdb")) |
| 1688 | 1688 | } |
| 1689 | 1689 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -1678,11 +1678,11 @@ | |
| 1678 | @ |
| 1679 | @ <p>Only a the first statement in the entry box will be run. |
| 1680 | @ Any subsequent statements will be silently ignored.</p> |
| 1681 | @ |
| 1682 | @ <p>Database names:<ul><li>repository → %s(db_name("repository")) |
| 1683 | if( g.configOpen ){ |
| 1684 | @ <li>config → %s(db_name("configdb")) |
| 1685 | } |
| 1686 | if( g.localOpen ){ |
| 1687 | @ <li>local-checkout → %s(db_name("localdb")) |
| 1688 | } |
| 1689 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -1678,11 +1678,11 @@ | |
| 1678 | @ |
| 1679 | @ <p>Only a the first statement in the entry box will be run. |
| 1680 | @ Any subsequent statements will be silently ignored.</p> |
| 1681 | @ |
| 1682 | @ <p>Database names:<ul><li>repository → %s(db_name("repository")) |
| 1683 | if( g.zConfigDbName ){ |
| 1684 | @ <li>config → %s(db_name("configdb")) |
| 1685 | } |
| 1686 | if( g.localOpen ){ |
| 1687 | @ <li>local-checkout → %s(db_name("localdb")) |
| 1688 | } |
| 1689 |
+1
-1
| --- src/setup.c | ||
| +++ src/setup.c | ||
| @@ -1678,11 +1678,11 @@ | ||
| 1678 | 1678 | @ |
| 1679 | 1679 | @ <p>Only a the first statement in the entry box will be run. |
| 1680 | 1680 | @ Any subsequent statements will be silently ignored.</p> |
| 1681 | 1681 | @ |
| 1682 | 1682 | @ <p>Database names:<ul><li>repository → %s(db_name("repository")) |
| 1683 | - if( g.configOpen ){ | |
| 1683 | + if( g.zConfigDbName ){ | |
| 1684 | 1684 | @ <li>config → %s(db_name("configdb")) |
| 1685 | 1685 | } |
| 1686 | 1686 | if( g.localOpen ){ |
| 1687 | 1687 | @ <li>local-checkout → %s(db_name("localdb")) |
| 1688 | 1688 | } |
| 1689 | 1689 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -1678,11 +1678,11 @@ | |
| 1678 | @ |
| 1679 | @ <p>Only a the first statement in the entry box will be run. |
| 1680 | @ Any subsequent statements will be silently ignored.</p> |
| 1681 | @ |
| 1682 | @ <p>Database names:<ul><li>repository → %s(db_name("repository")) |
| 1683 | if( g.configOpen ){ |
| 1684 | @ <li>config → %s(db_name("configdb")) |
| 1685 | } |
| 1686 | if( g.localOpen ){ |
| 1687 | @ <li>local-checkout → %s(db_name("localdb")) |
| 1688 | } |
| 1689 |
| --- src/setup.c | |
| +++ src/setup.c | |
| @@ -1678,11 +1678,11 @@ | |
| 1678 | @ |
| 1679 | @ <p>Only a the first statement in the entry box will be run. |
| 1680 | @ Any subsequent statements will be silently ignored.</p> |
| 1681 | @ |
| 1682 | @ <p>Database names:<ul><li>repository → %s(db_name("repository")) |
| 1683 | if( g.zConfigDbName ){ |
| 1684 | @ <li>config → %s(db_name("configdb")) |
| 1685 | } |
| 1686 | if( g.localOpen ){ |
| 1687 | @ <li>local-checkout → %s(db_name("localdb")) |
| 1688 | } |
| 1689 |
+51
-20
| --- src/sqlite3.c | ||
| +++ src/sqlite3.c | ||
| @@ -674,11 +674,11 @@ | ||
| 674 | 674 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 675 | 675 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 676 | 676 | */ |
| 677 | 677 | #define SQLITE_VERSION "3.7.16" |
| 678 | 678 | #define SQLITE_VERSION_NUMBER 3007016 |
| 679 | -#define SQLITE_SOURCE_ID "2013-03-01 23:40:26 780d06c5e54590f677f993fa9c313989c2eab8c7" | |
| 679 | +#define SQLITE_SOURCE_ID "2013-03-06 01:55:27 7097241c1220ada318f8eda938c3e3430b94a606" | |
| 680 | 680 | |
| 681 | 681 | /* |
| 682 | 682 | ** CAPI3REF: Run-Time Library Version Numbers |
| 683 | 683 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 684 | 684 | ** |
| @@ -1048,10 +1048,11 @@ | ||
| 1048 | 1048 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 1049 | 1049 | #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) |
| 1050 | 1050 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 1051 | 1051 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 1052 | 1052 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 1053 | +#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) | |
| 1053 | 1054 | #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| 1054 | 1055 | #define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) |
| 1055 | 1056 | #define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) |
| 1056 | 1057 | #define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8)) |
| 1057 | 1058 | #define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8)) |
| @@ -23459,11 +23460,14 @@ | ||
| 23459 | 23460 | #endif |
| 23460 | 23461 | }while( fd<0 && errno==EINTR ); |
| 23461 | 23462 | if( fd>=0 ){ |
| 23462 | 23463 | if( m!=0 ){ |
| 23463 | 23464 | struct stat statbuf; |
| 23464 | - if( osFstat(fd, &statbuf)==0 && (statbuf.st_mode&0777)!=m ){ | |
| 23465 | + if( osFstat(fd, &statbuf)==0 | |
| 23466 | + && statbuf.st_size==0 | |
| 23467 | + && (statbuf.st_mode&0777)!=m | |
| 23468 | + ){ | |
| 23465 | 23469 | osFchmod(fd, m); |
| 23466 | 23470 | } |
| 23467 | 23471 | } |
| 23468 | 23472 | #if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0) |
| 23469 | 23473 | osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC); |
| @@ -41111,16 +41115,30 @@ | ||
| 41111 | 41115 | /* |
| 41112 | 41116 | ** Truncate the in-memory database file image to nPage pages. This |
| 41113 | 41117 | ** function does not actually modify the database file on disk. It |
| 41114 | 41118 | ** just sets the internal state of the pager object so that the |
| 41115 | 41119 | ** truncation will be done when the current transaction is committed. |
| 41120 | +** | |
| 41121 | +** This function is only called right before committing a transaction. | |
| 41122 | +** Once this function has been called, the transaction must either be | |
| 41123 | +** rolled back or committed. It is not safe to call this function and | |
| 41124 | +** then continue writing to the database. | |
| 41116 | 41125 | */ |
| 41117 | 41126 | SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){ |
| 41118 | 41127 | assert( pPager->dbSize>=nPage ); |
| 41119 | 41128 | assert( pPager->eState>=PAGER_WRITER_CACHEMOD ); |
| 41120 | 41129 | pPager->dbSize = nPage; |
| 41121 | - assertTruncateConstraint(pPager); | |
| 41130 | + | |
| 41131 | + /* At one point the code here called assertTruncateConstraint() to | |
| 41132 | + ** ensure that all pages being truncated away by this operation are, | |
| 41133 | + ** if one or more savepoints are open, present in the savepoint | |
| 41134 | + ** journal so that they can be restored if the savepoint is rolled | |
| 41135 | + ** back. This is no longer necessary as this function is now only | |
| 41136 | + ** called right before committing a transaction. So although the | |
| 41137 | + ** Pager object may still have open savepoints (Pager.nSavepoint!=0), | |
| 41138 | + ** they cannot be rolled back. So the assertTruncateConstraint() call | |
| 41139 | + ** is no longer correct. */ | |
| 41122 | 41140 | } |
| 41123 | 41141 | |
| 41124 | 41142 | |
| 41125 | 41143 | /* |
| 41126 | 41144 | ** This function is called before attempting a hot-journal rollback. It |
| @@ -42169,10 +42187,15 @@ | ||
| 42169 | 42187 | } |
| 42170 | 42188 | if( rc!=SQLITE_OK ){ |
| 42171 | 42189 | goto failed; |
| 42172 | 42190 | } |
| 42173 | 42191 | if( bHotJournal ){ |
| 42192 | + if( pPager->readOnly ){ | |
| 42193 | + rc = SQLITE_READONLY_ROLLBACK; | |
| 42194 | + goto failed; | |
| 42195 | + } | |
| 42196 | + | |
| 42174 | 42197 | /* Get an EXCLUSIVE lock on the database file. At this point it is |
| 42175 | 42198 | ** important that a RESERVED lock is not obtained on the way to the |
| 42176 | 42199 | ** EXCLUSIVE lock. If it were, another process might open the |
| 42177 | 42200 | ** database file, detect the RESERVED lock, and conclude that the |
| 42178 | 42201 | ** database is safe to read while this process is still rolling the |
| @@ -51340,11 +51363,11 @@ | ||
| 51340 | 51363 | } |
| 51341 | 51364 | releasePage(pFreePg); |
| 51342 | 51365 | }while( bCommit && iFreePg>nFin ); |
| 51343 | 51366 | assert( iFreePg<iLastPg ); |
| 51344 | 51367 | |
| 51345 | - rc = relocatePage(pBt, pLastPg, eType, iPtrPage, iFreePg, nFin!=0); | |
| 51368 | + rc = relocatePage(pBt, pLastPg, eType, iPtrPage, iFreePg, bCommit); | |
| 51346 | 51369 | releasePage(pLastPg); |
| 51347 | 51370 | if( rc!=SQLITE_OK ){ |
| 51348 | 51371 | return rc; |
| 51349 | 51372 | } |
| 51350 | 51373 | } |
| @@ -53211,25 +53234,27 @@ | ||
| 53211 | 53234 | ** |
| 53212 | 53235 | ** SQLITE_OK is returned on success. Any other return value indicates |
| 53213 | 53236 | ** an error. *ppPage and *pPgno are undefined in the event of an error. |
| 53214 | 53237 | ** Do not invoke sqlite3PagerUnref() on *ppPage if an error is returned. |
| 53215 | 53238 | ** |
| 53216 | -** If the "nearby" parameter is not 0, then a (feeble) effort is made to | |
| 53239 | +** If the "nearby" parameter is not 0, then an effort is made to | |
| 53217 | 53240 | ** locate a page close to the page number "nearby". This can be used in an |
| 53218 | 53241 | ** attempt to keep related pages close to each other in the database file, |
| 53219 | 53242 | ** which in turn can make database access faster. |
| 53220 | 53243 | ** |
| 53221 | -** If the "exact" parameter is not 0, and the page-number nearby exists | |
| 53222 | -** anywhere on the free-list, then it is guarenteed to be returned. This | |
| 53223 | -** is only used by auto-vacuum databases when allocating a new table. | |
| 53244 | +** If the eMode parameter is BTALLOC_EXACT and the nearby page exists | |
| 53245 | +** anywhere on the free-list, then it is guaranteed to be returned. If | |
| 53246 | +** eMode is BTALLOC_LT then the page returned will be less than or equal | |
| 53247 | +** to nearby if any such page exists. If eMode is BTALLOC_ANY then there | |
| 53248 | +** are no restrictions on which page is returned. | |
| 53224 | 53249 | */ |
| 53225 | 53250 | static int allocateBtreePage( |
| 53226 | - BtShared *pBt, | |
| 53227 | - MemPage **ppPage, | |
| 53228 | - Pgno *pPgno, | |
| 53229 | - Pgno nearby, | |
| 53230 | - u8 eMode | |
| 53251 | + BtShared *pBt, /* The btree */ | |
| 53252 | + MemPage **ppPage, /* Store pointer to the allocated page here */ | |
| 53253 | + Pgno *pPgno, /* Store the page number here */ | |
| 53254 | + Pgno nearby, /* Search for a page near this one */ | |
| 53255 | + u8 eMode /* BTALLOC_EXACT, BTALLOC_LT, or BTALLOC_ANY */ | |
| 53231 | 53256 | ){ |
| 53232 | 53257 | MemPage *pPage1; |
| 53233 | 53258 | int rc; |
| 53234 | 53259 | u32 n; /* Number of pages on the freelist */ |
| 53235 | 53260 | u32 k; /* Number of leaves on the trunk of the freelist */ |
| @@ -53236,10 +53261,11 @@ | ||
| 53236 | 53261 | MemPage *pTrunk = 0; |
| 53237 | 53262 | MemPage *pPrevTrunk = 0; |
| 53238 | 53263 | Pgno mxPage; /* Total size of the database file */ |
| 53239 | 53264 | |
| 53240 | 53265 | assert( sqlite3_mutex_held(pBt->mutex) ); |
| 53266 | + assert( eMode==BTALLOC_ANY || (nearby>0 && pBt->autoVacuum) ); | |
| 53241 | 53267 | pPage1 = pBt->pPage1; |
| 53242 | 53268 | mxPage = btreePagecount(pBt); |
| 53243 | 53269 | n = get4byte(&pPage1->aData[36]); |
| 53244 | 53270 | testcase( n==mxPage-1 ); |
| 53245 | 53271 | if( n>=mxPage ){ |
| @@ -53248,11 +53274,11 @@ | ||
| 53248 | 53274 | if( n>0 ){ |
| 53249 | 53275 | /* There are pages on the freelist. Reuse one of those pages. */ |
| 53250 | 53276 | Pgno iTrunk; |
| 53251 | 53277 | u8 searchList = 0; /* If the free-list must be searched for 'nearby' */ |
| 53252 | 53278 | |
| 53253 | - /* If the 'exact' parameter was true and a query of the pointer-map | |
| 53279 | + /* If eMode==BTALLOC_EXACT and a query of the pointer-map | |
| 53254 | 53280 | ** shows that the page 'nearby' is somewhere on the free-list, then |
| 53255 | 53281 | ** the entire-list will be searched for that page. |
| 53256 | 53282 | */ |
| 53257 | 53283 | #ifndef SQLITE_OMIT_AUTOVACUUM |
| 53258 | 53284 | if( eMode==BTALLOC_EXACT ){ |
| @@ -53278,11 +53304,12 @@ | ||
| 53278 | 53304 | if( rc ) return rc; |
| 53279 | 53305 | put4byte(&pPage1->aData[36], n-1); |
| 53280 | 53306 | |
| 53281 | 53307 | /* The code within this loop is run only once if the 'searchList' variable |
| 53282 | 53308 | ** is not true. Otherwise, it runs once for each trunk-page on the |
| 53283 | - ** free-list until the page 'nearby' is located. | |
| 53309 | + ** free-list until the page 'nearby' is located (eMode==BTALLOC_EXACT) | |
| 53310 | + ** or until a page less than 'nearby' is located (eMode==BTALLOC_LT) | |
| 53284 | 53311 | */ |
| 53285 | 53312 | do { |
| 53286 | 53313 | pPrevTrunk = pTrunk; |
| 53287 | 53314 | if( pPrevTrunk ){ |
| 53288 | 53315 | iTrunk = get4byte(&pPrevTrunk->aData[0]); |
| @@ -103557,13 +103584,12 @@ | ||
| 103557 | 103584 | ** |
| 103558 | 103585 | ** If there are multiple terms in the WHERE clause of the form "X <op> <expr>" |
| 103559 | 103586 | ** then try for the one with no dependencies on <expr> - in other words where |
| 103560 | 103587 | ** <expr> is a constant expression of some kind. Only return entries of |
| 103561 | 103588 | ** the form "X <op> Y" where Y is a column in another table if no terms of |
| 103562 | -** the form "X <op> <const-expr>" exist. Other than this priority, if there | |
| 103563 | -** are two or more terms that match, then the choice of which term to return | |
| 103564 | -** is arbitrary. | |
| 103589 | +** the form "X <op> <const-expr>" exist. If no terms with a constant RHS | |
| 103590 | +** exist, try to return a term that does not use WO_EQUIV. | |
| 103565 | 103591 | */ |
| 103566 | 103592 | static WhereTerm *findTerm( |
| 103567 | 103593 | WhereClause *pWC, /* The WHERE clause to be searched */ |
| 103568 | 103594 | int iCur, /* Cursor number of LHS */ |
| 103569 | 103595 | int iColumn, /* Column number of LHS */ |
| @@ -103618,12 +103644,16 @@ | ||
| 103618 | 103644 | } |
| 103619 | 103645 | if( sqlite3StrICmp(pColl->zName, pIdx->azColl[j]) ){ |
| 103620 | 103646 | continue; |
| 103621 | 103647 | } |
| 103622 | 103648 | } |
| 103623 | - pResult = pTerm; | |
| 103624 | - if( pTerm->prereqRight==0 ) goto findTerm_success; | |
| 103649 | + if( pTerm->prereqRight==0 ){ | |
| 103650 | + pResult = pTerm; | |
| 103651 | + goto findTerm_success; | |
| 103652 | + }else if( pResult==0 ){ | |
| 103653 | + pResult = pTerm; | |
| 103654 | + } | |
| 103625 | 103655 | } |
| 103626 | 103656 | if( (pTerm->eOperator & WO_EQUIV)!=0 |
| 103627 | 103657 | && nEquiv<ArraySize(aEquiv) |
| 103628 | 103658 | ){ |
| 103629 | 103659 | pX = sqlite3ExprSkipCollate(pTerm->pExpr->pRight); |
| @@ -107145,10 +107175,11 @@ | ||
| 107145 | 107175 | testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */ |
| 107146 | 107176 | iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, iReleaseReg); |
| 107147 | 107177 | addrNxt = pLevel->addrNxt; |
| 107148 | 107178 | sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt); |
| 107149 | 107179 | sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addrNxt, iRowidReg); |
| 107180 | + sqlite3ExprCacheAffinityChange(pParse, iRowidReg, 1); | |
| 107150 | 107181 | sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg); |
| 107151 | 107182 | VdbeComment((v, "pk")); |
| 107152 | 107183 | pLevel->op = OP_Noop; |
| 107153 | 107184 | }else if( pLevel->plan.wsFlags & WHERE_ROWID_RANGE ){ |
| 107154 | 107185 | /* Case 2: We have an inequality comparison against the ROWID field. |
| 107155 | 107186 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -674,11 +674,11 @@ | |
| 674 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 675 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 676 | */ |
| 677 | #define SQLITE_VERSION "3.7.16" |
| 678 | #define SQLITE_VERSION_NUMBER 3007016 |
| 679 | #define SQLITE_SOURCE_ID "2013-03-01 23:40:26 780d06c5e54590f677f993fa9c313989c2eab8c7" |
| 680 | |
| 681 | /* |
| 682 | ** CAPI3REF: Run-Time Library Version Numbers |
| 683 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 684 | ** |
| @@ -1048,10 +1048,11 @@ | |
| 1048 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 1049 | #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) |
| 1050 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 1051 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 1052 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 1053 | #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| 1054 | #define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) |
| 1055 | #define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) |
| 1056 | #define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8)) |
| 1057 | #define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8)) |
| @@ -23459,11 +23460,14 @@ | |
| 23459 | #endif |
| 23460 | }while( fd<0 && errno==EINTR ); |
| 23461 | if( fd>=0 ){ |
| 23462 | if( m!=0 ){ |
| 23463 | struct stat statbuf; |
| 23464 | if( osFstat(fd, &statbuf)==0 && (statbuf.st_mode&0777)!=m ){ |
| 23465 | osFchmod(fd, m); |
| 23466 | } |
| 23467 | } |
| 23468 | #if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0) |
| 23469 | osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC); |
| @@ -41111,16 +41115,30 @@ | |
| 41111 | /* |
| 41112 | ** Truncate the in-memory database file image to nPage pages. This |
| 41113 | ** function does not actually modify the database file on disk. It |
| 41114 | ** just sets the internal state of the pager object so that the |
| 41115 | ** truncation will be done when the current transaction is committed. |
| 41116 | */ |
| 41117 | SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){ |
| 41118 | assert( pPager->dbSize>=nPage ); |
| 41119 | assert( pPager->eState>=PAGER_WRITER_CACHEMOD ); |
| 41120 | pPager->dbSize = nPage; |
| 41121 | assertTruncateConstraint(pPager); |
| 41122 | } |
| 41123 | |
| 41124 | |
| 41125 | /* |
| 41126 | ** This function is called before attempting a hot-journal rollback. It |
| @@ -42169,10 +42187,15 @@ | |
| 42169 | } |
| 42170 | if( rc!=SQLITE_OK ){ |
| 42171 | goto failed; |
| 42172 | } |
| 42173 | if( bHotJournal ){ |
| 42174 | /* Get an EXCLUSIVE lock on the database file. At this point it is |
| 42175 | ** important that a RESERVED lock is not obtained on the way to the |
| 42176 | ** EXCLUSIVE lock. If it were, another process might open the |
| 42177 | ** database file, detect the RESERVED lock, and conclude that the |
| 42178 | ** database is safe to read while this process is still rolling the |
| @@ -51340,11 +51363,11 @@ | |
| 51340 | } |
| 51341 | releasePage(pFreePg); |
| 51342 | }while( bCommit && iFreePg>nFin ); |
| 51343 | assert( iFreePg<iLastPg ); |
| 51344 | |
| 51345 | rc = relocatePage(pBt, pLastPg, eType, iPtrPage, iFreePg, nFin!=0); |
| 51346 | releasePage(pLastPg); |
| 51347 | if( rc!=SQLITE_OK ){ |
| 51348 | return rc; |
| 51349 | } |
| 51350 | } |
| @@ -53211,25 +53234,27 @@ | |
| 53211 | ** |
| 53212 | ** SQLITE_OK is returned on success. Any other return value indicates |
| 53213 | ** an error. *ppPage and *pPgno are undefined in the event of an error. |
| 53214 | ** Do not invoke sqlite3PagerUnref() on *ppPage if an error is returned. |
| 53215 | ** |
| 53216 | ** If the "nearby" parameter is not 0, then a (feeble) effort is made to |
| 53217 | ** locate a page close to the page number "nearby". This can be used in an |
| 53218 | ** attempt to keep related pages close to each other in the database file, |
| 53219 | ** which in turn can make database access faster. |
| 53220 | ** |
| 53221 | ** If the "exact" parameter is not 0, and the page-number nearby exists |
| 53222 | ** anywhere on the free-list, then it is guarenteed to be returned. This |
| 53223 | ** is only used by auto-vacuum databases when allocating a new table. |
| 53224 | */ |
| 53225 | static int allocateBtreePage( |
| 53226 | BtShared *pBt, |
| 53227 | MemPage **ppPage, |
| 53228 | Pgno *pPgno, |
| 53229 | Pgno nearby, |
| 53230 | u8 eMode |
| 53231 | ){ |
| 53232 | MemPage *pPage1; |
| 53233 | int rc; |
| 53234 | u32 n; /* Number of pages on the freelist */ |
| 53235 | u32 k; /* Number of leaves on the trunk of the freelist */ |
| @@ -53236,10 +53261,11 @@ | |
| 53236 | MemPage *pTrunk = 0; |
| 53237 | MemPage *pPrevTrunk = 0; |
| 53238 | Pgno mxPage; /* Total size of the database file */ |
| 53239 | |
| 53240 | assert( sqlite3_mutex_held(pBt->mutex) ); |
| 53241 | pPage1 = pBt->pPage1; |
| 53242 | mxPage = btreePagecount(pBt); |
| 53243 | n = get4byte(&pPage1->aData[36]); |
| 53244 | testcase( n==mxPage-1 ); |
| 53245 | if( n>=mxPage ){ |
| @@ -53248,11 +53274,11 @@ | |
| 53248 | if( n>0 ){ |
| 53249 | /* There are pages on the freelist. Reuse one of those pages. */ |
| 53250 | Pgno iTrunk; |
| 53251 | u8 searchList = 0; /* If the free-list must be searched for 'nearby' */ |
| 53252 | |
| 53253 | /* If the 'exact' parameter was true and a query of the pointer-map |
| 53254 | ** shows that the page 'nearby' is somewhere on the free-list, then |
| 53255 | ** the entire-list will be searched for that page. |
| 53256 | */ |
| 53257 | #ifndef SQLITE_OMIT_AUTOVACUUM |
| 53258 | if( eMode==BTALLOC_EXACT ){ |
| @@ -53278,11 +53304,12 @@ | |
| 53278 | if( rc ) return rc; |
| 53279 | put4byte(&pPage1->aData[36], n-1); |
| 53280 | |
| 53281 | /* The code within this loop is run only once if the 'searchList' variable |
| 53282 | ** is not true. Otherwise, it runs once for each trunk-page on the |
| 53283 | ** free-list until the page 'nearby' is located. |
| 53284 | */ |
| 53285 | do { |
| 53286 | pPrevTrunk = pTrunk; |
| 53287 | if( pPrevTrunk ){ |
| 53288 | iTrunk = get4byte(&pPrevTrunk->aData[0]); |
| @@ -103557,13 +103584,12 @@ | |
| 103557 | ** |
| 103558 | ** If there are multiple terms in the WHERE clause of the form "X <op> <expr>" |
| 103559 | ** then try for the one with no dependencies on <expr> - in other words where |
| 103560 | ** <expr> is a constant expression of some kind. Only return entries of |
| 103561 | ** the form "X <op> Y" where Y is a column in another table if no terms of |
| 103562 | ** the form "X <op> <const-expr>" exist. Other than this priority, if there |
| 103563 | ** are two or more terms that match, then the choice of which term to return |
| 103564 | ** is arbitrary. |
| 103565 | */ |
| 103566 | static WhereTerm *findTerm( |
| 103567 | WhereClause *pWC, /* The WHERE clause to be searched */ |
| 103568 | int iCur, /* Cursor number of LHS */ |
| 103569 | int iColumn, /* Column number of LHS */ |
| @@ -103618,12 +103644,16 @@ | |
| 103618 | } |
| 103619 | if( sqlite3StrICmp(pColl->zName, pIdx->azColl[j]) ){ |
| 103620 | continue; |
| 103621 | } |
| 103622 | } |
| 103623 | pResult = pTerm; |
| 103624 | if( pTerm->prereqRight==0 ) goto findTerm_success; |
| 103625 | } |
| 103626 | if( (pTerm->eOperator & WO_EQUIV)!=0 |
| 103627 | && nEquiv<ArraySize(aEquiv) |
| 103628 | ){ |
| 103629 | pX = sqlite3ExprSkipCollate(pTerm->pExpr->pRight); |
| @@ -107145,10 +107175,11 @@ | |
| 107145 | testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */ |
| 107146 | iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, iReleaseReg); |
| 107147 | addrNxt = pLevel->addrNxt; |
| 107148 | sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt); |
| 107149 | sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addrNxt, iRowidReg); |
| 107150 | sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg); |
| 107151 | VdbeComment((v, "pk")); |
| 107152 | pLevel->op = OP_Noop; |
| 107153 | }else if( pLevel->plan.wsFlags & WHERE_ROWID_RANGE ){ |
| 107154 | /* Case 2: We have an inequality comparison against the ROWID field. |
| 107155 |
| --- src/sqlite3.c | |
| +++ src/sqlite3.c | |
| @@ -674,11 +674,11 @@ | |
| 674 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 675 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 676 | */ |
| 677 | #define SQLITE_VERSION "3.7.16" |
| 678 | #define SQLITE_VERSION_NUMBER 3007016 |
| 679 | #define SQLITE_SOURCE_ID "2013-03-06 01:55:27 7097241c1220ada318f8eda938c3e3430b94a606" |
| 680 | |
| 681 | /* |
| 682 | ** CAPI3REF: Run-Time Library Version Numbers |
| 683 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 684 | ** |
| @@ -1048,10 +1048,11 @@ | |
| 1048 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 1049 | #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) |
| 1050 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 1051 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 1052 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 1053 | #define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) |
| 1054 | #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| 1055 | #define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) |
| 1056 | #define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) |
| 1057 | #define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8)) |
| 1058 | #define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8)) |
| @@ -23459,11 +23460,14 @@ | |
| 23460 | #endif |
| 23461 | }while( fd<0 && errno==EINTR ); |
| 23462 | if( fd>=0 ){ |
| 23463 | if( m!=0 ){ |
| 23464 | struct stat statbuf; |
| 23465 | if( osFstat(fd, &statbuf)==0 |
| 23466 | && statbuf.st_size==0 |
| 23467 | && (statbuf.st_mode&0777)!=m |
| 23468 | ){ |
| 23469 | osFchmod(fd, m); |
| 23470 | } |
| 23471 | } |
| 23472 | #if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0) |
| 23473 | osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC); |
| @@ -41111,16 +41115,30 @@ | |
| 41115 | /* |
| 41116 | ** Truncate the in-memory database file image to nPage pages. This |
| 41117 | ** function does not actually modify the database file on disk. It |
| 41118 | ** just sets the internal state of the pager object so that the |
| 41119 | ** truncation will be done when the current transaction is committed. |
| 41120 | ** |
| 41121 | ** This function is only called right before committing a transaction. |
| 41122 | ** Once this function has been called, the transaction must either be |
| 41123 | ** rolled back or committed. It is not safe to call this function and |
| 41124 | ** then continue writing to the database. |
| 41125 | */ |
| 41126 | SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){ |
| 41127 | assert( pPager->dbSize>=nPage ); |
| 41128 | assert( pPager->eState>=PAGER_WRITER_CACHEMOD ); |
| 41129 | pPager->dbSize = nPage; |
| 41130 | |
| 41131 | /* At one point the code here called assertTruncateConstraint() to |
| 41132 | ** ensure that all pages being truncated away by this operation are, |
| 41133 | ** if one or more savepoints are open, present in the savepoint |
| 41134 | ** journal so that they can be restored if the savepoint is rolled |
| 41135 | ** back. This is no longer necessary as this function is now only |
| 41136 | ** called right before committing a transaction. So although the |
| 41137 | ** Pager object may still have open savepoints (Pager.nSavepoint!=0), |
| 41138 | ** they cannot be rolled back. So the assertTruncateConstraint() call |
| 41139 | ** is no longer correct. */ |
| 41140 | } |
| 41141 | |
| 41142 | |
| 41143 | /* |
| 41144 | ** This function is called before attempting a hot-journal rollback. It |
| @@ -42169,10 +42187,15 @@ | |
| 42187 | } |
| 42188 | if( rc!=SQLITE_OK ){ |
| 42189 | goto failed; |
| 42190 | } |
| 42191 | if( bHotJournal ){ |
| 42192 | if( pPager->readOnly ){ |
| 42193 | rc = SQLITE_READONLY_ROLLBACK; |
| 42194 | goto failed; |
| 42195 | } |
| 42196 | |
| 42197 | /* Get an EXCLUSIVE lock on the database file. At this point it is |
| 42198 | ** important that a RESERVED lock is not obtained on the way to the |
| 42199 | ** EXCLUSIVE lock. If it were, another process might open the |
| 42200 | ** database file, detect the RESERVED lock, and conclude that the |
| 42201 | ** database is safe to read while this process is still rolling the |
| @@ -51340,11 +51363,11 @@ | |
| 51363 | } |
| 51364 | releasePage(pFreePg); |
| 51365 | }while( bCommit && iFreePg>nFin ); |
| 51366 | assert( iFreePg<iLastPg ); |
| 51367 | |
| 51368 | rc = relocatePage(pBt, pLastPg, eType, iPtrPage, iFreePg, bCommit); |
| 51369 | releasePage(pLastPg); |
| 51370 | if( rc!=SQLITE_OK ){ |
| 51371 | return rc; |
| 51372 | } |
| 51373 | } |
| @@ -53211,25 +53234,27 @@ | |
| 53234 | ** |
| 53235 | ** SQLITE_OK is returned on success. Any other return value indicates |
| 53236 | ** an error. *ppPage and *pPgno are undefined in the event of an error. |
| 53237 | ** Do not invoke sqlite3PagerUnref() on *ppPage if an error is returned. |
| 53238 | ** |
| 53239 | ** If the "nearby" parameter is not 0, then an effort is made to |
| 53240 | ** locate a page close to the page number "nearby". This can be used in an |
| 53241 | ** attempt to keep related pages close to each other in the database file, |
| 53242 | ** which in turn can make database access faster. |
| 53243 | ** |
| 53244 | ** If the eMode parameter is BTALLOC_EXACT and the nearby page exists |
| 53245 | ** anywhere on the free-list, then it is guaranteed to be returned. If |
| 53246 | ** eMode is BTALLOC_LT then the page returned will be less than or equal |
| 53247 | ** to nearby if any such page exists. If eMode is BTALLOC_ANY then there |
| 53248 | ** are no restrictions on which page is returned. |
| 53249 | */ |
| 53250 | static int allocateBtreePage( |
| 53251 | BtShared *pBt, /* The btree */ |
| 53252 | MemPage **ppPage, /* Store pointer to the allocated page here */ |
| 53253 | Pgno *pPgno, /* Store the page number here */ |
| 53254 | Pgno nearby, /* Search for a page near this one */ |
| 53255 | u8 eMode /* BTALLOC_EXACT, BTALLOC_LT, or BTALLOC_ANY */ |
| 53256 | ){ |
| 53257 | MemPage *pPage1; |
| 53258 | int rc; |
| 53259 | u32 n; /* Number of pages on the freelist */ |
| 53260 | u32 k; /* Number of leaves on the trunk of the freelist */ |
| @@ -53236,10 +53261,11 @@ | |
| 53261 | MemPage *pTrunk = 0; |
| 53262 | MemPage *pPrevTrunk = 0; |
| 53263 | Pgno mxPage; /* Total size of the database file */ |
| 53264 | |
| 53265 | assert( sqlite3_mutex_held(pBt->mutex) ); |
| 53266 | assert( eMode==BTALLOC_ANY || (nearby>0 && pBt->autoVacuum) ); |
| 53267 | pPage1 = pBt->pPage1; |
| 53268 | mxPage = btreePagecount(pBt); |
| 53269 | n = get4byte(&pPage1->aData[36]); |
| 53270 | testcase( n==mxPage-1 ); |
| 53271 | if( n>=mxPage ){ |
| @@ -53248,11 +53274,11 @@ | |
| 53274 | if( n>0 ){ |
| 53275 | /* There are pages on the freelist. Reuse one of those pages. */ |
| 53276 | Pgno iTrunk; |
| 53277 | u8 searchList = 0; /* If the free-list must be searched for 'nearby' */ |
| 53278 | |
| 53279 | /* If eMode==BTALLOC_EXACT and a query of the pointer-map |
| 53280 | ** shows that the page 'nearby' is somewhere on the free-list, then |
| 53281 | ** the entire-list will be searched for that page. |
| 53282 | */ |
| 53283 | #ifndef SQLITE_OMIT_AUTOVACUUM |
| 53284 | if( eMode==BTALLOC_EXACT ){ |
| @@ -53278,11 +53304,12 @@ | |
| 53304 | if( rc ) return rc; |
| 53305 | put4byte(&pPage1->aData[36], n-1); |
| 53306 | |
| 53307 | /* The code within this loop is run only once if the 'searchList' variable |
| 53308 | ** is not true. Otherwise, it runs once for each trunk-page on the |
| 53309 | ** free-list until the page 'nearby' is located (eMode==BTALLOC_EXACT) |
| 53310 | ** or until a page less than 'nearby' is located (eMode==BTALLOC_LT) |
| 53311 | */ |
| 53312 | do { |
| 53313 | pPrevTrunk = pTrunk; |
| 53314 | if( pPrevTrunk ){ |
| 53315 | iTrunk = get4byte(&pPrevTrunk->aData[0]); |
| @@ -103557,13 +103584,12 @@ | |
| 103584 | ** |
| 103585 | ** If there are multiple terms in the WHERE clause of the form "X <op> <expr>" |
| 103586 | ** then try for the one with no dependencies on <expr> - in other words where |
| 103587 | ** <expr> is a constant expression of some kind. Only return entries of |
| 103588 | ** the form "X <op> Y" where Y is a column in another table if no terms of |
| 103589 | ** the form "X <op> <const-expr>" exist. If no terms with a constant RHS |
| 103590 | ** exist, try to return a term that does not use WO_EQUIV. |
| 103591 | */ |
| 103592 | static WhereTerm *findTerm( |
| 103593 | WhereClause *pWC, /* The WHERE clause to be searched */ |
| 103594 | int iCur, /* Cursor number of LHS */ |
| 103595 | int iColumn, /* Column number of LHS */ |
| @@ -103618,12 +103644,16 @@ | |
| 103644 | } |
| 103645 | if( sqlite3StrICmp(pColl->zName, pIdx->azColl[j]) ){ |
| 103646 | continue; |
| 103647 | } |
| 103648 | } |
| 103649 | if( pTerm->prereqRight==0 ){ |
| 103650 | pResult = pTerm; |
| 103651 | goto findTerm_success; |
| 103652 | }else if( pResult==0 ){ |
| 103653 | pResult = pTerm; |
| 103654 | } |
| 103655 | } |
| 103656 | if( (pTerm->eOperator & WO_EQUIV)!=0 |
| 103657 | && nEquiv<ArraySize(aEquiv) |
| 103658 | ){ |
| 103659 | pX = sqlite3ExprSkipCollate(pTerm->pExpr->pRight); |
| @@ -107145,10 +107175,11 @@ | |
| 107175 | testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */ |
| 107176 | iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, iReleaseReg); |
| 107177 | addrNxt = pLevel->addrNxt; |
| 107178 | sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt); |
| 107179 | sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addrNxt, iRowidReg); |
| 107180 | sqlite3ExprCacheAffinityChange(pParse, iRowidReg, 1); |
| 107181 | sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg); |
| 107182 | VdbeComment((v, "pk")); |
| 107183 | pLevel->op = OP_Noop; |
| 107184 | }else if( pLevel->plan.wsFlags & WHERE_ROWID_RANGE ){ |
| 107185 | /* Case 2: We have an inequality comparison against the ROWID field. |
| 107186 |
+2
-1
| --- src/sqlite3.h | ||
| +++ src/sqlite3.h | ||
| @@ -107,11 +107,11 @@ | ||
| 107 | 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | 109 | */ |
| 110 | 110 | #define SQLITE_VERSION "3.7.16" |
| 111 | 111 | #define SQLITE_VERSION_NUMBER 3007016 |
| 112 | -#define SQLITE_SOURCE_ID "2013-03-01 23:40:26 780d06c5e54590f677f993fa9c313989c2eab8c7" | |
| 112 | +#define SQLITE_SOURCE_ID "2013-03-06 01:55:27 7097241c1220ada318f8eda938c3e3430b94a606" | |
| 113 | 113 | |
| 114 | 114 | /* |
| 115 | 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | 117 | ** |
| @@ -481,10 +481,11 @@ | ||
| 481 | 481 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 482 | 482 | #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) |
| 483 | 483 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 484 | 484 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 485 | 485 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 486 | +#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) | |
| 486 | 487 | #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| 487 | 488 | #define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) |
| 488 | 489 | #define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) |
| 489 | 490 | #define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8)) |
| 490 | 491 | #define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8)) |
| 491 | 492 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -107,11 +107,11 @@ | |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.7.16" |
| 111 | #define SQLITE_VERSION_NUMBER 3007016 |
| 112 | #define SQLITE_SOURCE_ID "2013-03-01 23:40:26 780d06c5e54590f677f993fa9c313989c2eab8c7" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -481,10 +481,11 @@ | |
| 481 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 482 | #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) |
| 483 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 484 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 485 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 486 | #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| 487 | #define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) |
| 488 | #define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) |
| 489 | #define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8)) |
| 490 | #define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8)) |
| 491 |
| --- src/sqlite3.h | |
| +++ src/sqlite3.h | |
| @@ -107,11 +107,11 @@ | |
| 107 | ** [sqlite3_libversion_number()], [sqlite3_sourceid()], |
| 108 | ** [sqlite_version()] and [sqlite_source_id()]. |
| 109 | */ |
| 110 | #define SQLITE_VERSION "3.7.16" |
| 111 | #define SQLITE_VERSION_NUMBER 3007016 |
| 112 | #define SQLITE_SOURCE_ID "2013-03-06 01:55:27 7097241c1220ada318f8eda938c3e3430b94a606" |
| 113 | |
| 114 | /* |
| 115 | ** CAPI3REF: Run-Time Library Version Numbers |
| 116 | ** KEYWORDS: sqlite3_version, sqlite3_sourceid |
| 117 | ** |
| @@ -481,10 +481,11 @@ | |
| 481 | #define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8)) |
| 482 | #define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8)) |
| 483 | #define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8)) |
| 484 | #define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8)) |
| 485 | #define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8)) |
| 486 | #define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8)) |
| 487 | #define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8)) |
| 488 | #define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8)) |
| 489 | #define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8)) |
| 490 | #define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8)) |
| 491 | #define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8)) |
| 492 |
+1
-1
| --- src/tkt.c | ||
| +++ src/tkt.c | ||
| @@ -934,11 +934,11 @@ | ||
| 934 | 934 | @ |
| 935 | 935 | @ <li><p>Delete attachment "%h(zFile)" |
| 936 | 936 | }else{ |
| 937 | 937 | @ |
| 938 | 938 | @ <li><p>Add attachment |
| 939 | - @ "%z(href("%R/artifact/%S",zSrc))%h(zFile)</a>" | |
| 939 | + @ "%z(href("%R/artifact/%S",zSrc))%s(zFile)</a>" | |
| 940 | 940 | } |
| 941 | 941 | @ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>] |
| 942 | 942 | @ (rid %d(rid)) by |
| 943 | 943 | hyperlink_to_user(zUser,zDate," on"); |
| 944 | 944 | hyperlink_to_date(zDate, ".</p>"); |
| 945 | 945 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -934,11 +934,11 @@ | |
| 934 | @ |
| 935 | @ <li><p>Delete attachment "%h(zFile)" |
| 936 | }else{ |
| 937 | @ |
| 938 | @ <li><p>Add attachment |
| 939 | @ "%z(href("%R/artifact/%S",zSrc))%h(zFile)</a>" |
| 940 | } |
| 941 | @ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>] |
| 942 | @ (rid %d(rid)) by |
| 943 | hyperlink_to_user(zUser,zDate," on"); |
| 944 | hyperlink_to_date(zDate, ".</p>"); |
| 945 |
| --- src/tkt.c | |
| +++ src/tkt.c | |
| @@ -934,11 +934,11 @@ | |
| 934 | @ |
| 935 | @ <li><p>Delete attachment "%h(zFile)" |
| 936 | }else{ |
| 937 | @ |
| 938 | @ <li><p>Add attachment |
| 939 | @ "%z(href("%R/artifact/%S",zSrc))%s(zFile)</a>" |
| 940 | } |
| 941 | @ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>] |
| 942 | @ (rid %d(rid)) by |
| 943 | hyperlink_to_user(zUser,zDate," on"); |
| 944 | hyperlink_to_date(zDate, ".</p>"); |
| 945 |
+35
-18
| --- src/utf8.c | ||
| +++ src/utf8.c | ||
| @@ -23,10 +23,18 @@ | ||
| 23 | 23 | #include "utf8.h" |
| 24 | 24 | #include <sqlite3.h> |
| 25 | 25 | #ifdef _WIN32 |
| 26 | 26 | # include <windows.h> |
| 27 | 27 | #endif |
| 28 | +#ifdef __CYGWIN__ | |
| 29 | +# include <sys/cygwin.h> | |
| 30 | +# define CP_UTF8 65001 | |
| 31 | + __declspec(dllimport) extern __stdcall int WideCharToMultiByte(int, int, | |
| 32 | + const char *, int, const char *, int, const char *, const char *); | |
| 33 | + __declspec(dllimport) extern __stdcall int MultiByteToWideChar(int, int, | |
| 34 | + const char *, int, wchar_t*, int); | |
| 35 | +#endif | |
| 28 | 36 | |
| 29 | 37 | #ifdef _WIN32 |
| 30 | 38 | /* |
| 31 | 39 | ** Translate MBCS to UTF-8. Return a pointer to the translated text. |
| 32 | 40 | ** Call fossil_mbcs_free() to deallocate any memory used to store the |
| @@ -42,38 +50,39 @@ | ||
| 42 | 50 | ** any memory used to hold the translation |
| 43 | 51 | */ |
| 44 | 52 | void fossil_mbcs_free(char *zOld){ |
| 45 | 53 | sqlite3_free(zOld); |
| 46 | 54 | } |
| 55 | +#endif /* _WIN32 */ | |
| 47 | 56 | |
| 48 | 57 | /* |
| 49 | 58 | ** Translate Unicode text into UTF-8. |
| 50 | 59 | ** Return a pointer to the translated text. |
| 51 | 60 | ** Call fossil_unicode_free() to deallocate any memory used to store the |
| 52 | 61 | ** returned pointer when done. |
| 53 | 62 | */ |
| 54 | 63 | char *fossil_unicode_to_utf8(const void *zUnicode){ |
| 55 | -#ifdef _WIN32 | |
| 64 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 56 | 65 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0); |
| 57 | 66 | char *zUtf = sqlite3_malloc( nByte ); |
| 58 | 67 | if( zUtf==0 ){ |
| 59 | 68 | return 0; |
| 60 | 69 | } |
| 61 | 70 | WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, zUtf, nByte, 0, 0); |
| 62 | 71 | return zUtf; |
| 63 | 72 | #else |
| 64 | - return fossil_strdup(zUtf8); /* TODO: implement for unix */ | |
| 73 | + return fossil_strdup(zUnicode); /* TODO: implement for unix */ | |
| 65 | 74 | #endif |
| 66 | 75 | } |
| 67 | 76 | |
| 68 | 77 | /* |
| 69 | 78 | ** Translate UTF-8 to unicode for use in system calls. Return a pointer to the |
| 70 | 79 | ** translated text.. Call fossil_unicode_free() to deallocate any memory |
| 71 | 80 | ** used to store the returned pointer when done. |
| 72 | 81 | */ |
| 73 | 82 | void *fossil_utf8_to_unicode(const char *zUtf8){ |
| 74 | -#ifdef _WIN32 | |
| 83 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 75 | 84 | int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); |
| 76 | 85 | wchar_t *zUnicode = sqlite3_malloc( nByte * 2 ); |
| 77 | 86 | if( zUnicode==0 ){ |
| 78 | 87 | return 0; |
| 79 | 88 | } |
| @@ -87,17 +96,16 @@ | ||
| 87 | 96 | /* |
| 88 | 97 | ** Deallocate any memory that was previously allocated by |
| 89 | 98 | ** fossil_unicode_to_utf8(). |
| 90 | 99 | */ |
| 91 | 100 | void fossil_unicode_free(void *pOld){ |
| 92 | -#ifdef _WIN32 | |
| 101 | +#if defined(_WIN32) || defined(__CYGWIN__) | |
| 93 | 102 | sqlite3_free(pOld); |
| 94 | 103 | #else |
| 95 | 104 | fossil_free(pOld); |
| 96 | 105 | #endif |
| 97 | 106 | } |
| 98 | -#endif /* _WIN32 */ | |
| 99 | 107 | |
| 100 | 108 | #if defined(__APPLE__) && !defined(WITHOUT_ICONV) |
| 101 | 109 | # include <iconv.h> |
| 102 | 110 | #endif |
| 103 | 111 | |
| @@ -160,17 +168,17 @@ | ||
| 160 | 168 | ** Call fossil_filename_free() to deallocate any memory used to store the |
| 161 | 169 | ** returned pointer when done. |
| 162 | 170 | */ |
| 163 | 171 | void *fossil_utf8_to_filename(const char *zUtf8){ |
| 164 | 172 | #ifdef _WIN32 |
| 165 | - int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); | |
| 166 | - wchar_t *zUnicode = sqlite3_malloc( nByte * 2 ); | |
| 173 | + int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); | |
| 174 | + wchar_t *zUnicode = sqlite3_malloc( nChar * 2 ); | |
| 167 | 175 | wchar_t *wUnicode = zUnicode; |
| 168 | 176 | if( zUnicode==0 ){ |
| 169 | 177 | return 0; |
| 170 | 178 | } |
| 171 | - MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nByte); | |
| 179 | + MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar); | |
| 172 | 180 | while( *wUnicode != '\0' ){ |
| 173 | 181 | if( *wUnicode == '/' ){ |
| 174 | 182 | *wUnicode = '\\'; |
| 175 | 183 | } |
| 176 | 184 | ++wUnicode; |
| @@ -178,22 +186,31 @@ | ||
| 178 | 186 | return zUnicode; |
| 179 | 187 | #elif defined(__CYGWIN__) |
| 180 | 188 | char *zPath, *p; |
| 181 | 189 | if( fossil_isalpha(zUtf8[0]) && (zUtf8[1]==':') |
| 182 | 190 | && (zUtf8[2]=='\\' || zUtf8[2]=='/')) { |
| 183 | - int n = strlen(zUtf8); | |
| 184 | - zPath = fossil_malloc( n+10 ); | |
| 185 | - memcpy(zPath, "/cygdrive/", 10); | |
| 186 | - zPath[10] = zUtf8[0]; | |
| 187 | - memcpy(zPath+11, zUtf8+2, n-1); | |
| 191 | + /* win32 absolute path starting with drive specifier. */ | |
| 192 | + int nByte; | |
| 193 | + wchar_t zUnicode[2000]; | |
| 194 | + wchar_t *wUnicode = zUnicode; | |
| 195 | + MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, count(zUnicode)); | |
| 196 | + while( *wUnicode != '\0' ){ | |
| 197 | + if( *wUnicode == '/' ){ | |
| 198 | + *wUnicode = '\\'; | |
| 199 | + } | |
| 200 | + ++wUnicode; | |
| 201 | + } | |
| 202 | + nByte = cygwin_conv_path(CCP_WIN_W_TO_POSIX, zUnicode, NULL, 0); | |
| 203 | + zPath = fossil_malloc(nByte); | |
| 204 | + cygwin_conv_path(CCP_WIN_W_TO_POSIX, zUnicode, zPath, nByte); | |
| 188 | 205 | } else { |
| 189 | 206 | zPath = fossil_strdup(zUtf8); |
| 190 | - } | |
| 191 | - zUtf8 = p = zPath; | |
| 192 | - while( (*p = *zUtf8++) != 0){ | |
| 193 | - if (*p++ == '\\' ) { | |
| 194 | - p[-1] = '/'; | |
| 207 | + zUtf8 = p = zPath; | |
| 208 | + while( (*p = *zUtf8++) != 0){ | |
| 209 | + if (*p++ == '\\' ) { | |
| 210 | + p[-1] = '/'; | |
| 211 | + } | |
| 195 | 212 | } |
| 196 | 213 | } |
| 197 | 214 | return zPath; |
| 198 | 215 | #elif defined(__APPLE__) && !defined(WITHOUT_ICONV) |
| 199 | 216 | return fossil_strdup(zUtf8); |
| 200 | 217 |
| --- src/utf8.c | |
| +++ src/utf8.c | |
| @@ -23,10 +23,18 @@ | |
| 23 | #include "utf8.h" |
| 24 | #include <sqlite3.h> |
| 25 | #ifdef _WIN32 |
| 26 | # include <windows.h> |
| 27 | #endif |
| 28 | |
| 29 | #ifdef _WIN32 |
| 30 | /* |
| 31 | ** Translate MBCS to UTF-8. Return a pointer to the translated text. |
| 32 | ** Call fossil_mbcs_free() to deallocate any memory used to store the |
| @@ -42,38 +50,39 @@ | |
| 42 | ** any memory used to hold the translation |
| 43 | */ |
| 44 | void fossil_mbcs_free(char *zOld){ |
| 45 | sqlite3_free(zOld); |
| 46 | } |
| 47 | |
| 48 | /* |
| 49 | ** Translate Unicode text into UTF-8. |
| 50 | ** Return a pointer to the translated text. |
| 51 | ** Call fossil_unicode_free() to deallocate any memory used to store the |
| 52 | ** returned pointer when done. |
| 53 | */ |
| 54 | char *fossil_unicode_to_utf8(const void *zUnicode){ |
| 55 | #ifdef _WIN32 |
| 56 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0); |
| 57 | char *zUtf = sqlite3_malloc( nByte ); |
| 58 | if( zUtf==0 ){ |
| 59 | return 0; |
| 60 | } |
| 61 | WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, zUtf, nByte, 0, 0); |
| 62 | return zUtf; |
| 63 | #else |
| 64 | return fossil_strdup(zUtf8); /* TODO: implement for unix */ |
| 65 | #endif |
| 66 | } |
| 67 | |
| 68 | /* |
| 69 | ** Translate UTF-8 to unicode for use in system calls. Return a pointer to the |
| 70 | ** translated text.. Call fossil_unicode_free() to deallocate any memory |
| 71 | ** used to store the returned pointer when done. |
| 72 | */ |
| 73 | void *fossil_utf8_to_unicode(const char *zUtf8){ |
| 74 | #ifdef _WIN32 |
| 75 | int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); |
| 76 | wchar_t *zUnicode = sqlite3_malloc( nByte * 2 ); |
| 77 | if( zUnicode==0 ){ |
| 78 | return 0; |
| 79 | } |
| @@ -87,17 +96,16 @@ | |
| 87 | /* |
| 88 | ** Deallocate any memory that was previously allocated by |
| 89 | ** fossil_unicode_to_utf8(). |
| 90 | */ |
| 91 | void fossil_unicode_free(void *pOld){ |
| 92 | #ifdef _WIN32 |
| 93 | sqlite3_free(pOld); |
| 94 | #else |
| 95 | fossil_free(pOld); |
| 96 | #endif |
| 97 | } |
| 98 | #endif /* _WIN32 */ |
| 99 | |
| 100 | #if defined(__APPLE__) && !defined(WITHOUT_ICONV) |
| 101 | # include <iconv.h> |
| 102 | #endif |
| 103 | |
| @@ -160,17 +168,17 @@ | |
| 160 | ** Call fossil_filename_free() to deallocate any memory used to store the |
| 161 | ** returned pointer when done. |
| 162 | */ |
| 163 | void *fossil_utf8_to_filename(const char *zUtf8){ |
| 164 | #ifdef _WIN32 |
| 165 | int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); |
| 166 | wchar_t *zUnicode = sqlite3_malloc( nByte * 2 ); |
| 167 | wchar_t *wUnicode = zUnicode; |
| 168 | if( zUnicode==0 ){ |
| 169 | return 0; |
| 170 | } |
| 171 | MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nByte); |
| 172 | while( *wUnicode != '\0' ){ |
| 173 | if( *wUnicode == '/' ){ |
| 174 | *wUnicode = '\\'; |
| 175 | } |
| 176 | ++wUnicode; |
| @@ -178,22 +186,31 @@ | |
| 178 | return zUnicode; |
| 179 | #elif defined(__CYGWIN__) |
| 180 | char *zPath, *p; |
| 181 | if( fossil_isalpha(zUtf8[0]) && (zUtf8[1]==':') |
| 182 | && (zUtf8[2]=='\\' || zUtf8[2]=='/')) { |
| 183 | int n = strlen(zUtf8); |
| 184 | zPath = fossil_malloc( n+10 ); |
| 185 | memcpy(zPath, "/cygdrive/", 10); |
| 186 | zPath[10] = zUtf8[0]; |
| 187 | memcpy(zPath+11, zUtf8+2, n-1); |
| 188 | } else { |
| 189 | zPath = fossil_strdup(zUtf8); |
| 190 | } |
| 191 | zUtf8 = p = zPath; |
| 192 | while( (*p = *zUtf8++) != 0){ |
| 193 | if (*p++ == '\\' ) { |
| 194 | p[-1] = '/'; |
| 195 | } |
| 196 | } |
| 197 | return zPath; |
| 198 | #elif defined(__APPLE__) && !defined(WITHOUT_ICONV) |
| 199 | return fossil_strdup(zUtf8); |
| 200 |
| --- src/utf8.c | |
| +++ src/utf8.c | |
| @@ -23,10 +23,18 @@ | |
| 23 | #include "utf8.h" |
| 24 | #include <sqlite3.h> |
| 25 | #ifdef _WIN32 |
| 26 | # include <windows.h> |
| 27 | #endif |
| 28 | #ifdef __CYGWIN__ |
| 29 | # include <sys/cygwin.h> |
| 30 | # define CP_UTF8 65001 |
| 31 | __declspec(dllimport) extern __stdcall int WideCharToMultiByte(int, int, |
| 32 | const char *, int, const char *, int, const char *, const char *); |
| 33 | __declspec(dllimport) extern __stdcall int MultiByteToWideChar(int, int, |
| 34 | const char *, int, wchar_t*, int); |
| 35 | #endif |
| 36 | |
| 37 | #ifdef _WIN32 |
| 38 | /* |
| 39 | ** Translate MBCS to UTF-8. Return a pointer to the translated text. |
| 40 | ** Call fossil_mbcs_free() to deallocate any memory used to store the |
| @@ -42,38 +50,39 @@ | |
| 50 | ** any memory used to hold the translation |
| 51 | */ |
| 52 | void fossil_mbcs_free(char *zOld){ |
| 53 | sqlite3_free(zOld); |
| 54 | } |
| 55 | #endif /* _WIN32 */ |
| 56 | |
| 57 | /* |
| 58 | ** Translate Unicode text into UTF-8. |
| 59 | ** Return a pointer to the translated text. |
| 60 | ** Call fossil_unicode_free() to deallocate any memory used to store the |
| 61 | ** returned pointer when done. |
| 62 | */ |
| 63 | char *fossil_unicode_to_utf8(const void *zUnicode){ |
| 64 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 65 | int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0); |
| 66 | char *zUtf = sqlite3_malloc( nByte ); |
| 67 | if( zUtf==0 ){ |
| 68 | return 0; |
| 69 | } |
| 70 | WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, zUtf, nByte, 0, 0); |
| 71 | return zUtf; |
| 72 | #else |
| 73 | return fossil_strdup(zUnicode); /* TODO: implement for unix */ |
| 74 | #endif |
| 75 | } |
| 76 | |
| 77 | /* |
| 78 | ** Translate UTF-8 to unicode for use in system calls. Return a pointer to the |
| 79 | ** translated text.. Call fossil_unicode_free() to deallocate any memory |
| 80 | ** used to store the returned pointer when done. |
| 81 | */ |
| 82 | void *fossil_utf8_to_unicode(const char *zUtf8){ |
| 83 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 84 | int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); |
| 85 | wchar_t *zUnicode = sqlite3_malloc( nByte * 2 ); |
| 86 | if( zUnicode==0 ){ |
| 87 | return 0; |
| 88 | } |
| @@ -87,17 +96,16 @@ | |
| 96 | /* |
| 97 | ** Deallocate any memory that was previously allocated by |
| 98 | ** fossil_unicode_to_utf8(). |
| 99 | */ |
| 100 | void fossil_unicode_free(void *pOld){ |
| 101 | #if defined(_WIN32) || defined(__CYGWIN__) |
| 102 | sqlite3_free(pOld); |
| 103 | #else |
| 104 | fossil_free(pOld); |
| 105 | #endif |
| 106 | } |
| 107 | |
| 108 | #if defined(__APPLE__) && !defined(WITHOUT_ICONV) |
| 109 | # include <iconv.h> |
| 110 | #endif |
| 111 | |
| @@ -160,17 +168,17 @@ | |
| 168 | ** Call fossil_filename_free() to deallocate any memory used to store the |
| 169 | ** returned pointer when done. |
| 170 | */ |
| 171 | void *fossil_utf8_to_filename(const char *zUtf8){ |
| 172 | #ifdef _WIN32 |
| 173 | int nChar = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0); |
| 174 | wchar_t *zUnicode = sqlite3_malloc( nChar * 2 ); |
| 175 | wchar_t *wUnicode = zUnicode; |
| 176 | if( zUnicode==0 ){ |
| 177 | return 0; |
| 178 | } |
| 179 | MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar); |
| 180 | while( *wUnicode != '\0' ){ |
| 181 | if( *wUnicode == '/' ){ |
| 182 | *wUnicode = '\\'; |
| 183 | } |
| 184 | ++wUnicode; |
| @@ -178,22 +186,31 @@ | |
| 186 | return zUnicode; |
| 187 | #elif defined(__CYGWIN__) |
| 188 | char *zPath, *p; |
| 189 | if( fossil_isalpha(zUtf8[0]) && (zUtf8[1]==':') |
| 190 | && (zUtf8[2]=='\\' || zUtf8[2]=='/')) { |
| 191 | /* win32 absolute path starting with drive specifier. */ |
| 192 | int nByte; |
| 193 | wchar_t zUnicode[2000]; |
| 194 | wchar_t *wUnicode = zUnicode; |
| 195 | MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, count(zUnicode)); |
| 196 | while( *wUnicode != '\0' ){ |
| 197 | if( *wUnicode == '/' ){ |
| 198 | *wUnicode = '\\'; |
| 199 | } |
| 200 | ++wUnicode; |
| 201 | } |
| 202 | nByte = cygwin_conv_path(CCP_WIN_W_TO_POSIX, zUnicode, NULL, 0); |
| 203 | zPath = fossil_malloc(nByte); |
| 204 | cygwin_conv_path(CCP_WIN_W_TO_POSIX, zUnicode, zPath, nByte); |
| 205 | } else { |
| 206 | zPath = fossil_strdup(zUtf8); |
| 207 | zUtf8 = p = zPath; |
| 208 | while( (*p = *zUtf8++) != 0){ |
| 209 | if (*p++ == '\\' ) { |
| 210 | p[-1] = '/'; |
| 211 | } |
| 212 | } |
| 213 | } |
| 214 | return zPath; |
| 215 | #elif defined(__APPLE__) && !defined(WITHOUT_ICONV) |
| 216 | return fossil_strdup(zUtf8); |
| 217 |
+2
-2
| --- win/Makefile.mingw | ||
| +++ win/Makefile.mingw | ||
| @@ -13,14 +13,14 @@ | ||
| 13 | 13 | # |
| 14 | 14 | |
| 15 | 15 | #### Select one of MinGW, MinGW-w64 (32-bit) or MinGW-w64 (64-bit) compilers. |
| 16 | 16 | # By default, this is an empty string (i.e. use the native compiler). |
| 17 | 17 | # |
| 18 | -PREFIX = | |
| 18 | +# PREFIX = | |
| 19 | 19 | # PREFIX = mingw32- |
| 20 | 20 | # PREFIX = i686-pc-mingw32- |
| 21 | -# PREFIX = i686-w64-mingw32- | |
| 21 | +PREFIX = i686-w64-mingw32- | |
| 22 | 22 | # PREFIX = x86_64-w64-mingw32- |
| 23 | 23 | |
| 24 | 24 | #### The toplevel directory of the source tree. Fossil can be built |
| 25 | 25 | # in a directory that is separate from the source tree. Just change |
| 26 | 26 | # the following to point from the build directory to the src/ folder. |
| 27 | 27 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -13,14 +13,14 @@ | |
| 13 | # |
| 14 | |
| 15 | #### Select one of MinGW, MinGW-w64 (32-bit) or MinGW-w64 (64-bit) compilers. |
| 16 | # By default, this is an empty string (i.e. use the native compiler). |
| 17 | # |
| 18 | PREFIX = |
| 19 | # PREFIX = mingw32- |
| 20 | # PREFIX = i686-pc-mingw32- |
| 21 | # PREFIX = i686-w64-mingw32- |
| 22 | # PREFIX = x86_64-w64-mingw32- |
| 23 | |
| 24 | #### The toplevel directory of the source tree. Fossil can be built |
| 25 | # in a directory that is separate from the source tree. Just change |
| 26 | # the following to point from the build directory to the src/ folder. |
| 27 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -13,14 +13,14 @@ | |
| 13 | # |
| 14 | |
| 15 | #### Select one of MinGW, MinGW-w64 (32-bit) or MinGW-w64 (64-bit) compilers. |
| 16 | # By default, this is an empty string (i.e. use the native compiler). |
| 17 | # |
| 18 | # PREFIX = |
| 19 | # PREFIX = mingw32- |
| 20 | # PREFIX = i686-pc-mingw32- |
| 21 | PREFIX = i686-w64-mingw32- |
| 22 | # PREFIX = x86_64-w64-mingw32- |
| 23 | |
| 24 | #### The toplevel directory of the source tree. Fossil can be built |
| 25 | # in a directory that is separate from the source tree. Just change |
| 26 | # the following to point from the build directory to the src/ folder. |
| 27 |
+2
-2
| --- win/Makefile.mingw | ||
| +++ win/Makefile.mingw | ||
| @@ -13,14 +13,14 @@ | ||
| 13 | 13 | # |
| 14 | 14 | |
| 15 | 15 | #### Select one of MinGW, MinGW-w64 (32-bit) or MinGW-w64 (64-bit) compilers. |
| 16 | 16 | # By default, this is an empty string (i.e. use the native compiler). |
| 17 | 17 | # |
| 18 | -PREFIX = | |
| 18 | +# PREFIX = | |
| 19 | 19 | # PREFIX = mingw32- |
| 20 | 20 | # PREFIX = i686-pc-mingw32- |
| 21 | -# PREFIX = i686-w64-mingw32- | |
| 21 | +PREFIX = i686-w64-mingw32- | |
| 22 | 22 | # PREFIX = x86_64-w64-mingw32- |
| 23 | 23 | |
| 24 | 24 | #### The toplevel directory of the source tree. Fossil can be built |
| 25 | 25 | # in a directory that is separate from the source tree. Just change |
| 26 | 26 | # the following to point from the build directory to the src/ folder. |
| 27 | 27 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -13,14 +13,14 @@ | |
| 13 | # |
| 14 | |
| 15 | #### Select one of MinGW, MinGW-w64 (32-bit) or MinGW-w64 (64-bit) compilers. |
| 16 | # By default, this is an empty string (i.e. use the native compiler). |
| 17 | # |
| 18 | PREFIX = |
| 19 | # PREFIX = mingw32- |
| 20 | # PREFIX = i686-pc-mingw32- |
| 21 | # PREFIX = i686-w64-mingw32- |
| 22 | # PREFIX = x86_64-w64-mingw32- |
| 23 | |
| 24 | #### The toplevel directory of the source tree. Fossil can be built |
| 25 | # in a directory that is separate from the source tree. Just change |
| 26 | # the following to point from the build directory to the src/ folder. |
| 27 |
| --- win/Makefile.mingw | |
| +++ win/Makefile.mingw | |
| @@ -13,14 +13,14 @@ | |
| 13 | # |
| 14 | |
| 15 | #### Select one of MinGW, MinGW-w64 (32-bit) or MinGW-w64 (64-bit) compilers. |
| 16 | # By default, this is an empty string (i.e. use the native compiler). |
| 17 | # |
| 18 | # PREFIX = |
| 19 | # PREFIX = mingw32- |
| 20 | # PREFIX = i686-pc-mingw32- |
| 21 | PREFIX = i686-w64-mingw32- |
| 22 | # PREFIX = x86_64-w64-mingw32- |
| 23 | |
| 24 | #### The toplevel directory of the source tree. Fossil can be built |
| 25 | # in a directory that is separate from the source tree. Just change |
| 26 | # the following to point from the build directory to the src/ folder. |
| 27 |