diff options
-rw-r--r-- | ot_stats.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -178,13 +178,13 @@ size_t stats_top10_txt( char * reply ) { | |||
178 | ot_peerlist *peer_list = ( ((ot_torrent*)(torrents_list->data))[j] ).peer_list; | 178 | ot_peerlist *peer_list = ( ((ot_torrent*)(torrents_list->data))[j] ).peer_list; |
179 | int idx = 9; while( (idx >= 0) && ( peer_list->peer_count > top10c[idx].val ) ) --idx; | 179 | int idx = 9; while( (idx >= 0) && ( peer_list->peer_count > top10c[idx].val ) ) --idx; |
180 | if ( idx++ != 9 ) { | 180 | if ( idx++ != 9 ) { |
181 | memcpy( top10c + idx + 1, top10c + idx, ( 9 - idx ) * sizeof( ot_record ) ); | 181 | memmove( top10c + idx + 1, top10c + idx, ( 9 - idx ) * sizeof( ot_record ) ); |
182 | top10c[idx].val = peer_list->peer_count; | 182 | top10c[idx].val = peer_list->peer_count; |
183 | top10c[idx].torrent = (ot_torrent*)(torrents_list->data) + j; | 183 | top10c[idx].torrent = (ot_torrent*)(torrents_list->data) + j; |
184 | } | 184 | } |
185 | idx = 9; while( (idx >= 0) && ( peer_list->seed_count > top10s[idx].val ) ) --idx; | 185 | idx = 9; while( (idx >= 0) && ( peer_list->seed_count > top10s[idx].val ) ) --idx; |
186 | if ( idx++ != 9 ) { | 186 | if ( idx++ != 9 ) { |
187 | memcpy( top10s + idx + 1, top10s + idx, ( 9 - idx ) * sizeof( ot_record ) ); | 187 | memmove( top10s + idx + 1, top10s + idx, ( 9 - idx ) * sizeof( ot_record ) ); |
188 | top10s[idx].val = peer_list->seed_count; | 188 | top10s[idx].val = peer_list->seed_count; |
189 | top10s[idx].torrent = (ot_torrent*)(torrents_list->data) + j; | 189 | top10s[idx].torrent = (ot_torrent*)(torrents_list->data) + j; |
190 | } | 190 | } |