Fossil SCM

Fix the upper bound on the number of digits of hash to display so that it can display full-length SHA3-256 hashes.

drh 2020-05-14 17:03 trunk
Commit 311aa9dd6716d7ce9f1ddb0d2d4c0f01932348dba65a99e06f088ecd586dab5b
1 file changed +3 -3
+3 -3
--- src/printf.c
+++ src/printf.c
@@ -34,11 +34,11 @@
3434
** The following macros help determine those lengths. FOSSIL_HASH_DIGITS
3535
** is the default number of digits to display to humans. This value can
3636
** be overridden using the hash-digits setting. FOSSIL_HASH_DIGITS_URL
3737
** is the minimum number of digits to be used in URLs. The number used
3838
** will always be at least 6 more than the number used for human output,
39
-** or 40 if the number of digits in human output is 34 or more.
39
+** or HNAME_MAX, whichever is least.
4040
*/
4141
#ifndef FOSSIL_HASH_DIGITS
4242
# define FOSSIL_HASH_DIGITS 10 /* For %S (human display) */
4343
#endif
4444
#ifndef FOSSIL_HASH_DIGITS_URL
@@ -54,14 +54,14 @@
5454
static int nDigitHuman = 0;
5555
static int nDigitUrl = 0;
5656
if( nDigitHuman==0 ){
5757
nDigitHuman = db_get_int("hash-digits", FOSSIL_HASH_DIGITS);
5858
if( nDigitHuman < 6 ) nDigitHuman = 6;
59
- if( nDigitHuman > 40 ) nDigitHuman = 40;
59
+ if( nDigitHuman > HNAME_MAX ) nDigitHuman = HNAME_MAX;
6060
nDigitUrl = nDigitHuman + 6;
6161
if( nDigitUrl < FOSSIL_HASH_DIGITS_URL ) nDigitUrl = FOSSIL_HASH_DIGITS_URL;
62
- if( nDigitUrl > 40 ) nDigitUrl = 40;
62
+ if( nDigitUrl > HNAME_MAX ) nDigitUrl = HNAME_MAX;
6363
}
6464
return bForUrl ? nDigitUrl : nDigitHuman;
6565
}
6666
6767
/*
6868
--- src/printf.c
+++ src/printf.c
@@ -34,11 +34,11 @@
34 ** The following macros help determine those lengths. FOSSIL_HASH_DIGITS
35 ** is the default number of digits to display to humans. This value can
36 ** be overridden using the hash-digits setting. FOSSIL_HASH_DIGITS_URL
37 ** is the minimum number of digits to be used in URLs. The number used
38 ** will always be at least 6 more than the number used for human output,
39 ** or 40 if the number of digits in human output is 34 or more.
40 */
41 #ifndef FOSSIL_HASH_DIGITS
42 # define FOSSIL_HASH_DIGITS 10 /* For %S (human display) */
43 #endif
44 #ifndef FOSSIL_HASH_DIGITS_URL
@@ -54,14 +54,14 @@
54 static int nDigitHuman = 0;
55 static int nDigitUrl = 0;
56 if( nDigitHuman==0 ){
57 nDigitHuman = db_get_int("hash-digits", FOSSIL_HASH_DIGITS);
58 if( nDigitHuman < 6 ) nDigitHuman = 6;
59 if( nDigitHuman > 40 ) nDigitHuman = 40;
60 nDigitUrl = nDigitHuman + 6;
61 if( nDigitUrl < FOSSIL_HASH_DIGITS_URL ) nDigitUrl = FOSSIL_HASH_DIGITS_URL;
62 if( nDigitUrl > 40 ) nDigitUrl = 40;
63 }
64 return bForUrl ? nDigitUrl : nDigitHuman;
65 }
66
67 /*
68
--- src/printf.c
+++ src/printf.c
@@ -34,11 +34,11 @@
34 ** The following macros help determine those lengths. FOSSIL_HASH_DIGITS
35 ** is the default number of digits to display to humans. This value can
36 ** be overridden using the hash-digits setting. FOSSIL_HASH_DIGITS_URL
37 ** is the minimum number of digits to be used in URLs. The number used
38 ** will always be at least 6 more than the number used for human output,
39 ** or HNAME_MAX, whichever is least.
40 */
41 #ifndef FOSSIL_HASH_DIGITS
42 # define FOSSIL_HASH_DIGITS 10 /* For %S (human display) */
43 #endif
44 #ifndef FOSSIL_HASH_DIGITS_URL
@@ -54,14 +54,14 @@
54 static int nDigitHuman = 0;
55 static int nDigitUrl = 0;
56 if( nDigitHuman==0 ){
57 nDigitHuman = db_get_int("hash-digits", FOSSIL_HASH_DIGITS);
58 if( nDigitHuman < 6 ) nDigitHuman = 6;
59 if( nDigitHuman > HNAME_MAX ) nDigitHuman = HNAME_MAX;
60 nDigitUrl = nDigitHuman + 6;
61 if( nDigitUrl < FOSSIL_HASH_DIGITS_URL ) nDigitUrl = FOSSIL_HASH_DIGITS_URL;
62 if( nDigitUrl > HNAME_MAX ) nDigitUrl = HNAME_MAX;
63 }
64 return bForUrl ? nDigitUrl : nDigitHuman;
65 }
66
67 /*
68

Keyboard Shortcuts

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