File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -162,15 +162,17 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
162162 memcpy (filepath, header->pathstr , plen);
163163 filepath[plen] = 0 ; // Copy and null terminate string
164164 fileSize = header->totalSize ;
165- WriteResponse resp;
165+ WriteResponse resp {} ;
166166 resp.command = commands::WRITE_PACING ;
167167 resp.offset = header->offset ;
168168 resp.modTime = 0 ;
169169
170170 int res = fs.FileOpen (&f, filepath, LFS_O_RDWR | LFS_O_CREAT );
171171 if (res == 0 ) {
172172 fs.FileClose (&f);
173- resp.status = (res == 0 ) ? 0x01 : (int8_t ) res;
173+ resp.status = 0x01 ;
174+ } else {
175+ resp.status = static_cast <int8_t >(res);
174176 }
175177 resp.freespace = std::min (fs.getSize () - (fs.GetFSSize () * fs.getBlockSize ()), fileSize - header->offset );
176178 auto * om = ble_hs_mbuf_from_flat (&resp, sizeof (WriteResponse));
@@ -180,9 +182,10 @@ int FSService::FSCommandHandler(uint16_t connectionHandle, os_mbuf* om) {
180182 case commands::WRITE_DATA : {
181183 NRF_LOG_INFO (" [FS_S] -> WriteData" );
182184 auto * header = (WritePacing*) om->om_data ;
183- WriteResponse resp;
185+ WriteResponse resp {} ;
184186 resp.command = commands::WRITE_PACING ;
185187 resp.offset = header->offset ;
188+ resp.status = 0x01 ;
186189 int res = 0 ;
187190
188191 if (!(res = fs.FileOpen (&f, filepath, LFS_O_RDWR | LFS_O_CREAT ))) {
You can’t perform that action at this time.
0 commit comments