Fossil SCM
Fix compiler warning and clarify use of local variables.
Commit
d2e7d2cf0d1553feff10aa374276ee61231f4bdb
Parent
a072137b03e3dc1…
1 file changed
+6
-6
+6
-6
| --- src/shun.c | ||
| +++ src/shun.c | ||
| @@ -43,12 +43,11 @@ | ||
| 43 | 43 | int cnt = 0; |
| 44 | 44 | const char *zUuid = P("uuid"); |
| 45 | 45 | const char *zShun = P("shun"); |
| 46 | 46 | const char *zAccept = P("accept"); |
| 47 | 47 | const char *zRcvid = P("rcvid"); |
| 48 | - int nRcvid; | |
| 49 | - int nUuid; | |
| 48 | + int nRcvid = 0; | |
| 50 | 49 | int numRows = 3; |
| 51 | 50 | char *zCanonical = 0; |
| 52 | 51 | |
| 53 | 52 | login_check_credentials(); |
| 54 | 53 | if( !g.perm.Admin ){ |
| @@ -79,11 +78,11 @@ | ||
| 79 | 78 | i++; |
| 80 | 79 | } |
| 81 | 80 | zCanonical[j+1] = zCanonical[j] = 0; |
| 82 | 81 | p = zCanonical; |
| 83 | 82 | while( *p ){ |
| 84 | - nUuid = strlen(p); | |
| 83 | + int nUuid = strlen(p); | |
| 85 | 84 | if( nUuid!=UUID_SIZE || !validate16(p, nUuid) ){ |
| 86 | 85 | @ <p class="generalError">Error: Bad artifact IDs.</p> |
| 87 | 86 | fossil_free(zCanonical); |
| 88 | 87 | zCanonical = 0; |
| 89 | 88 | break; |
| @@ -152,11 +151,12 @@ | ||
| 152 | 151 | @ They will be removed from the repository the next time the repository |
| 153 | 152 | @ is rebuilt using the <b>fossil rebuild</b> command-line</p> |
| 154 | 153 | } |
| 155 | 154 | if( zRcvid ){ |
| 156 | 155 | nRcvid = atoi(zRcvid); |
| 157 | - numRows = db_int(0, "SELECT min(count(), 10) FROM blob WHERE rcvid=%d", nRcvid); | |
| 156 | + numRows = db_int(0, "SELECT min(count(), 10) FROM blob WHERE rcvid=%d", | |
| 157 | + nRcvid); | |
| 158 | 158 | } |
| 159 | 159 | @ <p>A shunned artifact will not be pushed nor accepted in a pull and the |
| 160 | 160 | @ artifact content will be purged from the repository the next time the |
| 161 | 161 | @ repository is rebuilt. A list of shunned artifacts can be seen at the |
| 162 | 162 | @ bottom of this page.</p> |
| @@ -183,11 +183,11 @@ | ||
| 183 | 183 | login_insert_csrf_secret(); |
| 184 | 184 | @ <textarea class="fullsize-text" cols="50" rows="%d(numRows)" name="uuid"> |
| 185 | 185 | if( zShun ){ |
| 186 | 186 | if( strlen(zShun) ){ |
| 187 | 187 | @ %h(zShun) |
| 188 | - }else if( zRcvid ){ | |
| 188 | + }else if( nRcvid ){ | |
| 189 | 189 | db_prepare(&q, "SELECT uuid FROM blob WHERE rcvid=%d", nRcvid); |
| 190 | 190 | while( db_step(&q)==SQLITE_ROW ){ |
| 191 | 191 | @ %s(db_column_text(&q, 0)) |
| 192 | 192 | } |
| 193 | 193 | db_finalize(&q); |
| @@ -210,11 +210,11 @@ | ||
| 210 | 210 | login_insert_csrf_secret(); |
| 211 | 211 | @ <textarea class="fullsize-text" cols="50" rows="%d(numRows)" name="uuid"> |
| 212 | 212 | if( zAccept ){ |
| 213 | 213 | if( strlen(zAccept) ){ |
| 214 | 214 | @ %h(zAccept) |
| 215 | - }else if( zRcvid ){ | |
| 215 | + }else if( nRcvid ){ | |
| 216 | 216 | db_prepare(&q, "SELECT uuid FROM blob WHERE rcvid=%d", nRcvid); |
| 217 | 217 | while( db_step(&q)==SQLITE_ROW ){ |
| 218 | 218 | @ %s(db_column_text(&q, 0)) |
| 219 | 219 | } |
| 220 | 220 | db_finalize(&q); |
| 221 | 221 |
| --- src/shun.c | |
| +++ src/shun.c | |
| @@ -43,12 +43,11 @@ | |
| 43 | int cnt = 0; |
| 44 | const char *zUuid = P("uuid"); |
| 45 | const char *zShun = P("shun"); |
| 46 | const char *zAccept = P("accept"); |
| 47 | const char *zRcvid = P("rcvid"); |
| 48 | int nRcvid; |
| 49 | int nUuid; |
| 50 | int numRows = 3; |
| 51 | char *zCanonical = 0; |
| 52 | |
| 53 | login_check_credentials(); |
| 54 | if( !g.perm.Admin ){ |
| @@ -79,11 +78,11 @@ | |
| 79 | i++; |
| 80 | } |
| 81 | zCanonical[j+1] = zCanonical[j] = 0; |
| 82 | p = zCanonical; |
| 83 | while( *p ){ |
| 84 | nUuid = strlen(p); |
| 85 | if( nUuid!=UUID_SIZE || !validate16(p, nUuid) ){ |
| 86 | @ <p class="generalError">Error: Bad artifact IDs.</p> |
| 87 | fossil_free(zCanonical); |
| 88 | zCanonical = 0; |
| 89 | break; |
| @@ -152,11 +151,12 @@ | |
| 152 | @ They will be removed from the repository the next time the repository |
| 153 | @ is rebuilt using the <b>fossil rebuild</b> command-line</p> |
| 154 | } |
| 155 | if( zRcvid ){ |
| 156 | nRcvid = atoi(zRcvid); |
| 157 | numRows = db_int(0, "SELECT min(count(), 10) FROM blob WHERE rcvid=%d", nRcvid); |
| 158 | } |
| 159 | @ <p>A shunned artifact will not be pushed nor accepted in a pull and the |
| 160 | @ artifact content will be purged from the repository the next time the |
| 161 | @ repository is rebuilt. A list of shunned artifacts can be seen at the |
| 162 | @ bottom of this page.</p> |
| @@ -183,11 +183,11 @@ | |
| 183 | login_insert_csrf_secret(); |
| 184 | @ <textarea class="fullsize-text" cols="50" rows="%d(numRows)" name="uuid"> |
| 185 | if( zShun ){ |
| 186 | if( strlen(zShun) ){ |
| 187 | @ %h(zShun) |
| 188 | }else if( zRcvid ){ |
| 189 | db_prepare(&q, "SELECT uuid FROM blob WHERE rcvid=%d", nRcvid); |
| 190 | while( db_step(&q)==SQLITE_ROW ){ |
| 191 | @ %s(db_column_text(&q, 0)) |
| 192 | } |
| 193 | db_finalize(&q); |
| @@ -210,11 +210,11 @@ | |
| 210 | login_insert_csrf_secret(); |
| 211 | @ <textarea class="fullsize-text" cols="50" rows="%d(numRows)" name="uuid"> |
| 212 | if( zAccept ){ |
| 213 | if( strlen(zAccept) ){ |
| 214 | @ %h(zAccept) |
| 215 | }else if( zRcvid ){ |
| 216 | db_prepare(&q, "SELECT uuid FROM blob WHERE rcvid=%d", nRcvid); |
| 217 | while( db_step(&q)==SQLITE_ROW ){ |
| 218 | @ %s(db_column_text(&q, 0)) |
| 219 | } |
| 220 | db_finalize(&q); |
| 221 |
| --- src/shun.c | |
| +++ src/shun.c | |
| @@ -43,12 +43,11 @@ | |
| 43 | int cnt = 0; |
| 44 | const char *zUuid = P("uuid"); |
| 45 | const char *zShun = P("shun"); |
| 46 | const char *zAccept = P("accept"); |
| 47 | const char *zRcvid = P("rcvid"); |
| 48 | int nRcvid = 0; |
| 49 | int numRows = 3; |
| 50 | char *zCanonical = 0; |
| 51 | |
| 52 | login_check_credentials(); |
| 53 | if( !g.perm.Admin ){ |
| @@ -79,11 +78,11 @@ | |
| 78 | i++; |
| 79 | } |
| 80 | zCanonical[j+1] = zCanonical[j] = 0; |
| 81 | p = zCanonical; |
| 82 | while( *p ){ |
| 83 | int nUuid = strlen(p); |
| 84 | if( nUuid!=UUID_SIZE || !validate16(p, nUuid) ){ |
| 85 | @ <p class="generalError">Error: Bad artifact IDs.</p> |
| 86 | fossil_free(zCanonical); |
| 87 | zCanonical = 0; |
| 88 | break; |
| @@ -152,11 +151,12 @@ | |
| 151 | @ They will be removed from the repository the next time the repository |
| 152 | @ is rebuilt using the <b>fossil rebuild</b> command-line</p> |
| 153 | } |
| 154 | if( zRcvid ){ |
| 155 | nRcvid = atoi(zRcvid); |
| 156 | numRows = db_int(0, "SELECT min(count(), 10) FROM blob WHERE rcvid=%d", |
| 157 | nRcvid); |
| 158 | } |
| 159 | @ <p>A shunned artifact will not be pushed nor accepted in a pull and the |
| 160 | @ artifact content will be purged from the repository the next time the |
| 161 | @ repository is rebuilt. A list of shunned artifacts can be seen at the |
| 162 | @ bottom of this page.</p> |
| @@ -183,11 +183,11 @@ | |
| 183 | login_insert_csrf_secret(); |
| 184 | @ <textarea class="fullsize-text" cols="50" rows="%d(numRows)" name="uuid"> |
| 185 | if( zShun ){ |
| 186 | if( strlen(zShun) ){ |
| 187 | @ %h(zShun) |
| 188 | }else if( nRcvid ){ |
| 189 | db_prepare(&q, "SELECT uuid FROM blob WHERE rcvid=%d", nRcvid); |
| 190 | while( db_step(&q)==SQLITE_ROW ){ |
| 191 | @ %s(db_column_text(&q, 0)) |
| 192 | } |
| 193 | db_finalize(&q); |
| @@ -210,11 +210,11 @@ | |
| 210 | login_insert_csrf_secret(); |
| 211 | @ <textarea class="fullsize-text" cols="50" rows="%d(numRows)" name="uuid"> |
| 212 | if( zAccept ){ |
| 213 | if( strlen(zAccept) ){ |
| 214 | @ %h(zAccept) |
| 215 | }else if( nRcvid ){ |
| 216 | db_prepare(&q, "SELECT uuid FROM blob WHERE rcvid=%d", nRcvid); |
| 217 | while( db_step(&q)==SQLITE_ROW ){ |
| 218 | @ %s(db_column_text(&q, 0)) |
| 219 | } |
| 220 | db_finalize(&q); |
| 221 |