Skip to contentSkip to conversation

Change in openvpn[master]: dev-tools/text-removal.sh: Script to remove usage of tchar.h

Openvpn-devel flichtenheld (Code Review) 1 participant 3 messages Jan 8, 2025 – Mar 19, 2025 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): gerrit.1736341120000.I4879f983ed6cc035cd6ad8d571e00eb14f9ffdc1@...2715...

#1 lore raw

Attention is currently required from: plaisthos.

Hello plaisthos,

I'd like you to do a code review.
Please visit

    http://gerrit.openvpn.net/c/openvpn/+/852?usp=email

to review the following change.

Change subject: dev-tools/text-removal.sh: Script to remove usage of tchar.h
......................................................................

dev-tools/text-removal.sh: Script to remove usage of tchar.h

We only support UNICODE builds anyway, so why make some part of the code pretend that they do not. The code is more readable when removing the unused compatibility layer.

This script to be removed again once the conversion is completed.

Change-Id I4879f983ed6cc035cd6ad8d571e00eb14f9ffdc1

---
A dev-tools/text-removal.sh

1 file changed, 51 insertions(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/openvpn refs/changes/52/852/1

dev-tools/text-removal.sh new file +51 -0
new file mode 100755
index 0000000..7b4e863
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+# Replace all occurences of TEXT() in our codebase
+# to convert it to simpler Unicode-only code.
+
+set -x
+
+sed -i -E \
+	-e 's/TEXT\(("[^"]*")\)/L\1/g' \
+	-e 's/TEXT\(([^)]*)\)/L\1/g' \
+        -e 's/_T\(/_L(/g' \
+	-e 's/" LPRIsLPTSTR L"/ls/g' \
+	-e 's/" LPRIsLPTSTR/ls"/g' \
+	-e 's/LPRIsLPTSTR L"/L"ls/g' \
+	-e 's/" LPRIsLPOLESTR L"/ls/g' \
+	-e 's/LPRIsLPOLESTR L"/L"ls/g' \
+	-e 's/" LPRIsLPOLESTR/ls"/g' \
+	-e 's/" PRIsLPTSTR "/ls/g' \
+	-e 's/" PRIsLPOLESTR "/ls/g' \
+	-e 's/TCHAR/WCHAR/g' \
+	-e 's/LPTSTR/LPWSTR/g' \
+	-e 's/LPCTSTR/LPCWSTR/g' \
+	-e 's/LPRIXGUID/_L(PRIXGUID)/g' \
+	-e 's/LTAP_WIN_COMPONENT_ID/_L(TAP_WIN_COMPONENT_ID)/g' \
+	-e 's/LPACKAGE_(VERSION|NAME)/_L(PACKAGE_\1)/g' \
+        -e 's/LPACKAGE /_L(PACKAGE) /g' \
+	-e 's/_tcslen/wcslen/g' \
+        -e 's/_tcszlen/wcszlen/g' \
+	-e 's/_tcsrchr/wcsrchr/g' \
+	-e 's/_tcschr/wcschr/g' \
+	-e 's/_tcsstr/wcsstr/g' \
+	-e 's/_tcszistr/wcszistr/g' \
+        -e 's/_tcscpy/wcscpy/g' \
+        -e 's/_tcsicmp/wcsicmp/g' \
+        -e 's/_tcsdup/wcsdup/g' \
+        -e 's/_istspace/iswspace/g' \
+        -e 's/_stprintf/swprintf/g' \
+        -e 's/_ftprintf/fwprintf/g' \
+        -e 's/_tmain/wmain/g' \
+        -e 's/tchar\.h/wchar.h/g' \
+	src/openvpnmsica/*.[ch] \
+        src/openvpnserv/*.[ch] \
+        src/tapctl/*.[ch]
+
+# manual cleanup for complicated cases
+sed -i -E \
+    -e 's/error 0x%x.\\n"\),/error 0x%x).\\n",/g' \
+    src/tapctl/main.c
+sed -i -E \
+    -e 's/" is optional\\n"\),/") is optional\\n",/g' \
+    src/openvpnserv/service.c

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/852?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4879f983ed6cc035cd6ad8d571e00eb14f9ffdc1
Gerrit-Change-Number: 852
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-MessageType: newchange

#2 lore raw
In reply to a message not in the archive

Attention is currently required from: plaisthos.

flichtenheld has posted comments on this change. ( http://gerrit.openvpn.net/c/openvpn/+/852?usp=email )

Change subject: dev-tools/text-removal.sh: Script to remove usage of tchar.h
......................................................................

Patch Set 2:

This change is ready for review.

--
To view, visit http://gerrit.openvpn.net/c/openvpn/+/852?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4879f983ed6cc035cd6ad8d571e00eb14f9ffdc1
Gerrit-Change-Number: 852
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-Attention: plaisthos <[email protected]...>
Gerrit-Comment-Date: Tue, 18 Mar 2025 12:17:45 +0000
Gerrit-HasComments: No
Gerrit-Has-Labels: No
Gerrit-MessageType: comment

#3 lore raw
In reply to a message not in the archive

flichtenheld has abandoned this change. ( http://gerrit.openvpn.net/c/openvpn/+/852?usp=email )

Change subject: dev-tools/text-removal.sh: Script to remove usage of tchar.h
......................................................................

Abandoned

Not actually required to commit script to remove it immediately afterwards. It will remain documented in Gerrit and on the list. --
To view, visit http://gerrit.openvpn.net/c/openvpn/+/852?usp=email
To unsubscribe, or for help writing mail filters, visit http://gerrit.openvpn.net/settings

Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4879f983ed6cc035cd6ad8d571e00eb14f9ffdc1
Gerrit-Change-Number: 852
Gerrit-PatchSet: 2
Gerrit-Owner: flichtenheld <[email protected]...>
Gerrit-Reviewer: plaisthos <[email protected]...>
Gerrit-CC: openvpn-devel <[email protected]>
Gerrit-MessageType: abandon