@@ -264,7 +264,7 @@ static bool task_cloud_sync_should_ignore_file(const char *filename)
264264static void task_cloud_sync_manifest_append_dir (file_list_t * manifest ,
265265 const char * dir_fullpath , char * dir_name )
266266{
267- int i ;
267+ size_t i ;
268268 struct string_list * dir_list ;
269269 char dir_fullpath_slash [PATH_MAX_LENGTH ];
270270
@@ -273,6 +273,12 @@ static void task_cloud_sync_manifest_append_dir(file_list_t *manifest,
273273
274274 dir_list = dir_list_new (dir_fullpath_slash , NULL , false, true, true, true);
275275
276+ if (dir_list -> size == 0 )
277+ {
278+ string_list_free (dir_list );
279+ return ;
280+ }
281+
276282 file_list_reserve (manifest , manifest -> size + dir_list -> size );
277283 for (i = 0 ; i < dir_list -> size ; i ++ )
278284 {
@@ -318,7 +324,7 @@ static struct string_list *task_cloud_sync_directory_map(void)
318324static void task_cloud_sync_build_current_manifest (task_cloud_sync_state_t * sync_state )
319325{
320326 struct string_list * dirlist = task_cloud_sync_directory_map ();
321- int i ;
327+ size_t i ;
322328
323329 if (!(sync_state -> current_manifest = (file_list_t * )calloc (1 , sizeof (file_list_t ))))
324330 {
@@ -368,7 +374,10 @@ static void task_cloud_sync_update_progress(retro_task_t *task)
368374 if (sync_state -> current_manifest )
369375 count += sync_state -> current_manifest -> size ;
370376
371- task_set_progress (task , (val * 100 ) / count );
377+ if (count != 0 )
378+ task_set_progress (task , (val * 100 ) / count );
379+ else
380+ task_set_progress (task , 100 );
372381}
373382
374383static void task_cloud_sync_add_to_updated_manifest (task_cloud_sync_state_t * sync_state , const char * key , char * hash , bool server )
@@ -490,7 +499,7 @@ static void task_cloud_sync_fetch_server_file(task_cloud_sync_state_t *sync_stat
490499 char directory [PATH_MAX_LENGTH ];
491500 char filename [PATH_MAX_LENGTH ];
492501 settings_t * settings = config_get_ptr ();
493- int i ;
502+ size_t i ;
494503
495504 /* we're just fetching a file the server has, we can update this now */
496505 task_cloud_sync_add_to_updated_manifest (sync_state , key , CS_FILE_HASH (server_file ), true);
0 commit comments