Fix compiler warnings and improve code quality

- Replace unsafe strcpy with strcpy_s for better security
- Fix DLL binding issues by adding PRIVATEBIN_API macros
- Add explicit type casts to resolve size conversion warnings
- Replace unsafe getenv with _dupenv_s for better security
- Add PRIVATEBINAPI_EXPORTS definition in CMakeLists.txt
- Improve CMake configuration for better build compatibility
This commit is contained in:
mbusc
2025-08-28 21:25:25 +02:00
parent b97d9f2d7f
commit cd7e957692
5 changed files with 24 additions and 18 deletions

View File

@ -21,9 +21,12 @@ static bool extract_paste_id_and_key(const std::string& full_url, std::string& p
}
int main() {
const char* it = std::getenv("PRIVATEBIN_IT");
char* it = nullptr;
size_t len = 0;
_dupenv_s(&it, &len, "PRIVATEBIN_IT");
if (!it || std::string(it) == "0") {
std::cout << "[test] PRIVATEBIN_IT not set; skipping integration test." << std::endl;
free(it);
return 0; // treat as success when integration testing is disabled
}