Changeset 537
- Timestamp:
- Jan 28, 2011, 10:58:48 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified trunk/server/source3/lib/iconv.c ¶
r454 r537 128 128 } 129 129 130 #ifdef __OS2__ 131 // i could have done a static variable w/o this function. but i feel it's nicer this way. 132 // the purpose of this function is to save the to_name to get the korean and japanese code set working 133 char * save_toname(char *toname, bool what) 134 { 135 static char *to_name=NULL; 136 137 if ( what == 0 ) 138 to_name = SMB_STRDUP(toname); 139 140 return to_name; 141 } 130 #if defined(__OS2__) && defined(__INNOTEK_LIBC__) 131 #include <uconv.h> 132 133 typedef struct os2_iconv_t 134 { 135 UconvObject from; 136 } os2_iconv_t; 137 138 iconv_t os2_iconv_open (const char *tocode, const char *fromcode) 139 { 140 os2_iconv_t *os2_cd = (os2_iconv_t *)iconv_open(tocode, fromcode); 141 142 if (os2_cd != (iconv_t)(-1)) 143 { 144 /* Assume strings contain pathnames */ 145 uconv_attribute_t attr; 146 147 UniQueryUconvObject(os2_cd->from, &attr, 148 sizeof(uconv_attribute_t), 149 NULL, NULL, NULL ); 150 attr.converttype |= CVTTYPE_PATH; 151 UniSetUconvObject(os2_cd->from, &attr); 152 } 153 154 return (iconv_t)os2_cd; 155 } 156 157 #define iconv_open os2_iconv_open 142 158 #endif 143 159 … … 150 166 char **outbuf, size_t *outbytesleft) 151 167 { 152 #ifdef __OS2__153 uint16 *outbuf_uc = ( uint16 * )*outbuf;154 char *to_name = save_toname(NULL, 1);155 #endif156 157 168 size_t ret = iconv((iconv_t)cd, 158 169 (void *)inbuf, inbytesleft, … … 163 174 errno = saved_errno; 164 175 } 165 #ifdef __OS2__166 /* Workaround for path separator on OS/2 */167 else168 {169 if( (strstr(to_name, "949") != NULL) || /* Korean CP */170 (strstr(to_name, "932") != NULL) || /* Japanese CP */171 (strstr(to_name, "942") != NULL) || /* Japanese CP */172 (strstr(to_name, "943") != NULL) ) /* Japanese CP */173 {174 while(( char * )outbuf_uc < *outbuf )175 {176 if( *outbuf_uc == 0x20a9 || /* Korean WON */177 *outbuf_uc == 0x00a5 ) /* Japanese YEN */178 *outbuf_uc = '\\';179 180 outbuf_uc++;181 }182 }183 }184 #endif185 176 186 177 return ret; … … 201 192 char *bufp = cvtbuf; 202 193 size_t bufsize; 203 #ifdef __OS2__204 save_toname(cd->to_name, 0);205 #endif206 194 207 195 /* in many cases we can go direct */
Note:
See TracChangeset
for help on using the changeset viewer.