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.
Commit
311aa9dd6716d7ce9f1ddb0d2d4c0f01932348dba65a99e06f088ecd586dab5b
Parent
0475b4f120ac18b…
1 file changed
+3
-3
+3
-3
| --- src/printf.c | ||
| +++ src/printf.c | ||
| @@ -34,11 +34,11 @@ | ||
| 34 | 34 | ** The following macros help determine those lengths. FOSSIL_HASH_DIGITS |
| 35 | 35 | ** is the default number of digits to display to humans. This value can |
| 36 | 36 | ** be overridden using the hash-digits setting. FOSSIL_HASH_DIGITS_URL |
| 37 | 37 | ** is the minimum number of digits to be used in URLs. The number used |
| 38 | 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. | |
| 39 | +** or HNAME_MAX, whichever is least. | |
| 40 | 40 | */ |
| 41 | 41 | #ifndef FOSSIL_HASH_DIGITS |
| 42 | 42 | # define FOSSIL_HASH_DIGITS 10 /* For %S (human display) */ |
| 43 | 43 | #endif |
| 44 | 44 | #ifndef FOSSIL_HASH_DIGITS_URL |
| @@ -54,14 +54,14 @@ | ||
| 54 | 54 | static int nDigitHuman = 0; |
| 55 | 55 | static int nDigitUrl = 0; |
| 56 | 56 | if( nDigitHuman==0 ){ |
| 57 | 57 | nDigitHuman = db_get_int("hash-digits", FOSSIL_HASH_DIGITS); |
| 58 | 58 | if( nDigitHuman < 6 ) nDigitHuman = 6; |
| 59 | - if( nDigitHuman > 40 ) nDigitHuman = 40; | |
| 59 | + if( nDigitHuman > HNAME_MAX ) nDigitHuman = HNAME_MAX; | |
| 60 | 60 | nDigitUrl = nDigitHuman + 6; |
| 61 | 61 | 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; | |
| 63 | 63 | } |
| 64 | 64 | return bForUrl ? nDigitUrl : nDigitHuman; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | 67 | /* |
| 68 | 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 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 |