c = tolower_m(c);
- c_size = push_codepoint(iconv_convenience, dest+size, c);
+ c_size = push_codepoint_convenience(iconv_convenience, dest+size, c);
if (c_size == -1) {
talloc_free(dest);
return NULL;
c = toupper_m(c);
- c_size = push_codepoint(iconv_convenience, dest+size, c);
+ c_size = push_codepoint_convenience(iconv_convenience, dest+size, c);
if (c_size == -1) {
talloc_free(dest);
return NULL;
while (*s) {
size_t c_size, c_size2;
codepoint_t c = next_codepoint_convenience(iconv_convenience, s, &c_size);
- c_size2 = push_codepoint(iconv_convenience, d, tolower_m(c));
+ c_size2 = push_codepoint_convenience(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",
c, tolower_m(c), (int)c_size, (int)c_size2));
while (*s) {
size_t c_size, c_size2;
codepoint_t c = next_codepoint_convenience(iconv_convenience, s, &c_size);
- c_size2 = push_codepoint(iconv_convenience, d, toupper_m(c));
+ c_size2 = push_codepoint_convenience(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",
c, toupper_m(c), (int)c_size, (int)c_size2));
{
return next_codepoint_convenience(get_iconv_convenience(), str, size);
}
+
+_PUBLIC_ ssize_t push_codepoint(char *str, codepoint_t c)
+{
+ return push_codepoint(get_iconv_convenience(), str, c);
+}
struct preg_data {
int fd;
TALLOC_CTX *ctx;
- struct smb_iconv_convenience *ic;
};
-static WERROR preg_read_utf16(struct smb_iconv_convenience *ic, int fd, char *c)
+static WERROR preg_read_utf16(int fd, char *c)
{
uint16_t v;
if (read(fd, &v, 2) < 2) {
return WERR_GENERAL_FAILURE;
}
- push_codepoint(ic, c, v);
+ push_codepoint(c, v);
return WERR_OK;
}
-static WERROR preg_write_utf16(struct smb_iconv_convenience *ic, int fd, const char *string)
+static WERROR preg_write_utf16(int fd, const char *string)
{
codepoint_t v;
uint16_t i;
size_t size;
for (i = 0; i < strlen(string); i+=size) {
- v = next_codepoint_convenience(ic, &string[i], &size);
+ v = next_codepoint(&string[i], &size);
if (write(fd, &v, 2) < 2) {
return WERR_GENERAL_FAILURE;
}
struct preg_data *data = (struct preg_data *)_data;
uint32_t buf;
- preg_write_utf16(data->ic, data->fd, "[");
- preg_write_utf16(data->ic, data->fd, key_name);
- preg_write_utf16(data->ic, data->fd, ";");
- preg_write_utf16(data->ic, data->fd, value_name);
- preg_write_utf16(data->ic, data->fd, ";");
+ preg_write_utf16(data->fd, "[");
+ preg_write_utf16(data->fd, key_name);
+ preg_write_utf16(data->fd, ";");
+ preg_write_utf16(data->fd, value_name);
+ preg_write_utf16(data->fd, ";");
SIVAL(&buf, 0, value_type);
write(data->fd, &buf, sizeof(uint32_t));
- preg_write_utf16(data->ic, data->fd, ";");
+ preg_write_utf16(data->fd, ";");
SIVAL(&buf, 0, value_data.length);
write(data->fd, &buf, sizeof(uint32_t));
- preg_write_utf16(data->ic, data->fd, ";");
+ preg_write_utf16(data->fd, ";");
write(data->fd, value_data.data, value_data.length);
- preg_write_utf16(data->ic, data->fd, "]");
+ preg_write_utf16(data->fd, "]");
return WERR_OK;
}
write(data->fd, (uint8_t *)&preg_header,8);
data->ctx = ctx;
- data->ic = ic;
*callbacks = talloc(ctx, struct reg_diff_callbacks);
while(1) {
uint32_t value_type, length;
- if (!W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr))) {
+ if (!W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr))) {
break;
}
if (*buf_ptr != '[') {
/* Get the path */
buf_ptr = buf;
- while (W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
+ while (W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
*buf_ptr != ';' && buf_ptr-buf < buf_size) {
buf_ptr++;
}
/* Get the name */
buf_ptr = buf;
- while (W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
+ while (W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
*buf_ptr != ';' && buf_ptr-buf < buf_size) {
buf_ptr++;
}
/* Read past delimiter */
buf_ptr = buf;
- if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
+ if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
*buf_ptr == ';') && buf_ptr-buf < buf_size) {
DEBUG(0, ("Error in PReg file.\n"));
ret = WERR_GENERAL_FAILURE;
}
/* Read past delimiter */
buf_ptr = buf;
- if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
+ if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
*buf_ptr == ';') && buf_ptr-buf < buf_size) {
DEBUG(0, ("Error in PReg file.\n"));
ret = WERR_GENERAL_FAILURE;
/* Check if delimiter is in place (whine if it isn't) */
buf_ptr = buf;
- if (!(W_ERROR_IS_OK(preg_read_utf16(iconv_convenience, fd, buf_ptr)) &&
+ if (!(W_ERROR_IS_OK(preg_read_utf16(fd, buf_ptr)) &&
*buf_ptr == ']') && buf_ptr-buf < buf_size) {
DEBUG(0, ("Warning: Missing ']' in PReg file, expected ']', got '%c' 0x%x.\n",
*buf_ptr, *buf_ptr));