Skip to content
Browse files

Go back to using StringLength.

  • Loading branch information...
1 parent f7204dd commit d886b38897595698f5ed59e88c5dc25c11d8dbd6 @meh meh committed May 16, 2011
Showing with 3 additions and 4 deletions.
  1. +3 −4 src/protocols/survival/Buffer.c
View
7 src/protocols/survival/Buffer.c
@@ -128,10 +128,9 @@ SV_BufferAddString16 (CDBuffer* self, CDString* data)
evbuffer_add(self->raw, &size, SVShortSize);
- size_t len = CD_StringLength(sanitized);
- int16_t* ucs2 = CD_alloc(len * sizeof(int16_t));
+ int16_t* ucs2 = CD_alloc(CD_StringLength(sanitized) * sizeof(int16_t));
- for (size_t i = 0; i < len; i++) {
+ for (size_t i = 0; i < CD_StringLength(sanitized); i++) {
CDString* ch = CD_CharAt(sanitized, i);
const char* input = CD_StringContent(ch);
short uch = 0;
@@ -164,7 +163,7 @@ SV_BufferAddString16 (CDBuffer* self, CDString* data)
ucs2[i] = htons(uch);
}
- evbuffer_add(self->raw, ucs2, len * sizeof(int16_t));
+ evbuffer_add(self->raw, ucs2, CD_StringLength(sanitized) * sizeof(int16_t));
CD_free(ucs2);
CD_DestroyString(sanitized);

0 comments on commit d886b38

Please sign in to comment.
Something went wrong with that request. Please try again.