Makes all samples compile with -Wall -Wshadow -Werror.

This commit is contained in:
vladlosev
2010-02-27 08:21:11 +00:00
parent 70eceaf8e7
commit fe78760959
7 changed files with 49 additions and 49 deletions
+7 -7
View File
@@ -36,21 +36,21 @@
#include <string.h>
// Clones a 0-terminated C string, allocating memory using new.
const char * MyString::CloneCString(const char * c_string) {
if (c_string == NULL) return NULL;
const char* MyString::CloneCString(const char* a_c_string) {
if (a_c_string == NULL) return NULL;
const size_t len = strlen(c_string);
char * const clone = new char[ len + 1 ];
memcpy(clone, c_string, len + 1);
const size_t len = strlen(a_c_string);
char* const clone = new char[ len + 1 ];
memcpy(clone, a_c_string, len + 1);
return clone;
}
// Sets the 0-terminated C string this MyString object
// represents.
void MyString::Set(const char * c_string) {
void MyString::Set(const char* a_c_string) {
// Makes sure this works when c_string == c_string_
const char * const temp = MyString::CloneCString(c_string);
const char* const temp = MyString::CloneCString(a_c_string);
delete[] c_string_;
c_string_ = temp;
}