Fossil SCM

Fix compiler warning and clarify use of local variables.

mistachkin 2014-09-30 15:25 trunk
Commit d2e7d2cf0d1553feff10aa374276ee61231f4bdb
1 file changed +6 -6
+6 -6
--- src/shun.c
+++ src/shun.c
@@ -43,12 +43,11 @@
4343
int cnt = 0;
4444
const char *zUuid = P("uuid");
4545
const char *zShun = P("shun");
4646
const char *zAccept = P("accept");
4747
const char *zRcvid = P("rcvid");
48
- int nRcvid;
49
- int nUuid;
48
+ int nRcvid = 0;
5049
int numRows = 3;
5150
char *zCanonical = 0;
5251
5352
login_check_credentials();
5453
if( !g.perm.Admin ){
@@ -79,11 +78,11 @@
7978
i++;
8079
}
8180
zCanonical[j+1] = zCanonical[j] = 0;
8281
p = zCanonical;
8382
while( *p ){
84
- nUuid = strlen(p);
83
+ int nUuid = strlen(p);
8584
if( nUuid!=UUID_SIZE || !validate16(p, nUuid) ){
8685
@ <p class="generalError">Error: Bad artifact IDs.</p>
8786
fossil_free(zCanonical);
8887
zCanonical = 0;
8988
break;
@@ -152,11 +151,12 @@
152151
@ They will be removed from the repository the next time the repository
153152
@ is rebuilt using the <b>fossil rebuild</b> command-line</p>
154153
}
155154
if( zRcvid ){
156155
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);
158158
}
159159
@ <p>A shunned artifact will not be pushed nor accepted in a pull and the
160160
@ artifact content will be purged from the repository the next time the
161161
@ repository is rebuilt. A list of shunned artifacts can be seen at the
162162
@ bottom of this page.</p>
@@ -183,11 +183,11 @@
183183
login_insert_csrf_secret();
184184
@ <textarea class="fullsize-text" cols="50" rows="%d(numRows)" name="uuid">
185185
if( zShun ){
186186
if( strlen(zShun) ){
187187
@ %h(zShun)
188
- }else if( zRcvid ){
188
+ }else if( nRcvid ){
189189
db_prepare(&q, "SELECT uuid FROM blob WHERE rcvid=%d", nRcvid);
190190
while( db_step(&q)==SQLITE_ROW ){
191191
@ %s(db_column_text(&q, 0))
192192
}
193193
db_finalize(&q);
@@ -210,11 +210,11 @@
210210
login_insert_csrf_secret();
211211
@ <textarea class="fullsize-text" cols="50" rows="%d(numRows)" name="uuid">
212212
if( zAccept ){
213213
if( strlen(zAccept) ){
214214
@ %h(zAccept)
215
- }else if( zRcvid ){
215
+ }else if( nRcvid ){
216216
db_prepare(&q, "SELECT uuid FROM blob WHERE rcvid=%d", nRcvid);
217217
while( db_step(&q)==SQLITE_ROW ){
218218
@ %s(db_column_text(&q, 0))
219219
}
220220
db_finalize(&q);
221221
--- 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

Keyboard Shortcuts

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