mirror of
https://github.com/transmission/transmission.git
synced 2026-04-22 09:49:05 +01:00
Ongoing refactoring (use size_t instead of int)
This commit is contained in:
@@ -43,6 +43,9 @@
|
||||
#include <stdio.h>
|
||||
#endif
|
||||
#include <string.h> /* strlen () */
|
||||
|
||||
#include "transmission.h"
|
||||
|
||||
#include "ConvertUTF.h"
|
||||
|
||||
static const int halfShift = 10; /* used for shifting by 10 bits */
|
||||
@@ -350,7 +353,7 @@ Boolean isLegalUTF8Sequence (const UTF8 *source, const UTF8 *sourceEnd) {
|
||||
* In addition to knowing if the sequence is legal, it also tells you the last good character.
|
||||
*/
|
||||
Boolean
|
||||
tr_utf8_validate (const char * str, int max_len, const char ** end)
|
||||
tr_utf8_validate (const char * str, size_t max_len, const char ** end)
|
||||
{
|
||||
const UTF8* source = (const UTF8*) str;
|
||||
const UTF8* sourceEnd;
|
||||
@@ -361,7 +364,7 @@ tr_utf8_validate (const char * str, int max_len, const char ** end)
|
||||
if (str == NULL)
|
||||
return false;
|
||||
|
||||
sourceEnd = source + ((max_len < 0) ? strlen (str) : (size_t)max_len);
|
||||
sourceEnd = source + (max_len == TR_BAD_SIZE ? strlen (str) : max_len);
|
||||
|
||||
if (source == sourceEnd)
|
||||
{
|
||||
@@ -390,8 +393,6 @@ tr_utf8_validate (const char * str, int max_len, const char ** end)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user