mirror of
https://github.com/github/codeql.git
synced 2026-04-25 00:35:20 +02:00
C++: Add CSimpleStringT tests.
This commit is contained in:
@@ -898,4 +898,114 @@ void test_CUrl() {
|
||||
url2.SetUserName(x);
|
||||
sink(url2); // $ ir
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
struct IAtlStringMgr {}; // simplified
|
||||
|
||||
using XCHAR = char;
|
||||
using YCHAR = wchar_t;
|
||||
|
||||
template <typename BaseType>
|
||||
struct CSimpleStringT {
|
||||
using PCXSTR = const BaseType*; // simplified
|
||||
using PXSTR = BaseType*; // simplified
|
||||
|
||||
CSimpleStringT() throw();
|
||||
CSimpleStringT(const XCHAR* pchSrc, int nLength, IAtlStringMgr* pStringMgr);
|
||||
CSimpleStringT(PCXSTR pszSrc, IAtlStringMgr* pStringMgr);
|
||||
CSimpleStringT(const CSimpleStringT& strSrc);
|
||||
|
||||
~CSimpleStringT() throw();
|
||||
|
||||
void Append(const CSimpleStringT& strSrc);
|
||||
void Append(PCXSTR pszSrc, int nLength);
|
||||
void Append(PCXSTR pszSrc);
|
||||
|
||||
void AppendChar(XCHAR ch);
|
||||
|
||||
static void CopyChars(XCHAR* pchDest, const XCHAR* pchSrc, int nChars) throw();
|
||||
static void CopyChars(XCHAR* pchDest, size_t nDestLen, const XCHAR* pchSrc, int nChars) throw();
|
||||
static void CopyCharsOverlapped(XCHAR* pchDest, const XCHAR* pchSrc, int nChars) throw();
|
||||
|
||||
XCHAR GetAt(int iChar) const;
|
||||
PXSTR GetBuffer(int nMinBufferLength);
|
||||
PXSTR GetBuffer();
|
||||
PXSTR GetBufferSetLength(int nLength);
|
||||
|
||||
PCXSTR GetString() const throw();
|
||||
PXSTR LockBuffer();
|
||||
void SetAt(int iChar, XCHAR ch);
|
||||
void SetString(PCXSTR pszSrc, int nLength);
|
||||
void SetString(PCXSTR pszSrc);
|
||||
operator PCXSTR() const throw();
|
||||
XCHAR operator[](int iChar) const;
|
||||
|
||||
CSimpleStringT& operator+=(PCXSTR pszSrc);
|
||||
CSimpleStringT& operator+=(const CSimpleStringT& strSrc);
|
||||
CSimpleStringT& operator+=(char ch);
|
||||
CSimpleStringT& operator+=(unsigned char ch);
|
||||
CSimpleStringT& operator+=(wchar_t ch);
|
||||
|
||||
CSimpleStringT& operator=(PCXSTR pszSrc);
|
||||
CSimpleStringT& operator=(const CSimpleStringT& strSrc);
|
||||
};
|
||||
|
||||
void test_CSimpleStringT() {
|
||||
char* x = indirect_source<char>();
|
||||
|
||||
CSimpleStringT<char> s1(x, 10, nullptr);
|
||||
sink(s1.GetString()); // $ MISSING: ir
|
||||
|
||||
CSimpleStringT<char> s2(x, nullptr);
|
||||
sink(s2.GetString()); // $ MISSING: ir
|
||||
|
||||
CSimpleStringT<char> s3(s2);
|
||||
sink(s3.GetString()); // $ MISSING: ir
|
||||
|
||||
CSimpleStringT<char> s4;
|
||||
s4.Append(indirect_source<char>());
|
||||
sink(s4.GetString()); // $ MISSING: ir
|
||||
|
||||
CSimpleStringT<char> s5;
|
||||
s5.Append(s4);
|
||||
sink(s5.GetString()); // $ MISSING: ir
|
||||
|
||||
CSimpleStringT<char> s6;
|
||||
s6.Append(indirect_source<char>(), 42);
|
||||
sink(s6.GetString()); // $ MISSING: ir
|
||||
|
||||
char buffer1[128];
|
||||
CSimpleStringT<char>::CopyChars(buffer1, x, 10);
|
||||
sink(buffer1); // $ ast MISSING: ir
|
||||
|
||||
char buffer2[128];
|
||||
CSimpleStringT<char>::CopyChars(buffer2, 128, x, 10);
|
||||
sink(buffer2); // $ ast MISSING: ir
|
||||
|
||||
char buffer3[128];
|
||||
CSimpleStringT<char>::CopyCharsOverlapped(buffer3, x, 10);
|
||||
sink(buffer3); // $ ast MISSING: ir
|
||||
|
||||
sink(s4.GetAt(0)); // $ MISSING: ir
|
||||
sink(s4.GetBuffer(10)); // $ MISSING: ir
|
||||
sink(s4.GetBuffer()); // $ MISSING: ir
|
||||
sink(s4.GetBufferSetLength(10)); // $ MISSING: ir
|
||||
|
||||
sink(s4.LockBuffer());
|
||||
|
||||
CSimpleStringT<char> s7;
|
||||
s7.SetAt(0, source<char>());
|
||||
sink(s7.GetAt(0)); // $ MISSING: ir
|
||||
|
||||
CSimpleStringT<char> s8;
|
||||
s8.SetString(indirect_source<char>());
|
||||
sink(s8.GetAt(0)); // $ MISSING: ir
|
||||
|
||||
CSimpleStringT<char> s9;
|
||||
s9.SetString(indirect_source<char>(), 1024);
|
||||
sink(s9.GetAt(0)); // $ MISSING: ir
|
||||
|
||||
sink(static_cast<CSimpleStringT<char>::PCXSTR>(s1)); // $ MISSING: ir
|
||||
|
||||
sink(s1[0]); // $ MISSING: ir
|
||||
}
|
||||
|
||||
@@ -946,6 +946,82 @@ WARNING: module 'TaintTracking' has been deprecated and may be removed in future
|
||||
| atl.cpp:897:10:897:13 | call to CUrl | atl.cpp:900:3:900:3 | url2 | |
|
||||
| atl.cpp:898:5:898:8 | ref arg url2 | atl.cpp:899:10:899:13 | url2 | |
|
||||
| atl.cpp:898:5:898:8 | ref arg url2 | atl.cpp:900:3:900:3 | url2 | |
|
||||
| atl.cpp:954:13:954:33 | call to indirect_source | atl.cpp:956:27:956:27 | x | |
|
||||
| atl.cpp:954:13:954:33 | call to indirect_source | atl.cpp:959:27:959:27 | x | |
|
||||
| atl.cpp:954:13:954:33 | call to indirect_source | atl.cpp:978:44:978:44 | x | |
|
||||
| atl.cpp:954:13:954:33 | call to indirect_source | atl.cpp:982:49:982:49 | x | |
|
||||
| atl.cpp:954:13:954:33 | call to indirect_source | atl.cpp:986:54:986:54 | x | |
|
||||
| atl.cpp:956:27:956:41 | call to CSimpleStringT | atl.cpp:957:8:957:9 | s1 | |
|
||||
| atl.cpp:956:27:956:41 | call to CSimpleStringT | atl.cpp:1008:50:1008:51 | s1 | |
|
||||
| atl.cpp:956:27:956:41 | call to CSimpleStringT | atl.cpp:1010:8:1010:9 | s1 | |
|
||||
| atl.cpp:956:27:956:41 | call to CSimpleStringT | atl.cpp:1011:1:1011:1 | s1 | |
|
||||
| atl.cpp:959:27:959:37 | call to CSimpleStringT | atl.cpp:960:8:960:9 | s2 | |
|
||||
| atl.cpp:959:27:959:37 | call to CSimpleStringT | atl.cpp:962:27:962:28 | s2 | |
|
||||
| atl.cpp:959:27:959:37 | call to CSimpleStringT | atl.cpp:1011:1:1011:1 | s2 | |
|
||||
| atl.cpp:962:27:962:28 | s2 | atl.cpp:962:27:962:29 | call to CSimpleStringT | |
|
||||
| atl.cpp:962:27:962:29 | call to CSimpleStringT | atl.cpp:963:8:963:9 | s3 | |
|
||||
| atl.cpp:962:27:962:29 | call to CSimpleStringT | atl.cpp:1011:1:1011:1 | s3 | |
|
||||
| atl.cpp:965:24:965:25 | call to CSimpleStringT | atl.cpp:966:3:966:4 | s4 | |
|
||||
| atl.cpp:965:24:965:25 | call to CSimpleStringT | atl.cpp:967:8:967:9 | s4 | |
|
||||
| atl.cpp:965:24:965:25 | call to CSimpleStringT | atl.cpp:970:13:970:14 | s4 | |
|
||||
| atl.cpp:965:24:965:25 | call to CSimpleStringT | atl.cpp:989:8:989:9 | s4 | |
|
||||
| atl.cpp:965:24:965:25 | call to CSimpleStringT | atl.cpp:990:8:990:9 | s4 | |
|
||||
| atl.cpp:965:24:965:25 | call to CSimpleStringT | atl.cpp:991:8:991:9 | s4 | |
|
||||
| atl.cpp:965:24:965:25 | call to CSimpleStringT | atl.cpp:992:8:992:9 | s4 | |
|
||||
| atl.cpp:965:24:965:25 | call to CSimpleStringT | atl.cpp:994:8:994:9 | s4 | |
|
||||
| atl.cpp:965:24:965:25 | call to CSimpleStringT | atl.cpp:1011:1:1011:1 | s4 | |
|
||||
| atl.cpp:966:3:966:4 | ref arg s4 | atl.cpp:967:8:967:9 | s4 | |
|
||||
| atl.cpp:966:3:966:4 | ref arg s4 | atl.cpp:970:13:970:14 | s4 | |
|
||||
| atl.cpp:966:3:966:4 | ref arg s4 | atl.cpp:989:8:989:9 | s4 | |
|
||||
| atl.cpp:966:3:966:4 | ref arg s4 | atl.cpp:990:8:990:9 | s4 | |
|
||||
| atl.cpp:966:3:966:4 | ref arg s4 | atl.cpp:991:8:991:9 | s4 | |
|
||||
| atl.cpp:966:3:966:4 | ref arg s4 | atl.cpp:992:8:992:9 | s4 | |
|
||||
| atl.cpp:966:3:966:4 | ref arg s4 | atl.cpp:994:8:994:9 | s4 | |
|
||||
| atl.cpp:966:3:966:4 | ref arg s4 | atl.cpp:1011:1:1011:1 | s4 | |
|
||||
| atl.cpp:969:24:969:25 | call to CSimpleStringT | atl.cpp:970:3:970:4 | s5 | |
|
||||
| atl.cpp:969:24:969:25 | call to CSimpleStringT | atl.cpp:971:8:971:9 | s5 | |
|
||||
| atl.cpp:969:24:969:25 | call to CSimpleStringT | atl.cpp:1011:1:1011:1 | s5 | |
|
||||
| atl.cpp:970:3:970:4 | ref arg s5 | atl.cpp:971:8:971:9 | s5 | |
|
||||
| atl.cpp:970:3:970:4 | ref arg s5 | atl.cpp:1011:1:1011:1 | s5 | |
|
||||
| atl.cpp:973:24:973:25 | call to CSimpleStringT | atl.cpp:974:3:974:4 | s6 | |
|
||||
| atl.cpp:973:24:973:25 | call to CSimpleStringT | atl.cpp:975:8:975:9 | s6 | |
|
||||
| atl.cpp:973:24:973:25 | call to CSimpleStringT | atl.cpp:1011:1:1011:1 | s6 | |
|
||||
| atl.cpp:974:3:974:4 | ref arg s6 | atl.cpp:975:8:975:9 | s6 | |
|
||||
| atl.cpp:974:3:974:4 | ref arg s6 | atl.cpp:1011:1:1011:1 | s6 | |
|
||||
| atl.cpp:977:8:977:14 | buffer1 | atl.cpp:978:35:978:41 | buffer1 | |
|
||||
| atl.cpp:977:8:977:14 | buffer1 | atl.cpp:979:8:979:14 | buffer1 | |
|
||||
| atl.cpp:978:35:978:41 | ref arg buffer1 | atl.cpp:979:8:979:14 | buffer1 | |
|
||||
| atl.cpp:981:8:981:14 | buffer2 | atl.cpp:982:35:982:41 | buffer2 | |
|
||||
| atl.cpp:981:8:981:14 | buffer2 | atl.cpp:983:8:983:14 | buffer2 | |
|
||||
| atl.cpp:982:35:982:41 | ref arg buffer2 | atl.cpp:983:8:983:14 | buffer2 | |
|
||||
| atl.cpp:985:8:985:14 | buffer3 | atl.cpp:986:45:986:51 | buffer3 | |
|
||||
| atl.cpp:985:8:985:14 | buffer3 | atl.cpp:987:8:987:14 | buffer3 | |
|
||||
| atl.cpp:986:45:986:51 | ref arg buffer3 | atl.cpp:987:8:987:14 | buffer3 | |
|
||||
| atl.cpp:990:8:990:9 | ref arg s4 | atl.cpp:991:8:991:9 | s4 | |
|
||||
| atl.cpp:990:8:990:9 | ref arg s4 | atl.cpp:992:8:992:9 | s4 | |
|
||||
| atl.cpp:990:8:990:9 | ref arg s4 | atl.cpp:994:8:994:9 | s4 | |
|
||||
| atl.cpp:990:8:990:9 | ref arg s4 | atl.cpp:1011:1:1011:1 | s4 | |
|
||||
| atl.cpp:991:8:991:9 | ref arg s4 | atl.cpp:992:8:992:9 | s4 | |
|
||||
| atl.cpp:991:8:991:9 | ref arg s4 | atl.cpp:994:8:994:9 | s4 | |
|
||||
| atl.cpp:991:8:991:9 | ref arg s4 | atl.cpp:1011:1:1011:1 | s4 | |
|
||||
| atl.cpp:992:8:992:9 | ref arg s4 | atl.cpp:994:8:994:9 | s4 | |
|
||||
| atl.cpp:992:8:992:9 | ref arg s4 | atl.cpp:1011:1:1011:1 | s4 | |
|
||||
| atl.cpp:994:8:994:9 | ref arg s4 | atl.cpp:1011:1:1011:1 | s4 | |
|
||||
| atl.cpp:996:24:996:25 | call to CSimpleStringT | atl.cpp:997:3:997:4 | s7 | |
|
||||
| atl.cpp:996:24:996:25 | call to CSimpleStringT | atl.cpp:998:8:998:9 | s7 | |
|
||||
| atl.cpp:996:24:996:25 | call to CSimpleStringT | atl.cpp:1011:1:1011:1 | s7 | |
|
||||
| atl.cpp:997:3:997:4 | ref arg s7 | atl.cpp:998:8:998:9 | s7 | |
|
||||
| atl.cpp:997:3:997:4 | ref arg s7 | atl.cpp:1011:1:1011:1 | s7 | |
|
||||
| atl.cpp:1000:24:1000:25 | call to CSimpleStringT | atl.cpp:1001:3:1001:4 | s8 | |
|
||||
| atl.cpp:1000:24:1000:25 | call to CSimpleStringT | atl.cpp:1002:8:1002:9 | s8 | |
|
||||
| atl.cpp:1000:24:1000:25 | call to CSimpleStringT | atl.cpp:1011:1:1011:1 | s8 | |
|
||||
| atl.cpp:1001:3:1001:4 | ref arg s8 | atl.cpp:1002:8:1002:9 | s8 | |
|
||||
| atl.cpp:1001:3:1001:4 | ref arg s8 | atl.cpp:1011:1:1011:1 | s8 | |
|
||||
| atl.cpp:1004:24:1004:25 | call to CSimpleStringT | atl.cpp:1005:3:1005:4 | s9 | |
|
||||
| atl.cpp:1004:24:1004:25 | call to CSimpleStringT | atl.cpp:1006:8:1006:9 | s9 | |
|
||||
| atl.cpp:1004:24:1004:25 | call to CSimpleStringT | atl.cpp:1011:1:1011:1 | s9 | |
|
||||
| atl.cpp:1005:3:1005:4 | ref arg s9 | atl.cpp:1006:8:1006:9 | s9 | |
|
||||
| atl.cpp:1005:3:1005:4 | ref arg s9 | atl.cpp:1011:1:1011:1 | s9 | |
|
||||
| bsd.cpp:17:11:17:16 | call to source | bsd.cpp:20:18:20:18 | s | |
|
||||
| bsd.cpp:18:12:18:15 | addr | bsd.cpp:20:22:20:25 | addr | |
|
||||
| bsd.cpp:18:12:18:15 | addr | bsd.cpp:23:8:23:11 | addr | |
|
||||
|
||||
@@ -83,6 +83,8 @@ signatureMatches
|
||||
| atl.cpp:846:15:846:27 | SetSchemeName | (LPCTSTR) | _U_STRINGorID | _U_STRINGorID | 0 |
|
||||
| atl.cpp:847:15:847:24 | SetUrlPath | (LPCTSTR) | _U_STRINGorID | _U_STRINGorID | 0 |
|
||||
| atl.cpp:848:15:848:25 | SetUserName | (LPCTSTR) | _U_STRINGorID | _U_STRINGorID | 0 |
|
||||
| atl.cpp:921:8:921:13 | Append | (LPCOLESTR,int) | CComBSTR | Append | 1 |
|
||||
| atl.cpp:938:8:938:16 | SetString | (LPCOLESTR,int) | CComBSTR | Append | 1 |
|
||||
| constructor_delegation.cpp:10:2:10:8 | MyValue | (LPCOLESTR,int) | CComBSTR | Append | 1 |
|
||||
| constructor_delegation.cpp:19:2:19:15 | MyDerivedValue | (LPCOLESTR,int) | CComBSTR | Append | 1 |
|
||||
| standalone_iterators.cpp:103:27:103:36 | operator+= | (LPCOLESTR,int) | CComBSTR | Append | 1 |
|
||||
@@ -670,6 +672,37 @@ getParameterTypeName
|
||||
| atl.cpp:846:15:846:27 | SetSchemeName | 0 | LPCTSTR |
|
||||
| atl.cpp:847:15:847:24 | SetUrlPath | 0 | LPCTSTR |
|
||||
| atl.cpp:848:15:848:25 | SetUserName | 0 | LPCTSTR |
|
||||
| atl.cpp:903:8:903:8 | operator= | 0 | IAtlStringMgr && |
|
||||
| atl.cpp:903:8:903:8 | operator= | 0 | const IAtlStringMgr & |
|
||||
| atl.cpp:914:3:914:16 | CSimpleStringT | 0 | const XCHAR * |
|
||||
| atl.cpp:914:3:914:16 | CSimpleStringT | 1 | int |
|
||||
| atl.cpp:914:3:914:16 | CSimpleStringT | 2 | IAtlStringMgr * |
|
||||
| atl.cpp:915:3:915:16 | CSimpleStringT | 0 | PCXSTR |
|
||||
| atl.cpp:915:3:915:16 | CSimpleStringT | 1 | IAtlStringMgr * |
|
||||
| atl.cpp:916:3:916:16 | CSimpleStringT | 0 | const CSimpleStringT & |
|
||||
| atl.cpp:920:8:920:13 | Append | 0 | const CSimpleStringT & |
|
||||
| atl.cpp:921:8:921:13 | Append | 0 | PCXSTR |
|
||||
| atl.cpp:921:8:921:13 | Append | 1 | int |
|
||||
| atl.cpp:922:8:922:13 | Append | 0 | PCXSTR |
|
||||
| atl.cpp:926:15:926:23 | CopyChars | 0 | XCHAR * |
|
||||
| atl.cpp:926:15:926:23 | CopyChars | 1 | const XCHAR * |
|
||||
| atl.cpp:926:15:926:23 | CopyChars | 2 | int |
|
||||
| atl.cpp:927:15:927:23 | CopyChars | 0 | XCHAR * |
|
||||
| atl.cpp:927:15:927:23 | CopyChars | 1 | size_t |
|
||||
| atl.cpp:927:15:927:23 | CopyChars | 2 | const XCHAR * |
|
||||
| atl.cpp:927:15:927:23 | CopyChars | 3 | int |
|
||||
| atl.cpp:928:15:928:33 | CopyCharsOverlapped | 0 | XCHAR * |
|
||||
| atl.cpp:928:15:928:33 | CopyCharsOverlapped | 1 | const XCHAR * |
|
||||
| atl.cpp:928:15:928:33 | CopyCharsOverlapped | 2 | int |
|
||||
| atl.cpp:930:9:930:13 | GetAt | 0 | int |
|
||||
| atl.cpp:931:9:931:17 | GetBuffer | 0 | int |
|
||||
| atl.cpp:933:9:933:26 | GetBufferSetLength | 0 | int |
|
||||
| atl.cpp:937:8:937:12 | SetAt | 0 | int |
|
||||
| atl.cpp:937:8:937:12 | SetAt | 1 | XCHAR |
|
||||
| atl.cpp:938:8:938:16 | SetString | 0 | PCXSTR |
|
||||
| atl.cpp:938:8:938:16 | SetString | 1 | int |
|
||||
| atl.cpp:939:8:939:16 | SetString | 0 | PCXSTR |
|
||||
| atl.cpp:941:9:941:18 | operator[] | 0 | int |
|
||||
| bsd.cpp:6:8:6:8 | operator= | 0 | const sockaddr & |
|
||||
| bsd.cpp:6:8:6:8 | operator= | 0 | sockaddr && |
|
||||
| bsd.cpp:12:5:12:10 | accept | 0 | int |
|
||||
|
||||
Reference in New Issue
Block a user