22.06.2016, 07:10
Quote:
Yes, each pawn cell is of 4 bytes. But do you really think that strings in the abstract machine are in a such simple format?
|
Of course, that code won't work with packed strings and I don't use packed strings so I won't need to add support for that.
I have many more algorithms which work on arrays which use the exact same method (directly modifying the contents through pointers) and they work.
Quote:
Try using amx_GetString and check whether you get same results or not.
|
Quote:
EDIT:
Shouldn't this: string_strncpy(AMX amx, cell params) be: string_strncpy(AMX* amx, cell* params) ? |
Here is a copy from the actual source.
Code:
cell AMX_NATIVE_CALL string_strncpy(AMX* amx, cell* params) { cell* dest = NULL; cell* source = NULL; amx_GetAddr(amx, params[1], &dest); amx_GetAddr(amx, params[2], &source); int num = static_cast<int>(params[3]); unsigned int size_dest = static_cast<unsigned int>(params[4]); unsigned int size_src = static_cast<unsigned int>(params[5]); while (num-- && size_dest-- && size_src--) { logprintf("%d", *(source)); *dest++ = *source++; } *dest = 0; return 0; }
wtf I sware I did not change the code at all =,= the array size is 11 and it works today -_-
Code:
[13:05:59] t [13:05:59] e [13:05:59] s [13:05:59] t [13:05:59] [13:05:59] s [13:05:59] t [13:05:59] r [13:05:59] i [13:05:59] n [13:05:59] test strin