[Openvpn-devel,M] Change in openvpn[master]: dev-tools/text-removal.sh: Script to remove usage of tchar.h
Commit Message
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
Signed-off-by: Frank Lichtenheld <frank@lichtenheld.com>
---
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
new file mode 100755
@@ -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