From: "flichtenheld (Code Review)" Date: Wed, 8 Jan 2025 12:58:51 +0000 References: Reply-To: frank@...2641..., arne-openvpn@...1227..., openvpn-devel@lists.sourceforge.net Message-ID: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Disposition: inline Content-Type: multipart/alternative; boundary="4edq6CAU9Vg="; charset=UTF-8 Subject: [Openvpn-devel] [M] Change in openvpn[master]: dev-tools/text-removal.sh: Script to remove usage of tchar.h List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: plaisthos Cc: openvpn-devel --4edq6CAU9Vg= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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=3Demail 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 Signed-off-by: Frank Lichtenheld --- 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 diff --git a/dev-tools/text-removal.sh b/dev-tools/text-removal.sh new file mode 100755 index 0000000..7b4e863 --- /dev/null +++ b/dev-tools/text-removal.sh @@ -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=3Demail To unsubscribe, or for help writing mail filters, visit http://gerrit.openv= pn.net/settings Gerrit-Project: openvpn Gerrit-Branch: master Gerrit-Change-Id: I4879f983ed6cc035cd6ad8d571e00eb14f9ffdc1 Gerrit-Change-Number: 852 Gerrit-PatchSet: 1 Gerrit-Owner: flichtenheld Gerrit-Reviewer: plaisthos Gerrit-CC: openvpn-devel Gerrit-Attention: plaisthos Gerrit-MessageType: newchange --4edq6CAU9Vg= Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable

Attention is currently required from: plaisthos.

flichtenheld would like plaisthos to review this change.

Vi= ew Change

dev-tools/text-removal.sh: Script to remove usage of tchar.h<=
br>
We only support UNICODE builds anyway, so why make some
part of t= he code pretend that they do not. The code is
more readable when removin= g the unused compatibility layer.

This script to be removed again on= ce the conversion is
completed.

Change-Id: I4879f983ed6cc035cd6ad= 8d571e00eb14f9ffdc1
Signed-off-by: Frank Lichtenheld <frank@...2723...= .>
---
A dev-tools/text-removal.sh
1 file changed, 51 insertion= s(+), 0 deletions(-)

git pull ssh://gerrit.openvpn.net:29418/open=
vpn refs/changes/52/852/1
diff --git a/dev-tools/text-removal.sh b/=
dev-tools/text-removal.sh
new file mode 100755
index 0000000..7b4e863
--- /dev/null
++= + b/dev-tools/text-removal.sh
@@ -0,0 +1,51 @@
+#!/bin/bash
+
+# Replace all occurences of TEXT() in our codebase+# to convert it to simpler U= nicode-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&= quot;/g' \

+ -e &= #39;s/LPRIsLPTSTR L"/L"ls/g' \
+ -e 's/" LPRIsLPOLESTR L"/ls/g' = \
+ -e 's/LPRIsLP= OLESTR L"/L"ls/g' \
+ -e 's/" LPRIsLPOLESTR/ls"/g' \
<= span style=3D"color: hsl(120, 100%, 40%);">+ -e 's/" PRIsLPTSTR &q= uot;/ls/g' \
+ -e= 's/" PRIsLPOLESTR "/ls/g' \
+ -e 's/TCHAR/WCHAR/g' \
+ -e 's/LPTSTR/LPWSTR/g' \

+ -e 's/LPCTSTR/LPC= WSTR/g' \
+ -e &#= 39;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/_tcsle= n/wcslen/g' \
+ = -e 's/_tcszlen/wcszlen/g' \
+ -e 's/_tcsrchr/wcsrchr/g' \
+ -e 's/_tcschr/wcschr/g' \
+ -e 's/_tcsstr/wc= sstr/g' \
+ -e &#= 39;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= 9; \
+ -e '= ;s/_ftprintf/fwprintf/g' \
+ -e 's/_tmain/wmain/g' \
+ -e 's/tchar\.h/wchar.h/g' \<= /span>
+ src/openvpnmsica/*.= [ch] \
+ src/o= penvpnserv/*.[ch] \
+= src/tapctl/*.[ch]
+
+# manual clea= nup for complicated cases
+sed -i -E \
+ = -e 's/error 0x%x.\\n"\),/error 0x%x).\\n",/g' \<= br>+ src/tapctl/main.c
+sed -i -E \
+ -e 's/" is optional\= \n"\),/") is optional\\n",/g' \

+ src/openvpnserv/service.c

To view, visit change 852. To unsubscribe, or for help wri= ting mail filters, visit set= tings.

=
Gerrit-Project: openvpn
Gerrit-Branch: master
Gerrit-Change-Id: I4879f983ed6cc035cd6ad8d571e= 00eb14f9ffdc1
Gerrit-Change-Number: 852
Gerrit-PatchSet: 1
Gerrit-Owner: flichtenheld <frank@...2723...= .>
Gerrit-Reviewer: plaisthos <arne-openvpn@...1186...= .1227...>
Gerrit-CC: openvpn-devel <openvpn-devel@...1484...= ts.sourceforge.net>
Gerrit-Attention: plaisthos <arne-openvpn@...220...= ..1227...>
Gerrit-MessageType: newchange
--4edq6CAU9Vg=--