Rev 5713 | Rev 6021 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 5713 | Rev 5803 | ||
---|---|---|---|
Line 11... | Line 11... | ||
11 | // strpbrk(dword text1,text2) --- example: strpbrk("this test", " ckfi") -> return "is test" |
11 | // strpbrk(dword text1,text2) --- example: strpbrk("this test", " ckfi") -> return "is test" |
12 | // strcmp( ESI, EDI) |
12 | // strcmp( ESI, EDI) |
13 | // strlen( EDI) |
13 | // strlen( EDI) |
14 | // utf8_strlen( ESI) |
14 | // utf8_strlen( ESI) |
15 | // strcpy( EDI, ESI) --- 0 if == |
15 | // strcpy( EDI, ESI) --- 0 if == |
16 | // strncpy(dword text1,text2,signed length) |
16 | // strlcpy(dword text1,text2,signed length) |
17 | // strcat( EDI, ESI) |
17 | // strcat( EDI, ESI) |
18 | // strncat(dword text1,text2,signed length) --- pasting the text of a certain length |
18 | // strncat(dword text1,text2,signed length) --- pasting the text of a certain length |
19 | // strchr( ESI,BL) --- find first BL |
19 | // strchr( ESI,BL) --- find first BL |
20 | // strrchr( ESI,BL) --- find last BL |
20 | // strrchr( ESI,BL) --- find last BL |
21 | // strstr( EBX, EDX) |
21 | // strstr( EBX, EDX) |
Line 214... | Line 214... | ||
214 | $stosb |
214 | $stosb |
215 | $test al,al |
215 | $test al,al |
216 | $jnz L2 |
216 | $jnz L2 |
217 | } |
217 | } |
Line 218... | Line -... | ||
218 | - | ||
219 | inline dword strncpy(dword text1, text2, signed len) |
- | |
220 | signed o1,o2; |
- | |
221 | { |
- | |
222 | if(!text1)||(!len) return text1; |
- | |
223 | if(len<4) |
- | |
224 | { |
- | |
225 | o2 = len; |
- | |
226 | goto RUN_BYTE; |
- | |
227 | } |
- | |
228 | o1 = len/4; |
- | |
229 | o2 = len-4*o1; |
- | |
230 | while(o1){ |
- | |
231 | DSDWORD[text1] = DSDWORD[text2]; |
- | |
232 | text1 += 4; |
- | |
233 | text2 += 4; |
- | |
234 | $dec o1 |
- | |
235 | } |
- | |
236 | RUN_BYTE: |
- | |
237 | while(o2){ |
- | |
238 | DSBYTE[text1] = DSBYTE[text2]; |
- | |
239 | $inc text1 |
- | |
240 | $inc text2 |
- | |
241 | $dec o2 |
- | |
242 | } |
- | |
243 | DSBYTE[text1] = 0; |
- | |
244 | return text1; |
- | |
245 | } |
- | |
246 | 218 | ||
247 | inline fastcall int strlcpy(dword ESI, EDI, EBX) |
219 | inline fastcall int strlcpy(dword ESI, EDI, EBX) |
248 | { |
220 | { |
249 | if (EBX<0) return -1; |
221 | if (EBX<0) return -1; |
250 | EDX=0; |
222 | EDX=0; |
Line 757... | Line 729... | ||
757 | inline dword strdup(dword text) |
729 | inline dword strdup(dword text) |
758 | { |
730 | { |
759 | dword l = strlen(text); |
731 | dword l = strlen(text); |
760 | dword ret = malloc(l+1); |
732 | dword ret = malloc(l+1); |
761 | if(!ret) return NULL; |
733 | if(!ret) return NULL; |
762 | strncpy(ret,text,l); |
734 | strlcpy(ret,text,l); |
763 | return ret; |
735 | return ret; |
764 | } |
736 | } |
Line 765... | Line 737... | ||
765 | 737 | ||
766 | inline dword strndup(dword str, signed maxlen) |
738 | inline dword strndup(dword str, signed maxlen) |
Line 769... | Line 741... | ||
769 | 741 | ||
770 | len = strnlen(str, maxlen); |
742 | len = strnlen(str, maxlen); |
771 | copy = malloc(len + 1); |
743 | copy = malloc(len + 1); |
772 | if (copy != NULL) |
744 | if (copy != NULL) |
773 | { |
745 | { |
774 | strncpy(copy, str, len); |
746 | strlcpy(copy, str, len); |
775 | DSBYTE[len+copy] = '\0'; |
747 | DSBYTE[len+copy] = '\0'; |
776 | } |
748 | } |
777 | return copy; |
749 | return copy; |