Skip to content

Commit

Permalink
Replace memmove by memcpy
Browse files Browse the repository at this point in the history
  • Loading branch information
JuantAldea authored and egzumer committed Dec 13, 2023
1 parent bd17aea commit d0ae34f
Show file tree
Hide file tree
Showing 6 changed files with 22 additions and 22 deletions.
2 changes: 1 addition & 1 deletion app/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ static void MAIN_Key_STAR(bool bKeyPressed, bool bKeyHeld)
)
{ // start entering a DTMF string
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_InputMode = true;

Expand Down
4 changes: 2 additions & 2 deletions app/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -681,7 +681,7 @@ void MENU_AcceptSetting(void)
GUI_SelectNextDisplay(DISPLAY_MAIN);
gDTMF_InputMode = true;
gDTMF_InputBox_Index = 3;
memmove(gDTMF_InputBox, gDTMF_ID, 4);
memcpy(gDTMF_InputBox, gDTMF_ID, 4);
gRequestDisplayScreen = DISPLAY_INVALID;
}
return;
Expand Down Expand Up @@ -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

// 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;
}
Expand Down
6 changes: 3 additions & 3 deletions app/uart.c
Original file line number Diff line number Diff line change
Expand Up @@ -487,11 +487,11 @@ bool UART_IsCommandAvailable(void)
if (TailIndex < Index)
{
const uint16_t ChunkSize = sizeof(UART_DMA_Buffer) - Index;
memmove(UART_Command.Buffer, UART_DMA_Buffer + Index, ChunkSize);
memmove(UART_Command.Buffer + ChunkSize, UART_DMA_Buffer, TailIndex);
memcpy(UART_Command.Buffer, UART_DMA_Buffer + Index, ChunkSize);
memcpy(UART_Command.Buffer + ChunkSize, UART_DMA_Buffer, TailIndex);
}
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);
if (TailIndex < gUART_WriteIndex)
Expand Down
10 changes: 5 additions & 5 deletions ui/helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
const unsigned int index = pString[i] - ' ' - 1;
memmove(gFrameBuffer[Line + 0] + ofs, &gFontBig[index][0], 7);
memmove(gFrameBuffer[Line + 1] + ofs, &gFontBig[index][7], 7);
memcpy(gFrameBuffer[Line + 0] + ofs, &gFontBig[index][0], 7);
memcpy(gFrameBuffer[Line + 1] + ofs, &gFontBig[index][7], 7);
}
}
}
Expand All @@ -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;
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);
}
}
}
Expand All @@ -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;
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);
}
}
}
Expand All @@ -142,7 +142,7 @@ void UI_PrintStringSmallBuffer(const char *pString, uint8_t *buffer)
{
const unsigned int index = (unsigned int)pString[i] - ' ' - 1;
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);
}
}
}
Expand Down
16 changes: 8 additions & 8 deletions ui/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -408,14 +408,14 @@ void UI_DisplayMain(void)

// highlight the selected/used VFO with a marker
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
{ // highlight the selected/used VFO with a marker
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
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)
Expand Down Expand Up @@ -537,14 +537,14 @@ void UI_DisplayMain(void)
// show the scan list assigment symbols
const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
if (att.scanlist1)
memmove(p_line0 + 113, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
memcpy(p_line0 + 113, BITMAP_ScanList1, sizeof(BITMAP_ScanList1));
if (att.scanlist2)
memmove(p_line0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));
memcpy(p_line0 + 120, BITMAP_ScanList2, sizeof(BITMAP_ScanList2));

// compander symbol
#ifndef ENABLE_BIG_FREQ
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
// TODO: // find somewhere else to put the symbol
#endif
Expand Down Expand Up @@ -624,9 +624,9 @@ void UI_DisplayMain(void)
const ChannelAttributes_t att = gMR_ChannelAttributes[gEeprom.ScreenChannel[vfo_num]];
if (att.compander)
#ifdef ENABLE_BIG_FREQ
memmove(p_line0 + 120, BITMAP_compand, sizeof(BITMAP_compand));
memcpy(p_line0 + 120, BITMAP_compand, sizeof(BITMAP_compand));
#else
memmove(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
memcpy(p_line0 + 120 + LCD_WIDTH, BITMAP_compand, sizeof(BITMAP_compand));
#endif
}
}
Expand Down
6 changes: 3 additions & 3 deletions ui/menu.c
Original file line number Diff line number Diff line change
Expand Up @@ -426,7 +426,7 @@ void UI_DisplayMenu(void)

// draw the little sub-menu triangle marker
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
sprintf(String, "%2u.%u", 1 + gMenuCursor, gMenuListCount);
Expand Down Expand Up @@ -778,7 +778,7 @@ void UI_DisplayMenu(void)
if (!gIsDtmfContactValid)
strcpy(String, "NULL");
else
memmove(String, Contact, 8);
memcpy(String, Contact, 8);
break;
#endif

Expand Down Expand Up @@ -962,7 +962,7 @@ void UI_DisplayMenu(void)
if (UI_MENU_GetCurrentMenuId() == MENU_D_LIST && gIsDtmfContactValid)
{
Contact[11] = 0;
memmove(&gDTMF_ID, Contact + 8, 4);
memcpy(&gDTMF_ID, Contact + 8, 4);
sprintf(String, "ID:%s", Contact + 8);
UI_PrintString(String, menu_item_x1, menu_item_x2, 4, 8);
}
Expand Down

0 comments on commit d0ae34f

Please sign in to comment.