#include "StdAfx.h"
#include "StrOps.h"
StrOps::StrOps(void)
{
}
StrOps::~StrOps(void)
{
}
int StrOps::StrCmp(const char* str1, const char* str2)
{
if ((str1 == NULL) && (str2 == NULL))
{
// two NULL str are eqivalent
return 1;
}
else if ((str1 == NULL) || (str2 == NULL))
{
// one NULL str fails
return 0;
}
int idx = 0;
while(1)
{
if (str1[idx] != str2[idx])
{
//charcters not equal
return 0;
}
if ((str1[idx] == '\0') || (str2[idx] == '\0'))
{
// if one is '\0' the othe must be as well or it would have failed the
// previous test for equality and retruned a false, so the strings must
// be equal
return 1;
}
idx++;
}
}
int StrOps::StrLen(const char* str)
{
int len = 0;
while(str[len] != '\0')
{
len++;
}
return len;
}
char* StrOps::StrDup(const char* str)
{
int len = StrLen(str);
char* val = new char[len+1];
for (int idx = 0; idx < len; idx++)
{
val[idx] = str[idx];
}
val[len] = '\0';
return val;
}
| # | Change | User | Description | Committed | |
|---|---|---|---|---|---|
| #1 | 12954 | anis_sg |
Populate -o //guest/perforce_software/p4connect/... //guest/anis_sg/perforce_software/p4connect/.... |
||
| //guest/perforce_software/p4connect/src/P4Bridge/p4bridgeStressTest/StrOps.cpp | |||||
| #1 | 12135 | Norman Morse |
Integrate dev branch changes into main. This code is the basiis of the 2.7 BETA release which provides Unity 5 compatibility |
||
| //guest/norman_morse/dev/p4connect/src/P4Bridge/p4bridgeStressTest/StrOps.cpp | |||||
| #1 | 11821 | Norman Morse | Move Unity 5 compatible build from internal dev branch to workshop dev branch. | ||