Fossil SCM
Coding style fixes.
Commit
1d49b5ad9118d0ab0c7ea9359fef0f68fa4d5e899a9cfa26dedb8a3be1abfbcc
Parent
a90d0617d74204e…
1 file changed
+6
-6
+6
-6
| --- src/rebuild.c | ||
| +++ src/rebuild.c | ||
| @@ -1038,39 +1038,39 @@ | ||
| 1038 | 1038 | /* |
| 1039 | 1039 | ** Helper functions called from recon_read_dir() to set and restore the correct |
| 1040 | 1040 | ** hash policy for an artifact read from disk, inferred from the length of the |
| 1041 | 1041 | ** path name. |
| 1042 | 1042 | */ |
| 1043 | -#define HPOLICY_NOTDEFINED -1 | |
| 1044 | -static int saved_eHashPolicy = HPOLICY_NOTDEFINED; | |
| 1043 | +static int saved_eHashPolicy = -1; | |
| 1045 | 1044 | |
| 1046 | 1045 | void recon_set_hash_policy( |
| 1047 | 1046 | const int cchPathPrefix, /* Directory prefix length for zUuidAsFilePath */ |
| 1048 | 1047 | const char *zUuidAsFilePath /* Relative, well-formed, from recon_read_dir() */ |
| 1049 | 1048 | ){ |
| 1050 | 1049 | int cchTotal, cchHashPart; |
| 1051 | - int new_eHashPolicy = HPOLICY_NOTDEFINED; | |
| 1050 | + int new_eHashPolicy = -1; | |
| 1052 | 1051 | assert( HNAME_COUNT==2 ); /* Review function if new hashes are implemented. */ |
| 1053 | 1052 | if( zUuidAsFilePath==0 ) return; |
| 1054 | 1053 | cchTotal = strlen(zUuidAsFilePath); |
| 1055 | 1054 | if( cchTotal==0 ) return; |
| 1056 | - if( cchPathPrefix>=cchTotal) return; | |
| 1055 | + if( cchPathPrefix>=cchTotal ) return; | |
| 1057 | 1056 | cchHashPart = cchTotal - cchPathPrefix; |
| 1058 | 1057 | if( cchHashPart>=HNAME_LEN_K256 ){ |
| 1059 | 1058 | new_eHashPolicy = HPOLICY_SHA3; |
| 1060 | 1059 | }else if( cchHashPart>=HNAME_LEN_SHA1 ){ |
| 1061 | 1060 | new_eHashPolicy = HPOLICY_SHA1; |
| 1062 | 1061 | } |
| 1063 | - if( new_eHashPolicy!=HPOLICY_NOTDEFINED ){ | |
| 1062 | + if( new_eHashPolicy!=-1 ){ | |
| 1064 | 1063 | saved_eHashPolicy = g.eHashPolicy; |
| 1065 | 1064 | g.eHashPolicy = new_eHashPolicy; |
| 1066 | 1065 | } |
| 1067 | 1066 | } |
| 1068 | 1067 | |
| 1069 | 1068 | void recon_restore_hash_policy(){ |
| 1070 | - if( saved_eHashPolicy!=HPOLICY_NOTDEFINED ){ | |
| 1069 | + if( saved_eHashPolicy!=-1 ){ | |
| 1071 | 1070 | g.eHashPolicy = saved_eHashPolicy; |
| 1071 | + saved_eHashPolicy = -1; | |
| 1072 | 1072 | } |
| 1073 | 1073 | } |
| 1074 | 1074 | |
| 1075 | 1075 | /* |
| 1076 | 1076 | ** COMMAND: reconstruct* |
| 1077 | 1077 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -1038,39 +1038,39 @@ | |
| 1038 | /* |
| 1039 | ** Helper functions called from recon_read_dir() to set and restore the correct |
| 1040 | ** hash policy for an artifact read from disk, inferred from the length of the |
| 1041 | ** path name. |
| 1042 | */ |
| 1043 | #define HPOLICY_NOTDEFINED -1 |
| 1044 | static int saved_eHashPolicy = HPOLICY_NOTDEFINED; |
| 1045 | |
| 1046 | void recon_set_hash_policy( |
| 1047 | const int cchPathPrefix, /* Directory prefix length for zUuidAsFilePath */ |
| 1048 | const char *zUuidAsFilePath /* Relative, well-formed, from recon_read_dir() */ |
| 1049 | ){ |
| 1050 | int cchTotal, cchHashPart; |
| 1051 | int new_eHashPolicy = HPOLICY_NOTDEFINED; |
| 1052 | assert( HNAME_COUNT==2 ); /* Review function if new hashes are implemented. */ |
| 1053 | if( zUuidAsFilePath==0 ) return; |
| 1054 | cchTotal = strlen(zUuidAsFilePath); |
| 1055 | if( cchTotal==0 ) return; |
| 1056 | if( cchPathPrefix>=cchTotal) return; |
| 1057 | cchHashPart = cchTotal - cchPathPrefix; |
| 1058 | if( cchHashPart>=HNAME_LEN_K256 ){ |
| 1059 | new_eHashPolicy = HPOLICY_SHA3; |
| 1060 | }else if( cchHashPart>=HNAME_LEN_SHA1 ){ |
| 1061 | new_eHashPolicy = HPOLICY_SHA1; |
| 1062 | } |
| 1063 | if( new_eHashPolicy!=HPOLICY_NOTDEFINED ){ |
| 1064 | saved_eHashPolicy = g.eHashPolicy; |
| 1065 | g.eHashPolicy = new_eHashPolicy; |
| 1066 | } |
| 1067 | } |
| 1068 | |
| 1069 | void recon_restore_hash_policy(){ |
| 1070 | if( saved_eHashPolicy!=HPOLICY_NOTDEFINED ){ |
| 1071 | g.eHashPolicy = saved_eHashPolicy; |
| 1072 | } |
| 1073 | } |
| 1074 | |
| 1075 | /* |
| 1076 | ** COMMAND: reconstruct* |
| 1077 |
| --- src/rebuild.c | |
| +++ src/rebuild.c | |
| @@ -1038,39 +1038,39 @@ | |
| 1038 | /* |
| 1039 | ** Helper functions called from recon_read_dir() to set and restore the correct |
| 1040 | ** hash policy for an artifact read from disk, inferred from the length of the |
| 1041 | ** path name. |
| 1042 | */ |
| 1043 | static int saved_eHashPolicy = -1; |
| 1044 | |
| 1045 | void recon_set_hash_policy( |
| 1046 | const int cchPathPrefix, /* Directory prefix length for zUuidAsFilePath */ |
| 1047 | const char *zUuidAsFilePath /* Relative, well-formed, from recon_read_dir() */ |
| 1048 | ){ |
| 1049 | int cchTotal, cchHashPart; |
| 1050 | int new_eHashPolicy = -1; |
| 1051 | assert( HNAME_COUNT==2 ); /* Review function if new hashes are implemented. */ |
| 1052 | if( zUuidAsFilePath==0 ) return; |
| 1053 | cchTotal = strlen(zUuidAsFilePath); |
| 1054 | if( cchTotal==0 ) return; |
| 1055 | if( cchPathPrefix>=cchTotal ) return; |
| 1056 | cchHashPart = cchTotal - cchPathPrefix; |
| 1057 | if( cchHashPart>=HNAME_LEN_K256 ){ |
| 1058 | new_eHashPolicy = HPOLICY_SHA3; |
| 1059 | }else if( cchHashPart>=HNAME_LEN_SHA1 ){ |
| 1060 | new_eHashPolicy = HPOLICY_SHA1; |
| 1061 | } |
| 1062 | if( new_eHashPolicy!=-1 ){ |
| 1063 | saved_eHashPolicy = g.eHashPolicy; |
| 1064 | g.eHashPolicy = new_eHashPolicy; |
| 1065 | } |
| 1066 | } |
| 1067 | |
| 1068 | void recon_restore_hash_policy(){ |
| 1069 | if( saved_eHashPolicy!=-1 ){ |
| 1070 | g.eHashPolicy = saved_eHashPolicy; |
| 1071 | saved_eHashPolicy = -1; |
| 1072 | } |
| 1073 | } |
| 1074 | |
| 1075 | /* |
| 1076 | ** COMMAND: reconstruct* |
| 1077 |