Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FIX: compiler warnings in samples #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand All @@ -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,
Expand Down Expand Up @@ -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);
Expand All @@ -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");
Expand Down
2 changes: 1 addition & 1 deletion samples/sample_c/module_sample/hms/test_hms.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down