2 Unix SMB/CIFS implementation.
3 Samba module with developer tools
4 Copyright (C) Andrew Tridgell 2001
5 Copyright (C) Jelmer Vernooij 2002
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>.
22 #include "charset_proto.h"
36 size_t weird_pull(void *cd
, const char **inbuf
, size_t *inbytesleft
,
37 char **outbuf
, size_t *outbytesleft
)
39 while (*inbytesleft
>= 1 && *outbytesleft
>= 2) {
42 for (i
=0;weird_table
[i
].from
;i
++) {
45 weird_table
[i
].len
) == 0) {
46 if (*inbytesleft
< weird_table
[i
].len
) {
47 DEBUG(0,("ERROR: truncated weird string\n"));
48 /* smb_panic("weird_pull"); */
51 (*outbuf
)[0] = weird_table
[i
].from
;
53 (*inbytesleft
) -= weird_table
[i
].len
;
55 (*inbuf
) += weird_table
[i
].len
;
63 (*outbuf
)[0] = (*inbuf
)[0];
71 if (*inbytesleft
> 0) {
79 size_t weird_push(void *cd
, const char **inbuf
, size_t *inbytesleft
,
80 char **outbuf
, size_t *outbytesleft
)
84 while (*inbytesleft
>= 2 && *outbytesleft
>= 1) {
87 for (i
=0;weird_table
[i
].from
;i
++) {
88 if ((*inbuf
)[0] == weird_table
[i
].from
&&
90 if (*outbytesleft
< weird_table
[i
].len
) {
91 DEBUG(0,("No room for weird character\n"));
92 /* smb_panic("weird_push"); */
94 memcpy(*outbuf
, weird_table
[i
].to
,
97 (*outbytesleft
) -= weird_table
[i
].len
;
99 (*outbuf
) += weird_table
[i
].len
;
107 (*outbuf
)[0] = (*inbuf
)[0];
108 if ((*inbuf
)[1]) ir_count
++;
110 (*outbytesleft
) -= 1;
115 if (*inbytesleft
== 1) {
120 if (*inbytesleft
> 1) {
129 void charset_weird_dummy(void);
130 void charset_weird_dummy(void)