Replace memmove by memcpy

This commit is contained in:
Juan Antonio 2023-12-12 23:23:39 +01:00 committed by egzumer
parent bd17aea72b
commit d0ae34f9b4
6 changed files with 22 additions and 22 deletions

View File

@ -622,7 +622,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
) )
{ // start entering a DTMF string { // start entering a DTMF string
gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL; gBeepToPlay = BEEP_1KHZ_60MS_OPTIONAL;
memmove(gDTMF_InputBox, gDTMF_String, MIN(sizeof(gDTMF_InputBox), sizeof(gDTMF_String) - 1)); memcpy(gDTMF_InputBox, gDTMF_String, MIN(sizeof(gDTMF_InputBox), sizeof(gDTMF_String) - 1));
gDTMF_InputBox_Index = 0; gDTMF_InputBox_Index = 0;
gDTMF_InputMode = true; gDTMF_InputMode = true;

View File

@ -681,7 +681,7 @@ void MENU_AcceptSetting(void)
GUI_SelectNextDisplay(DISPLAY_MAIN); GUI_SelectNextDisplay(DISPLAY_MAIN);
gDTMF_InputMode = true; gDTMF_InputMode = true;
gDTMF_InputBox_Index = 3; gDTMF_InputBox_Index = 3;
memmove(gDTMF_InputBox, gDTMF_ID, 4); memcpy(gDTMF_InputBox, gDTMF_ID, 4);
gRequestDisplayScreen = DISPLAY_INVALID; gRequestDisplayScreen = DISPLAY_INVALID;
} }
return; return;
@ -1436,7 +1436,7 @@ static void MENU_Key_MENU(const bool bKeyPressed, const bool bKeyHeld)
edit_index = 0; // 'edit_index' is going to be used as the cursor position edit_index = 0; // 'edit_index' is going to be used as the cursor position
// make a copy so we can test for change when exiting the menu item // make a copy so we can test for change when exiting the menu item
memmove(edit_original, edit, sizeof(edit_original)); memcpy(edit_original, edit, sizeof(edit_original));
return; return;
} }

View File

@ -487,11 +487,11 @@ bool UART_IsCommandAvailable(void)
if (TailIndex < Index) if (TailIndex < Index)
{ {
const uint16_t ChunkSize = sizeof(UART_DMA_Buffer) - Index; const uint16_t ChunkSize = sizeof(UART_DMA_Buffer) - Index;
memmove(UART_Command.Buffer, UART_DMA_Buffer + Index, ChunkSize); memcpy(UART_Command.Buffer, UART_DMA_Buffer + Index, ChunkSize);
memmove(UART_Command.Buffer + ChunkSize, UART_DMA_Buffer, TailIndex); memcpy(UART_Command.Buffer + ChunkSize, UART_DMA_Buffer, TailIndex);
} }
else else
memmove(UART_Command.Buffer, UART_DMA_Buffer + Index, TailIndex - Index); memcpy(UART_Command.Buffer, UART_DMA_Buffer + Index, TailIndex - Index);
TailIndex = DMA_INDEX(TailIndex, 2); TailIndex = DMA_INDEX(TailIndex, 2);
if (TailIndex < gUART_WriteIndex) if (TailIndex < gUART_WriteIndex)

View File

@ -77,8 +77,8 @@ void UI_PrintString(const char *pString, uint8_t Start, uint8_t End, uint8_t Lin
if (pString[i] > ' ' && pString[i] < 127) if (pString[i] > ' ' && pString[i] < 127)
{ {
const unsigned int index = pString[i] - ' ' - 1; const unsigned int index = pString[i] - ' ' - 1;
memmove(gFrameBuffer[Line + 0] + ofs, &gFontBig[index][0], 7); memcpy(gFrameBuffer[Line + 0] + ofs, &gFontBig[index][0], 7);
memmove(gFrameBuffer[Line + 1] + ofs, &gFontBig[index][7], 7); memcpy(gFrameBuffer[Line + 1] + ofs, &gFontBig[index][7], 7);
} }
} }
} }
@ -102,7 +102,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
{ {
const unsigned int index = (unsigned int)pString[i] - ' ' - 1; const unsigned int index = (unsigned int)pString[i] - ' ' - 1;
if (index < ARRAY_SIZE(gFontSmall)) if (index < ARRAY_SIZE(gFontSmall))
memmove(pFb + (i * char_spacing) + 1, &gFontSmall[index], char_width); memcpy(pFb + (i * char_spacing) + 1, &gFontSmall[index], char_width);
} }
} }
} }
@ -125,7 +125,7 @@ void UI_PrintStringSmall(const char *pString, uint8_t Start, uint8_t End, uint8_
{ {
const unsigned int index = (unsigned int)pString[i] - ' ' - 1; const unsigned int index = (unsigned int)pString[i] - ' ' - 1;
if (index < ARRAY_SIZE(gFontSmallBold)) if (index < ARRAY_SIZE(gFontSmallBold))
memmove(pFb + (i * char_spacing) + 1, &gFontSmallBold[index], char_width); memcpy(pFb + (i * char_spacing) + 1, &gFontSmallBold[index], char_width);
} }
} }
} }
@ -142,7 +142,7 @@ void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer)
{ {
const unsigned int index = (unsigned int)pString[i] - ' ' - 1; const unsigned int index = (unsigned int)pString[i] - ' ' - 1;
if (index < ARRAY_SIZE(gFontSmall)) if (index < ARRAY_SIZE(gFontSmall))
memmove(buffer + (i * char_spacing) + 1, &gFontSmall[index], char_width); memcpy(buffer + (i * char_spacing) + 1, &gFontSmall[index], char_width);
} }
} }
} }

View File

@ -408,14 +408,14 @@ void UI_DisplayMain(void)
// highlight the selected/used VFO with a marker // highlight the selected/used VFO with a marker
if (isMainVFO) if (isMainVFO)
memmove(p_line0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); memcpy(p_line0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
} }
else // active TX VFO else // active TX VFO
{ // highlight the selected/used VFO with a marker { // highlight the selected/used VFO with a marker
if (isMainVFO) if (isMainVFO)
memmove(p_line0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default)); memcpy(p_line0 + 0, BITMAP_VFO_Default, sizeof(BITMAP_VFO_Default));
else else
memmove(p_line0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault)); memcpy(p_line0 + 0, BITMAP_VFO_NotDefault, sizeof(BITMAP_VFO_NotDefault));
} }
if (gCurrentFunction == FUNCTION_TRANSMIT) if (gCurrentFunction == FUNCTION_TRANSMIT)
@ -537,14 +537,14 @@ void UI_DisplayMain(void)
// show the scan list assigment symbols // show the scan list assigment symbols
const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]]; const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
if (att.scanlist1) if (att.scanlist1)
memmove(p_line0 + 113, BITMAP_ScanList1, sizeof(BITMAP_ScanList1)); memcpy(p_line0 + 113, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
if (att.scanlist2) if (att.scanlist2)
memmove(p_line0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2)); memcpy(p_line0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
// compander symbol // compander symbol
#ifndef ENABLE_BIG_FREQ #ifndef ENABLE_BIG_FREQ
if (att.compander) if (att.compander)
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand)); memcpy(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
#else #else
// TODO: // find somewhere else to put the symbol // TODO: // find somewhere else to put the symbol
#endif #endif
@ -624,9 +624,9 @@ void UI_DisplayMain(void)
const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]]; const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
if (att.compander) if (att.compander)
#ifdef ENABLE_BIG_FREQ #ifdef ENABLE_BIG_FREQ
memmove(p_line0 + 120, BITMAP_compand, sizeof(BITMAP_compand)); memcpy(p_line0 + 120, BITMAP_compand, sizeof(BITMAP_compand));
#else #else
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand)); memcpy(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
#endif #endif
} }
} }

View File

@ -426,7 +426,7 @@ void UI_DisplayMenu(void)
// draw the little sub-menu triangle marker // draw the little sub-menu triangle marker
if (gIsInSubMenu) if (gIsInSubMenu)
memmove(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator)); memcpy(gFrameBuffer[0] + (8 * menu_list_width) + 1, BITMAP_CurrentIndicator, sizeof(BITMAP_CurrentIndicator));
// draw the menu index number/count // draw the menu index number/count
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount); sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
@ -778,7 +778,7 @@ void UI_DisplayMenu(void)
if (!gIsDtmfContactValid) if (!gIsDtmfContactValid)
strcpy(String, "NULL"); strcpy(String, "NULL");
else else
memmove(String, Contact, 8); memcpy(String, Contact, 8);
break; break;
#endif #endif
@ -962,7 +962,7 @@ void UI_DisplayMenu(void)
if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid) if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid)
{ {
Contact[11] = 0; Contact[11] = 0;
memmove(&gDTMF_ID, Contact + 8, 4); memcpy(&gDTMF_ID, Contact + 8, 4);
sprintf(String, "ID:%s", Contact + 8); sprintf(String, "ID:%s", Contact + 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8); UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
} }