diff --git a/samples/sample_c/module_sample/camera_manager/test_camera_manager.c b/samples/sample_c/module_sample/camera_manager/test_camera_manager.c index ea1e842b..4edf9f98 100644 --- a/samples/sample_c/module_sample/camera_manager/test_camera_manager.c +++ b/samples/sample_c/module_sample/camera_manager/test_camera_manager.c @@ -1303,7 +1303,7 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj for (int i = 0; i < downloadCount; ++i) { if (s_meidaFileList.fileListInfo[i].fileSize < 1 * 1024 * 1024) { printf( - "\033[1;32;40m ### Media file_%03d name: %s, index: %d, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f KB, type: %d \033[0m\r\n", + "\033[1;32;40m ### Media file_%03d name: %s, index: %lu, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f KB, type: %d \033[0m\r\n", i, s_meidaFileList.fileListInfo[i].fileName, s_meidaFileList.fileListInfo[i].fileIndex, s_meidaFileList.fileListInfo[i].createTime.year, @@ -1316,7 +1316,7 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadAndDeleteMediaFile(E_Dj s_meidaFileList.fileListInfo[i].type); } else { printf( - "\033[1;32;40m ### Media file_%03d name: %s, index: %d, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f MB, type: %d \033[0m\r\n", + "\033[1;32;40m ### Media file_%03d name: %s, index: %lu, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f MB, type: %d \033[0m\r\n", i, s_meidaFileList.fileListInfo[i].fileName, s_meidaFileList.fileListInfo[i].fileIndex, s_meidaFileList.fileListInfo[i].createTime.year, @@ -1394,7 +1394,7 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadFileListBySlices(E_DjiM for (int i = 0; i < downloadCount; ++i) { if (s_meidaFileList.fileListInfo[i].fileSize < 1 * 1024 * 1024) { printf( - "\033[1;32;40m ### Media file_%03d name: %s, index: %d, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f KB, type: %d \033[0m\r\n", + "\033[1;32;40m ### Media file_%03d name: %s, index: %lu, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f KB, type: %d \033[0m\r\n", i, s_meidaFileList.fileListInfo[i].fileName, s_meidaFileList.fileListInfo[i].fileIndex, s_meidaFileList.fileListInfo[i].createTime.year, @@ -1407,7 +1407,7 @@ static T_DjiReturnCode DjiTest_CameraManagerMediaDownloadFileListBySlices(E_DjiM s_meidaFileList.fileListInfo[i].type); } else { printf( - "\033[1;32;40m ### Media file_%03d name: %s, index: %d, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f MB, type: %d \033[0m\r\n", + "\033[1;32;40m ### Media file_%03d name: %s, index: %lu, time:%04d-%02d-%02d_%02d:%02d:%02d, size: %.2f MB, type: %d \033[0m\r\n", i, s_meidaFileList.fileListInfo[i].fileName, s_meidaFileList.fileListInfo[i].fileIndex, s_meidaFileList.fileListInfo[i].createTime.year, @@ -1463,7 +1463,7 @@ static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownlo if (s_downloadMediaFile != NULL) { fwrite(data, 1, len, s_downloadMediaFile); } - printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %d, fileIndex: %d\033[0m\r\n", + printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %lu, fileIndex: %lu\033[0m\r\n", packetInfo.progressInPercent, downloadFileName, packetInfo.fileSize, packetInfo.fileIndex); printf("\033[1A"); USER_LOG_DEBUG("Transfer download media file data, len: %d, percent: %.1f", len, packetInfo.progressInPercent); @@ -1474,7 +1474,7 @@ static T_DjiReturnCode DjiTest_CameraManagerDownloadFileDataCallback(T_DjiDownlo osalHandler->GetTimeMs(&downloadEndMs); downloadSpeed = (float) packetInfo.fileSize / (float) (downloadEndMs - downloadStartMs); - printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %d, fileIndex: %d\033[0m\r\n", + printf("\033[1;32;40m ### [Complete rate : %0.1f%%] (%s), size: %lu, fileIndex: %lu\033[0m\r\n", packetInfo.progressInPercent, downloadFileName, packetInfo.fileSize, packetInfo.fileIndex); printf("\033[1A"); printf("\r\n"); diff --git a/samples/sample_c/module_sample/hms/test_hms.c b/samples/sample_c/module_sample/hms/test_hms.c index 3ebbb164..0e6d0685 100644 --- a/samples/sample_c/module_sample/hms/test_hms.c +++ b/samples/sample_c/module_sample/hms/test_hms.c @@ -292,7 +292,7 @@ static bool DjiTest_MarchErrCodeInfoTable(T_DjiHmsInfoTable hmsInfoTable) for (int j = 0; j < sizeof(hmsErrCodeInfoTbl) / sizeof(T_DjiHmsErrCodeInfo); j++) { if (hmsInfoTable.hmsInfo[i].errorCode == hmsErrCodeInfoTbl[j].alarmId) { hmsCodeMatchFlag = 1; - snprintf(alarmIdStr, sizeof(alarmIdStr), "%u", hmsInfoTable.hmsInfo[i].errorCode); + snprintf(alarmIdStr, sizeof(alarmIdStr), "%lu", hmsInfoTable.hmsInfo[i].errorCode); //note:sensor_idx:[0,5].In order to be consistent with the display of pilot, add one. snprintf(sensorIdStr, sizeof(sensorIdStr), "%d", hmsInfoTable.hmsInfo[i].componentIndex + 1); snprintf(componentIdStr, sizeof(componentIdStr), "0x%02X", hmsInfoTable.hmsInfo[i].componentIndex + 1); diff --git a/samples/sample_c/module_sample/mop_channel/test_mop_channel.c b/samples/sample_c/module_sample/mop_channel/test_mop_channel.c index cca40f75..20e53080 100644 --- a/samples/sample_c/module_sample/mop_channel/test_mop_channel.c +++ b/samples/sample_c/module_sample/mop_channel/test_mop_channel.c @@ -493,7 +493,11 @@ static void *DjiTest_MopChannelFileServiceSendTask(void *arg) USER_LOG_ERROR("Get file current path error, stat = 0x%08llX", returnCode); exit(1); } - snprintf(tempPath, DJI_FILE_PATH_SIZE_MAX, "%smop_channel_test_file/mop_send_test_file.mp4", curFileDirPath); + int pathLen = snprintf(tempPath, DJI_FILE_PATH_SIZE_MAX, "%smop_channel_test_file/mop_send_test_file.mp4", curFileDirPath); + if (pathLen < 0 || pathLen >= DJI_FILE_PATH_SIZE_MAX) { + USER_LOG_ERROR("snprintf error, pathLen = %d", pathLen); + exit(1); + } downloadFile = fopen(tempPath, "rb"); if (downloadFile == NULL) {