11// Licensed to the .NET Foundation under one or more agreements.
22// The .NET Foundation licenses this file to you under the MIT license.
3+
34// *****************************************************************************
45// NSUtilPriv.h
56//
67// Helpers for converting namespace separators.
7- //
88// *****************************************************************************
99
1010#ifndef __NSUTILPRIV_H__
@@ -15,7 +15,6 @@ class SString;
1515
1616struct ns
1717{
18-
1918// *****************************************************************************
2019// Determine how many chars large a fully qualified name would be given the
2120// two parts of the name. The return value includes room for every character
4342int IsValidName ( // true if valid, false invalid.
4443 LPCUTF8 szName); // Name to parse.
4544
46-
4745// *****************************************************************************
4846// Scan the string from the rear looking for the first valid separator. If
4947// found, return a pointer to it. Else return null. This code is smart enough
@@ -61,34 +59,22 @@ static
6159LPUTF8 FindSep ( // Pointer to separator or null.
6260 LPCUTF8 szPath); // The path to look in.
6361
64-
6562// *****************************************************************************
6663// Take a path and find the last separator (nsFindSep), and then replace the
6764// separator with a '\0' and return a pointer to the name. So for example:
6865// a.b.c
6966// becomes two strings "a.b" and "c" and the return value points to "c".
7067// *****************************************************************************
71- static
72- WCHAR *SplitInline ( // Pointer to name portion.
73- __inout __inout_z WCHAR *szPath); // The path to split.
74-
7568static
7669LPUTF8 SplitInline ( // Pointer to name portion.
7770 __inout __inout_z LPUTF8 szPath); // The path to split.
7871
79- static
80- void SplitInline (
81- __inout __inout_z LPWSTR szPath, // Path to split.
82- LPCWSTR &szNameSpace, // Return pointer to namespace.
83- LPCWSTR &szName); // Return pointer to name.
84-
8572static
8673void SplitInline (
8774 __inout __inout_z LPUTF8 szPath, // Path to split.
8875 LPCUTF8 &szNameSpace, // Return pointer to namespace.
8976 LPCUTF8 &szName); // Return pointer to name.
9077
91-
9278// *****************************************************************************
9379// Split the last parsable element from the end of the string as the name,
9480// the first part as the namespace.
@@ -109,7 +95,6 @@ int SplitPath( // true ok, false trunction.
10995 _Out_writes_opt_ (cchName) LPUTF8 szName, // Output for name.
11096 int cchName); // Max chars for output.
11197
112-
11398// *****************************************************************************
11499// Take two values and put them together in a fully qualified path using the
115100// correct separator.
@@ -128,31 +113,6 @@ int MakePath( // true ok, false truncation.
128113 LPCUTF8 szNameSpace, // Namespace.
129114 LPCUTF8 szName); // Name.
130115
131- static
132- int MakePath ( // true ok, false truncation.
133- _Out_writes_ (cchChars) WCHAR *szOut, // output path for name.
134- int cchChars, // max chars for output path.
135- LPCUTF8 szNameSpace, // Namespace.
136- LPCUTF8 szName); // Name.
137-
138- static
139- int MakePath ( // true ok, false out of memory
140- CQuickBytes &qb, // Where to put results.
141- LPCUTF8 szNameSpace, // Namespace for name.
142- LPCUTF8 szName); // Final part of name.
143-
144- static
145- int MakePath ( // true ok, false out of memory
146- CQuickArray<WCHAR> &qa, // Where to put results.
147- LPCUTF8 szNameSpace, // Namespace for name.
148- LPCUTF8 szName); // Final part of name.
149-
150- static
151- int MakePath ( // true ok, false out of memory
152- CQuickBytes &qb, // Where to put results.
153- const WCHAR *szNameSpace, // Namespace for name.
154- const WCHAR *szName); // Final part of name.
155-
156116static
157117void MakePath ( // throws on out of memory
158118 SString &ssBuf, // Where to put results.
@@ -176,46 +136,12 @@ bool MakeAssemblyQualifiedName( // true o
176136 int dwTypeName, // Number of characters (not including null)
177137 const WCHAR *szAssemblyName, // Final part of name.
178138 int dwAssemblyName); // Number of characters (not including null)
179-
180- static
181- int MakeNestedTypeName ( // true ok, false out of memory
182- CQuickBytes &qb, // Where to put results.
183- LPCUTF8 szEnclosingName, // Full name for enclosing type
184- LPCUTF8 szNestedName); // Full name for nested type
185-
186- static
187- int MakeNestedTypeName ( // true ok, false truncation.
188- _Out_writes_ (cchChars) LPUTF8 szOut, // output path for name.
189- int cchChars, // max chars for output path.
190- LPCUTF8 szEnclosingName, // Full name for enclosing type
191- LPCUTF8 szNestedName); // Full name for nested type
192-
193- static
194- void MakeNestedTypeName ( // throws on out of memory
195- SString &ssBuf, // output path for name.
196- const SString &ssEnclosingName, // Full name for enclosing type
197- const SString &ssNestedName); // Full name for nested type
198139}; // struct ns
199140
200- #ifndef NAMESPACE_SEPARATOR_CHAR
201141#define NAMESPACE_SEPARATOR_CHAR ' .'
202142#define NAMESPACE_SEPARATOR_WCHAR W (' .' )
203143#define NAMESPACE_SEPARATOR_STR " ."
204144#define NAMESPACE_SEPARATOR_WSTR W (" ." )
205- #define NAMESPACE_SEPARATOR_LEN 1
206- #define ASSEMBLY_SEPARATOR_CHAR ' ,'
207- #define ASSEMBLY_SEPARATOR_WCHAR W (' ,' )
208- #define ASSEMBLY_SEPARATOR_STR " , "
209- #define ASSEMBLY_SEPARATOR_WSTR W (" , " )
210- #define ASSEMBLY_SEPARATOR_LEN 2
211- #define NESTED_SEPARATOR_CHAR ' +'
212- #define NESTED_SEPARATOR_WCHAR W (' +' )
213- #define NESTED_SEPARATOR_STR " +"
214- #define NESTED_SEPARATOR_WSTR W (" +" )
215- #endif
216-
217- #define EMPTY_STR " "
218- #define EMPTY_WSTR W (" " )
219145
220146#define MAKE_FULL_PATH_ON_STACK_UTF8 (toptr, pnamespace, pname ) \
221147{ \
@@ -224,20 +150,11 @@ void MakeNestedTypeName( // throws on out of memory
224150 ns::MakePath (toptr, __i##toptr, pnamespace, pname); \
225151}
226152
227- #define MAKE_FULL_PATH_ON_STACK_UNICODE (toptr, pnamespace, pname ) \
228- { \
229- int __i##toptr = ns::GetFullLength (pnamespace, pname); \
230- toptr = (WCHAR *) alloca (__i##toptr * sizeof (WCHAR)); \
231- ns::MakePath (toptr, __i##toptr, pnamespace, pname); \
232- }
233-
234- #define MAKE_FULLY_QUALIFIED_NAME (pszFullyQualifiedName, pszNameSpace, pszName ) MAKE_FULL_PATH_ON_STACK_UTF8(pszFullyQualifiedName, pszNameSpace, pszName)
235-
236153#define MAKE_FULLY_QUALIFIED_MEMBER_NAME (ptr, pszNameSpace, pszClassName, pszMemberName, pszSig ) \
237154{ \
238155 int __i##ptr = ns::GetFullLength (pszNameSpace, pszClassName); \
239156 __i##ptr += (pszMemberName ? (int ) strlen (pszMemberName) : 0 ); \
240- __i##ptr += (NAMESPACE_SEPARATOR_LEN * 2 ) ; \
157+ __i##ptr += (int ) strlen (NAMESPACE_SEPARATOR_STR) * 2 ; \
241158 __i##ptr += (pszSig ? (int ) strlen (pszSig) : 0 ); \
242159 ptr = (LPUTF8) alloca (__i##ptr); \
243160 ns::MakePath (ptr, __i##ptr, pszNameSpace, pszClassName); \
@@ -252,12 +169,4 @@ void MakeNestedTypeName( // throws on out of memory
252169 } \
253170}
254171
255- #ifdef _PREFAST_
256- // need to eliminate the expansion of MAKE_FULLY_QUALIFIED_MEMBER_NAME in prefast
257- // builds to prevent it complaining about the potential for NULLs to strlen and strcat
258- #undef MAKE_FULLY_QUALIFIED_MEMBER_NAME
259- // need to set ptr=NULL so we don't get a build error because ptr isn't inited in a couple cases
260- #define MAKE_FULLY_QUALIFIED_MEMBER_NAME (ptr, pszNameSpace, pszClassName, pszMemberName, pszSig ) ptr=NULL ;
261- #endif
262-
263- #endif
172+ #endif // __NSUTILPRIV_H__
0 commit comments