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
Commit
6e1e4bb83dae3dba5366451143b9d6ce642682aa
Parent
3cadf76c3d1b764…
2 files changed
+1
-1
+4
-6
+1
-1
| --- src/file.c | ||
| +++ src/file.c | ||
| @@ -921,12 +921,12 @@ | ||
| 921 | 921 | ** |
| 922 | 922 | ** Test the operation of the relative name generator. |
| 923 | 923 | */ |
| 924 | 924 | void cmd_test_relative_name(void){ |
| 925 | 925 | int i; |
| 926 | - int slashFlag = find_option("slash",0,0)!=0; | |
| 927 | 926 | Blob x; |
| 927 | + int slashFlag = find_option("slash",0,0)!=0; | |
| 928 | 928 | blob_zero(&x); |
| 929 | 929 | for(i=2; i<g.argc; i++){ |
| 930 | 930 | file_relative_name(g.argv[i], &x, slashFlag); |
| 931 | 931 | fossil_print("%s\n", blob_buffer(&x)); |
| 932 | 932 | blob_reset(&x); |
| 933 | 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 | 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 @@ | ||
| 230 | 230 | ** Returns the difference in CPU times in microseconds since |
| 231 | 231 | ** fossil_timer_start() was called and returned the given timer ID (or |
| 232 | 232 | ** since it was last reset). Returns 0 if timerId is out of range. |
| 233 | 233 | */ |
| 234 | 234 | 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 ){ | |
| 238 | 236 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 239 | 237 | if( !start->id ){ |
| 240 | 238 | fossil_fatal("Invalid call to fetch a non-allocated " |
| 241 | 239 | "timer (#%d)", timerId); |
| 242 | 240 | /*NOTREACHED*/ |
| @@ -244,20 +242,19 @@ | ||
| 244 | 242 | sqlite3_uint64 eu = 0, es = 0; |
| 245 | 243 | fossil_cpu_times( &eu, &es ); |
| 246 | 244 | return (eu - start->u) + (es - start->s); |
| 247 | 245 | } |
| 248 | 246 | } |
| 247 | + return 0; | |
| 249 | 248 | } |
| 250 | 249 | |
| 251 | 250 | /* |
| 252 | 251 | ** Resets the timer associated with the given ID, as obtained via |
| 253 | 252 | ** fossil_timer_start(), to the current CPU time values. |
| 254 | 253 | */ |
| 255 | 254 | 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 ){ | |
| 259 | 256 | struct FossilTimer * start = &fossilTimerList[timerId-1]; |
| 260 | 257 | if( !start->id ){ |
| 261 | 258 | fossil_fatal("Invalid call to reset a non-allocated " |
| 262 | 259 | "timer (#%d)", timerId); |
| 263 | 260 | /*NOTREACHED*/ |
| @@ -265,10 +262,11 @@ | ||
| 265 | 262 | sqlite3_uint64 const rc = fossil_timer_fetch(timerId); |
| 266 | 263 | fossil_cpu_times( &start->u, &start->s ); |
| 267 | 264 | return rc; |
| 268 | 265 | } |
| 269 | 266 | } |
| 267 | + return 0; | |
| 270 | 268 | } |
| 271 | 269 | |
| 272 | 270 | /** |
| 273 | 271 | "Deallocates" the fossil timer identified by the given timer ID. |
| 274 | 272 | returns the difference (in uSec) between the last time that timer |
| 275 | 273 |
| --- 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 |