From f33b6dd08aa150928a1ca8f6b11aec9a4837b2be Mon Sep 17 00:00:00 2001 From: xavierchanth Date: Tue, 5 Nov 2024 10:47:54 -0500 Subject: [PATCH 1/2] chore: tell clangd to use C99 standards --- packages/c/.clangd | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/packages/c/.clangd b/packages/c/.clangd index f6cb59a46..9b5f10e62 100644 --- a/packages/c/.clangd +++ b/packages/c/.clangd @@ -2,7 +2,7 @@ CompileFlags: # Use gcc in development for better diagnostics # & Ensure that compilation doesn't fail due to warnings Compiler: gcc - Add: [-Wno-error] + Add: [-Wno-error, -xc, -std=c99] Index: # Enable background indexing for better symbol information @@ -15,4 +15,3 @@ Diagnostics: # Avoid running slow clang-tidy checks ClangTidy: FastCheckFilter: Loose - From 176ffb58772a595f750a82beb14c18f49a8de93f Mon Sep 17 00:00:00 2001 From: xavierchanth Date: Tue, 5 Nov 2024 13:49:53 -0500 Subject: [PATCH 2/2] fix: cast to int64_t instead of long --- packages/c/sshnpd/src/background_jobs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/c/sshnpd/src/background_jobs.c b/packages/c/sshnpd/src/background_jobs.c index 52fd55a6d..5e65c1900 100644 --- a/packages/c/sshnpd/src/background_jobs.c +++ b/packages/c/sshnpd/src/background_jobs.c @@ -8,11 +8,14 @@ #include #include #include +#include #include #include #include #include +const int64_t THIRTY_DAYS_MS = (int64_t)30 * 24 * 60 * 60 * 1000; + #define LOGGER_TAG "refresh_device_entry" void *refresh_device_entry(void *void_refresh_device_entry_params) { @@ -70,7 +73,7 @@ void *refresh_device_entry(void *void_refresh_device_entry_params) { atclient_atkey_metadata_set_is_encrypted(metadata, true); atclient_atkey_metadata_set_ttr(metadata, -1); atclient_atkey_metadata_set_ccd(metadata, true); - atclient_atkey_metadata_set_ttl(metadata, (long)30 * 24 * 60 * 60 * 1000); // 30 days in ms + atclient_atkey_metadata_set_ttl(metadata, THIRTY_DAYS_MS); buffer_len = strlen(params->params->manager_list[index]) + usernamekey_base_len; // example: @client_atsign:device_info.device_name.sshnp@client_atsign