return INVALID_CODEPOINT if the next character cannot be converted
*/
-_PUBLIC_ codepoint_t next_codepoint(struct smb_iconv_convenience *ic,
+_PUBLIC_ codepoint_t next_codepoint_convenience(struct smb_iconv_convenience *ic,
const char *str, size_t *size)
{
/* it cannot occupy more than 4 bytes in UTF16 format */
extern struct smb_iconv_convenience *global_iconv_convenience;
+_PUBLIC_ codepoint_t next_codepoint(const char *str, size_t *size);
+
/* codepoints */
-codepoint_t next_codepoint(struct smb_iconv_convenience *ic,
+codepoint_t next_codepoint_convenience(struct smb_iconv_convenience *ic,
const char *str, size_t *size);
ssize_t push_codepoint(struct smb_iconv_convenience *ic,
char *str, codepoint_t c);
buf[size+2] = random();
buf[size+3] = random();
- c = next_codepoint(lp_iconv_convenience(tctx->lp_ctx), (char *)buf, &size2);
+ c = next_codepoint_convenience(lp_iconv_convenience(tctx->lp_ctx), (char *)buf, &size2);
torture_assert(tctx, c == codepoint,
talloc_asprintf(tctx,
if (s2 == NULL) return 1;
while (*s1 && *s2) {
- c1 = next_codepoint(iconv_convenience, s1, &size1);
- c2 = next_codepoint(iconv_convenience, s2, &size2);
+ c1 = next_codepoint_convenience(iconv_convenience, s1, &size1);
+ c2 = next_codepoint_convenience(iconv_convenience, s2, &size2);
s1 += size1;
s2 += size2;
while (*s1 && *s2 && n) {
n--;
- c1 = next_codepoint(iconv_convenience, s1, &size1);
- c2 = next_codepoint(iconv_convenience, s2, &size2);
+ c1 = next_codepoint_convenience(iconv_convenience, s1, &size1);
+ c2 = next_codepoint_convenienceconv_convenience, s2, &size2);
s1 += size1;
s2 += size2;
struct smb_iconv_convenience *ic = get_iconv_convenience();
while (s && *s) {
size_t size;
- codepoint_t c = next_codepoint(ic, s, &size);
+ codepoint_t c = next_codepoint_convenience(ic, s, &size);
if (c == oldc) {
*s = newc;
}
while (*s) {
size_t size;
- codepoint_t c2 = next_codepoint(ic, s, &size);
+ codepoint_t c2 = next_codepoint_convenience(ic, s, &size);
if (c2 == c) {
return discard_const_p(char, s);
}
codepoint_t s;
codepoint_t t;
- s = next_codepoint(ic, string, &c_size);
+ s = next_codepoint_convenience(ic, string, &c_size);
string += c_size;
t = toupper_m(s);
codepoint_t s;
codepoint_t t;
- s = next_codepoint(ic, string, &c_size);
+ s = next_codepoint_convenience(ic, string, &c_size);
string += c_size;
t = tolower_m(s);
while (*src) {
size_t c_size;
- codepoint_t c = next_codepoint(iconv_convenience, src, &c_size);
+ codepoint_t c = next_codepoint_convenience(iconv_convenience, src, &c_size);
src += c_size;
c = tolower_m(c);
while (*s) {
size_t c_size, c_size2;
- codepoint_t c = next_codepoint(iconv_convenience, s, &c_size);
+ codepoint_t c = next_codepoint_convenience(iconv_convenience, s, &c_size);
c_size2 = push_codepoint(iconv_convenience, d, tolower_m(c));
if (c_size2 > c_size) {
DEBUG(0,("FATAL: codepoint 0x%x (0x%x) expanded from %d to %d bytes in strlower_m\n",
while (*s) {
size_t c_size, c_size2;
- codepoint_t c = next_codepoint(iconv_convenience, s, &c_size);
+ codepoint_t c = next_codepoint_convenience(iconv_convenience, s, &c_size);
c_size2 = push_codepoint(iconv_convenience, d, toupper_m(c));
if (c_size2 > c_size) {
DEBUG(0,("FATAL: codepoint 0x%x (0x%x) expanded from %d to %d bytes in strupper_m\n",
while (*s) {
size_t size;
- codepoint_t c2 = next_codepoint(ic, s, &size);
+ codepoint_t c2 = next_codepoint_convenience(ic, s, &size);
if (c2 == c) count++;
s += size;
}
return convert_string_talloc_convenience(ctx, get_iconv_convenience(),
from, to, src, srclen, dest);
}
+
+
+_PUBLIC_ codepoint_t next_codepoint(const char *str, size_t *size)
+{
+ return next_codepoint_convenience(get_iconv_convenience(), str, size);
+}
codepoint_t c, c2;
int i;
size_t size, size_n;
- struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
- while ((c = next_codepoint(iconv_convenience, p, &size))) {
+ while ((c = next_codepoint(p, &size))) {
p += size;
switch (c) {
return null_match(p);
}
for (i=0; n[i]; i += size_n) {
- next_codepoint(iconv_convenience, n+i, &size_n);
+ next_codepoint(n+i, &size_n);
if (ms_fnmatch_core(p, n+i, max_n+1, ldot) == 0) {
return 0;
}
return -1;
}
for (i=0; n[i]; i += size_n) {
- next_codepoint(iconv_convenience, n+i, &size_n);
+ next_codepoint(n+i, &size_n);
if (ms_fnmatch_core(p, n+i, max_n+1, ldot) == 0) return 0;
if (n+i == ldot) {
if (ms_fnmatch_core(p, n+i+size_n, max_n+1, ldot) == 0) return 0;
if (! *n) {
return -1;
}
- next_codepoint(iconv_convenience, n, &size_n);
+ next_codepoint(n, &size_n);
n += size_n;
break;
break;
}
if (! *n) return null_match(p);
- next_codepoint(iconv_convenience, n, &size_n);
+ next_codepoint(n, &size_n);
n += size_n;
break;
return 0;
}
if (*n != '.') return -1;
- next_codepoint(iconv_convenience, n, &size_n);
+ next_codepoint(n, &size_n);
n += size_n;
break;
default:
- c2 = next_codepoint(iconv_convenience, n, &size_n);
+ c2 = next_codepoint(n, &size_n);
if (c != c2 && codepoint_cmpi(c, c2) != 0) {
return -1;
}
while (*p2) {
codepoint_t c1, c2;
size_t c_size1, c_size2;
- c1 = next_codepoint(iconv_convenience, p1, &c_size1);
- c2 = next_codepoint(iconv_convenience, p2, &c_size2);
+ c1 = next_codepoint_convenience(iconv_convenience, p1, &c_size1);
+ c2 = next_codepoint_convenience(iconv_convenience, p2, &c_size2);
if (c2 == '?') {
d += push_codepoint(iconv_convenience, d, c1);
} else if (c2 == '*') {
while (*p) {
size_t c_size;
- codepoint_t c = next_codepoint(lp_iconv_convenience(pvfs->ntvfs->ctx->lp_ctx), p, &c_size);
+ codepoint_t c = next_codepoint_convenience(lp_iconv_convenience(pvfs->ntvfs->ctx->lp_ctx), p, &c_size);
switch (c) {
case '\\':
if (name->has_wildcard) {
if (s == NULL) return NT_STATUS_NO_MEMORY;
for (num_components=1, p=s; *p; p += c_size) {
- c = next_codepoint(iconv_convenience, p, &c_size);
+ c = next_codepoint_convenience(iconv_convenience, p, &c_size);
if (c == '\\') num_components++;
}
components[0] = s;
for (i=0, p=s; *p; p += c_size) {
- c = next_codepoint(iconv_convenience, p, &c_size);
+ c = next_codepoint_convenience(iconv_convenience, p, &c_size);
if (c == '\\') {
*p = 0;
components[++i] = p+1;
{
while (*name) {
size_t c_size;
- codepoint_t c = next_codepoint(ctx->iconv_convenience, name, &c_size);
+ codepoint_t c = next_codepoint_convenience(ctx->iconv_convenience, name, &c_size);
if (c == INVALID_CODEPOINT) {
return false;
}
const uint32_t fnv1_prime = 0x01000193;
const uint32_t fnv1_init = 0xa6b93095;
uint32_t value = fnv1_init;
- struct smb_iconv_convenience *iconv_convenience = lp_iconv_convenience(global_loadparm);
while (*key && length--) {
size_t c_size;
- codepoint_t c = next_codepoint(iconv_convenience, key, &c_size);
+ codepoint_t c = next_codepoint(key, &c_size);
c = toupper_m(c);
value *= fnv1_prime;
value ^= (uint32_t)c;