Fossil SCM

merge trunk

jan.nijtmans 2013-03-06 14:40 UTC fix-test-move-repository merge
Commit 7aa9f66f926c0317b6056a5577da90c609c7c343
+5 -3
--- src/blob.c
+++ src/blob.c
@@ -792,11 +792,11 @@
792792
}
793793
nName = file_simplify_name(zName, nName, 0);
794794
for(i=1; i<nName; i++){
795795
if( zName[i]=='/' ){
796796
zName[i] = 0;
797
-#if defined(_WIN32)
797
+#if defined(_WIN32) || defined(__CYGWIN__)
798798
/*
799799
** On Windows, local path looks like: C:/develop/project/file.txt
800800
** The if stops us from trying to create a directory of a drive letter
801801
** C: in this example.
802802
*/
@@ -804,11 +804,11 @@
804804
#endif
805805
if( file_mkdir(zName, 1) && file_isdir(zName)!=1 ){
806806
fossil_fatal_recursive("unable to create directory %s", zName);
807807
return 0;
808808
}
809
-#if defined(_WIN32)
809
+#if defined(_WIN32) || defined(__CYGWIN__)
810810
}
811811
#endif
812812
zName[i] = '/';
813813
}
814814
}
@@ -1104,11 +1104,11 @@
11041104
zUtf8 = blob_str(pBlob) + bomSize;
11051105
blob_zero(&temp);
11061106
blob_append(&temp, zUtf8, -1);
11071107
blob_swap(pBlob, &temp);
11081108
blob_reset(&temp);
1109
-#ifdef _WIN32
1109
+#if defined(_WIN32) || defined(__CYGWIN__)
11101110
}else if( starts_with_utf16_bom(pBlob, &bomSize, &bomReverse) ){
11111111
zUtf8 = blob_buffer(pBlob);
11121112
if( bomReverse ){
11131113
/* Found BOM, but with reversed bytes */
11141114
unsigned int i = blob_size(pBlob);
@@ -1124,13 +1124,15 @@
11241124
zUtf8 = blob_str(pBlob) + bomSize;
11251125
zUtf8 = fossil_unicode_to_utf8(zUtf8);
11261126
blob_zero(pBlob);
11271127
blob_append(pBlob, zUtf8, -1);
11281128
fossil_unicode_free(zUtf8);
1129
+#endif /* _WIN32 || __CYGWIN__ */
1130
+#if defined(_WIN32)
11291131
}else if( useMbcs ){
11301132
zUtf8 = fossil_mbcs_to_utf8(blob_str(pBlob));
11311133
blob_reset(pBlob);
11321134
blob_append(pBlob, zUtf8, -1);
11331135
fossil_mbcs_free(zUtf8);
11341136
#endif /* _WIN32 */
11351137
}
11361138
}
11371139
--- 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 @@
203203
int vid;
204204
db_must_be_within_tree();
205205
/* 012345678901234 */
206206
fossil_print("repository: %s\n", db_repository_filename());
207207
fossil_print("local-root: %s\n", g.zLocalRoot);
208
+ if( g.zConfigDbName ){
209
+ fossil_print("config-db: %s\n", g.zConfigDbName);
210
+ }
208211
vid = db_lget_int("checkout", 0);
209212
if( vid ){
210213
show_common_info(vid, "checkout:", 1, 1);
211214
}
212215
db_record_repository_filename(0);
@@ -902,83 +905,68 @@
902905
int encodingOk, /* Non-zero if encoding warnings should be disabled. */
903906
const char *zFilename /* The full name of the file being committed. */
904907
){
905908
int eType; /* return value of looks_like_utf8/utf16() */
906909
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 */
907913
char *zMsg; /* Warning message */
908914
Blob fname; /* Relative pathname of the file */
909915
static int allOk = 0; /* Set to true to disable this routine */
910916
911917
if( allOk ) return 0;
912918
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 ){
940924
const char *zWarning;
941925
const char *zDisable;
942926
const char *zConvert = "c=convert/";
943927
Blob ans;
944928
char cReply;
945929
946
- if( eType==-1 && fUnicode ){
930
+ if( fHasCrLf && fUnicode ){
947931
if ( crnlOk && encodingOk ){
948932
return 0; /* We don't want CR/NL and Unicode warnings for this file. */
949933
}
950934
zWarning = "CR/NL line endings and Unicode";
951935
zDisable = "\"crnl-glob\" and \"encoding-glob\" settings";
952
- }else if( eType==-1 ){
936
+ }else if( fHasCrLf ){
953937
if( crnlOk ){
954938
return 0; /* We don't want CR/NL warnings for this file. */
955939
}
956940
zWarning = "CR/NL line endings";
957941
zDisable = "\"crnl-glob\" setting";
958942
}else if( eType==0 ){
959943
if( binOk ){
960944
return 0; /* We don't want binary warnings for this file. */
961945
}
962
- zWarning = "binary data";
946
+ if( fHasLength ){
947
+ zWarning = "long lines";
948
+ }else{
949
+ zWarning = "binary data";
950
+ }
963951
zDisable = "\"binary-glob\" setting";
964952
zConvert = ""; /* We cannot convert binary files. */
965953
}else{
966954
if ( encodingOk ){
967955
return 0; /* We don't want encoding warnings for this file. */
968956
}
969957
zWarning = "Unicode";
970958
zDisable = "\"encoding-glob\" setting";
971
-#ifndef _WIN32
959
+#if !defined(_WIN32) && !defined(__CYGWIN__)
972960
zConvert = ""; /* On Unix, we cannot easily convert Unicode files. */
973961
#endif
974962
}
975963
file_relative_name(zFilename, &fname, 0);
976964
blob_zero(&ans);
977965
zMsg = mprintf(
978966
"%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)? ",
980968
blob_str(&fname), zWarning, zDisable, zConvert);
981969
prompt_user(zMsg, &ans);
982970
fossil_free(zMsg);
983971
cReply = blob_str(&ans)[0];
984972
if( cReply=='a' || cReply=='A' ){
985973
--- 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
+22 -29
--- src/db.c
+++ src/db.c
@@ -221,11 +221,11 @@
221221
** rolls back rather than commit. It is the responsibility of the
222222
** hooks themselves to issue any error messages.
223223
*/
224224
void db_commit_hook(int (*x)(void), int sequence){
225225
int i;
226
- assert( db.nCommitHook < sizeof(db.aHook)/sizeof(db.aHook[1]) );
226
+ assert( db.nCommitHook < count(db.aHook) );
227227
for(i=0; i<db.nCommitHook; i++){
228228
assert( x!=db.aHook[i].xHook );
229229
if( db.aHook[i].sequence>sequence ){
230230
int s = sequence;
231231
int (*xS)(void) = x;
@@ -792,11 +792,11 @@
792792
** case, invoke this routine with useAttach as 1.
793793
*/
794794
void db_open_config(int useAttach){
795795
char *zDbName;
796796
char *zHome;
797
- if( g.configOpen ) return;
797
+ if( g.zConfigDbName ) return;
798798
#if defined(_WIN32) || defined(__CYGWIN__)
799799
zHome = fossil_getenv("LOCALAPPDATA");
800800
if( zHome==0 ){
801801
zHome = fossil_getenv("APPDATA");
802802
if( zHome==0 ){
@@ -803,18 +803,10 @@
803803
char *zDrive = fossil_getenv("HOMEDRIVE");
804804
zHome = fossil_getenv("HOMEPATH");
805805
if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome);
806806
}
807807
}
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
816808
if( zHome==0 ){
817809
fossil_fatal("cannot locate home directory - "
818810
"please set the LOCALAPPDATA or APPDATA or HOMEPATH "
819811
"environment variables");
820812
}
@@ -826,35 +818,37 @@
826818
}
827819
#endif
828820
if( file_isdir(zHome)!=1 ){
829821
fossil_fatal("invalid home directory: %s", zHome);
830822
}
831
- if( file_access(zHome, W_OK) ){
832
- fossil_fatal("home directory %s must be writeable", zHome);
833
- }
834
- g.zHome = mprintf("%/", zHome);
835823
#if defined(_WIN32) || defined(__CYGWIN__)
836824
/* . filenames give some window systems problems and many apps problems */
837825
zDbName = mprintf("%//_fossil", zHome);
838826
#else
827
+ if( file_access(zHome, W_OK) ){
828
+ fossil_fatal("home directory %s must be writeable", zHome);
829
+ }
839830
zDbName = mprintf("%s/.fossil", zHome);
840831
#endif
841832
if( file_size(zDbName)<1024*3 ){
842833
db_init_database(zDbName, zConfigSchema, (char*)0);
843834
}
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
844840
if( useAttach ){
845841
db_open_or_attach(zDbName, "configdb", &g.useAttach);
846842
g.dbConfig = 0;
847843
g.zConfigDbType = 0;
848844
}else{
849845
g.useAttach = 0;
850846
g.dbConfig = db_open(zDbName);
851847
g.zConfigDbType = "configdb";
852848
}
853
- g.configOpen = 1;
854
- free(zDbName);
855
- fossil_filename_free(zHome);
849
+ g.zConfigDbName = zDbName;
856850
}
857851
858852
859853
/*
860854
** Returns TRUE if zTable exists in the local database but lacks column
@@ -926,32 +920,31 @@
926920
** that contains a valid repository database.
927921
**
928922
** For legacy, also look for ".fos". The use of ".fos" is deprecated
929923
** since "fos" has negative connotations in Hungarian, we are told.
930924
**
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
932926
** try again. Once the file is found, the g.zLocalRoot variable is set
933927
** to the root of the repository tree and this routine returns 1. If
934928
** no database is found, then this routine return 0.
935929
**
936930
** 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
938932
** is found, it is attached to the open database connection too.
939933
*/
940934
int db_open_local(const char *zDbName){
941935
int i, n;
942936
char zPwd[2000];
943
- static const char *const aDbName[] = { "/_FOSSIL_", "/.fslckout", "/.fos" };
937
+ static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };
944938
945939
if( g.localOpen) return 1;
946940
file_getcwd(zPwd, sizeof(zPwd)-20);
947941
n = strlen(zPwd);
948942
if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.';
949943
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]);
953946
if( isValidLocalDb(zPwd) ){
954947
/* Found a valid checkout database file */
955948
zPwd[n] = 0;
956949
while( n>1 && zPwd[n-1]=='/' ){
957950
n--;
@@ -1210,11 +1203,11 @@
12101203
fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt));
12111204
}
12121205
}
12131206
g.repositoryOpen = 0;
12141207
g.localOpen = 0;
1215
- g.configOpen = 0;
1208
+ g.zConfigDbName = NULL;
12161209
sqlite3_wal_checkpoint(g.db, 0);
12171210
sqlite3_close(g.db);
12181211
g.db = 0;
12191212
g.zMainDbType = 0;
12201213
if( g.dbConfig ){
@@ -1634,19 +1627,19 @@
16341627
** Return true if the string zVal represents "true" (or "false").
16351628
*/
16361629
int is_truth(const char *zVal){
16371630
static const char *const azOn[] = { "on", "yes", "true", "1" };
16381631
int i;
1639
- for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
1632
+ for(i=0; i<count(azOn); i++){
16401633
if( fossil_stricmp(zVal,azOn[i])==0 ) return 1;
16411634
}
16421635
return 0;
16431636
}
16441637
int is_false(const char *zVal){
16451638
static const char *const azOff[] = { "off", "no", "false", "0" };
16461639
int i;
1647
- for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
1640
+ for(i=0; i<count(azOff); i++){
16481641
if( fossil_stricmp(zVal,azOff[i])==0 ) return 1;
16491642
}
16501643
return 0;
16511644
}
16521645
@@ -1773,11 +1766,11 @@
17731766
}
17741767
}
17751768
if( g.repositoryOpen ){
17761769
z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName);
17771770
}
1778
- if( z==0 && g.configOpen ){
1771
+ if( z==0 && g.zConfigDbName ){
17791772
db_swap_connections();
17801773
z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
17811774
db_swap_connections();
17821775
}
17831776
if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){
@@ -1820,11 +1813,11 @@
18201813
}
18211814
db_end_transaction(0);
18221815
}
18231816
int db_is_global(const char *zName){
18241817
int rc = 0;
1825
- if( g.configOpen ){
1818
+ if( g.zConfigDbName ){
18261819
db_swap_connections();
18271820
rc = db_exists("SELECT 1 FROM global_config WHERE name=%Q", zName);
18281821
db_swap_connections();
18291822
}
18301823
return rc;
@@ -1841,11 +1834,11 @@
18411834
}
18421835
db_finalize(&q);
18431836
}else{
18441837
rc = SQLITE_DONE;
18451838
}
1846
- if( rc==SQLITE_DONE && g.configOpen ){
1839
+ if( rc==SQLITE_DONE && g.zConfigDbName ){
18471840
db_swap_connections();
18481841
v = db_int(dflt, "SELECT value FROM global_config WHERE name=%Q", zName);
18491842
db_swap_connections();
18501843
}
18511844
return v;
18521845
--- 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
+22 -29
--- src/db.c
+++ src/db.c
@@ -221,11 +221,11 @@
221221
** rolls back rather than commit. It is the responsibility of the
222222
** hooks themselves to issue any error messages.
223223
*/
224224
void db_commit_hook(int (*x)(void), int sequence){
225225
int i;
226
- assert( db.nCommitHook < sizeof(db.aHook)/sizeof(db.aHook[1]) );
226
+ assert( db.nCommitHook < count(db.aHook) );
227227
for(i=0; i<db.nCommitHook; i++){
228228
assert( x!=db.aHook[i].xHook );
229229
if( db.aHook[i].sequence>sequence ){
230230
int s = sequence;
231231
int (*xS)(void) = x;
@@ -792,11 +792,11 @@
792792
** case, invoke this routine with useAttach as 1.
793793
*/
794794
void db_open_config(int useAttach){
795795
char *zDbName;
796796
char *zHome;
797
- if( g.configOpen ) return;
797
+ if( g.zConfigDbName ) return;
798798
#if defined(_WIN32) || defined(__CYGWIN__)
799799
zHome = fossil_getenv("LOCALAPPDATA");
800800
if( zHome==0 ){
801801
zHome = fossil_getenv("APPDATA");
802802
if( zHome==0 ){
@@ -803,18 +803,10 @@
803803
char *zDrive = fossil_getenv("HOMEDRIVE");
804804
zHome = fossil_getenv("HOMEPATH");
805805
if( zDrive && zHome ) zHome = mprintf("%s%s", zDrive, zHome);
806806
}
807807
}
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
816808
if( zHome==0 ){
817809
fossil_fatal("cannot locate home directory - "
818810
"please set the LOCALAPPDATA or APPDATA or HOMEPATH "
819811
"environment variables");
820812
}
@@ -826,35 +818,37 @@
826818
}
827819
#endif
828820
if( file_isdir(zHome)!=1 ){
829821
fossil_fatal("invalid home directory: %s", zHome);
830822
}
831
- if( file_access(zHome, W_OK) ){
832
- fossil_fatal("home directory %s must be writeable", zHome);
833
- }
834
- g.zHome = mprintf("%/", zHome);
835823
#if defined(_WIN32) || defined(__CYGWIN__)
836824
/* . filenames give some window systems problems and many apps problems */
837825
zDbName = mprintf("%//_fossil", zHome);
838826
#else
827
+ if( file_access(zHome, W_OK) ){
828
+ fossil_fatal("home directory %s must be writeable", zHome);
829
+ }
839830
zDbName = mprintf("%s/.fossil", zHome);
840831
#endif
841832
if( file_size(zDbName)<1024*3 ){
842833
db_init_database(zDbName, zConfigSchema, (char*)0);
843834
}
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
844840
if( useAttach ){
845841
db_open_or_attach(zDbName, "configdb", &g.useAttach);
846842
g.dbConfig = 0;
847843
g.zConfigDbType = 0;
848844
}else{
849845
g.useAttach = 0;
850846
g.dbConfig = db_open(zDbName);
851847
g.zConfigDbType = "configdb";
852848
}
853
- g.configOpen = 1;
854
- free(zDbName);
855
- fossil_filename_free(zHome);
849
+ g.zConfigDbName = zDbName;
856850
}
857851
858852
859853
/*
860854
** Returns TRUE if zTable exists in the local database but lacks column
@@ -926,32 +920,31 @@
926920
** that contains a valid repository database.
927921
**
928922
** For legacy, also look for ".fos". The use of ".fos" is deprecated
929923
** since "fos" has negative connotations in Hungarian, we are told.
930924
**
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
932926
** try again. Once the file is found, the g.zLocalRoot variable is set
933927
** to the root of the repository tree and this routine returns 1. If
934928
** no database is found, then this routine return 0.
935929
**
936930
** 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
938932
** is found, it is attached to the open database connection too.
939933
*/
940934
int db_open_local(const char *zDbName){
941935
int i, n;
942936
char zPwd[2000];
943
- static const char *const aDbName[] = { "/_FOSSIL_", "/.fslckout", "/.fos" };
937
+ static const char aDbName[][10] = { "_FOSSIL_", ".fslckout", ".fos" };
944938
945939
if( g.localOpen) return 1;
946940
file_getcwd(zPwd, sizeof(zPwd)-20);
947941
n = strlen(zPwd);
948942
if( n==1 && zPwd[0]=='/' ) zPwd[0] = '.';
949943
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]);
953946
if( isValidLocalDb(zPwd) ){
954947
/* Found a valid checkout database file */
955948
zPwd[n] = 0;
956949
while( n>1 && zPwd[n-1]=='/' ){
957950
n--;
@@ -1210,11 +1203,11 @@
12101203
fossil_warning("unfinalized SQL statement: [%s]", sqlite3_sql(pStmt));
12111204
}
12121205
}
12131206
g.repositoryOpen = 0;
12141207
g.localOpen = 0;
1215
- g.configOpen = 0;
1208
+ g.zConfigDbName = NULL;
12161209
sqlite3_wal_checkpoint(g.db, 0);
12171210
sqlite3_close(g.db);
12181211
g.db = 0;
12191212
g.zMainDbType = 0;
12201213
if( g.dbConfig ){
@@ -1634,19 +1627,19 @@
16341627
** Return true if the string zVal represents "true" (or "false").
16351628
*/
16361629
int is_truth(const char *zVal){
16371630
static const char *const azOn[] = { "on", "yes", "true", "1" };
16381631
int i;
1639
- for(i=0; i<sizeof(azOn)/sizeof(azOn[0]); i++){
1632
+ for(i=0; i<count(azOn); i++){
16401633
if( fossil_stricmp(zVal,azOn[i])==0 ) return 1;
16411634
}
16421635
return 0;
16431636
}
16441637
int is_false(const char *zVal){
16451638
static const char *const azOff[] = { "off", "no", "false", "0" };
16461639
int i;
1647
- for(i=0; i<sizeof(azOff)/sizeof(azOff[0]); i++){
1640
+ for(i=0; i<count(azOff); i++){
16481641
if( fossil_stricmp(zVal,azOff[i])==0 ) return 1;
16491642
}
16501643
return 0;
16511644
}
16521645
@@ -1773,11 +1766,11 @@
17731766
}
17741767
}
17751768
if( g.repositoryOpen ){
17761769
z = db_text(0, "SELECT value FROM config WHERE name=%Q", zName);
17771770
}
1778
- if( z==0 && g.configOpen ){
1771
+ if( z==0 && g.zConfigDbName ){
17791772
db_swap_connections();
17801773
z = db_text(0, "SELECT value FROM global_config WHERE name=%Q", zName);
17811774
db_swap_connections();
17821775
}
17831776
if( ctrlSetting!=0 && ctrlSetting->versionable && g.localOpen ){
@@ -1820,11 +1813,11 @@
18201813
}
18211814
db_end_transaction(0);
18221815
}
18231816
int db_is_global(const char *zName){
18241817
int rc = 0;
1825
- if( g.configOpen ){
1818
+ if( g.zConfigDbName ){
18261819
db_swap_connections();
18271820
rc = db_exists("SELECT 1 FROM global_config WHERE name=%Q", zName);
18281821
db_swap_connections();
18291822
}
18301823
return rc;
@@ -1841,11 +1834,11 @@
18411834
}
18421835
db_finalize(&q);
18431836
}else{
18441837
rc = SQLITE_DONE;
18451838
}
1846
- if( rc==SQLITE_DONE && g.configOpen ){
1839
+ if( rc==SQLITE_DONE && g.zConfigDbName ){
18471840
db_swap_connections();
18481841
v = db_int(dflt, "SELECT value FROM global_config WHERE name=%Q", zName);
18491842
db_swap_connections();
18501843
}
18511844
return v;
18521845
--- 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 @@
5757
"more than 10,000 changes\n"
5858
5959
#define DIFF_TOO_MANY_CHANGES_HTML \
6060
"<p class='generalError'>More than 10,000 changes</p>\n"
6161
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. */
6377
#endif /* INTERFACE */
6478
6579
/*
6680
** Maximum length of a line in a text file, in bytes. (2**13 = 8192 bytes)
6781
*/
@@ -186,27 +200,18 @@
186200
/*
187201
** This function attempts to scan each logical line within the blob to
188202
** determine the type of content it appears to contain. Possible return
189203
** values are:
190204
**
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.
194207
**
195208
** (0) -- The content appears to be binary because it contains embedded
196209
** NUL characters or an extremely long line. Since this function
197210
** does not understand UTF-16, it may falsely consider UTF-16 text
198211
** to be binary.
199212
**
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
-**
208213
************************************ WARNING **********************************
209214
**
210215
** This function does not validate that the blob content is properly formed
211216
** UTF-8. It assumes that all code points are the same size. It does not
212217
** validate any code points. It makes no attempt to detect if any [invalid]
@@ -215,39 +220,49 @@
215220
** The only code points that this function cares about are the NUL character,
216221
** carriage-return, and line-feed.
217222
**
218223
************************************ WARNING **********************************
219224
*/
220
-int looks_like_utf8(const Blob *pContent){
225
+int looks_like_utf8(const Blob *pContent, int *pFlags){
221226
const char *z = blob_buffer(pContent);
222227
unsigned int n = blob_size(pContent);
223228
int j, c;
224
- int flags = 0; /* bit 0 = long lines found, 1 = CR/NL found. */
225229
226
- /* Check individual lines.
227
- */
230
+ if( pFlags ) *pFlags = LOOK_NONE;
228231
if( n==0 ) return 1; /* Empty file -> text */
229232
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
+ }
231237
j = (c!='\n');
232238
while( --n>0 ){
233239
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
+ }
235244
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
+ }
238251
}
239252
if( j>LENGTH_MASK ){
240
- flags |= 1; /* Very long line, continue */
253
+ if( pFlags ) *pFlags |= LOOK_LENGTH;
254
+ return 0; /* Very long line -> binary */
241255
}
242256
j = 0;
243257
}
244258
}
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 */
247262
}
248
- return 1-flags; /* No problems seen -> not binary */
263
+ return 1; /* No problems seen -> not binary */
249264
}
250265
251266
/*
252267
** Define the type needed to represent a Unicode (UTF-16) character.
253268
*/
@@ -279,27 +294,18 @@
279294
/*
280295
** This function attempts to scan each logical line within the blob to
281296
** determine the type of content it appears to contain. Possible return
282297
** values are:
283298
**
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.
287301
**
288302
** (0) -- The content appears to be binary because it contains embedded
289303
** NUL characters or an extremely long line. Since this function
290304
** does not understand UTF-8, it may falsely consider UTF-8 text
291305
** to be binary.
292306
**
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
-**
301307
************************************ WARNING **********************************
302308
**
303309
** This function does not validate that the blob content is properly formed
304310
** UTF-16. It assumes that all code points are the same size. It does not
305311
** validate any code points. It makes no attempt to detect if any [invalid]
@@ -308,41 +314,50 @@
308314
** The only code points that this function cares about are the NUL character,
309315
** carriage-return, and line-feed.
310316
**
311317
************************************ WARNING **********************************
312318
*/
313
-int looks_like_utf16(const Blob *pContent){
319
+int looks_like_utf16(const Blob *pContent, int *pFlags){
314320
const WCHAR_T *z = (WCHAR_T *)blob_buffer(pContent);
315321
unsigned int n = blob_size(pContent);
316322
int j, c;
317
- int flags = 0; /* bit 0 = long lines found, 1 = CR/NL found. */
318323
319
- /* Check individual lines.
320
- */
324
+ if( pFlags ) *pFlags = LOOK_NONE;
321325
if( n==0 ) return 1; /* Empty file -> text */
322326
if( n%2 ) return 0; /* Odd number of bytes -> binary (or UTF-8) */
323327
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
+ }
325332
j = ((c!=UTF16BE_LF) && (c!=UTF16LE_LF));
326333
while( (n-=2)>0 ){
327334
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
+ }
329339
if( c==UTF16BE_LF || c==UTF16LE_LF ){
330340
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
+ }
333346
}
334347
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 */
336350
}
337351
j = 0;
338352
}
339353
}
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 */
342357
}
343
- return 1-flags; /* No problems seen -> not binary */
358
+ return 1; /* No problems seen -> not binary */
344359
}
345360
346361
/*
347362
** This function returns an array of bytes representing the byte-order-mark
348363
** for UTF-8.
@@ -1408,11 +1423,11 @@
14081423
/* Delete one line from the left */
14091424
s.n = 0;
14101425
sbsWriteLineno(&s, a);
14111426
s.iStart = 0;
14121427
s.zStart = "<span class=\"diffrm\">";
1413
- s.iEnd = s.width;
1428
+ s.iEnd = LENGTH(&A[a]);
14141429
sbsWriteText(&s, &A[a], SBS_PAD);
14151430
if( s.escHtml ){
14161431
sbsWrite(&s, " &lt;\n", 6);
14171432
}else{
14181433
sbsWrite(&s, " <\n", 3);
@@ -1441,11 +1456,11 @@
14411456
sbsWrite(&s, " > ", 3);
14421457
}
14431458
sbsWriteLineno(&s, b);
14441459
s.iStart = 0;
14451460
s.zStart = "<span class=\"diffadd\">";
1446
- s.iEnd = s.width;
1461
+ s.iEnd = LENGTH(&B[b]);
14471462
sbsWriteText(&s, &B[b], SBS_NEWLINE);
14481463
blob_append(pOut, s.zLine, s.n);
14491464
assert( mb>0 );
14501465
mb--;
14511466
b++;
@@ -1453,17 +1468,17 @@
14531468
/* Delete from the left and insert on the right */
14541469
s.n = 0;
14551470
sbsWriteLineno(&s, a);
14561471
s.iStart = 0;
14571472
s.zStart = "<span class=\"diffrm\">";
1458
- s.iEnd = s.width;
1473
+ s.iEnd = LENGTH(&A[a]);
14591474
sbsWriteText(&s, &A[a], SBS_PAD);
14601475
sbsWrite(&s, " | ", 3);
14611476
sbsWriteLineno(&s, b);
14621477
s.iStart = 0;
14631478
s.zStart = "<span class=\"diffadd\">";
1464
- s.iEnd = s.width;
1479
+ s.iEnd = LENGTH(&B[b]);
14651480
sbsWriteText(&s, &B[b], SBS_NEWLINE);
14661481
blob_append(pOut, s.zLine, s.n);
14671482
ma--;
14681483
mb--;
14691484
a++;
14701485
--- 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, " &lt;\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, " &lt;\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 @@
5454
cTerm = zGlobList[0];
5555
zGlobList++;
5656
}else{
5757
cTerm = ',';
5858
}
59
- for(i=0; zGlobList[i] && zGlobList[i]!=cTerm; i++){}
59
+ for(i=0; zGlobList[i] && zGlobList[i]!=cTerm && zGlobList[i]!='\n'; i++){}
6060
if( cTerm==',' ){
6161
while( i>0 && fossil_isspace(zGlobList[i-1]) ){ i--; }
6262
}
6363
blob_appendf(&expr, "%s%s GLOB '%#q'", zSep, zVal, i, zGlobList);
6464
zSep = " OR ";
6565
--- 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 @@
198198
if( g.localOpen ){
199199
fossil_print("repository: %s\n", db_repository_filename());
200200
fossil_print("local-root: %s\n", g.zLocalRoot);
201201
}
202202
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);
206205
}
207
-#endif
208206
fossil_print("project-code: %s\n", db_get("project-code", ""));
209207
vid = g.localOpen ? db_lget_int("checkout", 0) : 0;
210208
if( vid ){
211209
show_common_info(vid, "checkout:", 1, 1);
212210
}
213211
--- 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 @@
13721372
#define VAL(K,V) cson_object_set(o, #K, (V) ? (V) : cson_value_null())
13731373
VAL(capabilities, json_cap_value());
13741374
INT(g, argc);
13751375
INT(g, isConst);
13761376
INT(g, useAttach);
1377
- INT(g, configOpen);
1377
+ CSTR(g, zConfigDbName);
13781378
INT(g, repositoryOpen);
13791379
INT(g, localOpen);
13801380
INT(g, minPrefix);
13811381
INT(g, fSqlTrace);
13821382
INT(g, fSqlStats);
@@ -1410,11 +1410,10 @@
14101410
INT(g, nAux);
14111411
INT(g, allowSymlinks);
14121412
14131413
CSTR(g, zMainDbType);
14141414
CSTR(g, zConfigDbType);
1415
- CSTR(g, zHome);
14161415
CSTR(g, zLocalRoot);
14171416
CSTR(g, zPath);
14181417
CSTR(g, zExtra);
14191418
CSTR(g, zBaseURL);
14201419
CSTR(g, zTop);
14211420
--- 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
--- src/json_status.c
+++ src/json_status.c
@@ -37,11 +37,10 @@
3737
/*
3838
** Implementation of the /json/status page.
3939
**
4040
*/
4141
cson_value * json_page_status(){
42
- char const * zSql = NULL;
4342
Stmt q = empty_Stmt;
4443
cson_object * oPay;
4544
/*cson_object * files;*/
4645
int vid, nErr = 0;
4746
cson_object * tmpO;
@@ -101,11 +100,10 @@
101100
" WHERE is_selected(id)"
102101
" AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
103102
);
104103
while( db_step(&q)==SQLITE_ROW ){
105104
const char *zPathname = db_column_text(&q,0);
106
- const char *zDisplayName = zPathname;
107105
int isDeleted = db_column_int(&q, 1);
108106
int isChnged = db_column_int(&q,2);
109107
int isNew = db_column_int(&q,3)==0;
110108
int isRenamed = db_column_int(&q,4);
111109
cson_object * oFile;
112110
--- 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
--- src/json_status.c
+++ src/json_status.c
@@ -37,11 +37,10 @@
3737
/*
3838
** Implementation of the /json/status page.
3939
**
4040
*/
4141
cson_value * json_page_status(){
42
- char const * zSql = NULL;
4342
Stmt q = empty_Stmt;
4443
cson_object * oPay;
4544
/*cson_object * files;*/
4645
int vid, nErr = 0;
4746
cson_object * tmpO;
@@ -101,11 +100,10 @@
101100
" WHERE is_selected(id)"
102101
" AND (chnged OR deleted OR rid=0 OR pathname!=origname) ORDER BY 1"
103102
);
104103
while( db_step(&q)==SQLITE_ROW ){
105104
const char *zPathname = db_column_text(&q,0);
106
- const char *zDisplayName = zPathname;
107105
int isDeleted = db_column_int(&q, 1);
108106
int isChnged = db_column_int(&q,2);
109107
int isNew = db_column_int(&q,3)==0;
110108
int isRenamed = db_column_int(&q,4);
111109
cson_object * oFile;
112110
--- 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 @@
114114
char *nameOfExe; /* Full path of executable. */
115115
int isConst; /* True if the output is unchanging */
116116
sqlite3 *db; /* The connection to the databases */
117117
sqlite3 *dbConfig; /* Separate connection for global_config table */
118118
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 */
120120
sqlite3_int64 now; /* Seconds since 1970 */
121121
int repositoryOpen; /* True if the main repository database is open */
122122
char *zRepositoryName; /* Name of the repository database */
123123
const char *zMainDbType;/* "configdb", "localdb", or "repository" */
124124
const char *zConfigDbType; /* "configdb", "localdb", or "repository" */
125
- const char *zHome; /* Name of user home directory */
126125
int localOpen; /* True if the local database is open */
127126
char *zLocalRoot; /* The directory holding the local database */
128127
int minPrefix; /* Number of digits needed for a distinct UUID */
129128
int fSqlTrace; /* True if --sqltrace flag is present */
130129
int fSqlStats; /* True if --sqltrace or --sqlstats are present */
131130
--- 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 @@
258258
memset(p, 0, count-8);
259259
}
260260
byteReverse(ctx->in, 14);
261261
262262
/* 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));
265264
266265
MD5Transform(ctx->buf, (uint32 *)ctx->in);
267266
byteReverse((unsigned char *)ctx->buf, 4);
268267
memcpy(digest, ctx->buf, 16);
269268
memset(ctx, 0, sizeof(*ctx)); /* In case it's sensitive */
270269
--- 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 @@
16781678
@
16791679
@ <p>Only a the first statement in the entry box will be run.
16801680
@ Any subsequent statements will be silently ignored.</p>
16811681
@
16821682
@ <p>Database names:<ul><li>repository &rarr; %s(db_name("repository"))
1683
- if( g.configOpen ){
1683
+ if( g.zConfigDbName ){
16841684
@ <li>config &rarr; %s(db_name("configdb"))
16851685
}
16861686
if( g.localOpen ){
16871687
@ <li>local-checkout &rarr; %s(db_name("localdb"))
16881688
}
16891689
--- 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 &rarr; %s(db_name("repository"))
1683 if( g.configOpen ){
1684 @ <li>config &rarr; %s(db_name("configdb"))
1685 }
1686 if( g.localOpen ){
1687 @ <li>local-checkout &rarr; %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 &rarr; %s(db_name("repository"))
1683 if( g.zConfigDbName ){
1684 @ <li>config &rarr; %s(db_name("configdb"))
1685 }
1686 if( g.localOpen ){
1687 @ <li>local-checkout &rarr; %s(db_name("localdb"))
1688 }
1689
+1 -1
--- src/setup.c
+++ src/setup.c
@@ -1678,11 +1678,11 @@
16781678
@
16791679
@ <p>Only a the first statement in the entry box will be run.
16801680
@ Any subsequent statements will be silently ignored.</p>
16811681
@
16821682
@ <p>Database names:<ul><li>repository &rarr; %s(db_name("repository"))
1683
- if( g.configOpen ){
1683
+ if( g.zConfigDbName ){
16841684
@ <li>config &rarr; %s(db_name("configdb"))
16851685
}
16861686
if( g.localOpen ){
16871687
@ <li>local-checkout &rarr; %s(db_name("localdb"))
16881688
}
16891689
--- 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 &rarr; %s(db_name("repository"))
1683 if( g.configOpen ){
1684 @ <li>config &rarr; %s(db_name("configdb"))
1685 }
1686 if( g.localOpen ){
1687 @ <li>local-checkout &rarr; %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 &rarr; %s(db_name("repository"))
1683 if( g.zConfigDbName ){
1684 @ <li>config &rarr; %s(db_name("configdb"))
1685 }
1686 if( g.localOpen ){
1687 @ <li>local-checkout &rarr; %s(db_name("localdb"))
1688 }
1689
+51 -20
--- src/sqlite3.c
+++ src/sqlite3.c
@@ -674,11 +674,11 @@
674674
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
675675
** [sqlite_version()] and [sqlite_source_id()].
676676
*/
677677
#define SQLITE_VERSION "3.7.16"
678678
#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"
680680
681681
/*
682682
** CAPI3REF: Run-Time Library Version Numbers
683683
** KEYWORDS: sqlite3_version, sqlite3_sourceid
684684
**
@@ -1048,10 +1048,11 @@
10481048
#define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8))
10491049
#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8))
10501050
#define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8))
10511051
#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8))
10521052
#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8))
1053
+#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8))
10531054
#define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8))
10541055
#define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8))
10551056
#define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8))
10561057
#define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8))
10571058
#define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8))
@@ -23459,11 +23460,14 @@
2345923460
#endif
2346023461
}while( fd<0 && errno==EINTR );
2346123462
if( fd>=0 ){
2346223463
if( m!=0 ){
2346323464
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
+ ){
2346523469
osFchmod(fd, m);
2346623470
}
2346723471
}
2346823472
#if defined(FD_CLOEXEC) && (!defined(O_CLOEXEC) || O_CLOEXEC==0)
2346923473
osFcntl(fd, F_SETFD, osFcntl(fd, F_GETFD, 0) | FD_CLOEXEC);
@@ -41111,16 +41115,30 @@
4111141115
/*
4111241116
** Truncate the in-memory database file image to nPage pages. This
4111341117
** function does not actually modify the database file on disk. It
4111441118
** just sets the internal state of the pager object so that the
4111541119
** 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.
4111641125
*/
4111741126
SQLITE_PRIVATE void sqlite3PagerTruncateImage(Pager *pPager, Pgno nPage){
4111841127
assert( pPager->dbSize>=nPage );
4111941128
assert( pPager->eState>=PAGER_WRITER_CACHEMOD );
4112041129
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. */
4112241140
}
4112341141
4112441142
4112541143
/*
4112641144
** This function is called before attempting a hot-journal rollback. It
@@ -42169,10 +42187,15 @@
4216942187
}
4217042188
if( rc!=SQLITE_OK ){
4217142189
goto failed;
4217242190
}
4217342191
if( bHotJournal ){
42192
+ if( pPager->readOnly ){
42193
+ rc = SQLITE_READONLY_ROLLBACK;
42194
+ goto failed;
42195
+ }
42196
+
4217442197
/* Get an EXCLUSIVE lock on the database file. At this point it is
4217542198
** important that a RESERVED lock is not obtained on the way to the
4217642199
** EXCLUSIVE lock. If it were, another process might open the
4217742200
** database file, detect the RESERVED lock, and conclude that the
4217842201
** database is safe to read while this process is still rolling the
@@ -51340,11 +51363,11 @@
5134051363
}
5134151364
releasePage(pFreePg);
5134251365
}while( bCommit && iFreePg>nFin );
5134351366
assert( iFreePg<iLastPg );
5134451367
51345
- rc = relocatePage(pBt, pLastPg, eType, iPtrPage, iFreePg, nFin!=0);
51368
+ rc = relocatePage(pBt, pLastPg, eType, iPtrPage, iFreePg, bCommit);
5134651369
releasePage(pLastPg);
5134751370
if( rc!=SQLITE_OK ){
5134851371
return rc;
5134951372
}
5135051373
}
@@ -53211,25 +53234,27 @@
5321153234
**
5321253235
** SQLITE_OK is returned on success. Any other return value indicates
5321353236
** an error. *ppPage and *pPgno are undefined in the event of an error.
5321453237
** Do not invoke sqlite3PagerUnref() on *ppPage if an error is returned.
5321553238
**
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
5321753240
** locate a page close to the page number "nearby". This can be used in an
5321853241
** attempt to keep related pages close to each other in the database file,
5321953242
** which in turn can make database access faster.
5322053243
**
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.
5322453249
*/
5322553250
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 */
5323153256
){
5323253257
MemPage *pPage1;
5323353258
int rc;
5323453259
u32 n; /* Number of pages on the freelist */
5323553260
u32 k; /* Number of leaves on the trunk of the freelist */
@@ -53236,10 +53261,11 @@
5323653261
MemPage *pTrunk = 0;
5323753262
MemPage *pPrevTrunk = 0;
5323853263
Pgno mxPage; /* Total size of the database file */
5323953264
5324053265
assert( sqlite3_mutex_held(pBt->mutex) );
53266
+ assert( eMode==BTALLOC_ANY || (nearby>0 && pBt->autoVacuum) );
5324153267
pPage1 = pBt->pPage1;
5324253268
mxPage = btreePagecount(pBt);
5324353269
n = get4byte(&pPage1->aData[36]);
5324453270
testcase( n==mxPage-1 );
5324553271
if( n>=mxPage ){
@@ -53248,11 +53274,11 @@
5324853274
if( n>0 ){
5324953275
/* There are pages on the freelist. Reuse one of those pages. */
5325053276
Pgno iTrunk;
5325153277
u8 searchList = 0; /* If the free-list must be searched for 'nearby' */
5325253278
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
5325453280
** shows that the page 'nearby' is somewhere on the free-list, then
5325553281
** the entire-list will be searched for that page.
5325653282
*/
5325753283
#ifndef SQLITE_OMIT_AUTOVACUUM
5325853284
if( eMode==BTALLOC_EXACT ){
@@ -53278,11 +53304,12 @@
5327853304
if( rc ) return rc;
5327953305
put4byte(&pPage1->aData[36], n-1);
5328053306
5328153307
/* The code within this loop is run only once if the 'searchList' variable
5328253308
** 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)
5328453311
*/
5328553312
do {
5328653313
pPrevTrunk = pTrunk;
5328753314
if( pPrevTrunk ){
5328853315
iTrunk = get4byte(&pPrevTrunk->aData[0]);
@@ -103557,13 +103584,12 @@
103557103584
**
103558103585
** If there are multiple terms in the WHERE clause of the form "X <op> <expr>"
103559103586
** then try for the one with no dependencies on <expr> - in other words where
103560103587
** <expr> is a constant expression of some kind. Only return entries of
103561103588
** 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.
103565103591
*/
103566103592
static WhereTerm *findTerm(
103567103593
WhereClause *pWC, /* The WHERE clause to be searched */
103568103594
int iCur, /* Cursor number of LHS */
103569103595
int iColumn, /* Column number of LHS */
@@ -103618,12 +103644,16 @@
103618103644
}
103619103645
if( sqlite3StrICmp(pColl->zName, pIdx->azColl[j]) ){
103620103646
continue;
103621103647
}
103622103648
}
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
+ }
103625103655
}
103626103656
if( (pTerm->eOperator & WO_EQUIV)!=0
103627103657
&& nEquiv<ArraySize(aEquiv)
103628103658
){
103629103659
pX = sqlite3ExprSkipCollate(pTerm->pExpr->pRight);
@@ -107145,10 +107175,11 @@
107145107175
testcase( pTerm->wtFlags & TERM_VIRTUAL ); /* EV: R-30575-11662 */
107146107176
iRowidReg = codeEqualityTerm(pParse, pTerm, pLevel, iReleaseReg);
107147107177
addrNxt = pLevel->addrNxt;
107148107178
sqlite3VdbeAddOp2(v, OP_MustBeInt, iRowidReg, addrNxt);
107149107179
sqlite3VdbeAddOp3(v, OP_NotExists, iCur, addrNxt, iRowidReg);
107180
+ sqlite3ExprCacheAffinityChange(pParse, iRowidReg, 1);
107150107181
sqlite3ExprCacheStore(pParse, iCur, -1, iRowidReg);
107151107182
VdbeComment((v, "pk"));
107152107183
pLevel->op = OP_Noop;
107153107184
}else if( pLevel->plan.wsFlags & WHERE_ROWID_RANGE ){
107154107185
/* Case 2: We have an inequality comparison against the ROWID field.
107155107186
--- 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 @@
107107
** [sqlite3_libversion_number()], [sqlite3_sourceid()],
108108
** [sqlite_version()] and [sqlite_source_id()].
109109
*/
110110
#define SQLITE_VERSION "3.7.16"
111111
#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"
113113
114114
/*
115115
** CAPI3REF: Run-Time Library Version Numbers
116116
** KEYWORDS: sqlite3_version, sqlite3_sourceid
117117
**
@@ -481,10 +481,11 @@
481481
#define SQLITE_CANTOPEN_ISDIR (SQLITE_CANTOPEN | (2<<8))
482482
#define SQLITE_CANTOPEN_FULLPATH (SQLITE_CANTOPEN | (3<<8))
483483
#define SQLITE_CORRUPT_VTAB (SQLITE_CORRUPT | (1<<8))
484484
#define SQLITE_READONLY_RECOVERY (SQLITE_READONLY | (1<<8))
485485
#define SQLITE_READONLY_CANTLOCK (SQLITE_READONLY | (2<<8))
486
+#define SQLITE_READONLY_ROLLBACK (SQLITE_READONLY | (3<<8))
486487
#define SQLITE_ABORT_ROLLBACK (SQLITE_ABORT | (2<<8))
487488
#define SQLITE_CONSTRAINT_CHECK (SQLITE_CONSTRAINT | (1<<8))
488489
#define SQLITE_CONSTRAINT_COMMITHOOK (SQLITE_CONSTRAINT | (2<<8))
489490
#define SQLITE_CONSTRAINT_FOREIGNKEY (SQLITE_CONSTRAINT | (3<<8))
490491
#define SQLITE_CONSTRAINT_FUNCTION (SQLITE_CONSTRAINT | (4<<8))
491492
--- 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 @@
934934
@
935935
@ <li><p>Delete attachment "%h(zFile)"
936936
}else{
937937
@
938938
@ <li><p>Add attachment
939
- @ "%z(href("%R/artifact/%S",zSrc))%h(zFile)</a>"
939
+ @ "%z(href("%R/artifact/%S",zSrc))%s(zFile)</a>"
940940
}
941941
@ [%z(href("%R/artifact/%T",zChngUuid))%s(zShort)</a>]
942942
@ (rid %d(rid)) by
943943
hyperlink_to_user(zUser,zDate," on");
944944
hyperlink_to_date(zDate, ".</p>");
945945
--- 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 @@
2323
#include "utf8.h"
2424
#include <sqlite3.h>
2525
#ifdef _WIN32
2626
# include <windows.h>
2727
#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
2836
2937
#ifdef _WIN32
3038
/*
3139
** Translate MBCS to UTF-8. Return a pointer to the translated text.
3240
** Call fossil_mbcs_free() to deallocate any memory used to store the
@@ -42,38 +50,39 @@
4250
** any memory used to hold the translation
4351
*/
4452
void fossil_mbcs_free(char *zOld){
4553
sqlite3_free(zOld);
4654
}
55
+#endif /* _WIN32 */
4756
4857
/*
4958
** Translate Unicode text into UTF-8.
5059
** Return a pointer to the translated text.
5160
** Call fossil_unicode_free() to deallocate any memory used to store the
5261
** returned pointer when done.
5362
*/
5463
char *fossil_unicode_to_utf8(const void *zUnicode){
55
-#ifdef _WIN32
64
+#if defined(_WIN32) || defined(__CYGWIN__)
5665
int nByte = WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, 0, 0, 0, 0);
5766
char *zUtf = sqlite3_malloc( nByte );
5867
if( zUtf==0 ){
5968
return 0;
6069
}
6170
WideCharToMultiByte(CP_UTF8, 0, zUnicode, -1, zUtf, nByte, 0, 0);
6271
return zUtf;
6372
#else
64
- return fossil_strdup(zUtf8); /* TODO: implement for unix */
73
+ return fossil_strdup(zUnicode); /* TODO: implement for unix */
6574
#endif
6675
}
6776
6877
/*
6978
** Translate UTF-8 to unicode for use in system calls. Return a pointer to the
7079
** translated text.. Call fossil_unicode_free() to deallocate any memory
7180
** used to store the returned pointer when done.
7281
*/
7382
void *fossil_utf8_to_unicode(const char *zUtf8){
74
-#ifdef _WIN32
83
+#if defined(_WIN32) || defined(__CYGWIN__)
7584
int nByte = MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, 0, 0);
7685
wchar_t *zUnicode = sqlite3_malloc( nByte * 2 );
7786
if( zUnicode==0 ){
7887
return 0;
7988
}
@@ -87,17 +96,16 @@
8796
/*
8897
** Deallocate any memory that was previously allocated by
8998
** fossil_unicode_to_utf8().
9099
*/
91100
void fossil_unicode_free(void *pOld){
92
-#ifdef _WIN32
101
+#if defined(_WIN32) || defined(__CYGWIN__)
93102
sqlite3_free(pOld);
94103
#else
95104
fossil_free(pOld);
96105
#endif
97106
}
98
-#endif /* _WIN32 */
99107
100108
#if defined(__APPLE__) && !defined(WITHOUT_ICONV)
101109
# include <iconv.h>
102110
#endif
103111
@@ -160,17 +168,17 @@
160168
** Call fossil_filename_free() to deallocate any memory used to store the
161169
** returned pointer when done.
162170
*/
163171
void *fossil_utf8_to_filename(const char *zUtf8){
164172
#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 );
167175
wchar_t *wUnicode = zUnicode;
168176
if( zUnicode==0 ){
169177
return 0;
170178
}
171
- MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nByte);
179
+ MultiByteToWideChar(CP_UTF8, 0, zUtf8, -1, zUnicode, nChar);
172180
while( *wUnicode != '\0' ){
173181
if( *wUnicode == '/' ){
174182
*wUnicode = '\\';
175183
}
176184
++wUnicode;
@@ -178,22 +186,31 @@
178186
return zUnicode;
179187
#elif defined(__CYGWIN__)
180188
char *zPath, *p;
181189
if( fossil_isalpha(zUtf8[0]) && (zUtf8[1]==':')
182190
&& (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);
188205
} else {
189206
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
+ }
195212
}
196213
}
197214
return zPath;
198215
#elif defined(__APPLE__) && !defined(WITHOUT_ICONV)
199216
return fossil_strdup(zUtf8);
200217
--- 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
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -13,14 +13,14 @@
1313
#
1414
1515
#### Select one of MinGW, MinGW-w64 (32-bit) or MinGW-w64 (64-bit) compilers.
1616
# By default, this is an empty string (i.e. use the native compiler).
1717
#
18
-PREFIX =
18
+# PREFIX =
1919
# PREFIX = mingw32-
2020
# PREFIX = i686-pc-mingw32-
21
-# PREFIX = i686-w64-mingw32-
21
+PREFIX = i686-w64-mingw32-
2222
# PREFIX = x86_64-w64-mingw32-
2323
2424
#### The toplevel directory of the source tree. Fossil can be built
2525
# in a directory that is separate from the source tree. Just change
2626
# the following to point from the build directory to the src/ folder.
2727
--- 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
--- win/Makefile.mingw
+++ win/Makefile.mingw
@@ -13,14 +13,14 @@
1313
#
1414
1515
#### Select one of MinGW, MinGW-w64 (32-bit) or MinGW-w64 (64-bit) compilers.
1616
# By default, this is an empty string (i.e. use the native compiler).
1717
#
18
-PREFIX =
18
+# PREFIX =
1919
# PREFIX = mingw32-
2020
# PREFIX = i686-pc-mingw32-
21
-# PREFIX = i686-w64-mingw32-
21
+PREFIX = i686-w64-mingw32-
2222
# PREFIX = x86_64-w64-mingw32-
2323
2424
#### The toplevel directory of the source tree. Fossil can be built
2525
# in a directory that is separate from the source tree. Just change
2626
# the following to point from the build directory to the src/ folder.
2727
--- 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

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button