"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "googletest/samples/sample2.cc" between
googletest-release-1.11.0.tar.gz and googletest-release-1.12.0.tar.gz

About: GoogleTest is Google's (unit) testing and mocking framework for C++ tests.

sample2.cc  (googletest-release-1.11.0):sample2.cc  (googletest-release-1.12.0)
skipping to change at line 41 skipping to change at line 41
#include "sample2.h" #include "sample2.h"
#include <string.h> #include <string.h>
// Clones a 0-terminated C string, allocating memory using new. // Clones a 0-terminated C string, allocating memory using new.
const char* MyString::CloneCString(const char* a_c_string) { const char* MyString::CloneCString(const char* a_c_string) {
if (a_c_string == nullptr) return nullptr; if (a_c_string == nullptr) return nullptr;
const size_t len = strlen(a_c_string); const size_t len = strlen(a_c_string);
char* const clone = new char[ len + 1 ]; char* const clone = new char[len + 1];
memcpy(clone, a_c_string, len + 1); memcpy(clone, a_c_string, len + 1);
return clone; return clone;
} }
// Sets the 0-terminated C string this MyString object // Sets the 0-terminated C string this MyString object
// represents. // represents.
void MyString::Set(const char* a_c_string) { void MyString::Set(const char* a_c_string) {
// Makes sure this works when c_string == c_string_ // Makes sure this works when c_string == c_string_
const char* const temp = MyString::CloneCString(a_c_string); const char* const temp = MyString::CloneCString(a_c_string);
 End of changes. 1 change blocks. 
1 lines changed or deleted 1 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)