aboutsummaryrefslogtreecommitdiff
path: root/NitrokeyManager.cc
diff options
context:
space:
mode:
authorSzczepan Zalega <szczepan@nitrokey.com>2017-05-13 10:07:56 +0200
committerSzczepan Zalega <szczepan@nitrokey.com>2017-05-13 10:13:05 +0200
commitad1d4605fdafc44fcba1bef57b874759f18a94e6 (patch)
tree148a5199cc68a520fb31fc61b6a67fe1e2310a1b /NitrokeyManager.cc
parent79b616830381d0ea5f89e920b55f154d2e7e06ce (diff)
downloadlibnitrokey-ad1d4605fdafc44fcba1bef57b874759f18a94e6.tar.gz
libnitrokey-ad1d4605fdafc44fcba1bef57b874759f18a94e6.tar.bz2
Code refactoring
Remove doubled implementation Remove clutter from DEBUG log level Signed-off-by: Szczepan Zalega <szczepan@nitrokey.com>
Diffstat (limited to 'NitrokeyManager.cc')
-rw-r--r--NitrokeyManager.cc25
1 files changed, 1 insertions, 24 deletions
diff --git a/NitrokeyManager.cc b/NitrokeyManager.cc
index 096a8c4..9a9d106 100644
--- a/NitrokeyManager.cc
+++ b/NitrokeyManager.cc
@@ -26,30 +26,7 @@ char * strndup(const char* str, size_t maxlen){
#endif
-
- /**
- * Copies string from pointer to fixed size C-style array. Src needs to be a valid C-string - eg. ended with '\0'.
- * Throws when source is bigger than destination.
- * @tparam T type of destination array
- * @param dest fixed size destination array
- * @param src pointer to source c-style valid string
- */
- template <typename T>
- void strcpyT(T& dest, const char* src){
-
- if (src == nullptr)
-// throw EmptySourceStringException(slot_number);
- return;
- const size_t s_dest = sizeof dest;
- LOG(std::string("strcpyT sizes dest src ")
- +std::to_string(s_dest)+ " "
- +std::to_string(strlen(src))+ " "
- ,nitrokey::log::Loglevel::DEBUG_L2);
- if (strlen(src) > s_dest){
- throw TooLongStringException(strlen(src), s_dest, src);
- }
- strncpy((char*) &dest, src, s_dest);
- }
+using nitrokey::misc::strcpyT;
template <typename T>
typename T::CommandPayload get_payload(){