forked from PAWPAW-Mirror/lib_xua
Add missing string and memset buffers
This commit is contained in:
@@ -234,6 +234,8 @@ void XUA_Endpoint0_setVendorId(unsigned short vid) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer) {
|
void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer) {
|
||||||
|
memset(string_buffer, '\0', strlen(string_buffer));
|
||||||
|
|
||||||
uint32_t remaining_buffer_size = MIN(strlen(string1), XUA_MAX_STR_LEN-1);
|
uint32_t remaining_buffer_size = MIN(strlen(string1), XUA_MAX_STR_LEN-1);
|
||||||
strncpy(string_buffer, string1, remaining_buffer_size);
|
strncpy(string_buffer, string1, remaining_buffer_size);
|
||||||
uint32_t total_string_size = MIN(strlen(string1)+strlen(string2), XUA_MAX_STR_LEN-1);
|
uint32_t total_string_size = MIN(strlen(string1)+strlen(string2), XUA_MAX_STR_LEN-1);
|
||||||
@@ -246,6 +248,7 @@ void concatenateAndCopyStrings(char* string1, char* string2, char* string_buffer
|
|||||||
}
|
}
|
||||||
|
|
||||||
void XUA_Endpoint0_setStrTable() {
|
void XUA_Endpoint0_setStrTable() {
|
||||||
|
|
||||||
// update Vendor strings
|
// update Vendor strings
|
||||||
concatenateAndCopyStrings(g_vendor_str, "", g_strTable.vendorStr);
|
concatenateAndCopyStrings(g_vendor_str, "", g_strTable.vendorStr);
|
||||||
#if (AUDIO_CLASS == 2)
|
#if (AUDIO_CLASS == 2)
|
||||||
|
|||||||
@@ -32,13 +32,14 @@
|
|||||||
// The last char of the strings are different, so that the compiler allocates separate memory spaces
|
// The last char of the strings are different, so that the compiler allocates separate memory spaces
|
||||||
#define XUA_VENDOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\01"
|
#define XUA_VENDOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\01"
|
||||||
#define XUA_PRODUCT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\02"
|
#define XUA_PRODUCT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\02"
|
||||||
#define XUA_INTERNAL_CLOCK_SELECTOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\03"
|
#define XUA_CLOCK_SELECTOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\03"
|
||||||
#define XUA_SPDIF_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\04"
|
#define XUA_INTERNAL_CLOCK_SELECTOR_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\04"
|
||||||
#define XUA_ADAT_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\05"
|
#define XUA_SPDIF_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\05"
|
||||||
#define XUA_DFU_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\06"
|
#define XUA_ADAT_CLOCK_SOURCE_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\06"
|
||||||
#define XUA_CTRL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\07"
|
#define XUA_DFU_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\07"
|
||||||
#define XUA_MIDI_OUT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\08"
|
#define XUA_CTRL_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\08"
|
||||||
#define XUA_MIDI_IN_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\09"
|
#define XUA_MIDI_OUT_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\09"
|
||||||
|
#define XUA_MIDI_IN_EMPTY_STRING "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0a"
|
||||||
|
|
||||||
// The value below must match the length of XUA_DESCR_EMPTY_STRING.
|
// The value below must match the length of XUA_DESCR_EMPTY_STRING.
|
||||||
#define XUA_MAX_STR_LEN (32)
|
#define XUA_MAX_STR_LEN (32)
|
||||||
|
|||||||
Reference in New Issue
Block a user