@@ -834,7 +834,12 @@ int git_path_direach(
834834	DIR  * dir ;
835835	path_dirent_data  de_data ;
836836	struct  dirent  * de , * de_buf  =  (struct  dirent  * )& de_data ;
837+ 
838+ 	(void )flags ;
839+ 
840+ #ifdef  GIT_USE_ICONV 
837841	git_path_iconv_t  ic  =  GIT_PATH_ICONV_INIT ;
842+ #endif 
838843
839844	if  (git_path_to_dir (path ) <  0 )
840845		return  -1 ;
@@ -846,8 +851,10 @@ int git_path_direach(
846851		return  -1 ;
847852	}
848853
854+ #ifdef  GIT_USE_ICONV 
849855	if  ((flags  &  GIT_PATH_DIR_PRECOMPOSE_UNICODE ) !=  0 )
850856		(void )git_path_iconv_init_precompose (& ic );
857+ #endif 
851858
852859	while  (p_readdir_r (dir , de_buf , & de ) ==  0  &&  de  !=  NULL ) {
853860		char  * de_path  =  de -> d_name ;
@@ -856,8 +863,12 @@ int git_path_direach(
856863		if  (git_path_is_dot_or_dotdot (de_path ))
857864			continue ;
858865
859- 		if  ((error  =  git_path_iconv (& ic , & de_path , & de_len )) <  0  || 
860- 			(error  =  git_buf_put (path , de_path , de_len )) <  0 )
866+ #ifdef  GIT_USE_ICONV 
867+ 		if  ((error  =  git_path_iconv (& ic , & de_path , & de_len )) <  0 )
868+ 			break ;
869+ #endif 
870+ 				
871+ 		if  ((error  =  git_buf_put (path , de_path , de_len )) <  0 )
861872			break ;
862873
863874		error  =  fn (arg , path );
@@ -871,7 +882,10 @@ int git_path_direach(
871882	}
872883
873884	closedir (dir );
885+ 
886+ #ifdef  GIT_USE_ICONV 
874887	git_path_iconv_clear (& ic );
888+ #endif 
875889
876890	return  error ;
877891}
@@ -888,7 +902,12 @@ int git_path_dirload(
888902	size_t  path_len ;
889903	path_dirent_data  de_data ;
890904	struct  dirent  * de , * de_buf  =  (struct  dirent  * )& de_data ;
905+ 
906+ 	(void )flags ;
907+ 
908+ #ifdef  GIT_USE_ICONV 
891909	git_path_iconv_t  ic  =  GIT_PATH_ICONV_INIT ;
910+ #endif 
892911
893912	assert (path  &&  contents );
894913
@@ -903,8 +922,10 @@ int git_path_dirload(
903922		return  -1 ;
904923	}
905924
925+ #ifdef  GIT_USE_ICONV 
906926	if  ((flags  &  GIT_PATH_DIR_PRECOMPOSE_UNICODE ) !=  0 )
907927		(void )git_path_iconv_init_precompose (& ic );
928+ #endif 
908929
909930	path  +=  prefix_len ;
910931	path_len  -=  prefix_len ;
@@ -917,8 +938,10 @@ int git_path_dirload(
917938		if  (git_path_is_dot_or_dotdot (de_path ))
918939			continue ;
919940
941+ #ifdef  GIT_USE_ICONV 
920942		if  ((error  =  git_path_iconv (& ic , & de_path , & de_len )) <  0 )
921943			break ;
944+ #endif 
922945
923946		alloc_size  =  path_len  +  need_slash  +  de_len  +  1  +  alloc_extra ;
924947		if  ((entry_path  =  git__calloc (alloc_size , 1 )) ==  NULL ) {
@@ -937,7 +960,10 @@ int git_path_dirload(
937960	}
938961
939962	closedir (dir );
963+ 
964+ #ifdef  GIT_USE_ICONV 
940965	git_path_iconv_clear (& ic );
966+ #endif 
941967
942968	if  (error  !=  0 )
943969		giterr_set (GITERR_OS , "Failed to process directory entry in '%s'" , path );
0 commit comments