Skip to content

Commit ea1eaff

Browse files
committed
minor fixes
1 parent 69ed43a commit ea1eaff

File tree

1 file changed

+7
-5
lines changed
  • tests/tools/TestApp/src

1 file changed

+7
-5
lines changed

tests/tools/TestApp/src/mcm.c

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@ void file_to_buffer(FILE *file, MeshBuffer* buf){
101101
return;
102102
}
103103

104-
// Move the file pointer to the end of the file to determine the file size
104+
/* Move the file pointer to the end of the file to determine the file size */
105105
fseek(file, 0, SEEK_END);
106106
long file_size = ftell(file);
107107
if (file_size > buf->payload_len) {
108108
printf("Failed to serialize file into buffer: file size exceed buffer size\n");
109109
return;
110110
}
111111

112-
// Move the file pointer back to the beginning of the file
112+
/* Move the file pointer back to the beginning of the file */
113113
fseek(file, 0, SEEK_SET);
114114

115115
// Allocate memory for the byte array
@@ -121,11 +121,13 @@ void file_to_buffer(FILE *file, MeshBuffer* buf){
121121

122122
// Read the file into the buffer
123123
fread(frame_buf, BYTE_SIZE, file_size, file);
124-
125-
// Clean the space under the specified address
124+
/* buf->payload_ptr is const type, it cannot be reassigned,
125+
* so frame_buf data needs to be copied under it's address
126+
*/
127+
/* clear mesh buffer payload space */
126128
memset(buf->payload_ptr, FIRST_INDEX, buf->payload_len);
127129

128-
//Copy the serialized buffer to the specified address
130+
/* copy frame_buf data into mesh buffer */
129131
memcpy(buf->payload_ptr, frame_buf, buf->payload_len);
130132
free(frame_buf);
131133
}

0 commit comments

Comments
 (0)