From 2cc222856e6581e94fb9d611693607cf53dddb3b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A9a=20Saviot?= Date: Thu, 25 Apr 2019 16:11:09 +0200 Subject: [PATCH] [ion] remove crc32Padded --- ion/Makefile | 1 - ion/src/blackbox/Makefile | 1 - ion/src/device/Makefile | 1 - ion/src/emscripten/Makefile | 1 - ion/src/sdl/Makefile | 1 - ion/src/shared/crc32_padded.cpp | 28 ---------------------------- ion/src/simulator/Makefile | 1 - 7 files changed, 34 deletions(-) delete mode 100644 ion/src/shared/crc32_padded.cpp diff --git a/ion/Makefile b/ion/Makefile index a02f74390..f3ab41ebb 100644 --- a/ion/Makefile +++ b/ion/Makefile @@ -22,7 +22,6 @@ initializer_list = $(shell echo $(1) | sed "s/\(.\)/'\1',/g")0 $(call object_for,ion/src/shared/platform_info.cpp): SFLAGS += -DPATCH_LEVEL="$(call initializer_list,$(PATCH_LEVEL))" -DEPSILON_VERSION="$(call initializer_list,$(EPSILON_VERSION))" src += $(addprefix ion/src/shared/, \ - crc32_padded.cpp \ decompress.cpp \ events.cpp \ led.cpp \ diff --git a/ion/src/blackbox/Makefile b/ion/src/blackbox/Makefile index 9c93b9bf8..cf518fdf9 100644 --- a/ion/src/blackbox/Makefile +++ b/ion/src/blackbox/Makefile @@ -9,7 +9,6 @@ src += $(addprefix ion/src/shared/, \ console_line.cpp \ console_stdio.cpp \ crc32.cpp \ - crc32_padded.cpp \ events.cpp \ power.cpp \ random.cpp \ diff --git a/ion/src/device/Makefile b/ion/src/device/Makefile index d3674033e..26262a60a 100644 --- a/ion/src/device/Makefile +++ b/ion/src/device/Makefile @@ -7,7 +7,6 @@ $(call object_for,ion/src/shared/platform_info.cpp): SFLAGS += -DHEADER_SECTION= src += $(addprefix ion/src/shared/, \ console_line.cpp \ - crc32_padded.cpp \ events_keyboard.cpp \ events_modifier.cpp \ ) diff --git a/ion/src/emscripten/Makefile b/ion/src/emscripten/Makefile index 950dcb4cb..26c85a7ea 100644 --- a/ion/src/emscripten/Makefile +++ b/ion/src/emscripten/Makefile @@ -6,7 +6,6 @@ src += $(addprefix ion/src/emscripten/, \ src += $(addprefix ion/src/shared/, \ crc32.cpp \ - crc32_padded.cpp \ events.cpp \ events_modifier.cpp \ power.cpp \ diff --git a/ion/src/sdl/Makefile b/ion/src/sdl/Makefile index ad92e2e34..b77d3e247 100644 --- a/ion/src/sdl/Makefile +++ b/ion/src/sdl/Makefile @@ -1,7 +1,6 @@ # TODO src += $(addprefix ion/src/shared/, \ crc32.cpp \ - crc32_padded.cpp \ events.cpp \ events_keyboard.cpp \ events_modifier.cpp \ diff --git a/ion/src/shared/crc32_padded.cpp b/ion/src/shared/crc32_padded.cpp deleted file mode 100644 index ca1bce352..000000000 --- a/ion/src/shared/crc32_padded.cpp +++ /dev/null @@ -1,28 +0,0 @@ -#include - -uint32_t Ion::crc32PaddedString(const char * s, int length) { - /* s is a char array. Its length in Bytes is not necessarily a multiple of 4. - * However, crc32 method awaits input in a form of uint32_t table. To limit - * the use of additional memory, we compute 2 crc32: - * - one corresponding to s with a byte length truncated to be a multiple of 4 - * - the other corresponds to the remaining chars in s padded with 0 to be 4 - * bytes long - * The CRC32 of s is the crc32 of both. */ - - // CRC32 of the truncated string - uint32_t c[2] = {0, 0}; - size_t crc32TruncatedInputSize = (length*sizeof(char))/sizeof(uint32_t); - c[0] = Ion::crc32((const uint32_t *)s, crc32TruncatedInputSize); - - /* CRC32 of the tail of the string. We copy the remaining bytes in a uint32_t. - * Because there are less than 3 remaining bytes, we can use strlcpy with a - * size of tailLength + 1, it will be inferior to 4, the size of a uint32_t in - * bytes. */ - uint32_t tailName = 0; - size_t offset = (crc32TruncatedInputSize*sizeof(uint32_t))/sizeof(char); - size_t tailLength = length - offset; - strlcpy((char *)&tailName, s+offset, tailLength+1); //+1 because strlcpy assures null termination - c[1] = Ion::crc32(&tailName, 1); - - return Ion::crc32((const uint32_t *)c, 2); -} diff --git a/ion/src/simulator/Makefile b/ion/src/simulator/Makefile index 748c274bb..4b08536f7 100644 --- a/ion/src/simulator/Makefile +++ b/ion/src/simulator/Makefile @@ -8,7 +8,6 @@ src += $(addprefix ion/src/simulator/keyboard/, fltkkbd.cpp) src += $(addprefix ion/src/shared/, \ crc32.cpp \ - crc32_padded.cpp \ console_line.cpp \ console_stdio.cpp \ events_modifier.cpp \