File tree Expand file tree Collapse file tree 2 files changed +19
-23
lines changed Expand file tree Collapse file tree 2 files changed +19
-23
lines changed Original file line number Diff line number Diff line change @@ -705,9 +705,26 @@ class Cdr
705
705
* @exception exception::NotEnoughMemoryException This exception is thrown when trying to serialize a position that exceeds the internal memory size.
706
706
* @exception exception::BadParamException This exception is thrown when trying to serialize a string with null characters.
707
707
*/
708
- TEMPLATE_SPEC Cdr_DllAPI
708
+ TEMPLATE_SPEC
709
709
Cdr& serialize (
710
- const std::string& string_t );
710
+ const std::string& string_t )
711
+ {
712
+ // An empty string is serialized as a 0 length string.
713
+ if (string_t .empty ())
714
+ {
715
+ return serialize (static_cast <uint32_t >(0 ));
716
+ }
717
+
718
+ // Check there are no null characters in the string.
719
+ const char * c_str = string_t .c_str ();
720
+ const auto str_len = strlen (c_str);
721
+ if (string_t .size () > str_len)
722
+ {
723
+ throw BadParamException (" The string contains null characters" );
724
+ }
725
+
726
+ return serialize_sequence (c_str, str_len + 1 );
727
+ }
711
728
712
729
/* !
713
730
* @brief This function serializes a std::wstring.
Original file line number Diff line number Diff line change @@ -887,27 +887,6 @@ Cdr& Cdr::serialize(
887
887
return *this ;
888
888
}
889
889
890
- TEMPLATE_SPEC
891
- Cdr& Cdr::serialize (
892
- const std::string& string_t )
893
- {
894
- // An empty string is serialized as a 0 length string.
895
- if (string_t .empty ())
896
- {
897
- return serialize (static_cast <uint32_t >(0 ));
898
- }
899
-
900
- // Check there are no null characters in the string.
901
- const char * c_str = string_t .c_str ();
902
- const auto str_len = strlen (c_str);
903
- if (string_t .size () > str_len)
904
- {
905
- throw BadParamException (" The string contains null characters" );
906
- }
907
-
908
- return serialize_sequence (c_str, str_len + 1 );
909
- }
910
-
911
890
Cdr& Cdr::serialize_array (
912
891
const bool * bool_t ,
913
892
size_t num_elements)
You can’t perform that action at this time.
0 commit comments