Skip to content

Commit

Permalink
KWSys 2020-04-23 (83118a93)
Browse files Browse the repository at this point in the history
Code extracted from:

    https://gitlab.kitware.com/utils/kwsys.git

at commit 83118a9307b21a1fdc3966ca50af210c6164d805 (master).

Upstream Shortlog
-----------------

Ben Boeckel (10):
      ccab3808 clang-tidy: address readability-isolate-declaration lints
      87b57076 clang-tidy: address readability-braces-around-statements lints
      13b45a41 clang-tidy: address readability-else-after-return lints
      ebb48d58 clang-tidy: address google-readability-casting lint
      09942f51 testSystemTools: add tests for SplitString
      986519af SystemTools: handle splitting a string starting with the separator
      83b20b65 clang-tidy: address `readability-braces-around-statements` lint
      535633fa clang-tidy: address `readability-isolate-declaration` lint
      de210648 clang-tidy: address `readability-else-after-return` lint
      39fd4817 testProcess: fix another clang-tidy warning

Brad King (6):
      313b2f7a SystemTools: Make SystemToolsStatic singleton private to implementation file
      019afb6e SystemTools: Drop GetCurrentWorkingDirectory 'collapse' argument
      c35a377f SystemTools: Refactor CollapseFullPath to call getcwd only when needed
      e3989b18 SystemTools: Restore GetCurrentWorkingDirectory slash conversion on Windows
      41700ca4 SystemTools: Fix FileIsExecutable on Windows
      b8177b56 testProcess: Disable unreliable test case 7

Hernan Martinez (1):
      00629420 SystemInformation: Add support for Windows on ARM64

Robert Maynard (1):
      4b537c59 Tests: Handle that root users on linux can always write to files

Sean McBride (1):
      c58d4b47 SystemTools: On Windows, strip 'e' from Fopen mode

Vladimir Menshakov (1):
      66724af8 SystemTools: Teach FindProgram to find non-readable programs
  • Loading branch information
kwrobot authored and bradking committed Apr 23, 2020
1 parent 2ab6e82 commit d33a5e5
Show file tree
Hide file tree
Showing 9 changed files with 282 additions and 184 deletions.
5 changes: 4 additions & 1 deletion Base64.c
Expand Up @@ -130,7 +130,10 @@ size_t kwsysBase64_Encode(const unsigned char* input, size_t length,
/* Decode 4 bytes into a 3 byte string. */
int kwsysBase64_Decode3(const unsigned char* src, unsigned char* dest)
{
unsigned char d0, d1, d2, d3;
unsigned char d0;
unsigned char d1;
unsigned char d2;
unsigned char d3;

d0 = kwsysBase64DecodeChar(src[0]);
d1 = kwsysBase64DecodeChar(src[1]);
Expand Down
4 changes: 1 addition & 3 deletions CMakeLists.txt
Expand Up @@ -1198,9 +1198,7 @@ if(KWSYS_STANDALONE OR CMake_SOURCE_DIR)
add_executable(${KWSYS_NAMESPACE}TestProcess testProcess.c)
set_property(TARGET ${KWSYS_NAMESPACE}TestProcess PROPERTY LABELS ${KWSYS_LABELS_EXE})
target_link_libraries(${KWSYS_NAMESPACE}TestProcess ${KWSYS_TARGET_C_LINK})
if(NOT CYGWIN)
set(KWSYS_TEST_PROCESS_7 7)
endif()
#set(KWSYS_TEST_PROCESS_7 7) # uncomment to run timing-sensitive test locally
foreach(n 1 2 3 4 5 6 ${KWSYS_TEST_PROCESS_7} 9 10)
add_test(kwsys.testProcess-${n} ${EXEC_DIR}/${KWSYS_NAMESPACE}TestProcess ${n})
set_property(TEST kwsys.testProcess-${n} PROPERTY LABELS ${KWSYS_LABELS_TEST})
Expand Down
30 changes: 20 additions & 10 deletions MD5.c
Expand Up @@ -171,8 +171,10 @@ typedef struct md5_state_s

static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
{
md5_word_t a = pms->abcd[0], b = pms->abcd[1], c = pms->abcd[2],
d = pms->abcd[3];
md5_word_t a = pms->abcd[0];
md5_word_t b = pms->abcd[1];
md5_word_t c = pms->abcd[2];
md5_word_t d = pms->abcd[3];
md5_word_t t;
#if BYTE_ORDER > 0
/* Define storage only for big-endian CPUs. */
Expand Down Expand Up @@ -227,9 +229,10 @@ static void md5_process(md5_state_t* pms, const md5_byte_t* data /*[64]*/)
# else
# define xbuf X /* (static only) */
# endif
for (i = 0; i < 16; ++i, xp += 4)
for (i = 0; i < 16; ++i, xp += 4) {
xbuf[i] =
(md5_word_t)(xp[0] + (xp[1] << 8) + (xp[2] << 16) + (xp[3] << 24));
}
}
#endif
}
Expand Down Expand Up @@ -367,34 +370,39 @@ static void md5_append(md5_state_t* pms, const md5_byte_t* data, size_t nbytes)
size_t offset = (pms->count[0] >> 3) & 63;
md5_word_t nbits = (md5_word_t)(nbytes << 3);

if (nbytes <= 0)
if (nbytes <= 0) {
return;
}

/* Update the message length. */
pms->count[1] += (md5_word_t)(nbytes >> 29);
pms->count[0] += nbits;
if (pms->count[0] < nbits)
if (pms->count[0] < nbits) {
pms->count[1]++;
}

/* Process an initial partial block. */
if (offset) {
size_t copy = (offset + nbytes > 64 ? 64 - offset : nbytes);

memcpy(pms->buf + offset, p, copy);
if (offset + copy < 64)
if (offset + copy < 64) {
return;
}
p += copy;
left -= copy;
md5_process(pms, pms->buf);
}

/* Process full blocks. */
for (; left >= 64; p += 64, left -= 64)
for (; left >= 64; p += 64, left -= 64) {
md5_process(pms, p);
}

/* Process a final partial block. */
if (left)
if (left) {
memcpy(pms->buf, p, left);
}
}

/* Finish the message and return the digest. */
Expand All @@ -409,14 +417,16 @@ static void md5_finish(md5_state_t* pms, md5_byte_t digest[16])
int i;

/* Save the length before padding. */
for (i = 0; i < 8; ++i)
for (i = 0; i < 8; ++i) {
data[i] = (md5_byte_t)(pms->count[i >> 2] >> ((i & 3) << 3));
}
/* Pad to 56 bytes mod 64. */
md5_append(pms, pad, ((55 - (pms->count[0] >> 3)) & 63) + 1);
/* Append the length. */
md5_append(pms, data, 8);
for (i = 0; i < 16; ++i)
for (i = 0; i < 16; ++i) {
digest[i] = (md5_byte_t)(pms->abcd[i >> 2] >> ((i & 3) << 3));
}
}

#if defined(__clang__) && !defined(__INTEL_COMPILER)
Expand Down

0 comments on commit d33a5e5

Please sign in to comment.