modules/weird.c

ソースコードを見る。

関数

static size_t weird_pull (void *cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
static size_t weird_push (void *cd, const char **inbuf, size_t *inbytesleft, char **outbuf, size_t *outbytesleft)
NTSTATUS charset_weird_init (void)

変数

struct {
   char   from
   const char *   to
   int   len
weird_table []
charset_functions weird_functions = {"WEIRD", weird_pull, weird_push}


関数

static size_t weird_pull ( void *  cd,
const char **  inbuf,
size_t *  inbytesleft,
char **  outbuf,
size_t *  outbytesleft 
) [static]

weird.c34 行で定義されています。

参照先 errnolentoweird_table.

00036 {
00037         while (*inbytesleft >= 1 && *outbytesleft >= 2) {
00038                 int i;
00039                 int done = 0;
00040                 for (i=0;weird_table[i].from;i++) {
00041                         if (strncmp((*inbuf), 
00042                                     weird_table[i].to, 
00043                                     weird_table[i].len) == 0) {
00044                                 if (*inbytesleft < weird_table[i].len) {
00045                                         DEBUG(0,("ERROR: truncated weird string\n"));
00046                                         /* smb_panic("weird_pull"); */
00047 
00048                                 } else {
00049                                         (*outbuf)[0] = weird_table[i].from;
00050                                         (*outbuf)[1] = 0;
00051                                         (*inbytesleft)  -= weird_table[i].len;
00052                                         (*outbytesleft) -= 2;
00053                                         (*inbuf)  += weird_table[i].len;
00054                                         (*outbuf) += 2;
00055                                         done = 1;
00056                                         break;
00057                                 }
00058                         }
00059                 }
00060                 if (done) continue;
00061                 (*outbuf)[0] = (*inbuf)[0];
00062                 (*outbuf)[1] = 0;
00063                 (*inbytesleft)  -= 1;
00064                 (*outbytesleft) -= 2;
00065                 (*inbuf)  += 1;
00066                 (*outbuf) += 2;
00067         }
00068 
00069         if (*inbytesleft > 0) {
00070                 errno = E2BIG;
00071                 return -1;
00072         }
00073         
00074         return 0;
00075 }

static size_t weird_push ( void *  cd,
const char **  inbuf,
size_t *  inbytesleft,
char **  outbuf,
size_t *  outbytesleft 
) [static]

weird.c77 行で定義されています。

参照先 errnofromlentoweird_table.

00079 {
00080         int ir_count=0;
00081 
00082         while (*inbytesleft >= 2 && *outbytesleft >= 1) {
00083                 int i;
00084                 int done=0;
00085                 for (i=0;weird_table[i].from;i++) {
00086                         if ((*inbuf)[0] == weird_table[i].from &&
00087                             (*inbuf)[1] == 0) {
00088                                 if (*outbytesleft < weird_table[i].len) {
00089                                         DEBUG(0,("No room for weird character\n"));
00090                                         /* smb_panic("weird_push"); */
00091                                 } else {
00092                                         memcpy(*outbuf, weird_table[i].to, 
00093                                                weird_table[i].len);
00094                                         (*inbytesleft)  -= 2;
00095                                         (*outbytesleft) -= weird_table[i].len;
00096                                         (*inbuf)  += 2;
00097                                         (*outbuf) += weird_table[i].len;
00098                                         done = 1;
00099                                         break;
00100                                 }
00101                         }
00102                 }
00103                 if (done) continue;
00104 
00105                 (*outbuf)[0] = (*inbuf)[0];
00106                 if ((*inbuf)[1]) ir_count++;
00107                 (*inbytesleft)  -= 2;
00108                 (*outbytesleft) -= 1;
00109                 (*inbuf)  += 2;
00110                 (*outbuf) += 1;
00111         }
00112 
00113         if (*inbytesleft == 1) {
00114                 errno = EINVAL;
00115                 return -1;
00116         }
00117 
00118         if (*inbytesleft > 1) {
00119                 errno = E2BIG;
00120                 return -1;
00121         }
00122         
00123         return ir_count;
00124 }

NTSTATUS charset_weird_init ( void   ) 

developer.c128 行で定義されています。

参照先 smb_register_charset()weird_functions.

00129 {
00130         smb_register_charset(&weird_functions);
00131         return True;
00132 }


変数

char from

weird.c25 行で定義されています。

const char* to

weird.c26 行で定義されています。

int len

weird.c27 行で定義されています。

struct { ... } weird_table[] [static]

struct charset_functions weird_functions = {"WEIRD", weird_pull, weird_push}

weird.c126 行で定義されています。


Sambaに対してSat Aug 29 21:23:52 2009に生成されました。  doxygen 1.4.7