Fossil SCM

Fix MSVC build error and warnings: c:\localdata\workspace\fossil\src\util.c(249) : warning C4715: 'fossil_timer_fetch' : not all control paths return a value c:\localdata\workspace\fossil\src\util.c(270) : warning C4715: 'fossil_timer_reset' : not all control paths return a value

jan.nijtmans 2013-09-19 11:48 trunk
Commit 6e1e4bb83dae3dba5366451143b9d6ce642682aa
2 files changed +1 -1 +4 -6
+1 -1
--- src/file.c
+++ src/file.c
@@ -921,12 +921,12 @@
921921
**
922922
** Test the operation of the relative name generator.
923923
*/
924924
void cmd_test_relative_name(void){
925925
int i;
926
- int slashFlag = find_option("slash",0,0)!=0;
927926
Blob x;
927
+ int slashFlag = find_option("slash",0,0)!=0;
928928
blob_zero(&x);
929929
for(i=2; i<g.argc; i++){
930930
file_relative_name(g.argv[i], &x, slashFlag);
931931
fossil_print("%s\n", blob_buffer(&x));
932932
blob_reset(&x);
933933
--- src/file.c
+++ src/file.c
@@ -921,12 +921,12 @@
921 **
922 ** Test the operation of the relative name generator.
923 */
924 void cmd_test_relative_name(void){
925 int i;
926 int slashFlag = find_option("slash",0,0)!=0;
927 Blob x;
 
928 blob_zero(&x);
929 for(i=2; i<g.argc; i++){
930 file_relative_name(g.argv[i], &x, slashFlag);
931 fossil_print("%s\n", blob_buffer(&x));
932 blob_reset(&x);
933
--- src/file.c
+++ src/file.c
@@ -921,12 +921,12 @@
921 **
922 ** Test the operation of the relative name generator.
923 */
924 void cmd_test_relative_name(void){
925 int i;
 
926 Blob x;
927 int slashFlag = find_option("slash",0,0)!=0;
928 blob_zero(&x);
929 for(i=2; i<g.argc; i++){
930 file_relative_name(g.argv[i], &x, slashFlag);
931 fossil_print("%s\n", blob_buffer(&x));
932 blob_reset(&x);
933
+4 -6
--- src/util.c
+++ src/util.c
@@ -230,13 +230,11 @@
230230
** Returns the difference in CPU times in microseconds since
231231
** fossil_timer_start() was called and returned the given timer ID (or
232232
** since it was last reset). Returns 0 if timerId is out of range.
233233
*/
234234
sqlite3_uint64 fossil_timer_fetch(int timerId){
235
- if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){
236
- return 0;
237
- }else{
235
+ if( timerId>0 && timerId<=FOSSIL_TIMER_COUNT ){
238236
struct FossilTimer * start = &fossilTimerList[timerId-1];
239237
if( !start->id ){
240238
fossil_fatal("Invalid call to fetch a non-allocated "
241239
"timer (#%d)", timerId);
242240
/*NOTREACHED*/
@@ -244,20 +242,19 @@
244242
sqlite3_uint64 eu = 0, es = 0;
245243
fossil_cpu_times( &eu, &es );
246244
return (eu - start->u) + (es - start->s);
247245
}
248246
}
247
+ return 0;
249248
}
250249
251250
/*
252251
** Resets the timer associated with the given ID, as obtained via
253252
** fossil_timer_start(), to the current CPU time values.
254253
*/
255254
sqlite3_uint64 fossil_timer_reset(int timerId){
256
- if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){
257
- return 0;
258
- }else{
255
+ if( timerId>0 && timerId<=FOSSIL_TIMER_COUNT ){
259256
struct FossilTimer * start = &fossilTimerList[timerId-1];
260257
if( !start->id ){
261258
fossil_fatal("Invalid call to reset a non-allocated "
262259
"timer (#%d)", timerId);
263260
/*NOTREACHED*/
@@ -265,10 +262,11 @@
265262
sqlite3_uint64 const rc = fossil_timer_fetch(timerId);
266263
fossil_cpu_times( &start->u, &start->s );
267264
return rc;
268265
}
269266
}
267
+ return 0;
270268
}
271269
272270
/**
273271
"Deallocates" the fossil timer identified by the given timer ID.
274272
returns the difference (in uSec) between the last time that timer
275273
--- src/util.c
+++ src/util.c
@@ -230,13 +230,11 @@
230 ** Returns the difference in CPU times in microseconds since
231 ** fossil_timer_start() was called and returned the given timer ID (or
232 ** since it was last reset). Returns 0 if timerId is out of range.
233 */
234 sqlite3_uint64 fossil_timer_fetch(int timerId){
235 if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){
236 return 0;
237 }else{
238 struct FossilTimer * start = &fossilTimerList[timerId-1];
239 if( !start->id ){
240 fossil_fatal("Invalid call to fetch a non-allocated "
241 "timer (#%d)", timerId);
242 /*NOTREACHED*/
@@ -244,20 +242,19 @@
244 sqlite3_uint64 eu = 0, es = 0;
245 fossil_cpu_times( &eu, &es );
246 return (eu - start->u) + (es - start->s);
247 }
248 }
 
249 }
250
251 /*
252 ** Resets the timer associated with the given ID, as obtained via
253 ** fossil_timer_start(), to the current CPU time values.
254 */
255 sqlite3_uint64 fossil_timer_reset(int timerId){
256 if(timerId<1 || timerId>FOSSIL_TIMER_COUNT){
257 return 0;
258 }else{
259 struct FossilTimer * start = &fossilTimerList[timerId-1];
260 if( !start->id ){
261 fossil_fatal("Invalid call to reset a non-allocated "
262 "timer (#%d)", timerId);
263 /*NOTREACHED*/
@@ -265,10 +262,11 @@
265 sqlite3_uint64 const rc = fossil_timer_fetch(timerId);
266 fossil_cpu_times( &start->u, &start->s );
267 return rc;
268 }
269 }
 
270 }
271
272 /**
273 "Deallocates" the fossil timer identified by the given timer ID.
274 returns the difference (in uSec) between the last time that timer
275
--- src/util.c
+++ src/util.c
@@ -230,13 +230,11 @@
230 ** Returns the difference in CPU times in microseconds since
231 ** fossil_timer_start() was called and returned the given timer ID (or
232 ** since it was last reset). Returns 0 if timerId is out of range.
233 */
234 sqlite3_uint64 fossil_timer_fetch(int timerId){
235 if( timerId>0 && timerId<=FOSSIL_TIMER_COUNT ){
 
 
236 struct FossilTimer * start = &fossilTimerList[timerId-1];
237 if( !start->id ){
238 fossil_fatal("Invalid call to fetch a non-allocated "
239 "timer (#%d)", timerId);
240 /*NOTREACHED*/
@@ -244,20 +242,19 @@
242 sqlite3_uint64 eu = 0, es = 0;
243 fossil_cpu_times( &eu, &es );
244 return (eu - start->u) + (es - start->s);
245 }
246 }
247 return 0;
248 }
249
250 /*
251 ** Resets the timer associated with the given ID, as obtained via
252 ** fossil_timer_start(), to the current CPU time values.
253 */
254 sqlite3_uint64 fossil_timer_reset(int timerId){
255 if( timerId>0 && timerId<=FOSSIL_TIMER_COUNT ){
 
 
256 struct FossilTimer * start = &fossilTimerList[timerId-1];
257 if( !start->id ){
258 fossil_fatal("Invalid call to reset a non-allocated "
259 "timer (#%d)", timerId);
260 /*NOTREACHED*/
@@ -265,10 +262,11 @@
262 sqlite3_uint64 const rc = fossil_timer_fetch(timerId);
263 fossil_cpu_times( &start->u, &start->s );
264 return rc;
265 }
266 }
267 return 0;
268 }
269
270 /**
271 "Deallocates" the fossil timer identified by the given timer ID.
272 returns the difference (in uSec) between the last time that timer
273

Keyboard Shortcuts

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