Fossil SCM

Coding style fixes.

florian 2019-01-29 14:01 reconstruct-sha3
Commit 1d49b5ad9118d0ab0c7ea9359fef0f68fa4d5e899a9cfa26dedb8a3be1abfbcc
1 file changed +6 -6
+6 -6
--- src/rebuild.c
+++ src/rebuild.c
@@ -1038,39 +1038,39 @@
10381038
/*
10391039
** Helper functions called from recon_read_dir() to set and restore the correct
10401040
** hash policy for an artifact read from disk, inferred from the length of the
10411041
** path name.
10421042
*/
1043
-#define HPOLICY_NOTDEFINED -1
1044
-static int saved_eHashPolicy = HPOLICY_NOTDEFINED;
1043
+static int saved_eHashPolicy = -1;
10451044
10461045
void recon_set_hash_policy(
10471046
const int cchPathPrefix, /* Directory prefix length for zUuidAsFilePath */
10481047
const char *zUuidAsFilePath /* Relative, well-formed, from recon_read_dir() */
10491048
){
10501049
int cchTotal, cchHashPart;
1051
- int new_eHashPolicy = HPOLICY_NOTDEFINED;
1050
+ int new_eHashPolicy = -1;
10521051
assert( HNAME_COUNT==2 ); /* Review function if new hashes are implemented. */
10531052
if( zUuidAsFilePath==0 ) return;
10541053
cchTotal = strlen(zUuidAsFilePath);
10551054
if( cchTotal==0 ) return;
1056
- if( cchPathPrefix>=cchTotal) return;
1055
+ if( cchPathPrefix>=cchTotal ) return;
10571056
cchHashPart = cchTotal - cchPathPrefix;
10581057
if( cchHashPart>=HNAME_LEN_K256 ){
10591058
new_eHashPolicy = HPOLICY_SHA3;
10601059
}else if( cchHashPart>=HNAME_LEN_SHA1 ){
10611060
new_eHashPolicy = HPOLICY_SHA1;
10621061
}
1063
- if( new_eHashPolicy!=HPOLICY_NOTDEFINED ){
1062
+ if( new_eHashPolicy!=-1 ){
10641063
saved_eHashPolicy = g.eHashPolicy;
10651064
g.eHashPolicy = new_eHashPolicy;
10661065
}
10671066
}
10681067
10691068
void recon_restore_hash_policy(){
1070
- if( saved_eHashPolicy!=HPOLICY_NOTDEFINED ){
1069
+ if( saved_eHashPolicy!=-1 ){
10711070
g.eHashPolicy = saved_eHashPolicy;
1071
+ saved_eHashPolicy = -1;
10721072
}
10731073
}
10741074
10751075
/*
10761076
** COMMAND: reconstruct*
10771077
--- 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

Keyboard Shortcuts

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