Skip to content

Commit 236cd36

Browse files
flichtenheldcron2
authored andcommitted
Apply text-removal.sh script to Windows codebase
Change-Id: I8f53c49b885c7c9e36a78ca434ec021e6dc347e0 Signed-off-by: Frank Lichtenheld <[email protected]> Acked-by: Gert Doering <[email protected]> Message-Id: <[email protected]> URL: https://www.mail-archive.com/[email protected]/msg31159.html Signed-off-by: Gert Doering <[email protected]>
1 parent db48cea commit 236cd36

File tree

16 files changed

+499
-499
lines changed

16 files changed

+499
-499
lines changed

src/openvpnmsica/dllmain.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#pragma comment(lib, "msi.lib")
3333
#endif
3434
#include <stdio.h>
35-
#include <tchar.h>
35+
#include <wchar.h>
3636

3737

3838
DWORD openvpnmsica_thread_data_idx = TLS_OUT_OF_INDEXES;
@@ -160,13 +160,13 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist)
160160
MsiRecordSetInteger(hRecordProg, 3, dwResult);
161161

162162
/* Field 4: The Windows error description. */
163-
LPTSTR szErrMessage = NULL;
163+
LPWSTR szErrMessage = NULL;
164164
if (FormatMessage(
165165
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_IGNORE_INSERTS,
166166
0,
167167
dwResult,
168168
0,
169-
(LPTSTR)&szErrMessage,
169+
(LPWSTR)&szErrMessage,
170170
0,
171171
NULL) && szErrMessage)
172172
{
@@ -175,7 +175,7 @@ x_msg_va(const unsigned int flags, const char *format, va_list arglist)
175175
{
176176
if (szErrMessage[i])
177177
{
178-
if (!_istspace(szErrMessage[i]))
178+
if (!iswspace(szErrMessage[i]))
179179
{
180180
i_last = i + 1;
181181
}

src/openvpnmsica/msica_arg.c

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ msica_arg_seq_free(_Inout_ struct msica_arg_seq *seq)
5454
void
5555
msica_arg_seq_add_head(
5656
_Inout_ struct msica_arg_seq *seq,
57-
_In_z_ LPCTSTR argument)
57+
_In_z_ LPCWSTR argument)
5858
{
59-
size_t argument_size = (_tcslen(argument) + 1) * sizeof(TCHAR);
59+
size_t argument_size = (wcslen(argument) + 1) * sizeof(WCHAR);
6060
struct msica_arg *p = malloc(sizeof(struct msica_arg) + argument_size);
6161
if (p == NULL)
6262
{
@@ -75,9 +75,9 @@ msica_arg_seq_add_head(
7575
void
7676
msica_arg_seq_add_tail(
7777
_Inout_ struct msica_arg_seq *seq,
78-
_Inout_ LPCTSTR argument)
78+
_Inout_ LPCWSTR argument)
7979
{
80-
size_t argument_size = (_tcslen(argument) + 1) * sizeof(TCHAR);
80+
size_t argument_size = (wcslen(argument) + 1) * sizeof(WCHAR);
8181
struct msica_arg *p = malloc(sizeof(struct msica_arg) + argument_size);
8282
if (p == NULL)
8383
{
@@ -90,19 +90,19 @@ msica_arg_seq_add_tail(
9090
}
9191

9292

93-
LPTSTR
93+
LPWSTR
9494
msica_arg_seq_join(_In_ const struct msica_arg_seq *seq)
9595
{
9696
/* Count required space. */
9797
size_t size = 2 /*x + zero-terminator*/;
9898
for (struct msica_arg *p = seq->head; p != NULL; p = p->next)
9999
{
100-
size += _tcslen(p->val) + 1 /*space delimiter|zero-terminator*/;
100+
size += wcslen(p->val) + 1 /*space delimiter|zero-terminator*/;
101101
}
102-
size *= sizeof(TCHAR);
102+
size *= sizeof(WCHAR);
103103

104104
/* Allocate. */
105-
LPTSTR str = malloc(size);
105+
LPWSTR str = malloc(size);
106106
if (str == NULL)
107107
{
108108
msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, size);
@@ -115,18 +115,18 @@ msica_arg_seq_join(_In_ const struct msica_arg_seq *seq)
115115
#endif
116116

117117
/* Dummy argv[0] (i.e. executable name), for CommandLineToArgvW to work correctly when parsing this string. */
118-
_tcscpy(str, TEXT("x"));
118+
wcscpy(str, L"x");
119119

120120
/* Join. */
121-
LPTSTR s = str + 1 /*x*/;
121+
LPWSTR s = str + 1 /*x*/;
122122
for (struct msica_arg *p = seq->head; p != NULL; p = p->next)
123123
{
124124
/* Convert zero-terminator into space delimiter. */
125-
s[0] = TEXT(' ');
125+
s[0] = L' ';
126126
s++;
127127
/* Append argument. */
128-
_tcscpy(s, p->val);
129-
s += _tcslen(p->val);
128+
wcscpy(s, p->val);
129+
s += wcslen(p->val);
130130
}
131131

132132
#ifdef _MSC_VER

src/openvpnmsica/msica_arg.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
#define MSICA_ARG_H
2323

2424
#include <windows.h>
25-
#include <tchar.h>
25+
#include <wchar.h>
2626
#include "../tapctl/basic.h"
2727

2828

@@ -38,7 +38,7 @@
3838
struct msica_arg
3939
{
4040
struct msica_arg *next; /**< Pointer to the next argument in the sequence */
41-
TCHAR val[]; /**< Zero terminated argument string */
41+
WCHAR val[]; /**< Zero terminated argument string */
4242
};
4343

4444

@@ -80,7 +80,7 @@ msica_arg_seq_free(_Inout_ struct msica_arg_seq *seq);
8080
void
8181
msica_arg_seq_add_head(
8282
_Inout_ struct msica_arg_seq *seq,
83-
_In_z_ LPCTSTR argument);
83+
_In_z_ LPCWSTR argument);
8484

8585

8686
/**
@@ -93,7 +93,7 @@ msica_arg_seq_add_head(
9393
void
9494
msica_arg_seq_add_tail(
9595
_Inout_ struct msica_arg_seq *seq,
96-
_Inout_ LPCTSTR argument);
96+
_Inout_ LPCWSTR argument);
9797

9898
/**
9999
* Join arguments of the argument sequence into a space delimited string
@@ -102,7 +102,7 @@ msica_arg_seq_add_tail(
102102
*
103103
* @return Joined argument string. Must be released with free() after use.
104104
*/
105-
LPTSTR
105+
LPWSTR
106106
msica_arg_seq_join(_In_ const struct msica_arg_seq *seq);
107107

108108
#ifdef _MSC_VER

src/openvpnmsica/msiex.c

Lines changed: 24 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -37,38 +37,38 @@
3737
UINT
3838
msi_get_string(
3939
_In_ MSIHANDLE hInstall,
40-
_In_z_ LPCTSTR szName,
41-
_Out_ LPTSTR *pszValue)
40+
_In_z_ LPCWSTR szName,
41+
_Out_ LPWSTR *pszValue)
4242
{
4343
if (pszValue == NULL)
4444
{
4545
return ERROR_BAD_ARGUMENTS;
4646
}
4747

4848
/* Try with stack buffer first. */
49-
TCHAR szBufStack[128];
49+
WCHAR szBufStack[128];
5050
DWORD dwLength = _countof(szBufStack);
5151
UINT uiResult = MsiGetProperty(hInstall, szName, szBufStack, &dwLength);
5252
if (uiResult == ERROR_SUCCESS)
5353
{
5454
/* Copy from stack. */
55-
*pszValue = (LPTSTR)malloc(++dwLength * sizeof(TCHAR));
55+
*pszValue = (LPWSTR)malloc(++dwLength * sizeof(WCHAR));
5656
if (*pszValue == NULL)
5757
{
58-
msg(M_FATAL, "%s: malloc(%u) failed", dwLength * sizeof(TCHAR));
58+
msg(M_FATAL, "%s: malloc(%u) failed", dwLength * sizeof(WCHAR));
5959
return ERROR_OUTOFMEMORY;
6060
}
6161

62-
memcpy(*pszValue, szBufStack, dwLength * sizeof(TCHAR));
62+
memcpy(*pszValue, szBufStack, dwLength * sizeof(WCHAR));
6363
return ERROR_SUCCESS;
6464
}
6565
else if (uiResult == ERROR_MORE_DATA)
6666
{
6767
/* Allocate on heap and retry. */
68-
LPTSTR szBufHeap = (LPTSTR)malloc(++dwLength * sizeof(TCHAR));
68+
LPWSTR szBufHeap = (LPWSTR)malloc(++dwLength * sizeof(WCHAR));
6969
if (szBufHeap == NULL)
7070
{
71-
msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, dwLength * sizeof(TCHAR));
71+
msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, dwLength * sizeof(WCHAR));
7272
return ERROR_OUTOFMEMORY;
7373
}
7474

@@ -96,37 +96,37 @@ UINT
9696
msi_get_record_string(
9797
_In_ MSIHANDLE hRecord,
9898
_In_ unsigned int iField,
99-
_Out_ LPTSTR *pszValue)
99+
_Out_ LPWSTR *pszValue)
100100
{
101101
if (pszValue == NULL)
102102
{
103103
return ERROR_BAD_ARGUMENTS;
104104
}
105105

106106
/* Try with stack buffer first. */
107-
TCHAR szBufStack[128];
107+
WCHAR szBufStack[128];
108108
DWORD dwLength = _countof(szBufStack);
109109
UINT uiResult = MsiRecordGetString(hRecord, iField, szBufStack, &dwLength);
110110
if (uiResult == ERROR_SUCCESS)
111111
{
112112
/* Copy from stack. */
113-
*pszValue = (LPTSTR)malloc(++dwLength * sizeof(TCHAR));
113+
*pszValue = (LPWSTR)malloc(++dwLength * sizeof(WCHAR));
114114
if (*pszValue == NULL)
115115
{
116-
msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, dwLength * sizeof(TCHAR));
116+
msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, dwLength * sizeof(WCHAR));
117117
return ERROR_OUTOFMEMORY;
118118
}
119119

120-
memcpy(*pszValue, szBufStack, dwLength * sizeof(TCHAR));
120+
memcpy(*pszValue, szBufStack, dwLength * sizeof(WCHAR));
121121
return ERROR_SUCCESS;
122122
}
123123
else if (uiResult == ERROR_MORE_DATA)
124124
{
125125
/* Allocate on heap and retry. */
126-
LPTSTR szBufHeap = (LPTSTR)malloc(++dwLength * sizeof(TCHAR));
126+
LPWSTR szBufHeap = (LPWSTR)malloc(++dwLength * sizeof(WCHAR));
127127
if (szBufHeap == NULL)
128128
{
129-
msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, dwLength * sizeof(TCHAR));
129+
msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, dwLength * sizeof(WCHAR));
130130
return ERROR_OUTOFMEMORY;
131131
}
132132

@@ -154,37 +154,37 @@ UINT
154154
msi_format_record(
155155
_In_ MSIHANDLE hInstall,
156156
_In_ MSIHANDLE hRecord,
157-
_Out_ LPTSTR *pszValue)
157+
_Out_ LPWSTR *pszValue)
158158
{
159159
if (pszValue == NULL)
160160
{
161161
return ERROR_BAD_ARGUMENTS;
162162
}
163163

164164
/* Try with stack buffer first. */
165-
TCHAR szBufStack[128];
165+
WCHAR szBufStack[128];
166166
DWORD dwLength = _countof(szBufStack);
167167
UINT uiResult = MsiFormatRecord(hInstall, hRecord, szBufStack, &dwLength);
168168
if (uiResult == ERROR_SUCCESS)
169169
{
170170
/* Copy from stack. */
171-
*pszValue = (LPTSTR)malloc(++dwLength * sizeof(TCHAR));
171+
*pszValue = (LPWSTR)malloc(++dwLength * sizeof(WCHAR));
172172
if (*pszValue == NULL)
173173
{
174-
msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, dwLength * sizeof(TCHAR));
174+
msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, dwLength * sizeof(WCHAR));
175175
return ERROR_OUTOFMEMORY;
176176
}
177177

178-
memcpy(*pszValue, szBufStack, dwLength * sizeof(TCHAR));
178+
memcpy(*pszValue, szBufStack, dwLength * sizeof(WCHAR));
179179
return ERROR_SUCCESS;
180180
}
181181
else if (uiResult == ERROR_MORE_DATA)
182182
{
183183
/* Allocate on heap and retry. */
184-
LPTSTR szBufHeap = (LPTSTR)malloc(++dwLength * sizeof(TCHAR));
184+
LPWSTR szBufHeap = (LPWSTR)malloc(++dwLength * sizeof(WCHAR));
185185
if (szBufHeap == NULL)
186186
{
187-
msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, dwLength * sizeof(TCHAR));
187+
msg(M_FATAL, "%s: malloc(%u) failed", __FUNCTION__, dwLength * sizeof(WCHAR));
188188
return ERROR_OUTOFMEMORY;
189189
}
190190

@@ -213,15 +213,15 @@ msi_format_field(
213213
_In_ MSIHANDLE hInstall,
214214
_In_ MSIHANDLE hRecord,
215215
_In_ unsigned int iField,
216-
_Out_ LPTSTR *pszValue)
216+
_Out_ LPWSTR *pszValue)
217217
{
218218
if (pszValue == NULL)
219219
{
220220
return ERROR_BAD_ARGUMENTS;
221221
}
222222

223223
/* Read string to format. */
224-
LPTSTR szValue = NULL;
224+
LPWSTR szValue = NULL;
225225
UINT uiResult = msi_get_record_string(hRecord, iField, &szValue);
226226
if (uiResult != ERROR_SUCCESS)
227227
{

src/openvpnmsica/msiex.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
UINT
4242
msi_get_string(
4343
_In_ MSIHANDLE hInstall,
44-
_In_z_ LPCTSTR szName,
45-
_Out_ LPTSTR *pszValue);
44+
_In_z_ LPCWSTR szName,
45+
_Out_ LPWSTR *pszValue);
4646

4747

4848
/**
@@ -61,7 +61,7 @@ UINT
6161
msi_get_record_string(
6262
_In_ MSIHANDLE hRecord,
6363
_In_ unsigned int iField,
64-
_Out_ LPTSTR *pszValue);
64+
_Out_ LPWSTR *pszValue);
6565

6666

6767
/**
@@ -83,7 +83,7 @@ UINT
8383
msi_format_record(
8484
_In_ MSIHANDLE hInstall,
8585
_In_ MSIHANDLE hRecord,
86-
_Out_ LPTSTR *pszValue);
86+
_Out_ LPWSTR *pszValue);
8787

8888

8989
/**
@@ -107,6 +107,6 @@ msi_format_field(
107107
_In_ MSIHANDLE hInstall,
108108
_In_ MSIHANDLE hRecord,
109109
_In_ unsigned int iField,
110-
_Out_ LPTSTR *pszValue);
110+
_Out_ LPWSTR *pszValue);
111111

112112
#endif /* ifndef MSIHLP_H */

0 commit comments

Comments
 (0)