@@ -69,11 +69,9 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
6969 while (systemTask.IsSleeping ()) {
7070 vTaskDelay (100 ); // 50ms
7171 }
72- lfs_dir_t dir;
73- lfs_info info;
74- lfs_file f;
75- memset (&f, 0 , sizeof (lfs_file_t ));
76- memset (&dir, 0 , sizeof (lfs_dir_t ));
72+ lfs_dir_t dir = {0 };
73+ lfs_info info = {0 };
74+ lfs_file f = {0 };
7775 switch (command) {
7876 case commands::READ: {
7977 NRF_LOG_INFO (" [FS_S] -> Read" );
@@ -100,7 +98,7 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
10098 resp.totallen = info.size ;
10199 fs.FileOpen (&f, filepath, LFS_O_RDONLY);
102100 fs.FileSeek (&f, header->chunkoff );
103- uint8_t fileData[resp.chunklen ] {0 };
101+ uint8_t fileData[resp.chunklen ] = {0 };
104102 resp.chunklen = fs.FileRead (&f, fileData, resp.chunklen );
105103 om = ble_hs_mbuf_from_flat (&resp, sizeof (ReadResponse));
106104 os_mbuf_append (om, fileData, resp.chunklen );
@@ -130,7 +128,7 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
130128 }
131129 os_mbuf* om;
132130 if (resp.chunklen > 0 ) {
133- uint8_t fileData[resp.chunklen ] {0 };
131+ uint8_t fileData[resp.chunklen ] = {0 };
134132 resp.chunklen = fs.FileRead (&f, fileData, resp.chunklen );
135133 om = ble_hs_mbuf_from_flat (&resp, sizeof (ReadResponse));
136134 os_mbuf_append (om, fileData, resp.chunklen );
@@ -176,7 +174,7 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
176174 int res = 0 ;
177175
178176 if (!(res = fs.FileOpen (&f, filepath, LFS_O_RDWR | LFS_O_CREAT))) {
179- if ((res = fs.FileSeek (&f, header->offset ) ) >= 0 ) {
177+ if ((res = fs.FileSeek (&f, header->offset )) >= 0 ) {
180178 res = fs.FileWrite (&f, header->data , header->dataSize );
181179 }
182180 fs.FileClose (&f);
@@ -193,7 +191,7 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
193191 NRF_LOG_INFO (" [FS_S] -> Delete" );
194192 auto * header = (DelHeader*) om->om_data ;
195193 uint16_t plen = header->pathlen ;
196- char path[plen + 1 ] {0 };
194+ char path[plen + 1 ] = {0 };
197195 memcpy (path, header->pathstr , plen);
198196 path[plen] = 0 ; // Copy and null teminate string
199197 DelResponse resp {};
@@ -208,7 +206,7 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
208206 NRF_LOG_INFO (" [FS_S] -> MKDir" );
209207 auto * header = (MKDirHeader*) om->om_data ;
210208 uint16_t plen = header->pathlen ;
211- char path[plen + 1 ] {0 };
209+ char path[plen + 1 ] = {0 };
212210 memcpy (path, header->pathstr , plen);
213211 path[plen] = 0 ; // Copy and null teminate string
214212 MKDirResponse resp {};
@@ -224,7 +222,7 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
224222 NRF_LOG_INFO (" [FS_S] -> ListDir" );
225223 ListDirHeader* header = (ListDirHeader*) om->om_data ;
226224 uint16_t plen = header->pathlen ;
227- char path[plen + 1 ] {0 };
225+ char path[plen + 1 ] = {0 };
228226 path[plen] = 0 ; // Copy and null teminate string
229227 memcpy (path, header->pathstr , plen);
230228
@@ -290,7 +288,7 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
290288 uint16_t plen = header->OldPathLength ;
291289 // Null Terminate string
292290 header->pathstr [plen] = 0 ;
293- char path[header->NewPathLength + 1 ] {0 };
291+ char path[header->NewPathLength + 1 ] = {0 };
294292 memcpy (path, &header->pathstr [plen + 1 ], header->NewPathLength );
295293 path[header->NewPathLength ] = 0 ; // Copy and null teminate string
296294 MoveResponse resp {};
0 commit comments