Skip to content

Instantly share code, notes, and snippets.

@damurashov
Last active March 5, 2024 08:45
Show Gist options
  • Save damurashov/134566c21a9741714b97be71b8fcc82b to your computer and use it in GitHub Desktop.
Save damurashov/134566c21a9741714b97be71b8fcc82b to your computer and use it in GitHub Desktop.
`std::size_t` GTFO
#!/usr/bin/python3
import sys
def main():
filename = sys.argv[1]
print('got filename', filename)
with open(filename, 'r') as f:
content = f.read()
content = content.replace('cstddef', 'stddef.h')
content = content.replace('cstdint', 'stdint.h')
content = content.replace('std::size', 'size')
content = content.replace('std::int', 'int')
content = content.replace('std::uint', 'uint')
with open(filename, 'w') as f:
f.write(content)
if __name__ == "__main__":
main()
#!/bin/bash
find . -type f -name '*pp' | grep -v 'Libs/' | grep -v 'build_nuttx' | grep -vi 'lua' | xargs -n 1 realpath > /tmp/files.txt
cat /tmp/files.txt | xargs -n 1 oo-replace-sizet.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment