@@ -114,7 +114,7 @@ typedef struct {
114
114
union {
115
115
DIR dp ;
116
116
FIL fp ;
117
- };
117
+ }u ;
118
118
int32_t lc_sd ;
119
119
int32_t ld_sd ;
120
120
int32_t c_sd ;
@@ -652,9 +652,9 @@ static void ftp_process_cmd (void) {
652
652
fres = FR_NO_PATH ;
653
653
ftp_pop_param (& bufptr , ftp_scratch_buffer , false);
654
654
ftp_open_child (ftp_path , ftp_scratch_buffer );
655
- if ((ftp_path [0 ] == '/' && ftp_path [1 ] == '\0' ) || ((fres = f_opendir (& ftp_data .dp , ftp_path )) == FR_OK )) {
655
+ if ((ftp_path [0 ] == '/' && ftp_path [1 ] == '\0' ) || ((fres = f_opendir (& ftp_data .u . dp , ftp_path )) == FR_OK )) {
656
656
if (fres == FR_OK ) {
657
- f_closedir (& ftp_data .dp );
657
+ f_closedir (& ftp_data .u . dp );
658
658
}
659
659
ftp_send_reply (250 , NULL );
660
660
} else {
@@ -839,9 +839,9 @@ static void ftp_process_cmd (void) {
839
839
840
840
static void ftp_close_files (void ) {
841
841
if (ftp_data .e_open == E_FTP_FILE_OPEN ) {
842
- f_close (& ftp_data .fp );
842
+ f_close (& ftp_data .u . fp );
843
843
} else if (ftp_data .e_open == E_FTP_DIR_OPEN ) {
844
- f_closedir (& ftp_data .dp );
844
+ f_closedir (& ftp_data .u . dp );
845
845
}
846
846
ftp_data .e_open = E_FTP_NOTHING_OPEN ;
847
847
}
@@ -939,7 +939,7 @@ static int ftp_print_eplf_drive (char *dest, uint32_t destsize, char *name) {
939
939
}
940
F438
code>
940
941
941
static bool ftp_open_file (const char * path , int mode ) {
942
- FRESULT res = f_open (& ftp_data .fp , path , mode );
942
+ FRESULT res = f_open (& ftp_data .u . fp , path , mode );
943
943
if (res != FR_OK ) {
944
944
return false;
945
945
}
@@ -949,7 +949,7 @@ static bool ftp_open_file (const char *path, int mode) {
949
949
950
950
static ftp_result_t ftp_read_file (char * filebuf , uint32_t desiredsize , uint32_t * actualsize ) {
951
951
ftp_result_t result = E_FTP_RESULT_CONTINUE ;
952
- FRESULT res = f_read (& ftp_data .fp , filebuf , desiredsize , (UINT * )actualsize );
952
+ FRESULT res = f_read (& ftp_data .u . fp , filebuf , desiredsize , (UINT * )actualsize );
953
953
if (res != FR_OK ) {
954
954
ftp_close_files ();
955
955
result = E_FTP_RESULT_FAILED ;
@@ -964,7 +964,7 @@ static ftp_result_t ftp_read_file (char *filebuf, uint32_t desiredsize, uint32_t
964
964
static ftp_result_t ftp_write_file (char * filebuf , uint32_t size ) {
965
965
ftp_result_t result = E_FTP_RESULT_FAILED ;
966
966
uint32_t actualsize ;
967
- FRESULT res = f_write (& ftp_data .fp , filebuf , size , (UINT * )& actualsize );
967
+ FRESULT res = f_write (& ftp_data .u . fp , filebuf , size , (UINT * )& actualsize );
968
968
if ((actualsize == size ) && (FR_OK == res )) {
969
969
result = E_FTP_RESULT_OK ;
970
970
} else {
@@ -979,7 +979,7 @@ static ftp_result_t ftp_open_dir_for_listing (const char *path) {
979
979
ftp_data .listroot = true;
980
980
} else {
981
981
FRESULT res ;
982
- res = f_opendir (& ftp_data .dp , path ); /* Open the directory */
982
+ res = f_opendir (& ftp_data .u . dp , path ); /* Open the directory */
983
983
if (res != FR_OK ) {
984
984
return E_FTP_RESULT_FAILED ;
985
985
}
@@ -999,7 +999,7 @@ static ftp_result_t ftp_list_dir (char *list, uint32_t maxlistsize, uint32_t *li
999
999
// if we are resuming an incomplete list operation, go back to the item we left behind
1000
1000
if (!ftp_data .listroot ) {
1001
1001
for (int i = 0 ; i < ftp_last_dir_idx ; i ++ ) {
1002
- f_readdir (& ftp_data .dp , & fno );
1002
+ f_readdir (& ftp_data .u . dp , & fno );
1003
1003
}
1004
1004
}
1005
1005
@@ -1030,7 +1030,7 @@ static ftp_result_t ftp_list_dir (char *list, uint32_t maxlistsize, uint32_t *li
1030
1030
ftp_data .volcount ++ ;
1031
1031
} else {
1032
1032
// a "normal" directory
1033
- res = f_readdir (& ftp_data .dp , & fno ); /* Read a directory item */
1033
+ res = f_readdir (& ftp_data .u . dp , & fno ); /* Read a directory item */
1034
1034
if (res != FR_OK || fno .fname [0 ] == 0 ) {
1035
1035
result = E_FTP_RESULT_OK ;
1036
1036
break ; /* Break on error or end of dp */
0 commit comments