Reputation: 375
I have a very large code in which I have by mistake I have used unsigned
instead of uint64_t
. Due to this blunder my code does not work for large values greater than 4 byte. Now I want to recify this mistake...but it impossible for me to go into each file (there are 540 files) and replace unsigned
with uint64_t
. Is there some linux command or some automated method which may do it for me.
I just want to replace word unsigned
by uint64_t
. I dont want words like unsignedFunction
to get replaced by uint64_t
.
EDIT: When I replace it for functions of the following form:
static inline unsigned readUint32Aligned(const unsigned char* data) { return toHost(*reinterpret_cast<const unsigned*>(data)); }
The converted function being :
static inline uint64_t readUint32Aligned(const uint64_t char* data) { return toHost(*reinterpret_cast<const uint32_t*>(data)); }
It gives me the error:
error: ‘data’ was not declared in this scope
Is there something other than uint64_t
which I can do for replacing, which may work for functions of the above form?
Sorry there isn't its probably a typo.
Upvotes: 0
Views: 98
Reputation: 44706
Use sed
and the pattern s/\bunsigned\b/uint64_t/g
.
The \b
is the interesting bit. In regularl expressions, it matches word boundaries.
Upvotes: 2