- Timestamp:
- Jan 28, 2011, 11:00:37 AM (15 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/samba-3.0/source/lib/iconv.c
r337 r539 129 129 } 130 130 131 #ifdef __OS2__ 132 // i could have done a static variable w/o this function. but i feel it's nicer this way. SCS 133 // the purpose of this function is to save the to_name to get the korean and japanese code set working 134 char * save_toname(char *toname, bool what) 135 { 136 static char *to_name=NULL; 137 138 if ( what == 0 ) 139 to_name = SMB_STRDUP(toname); 140 141 return to_name; 142 } 131 #if defined(__OS2__) && defined(__INNOTEK_LIBC__) 132 #include <uconv.h> 133 134 typedef struct os2_iconv_t 135 { 136 UconvObject from; 137 } os2_iconv_t; 138 139 iconv_t os2_iconv_open (const char *tocode, const char *fromcode) 140 { 141 os2_iconv_t *os2_cd = (os2_iconv_t *)iconv_open(tocode, fromcode); 142 143 if (os2_cd != (iconv_t)(-1)) 144 { 145 /* Assume strings contain pathnames */ 146 uconv_attribute_t attr; 147 148 UniQueryUconvObject(os2_cd->from, &attr, 149 sizeof(uconv_attribute_t), 150 NULL, NULL, NULL ); 151 attr.converttype |= CVTTYPE_PATH; 152 UniSetUconvObject(os2_cd->from, &attr); 153 } 154 155 return (iconv_t)os2_cd; 156 } 157 158 #define iconv_open os2_iconv_open 143 159 #endif 144 160 … … 151 167 char **outbuf, size_t *outbytesleft) 152 168 { 153 #ifdef __OS2__154 uint16 *outbuf_uc = ( uint16 * )*outbuf;155 char *to_name = save_toname(NULL, 1);156 #endif157 169 158 170 size_t ret = iconv((iconv_t)cd, … … 164 176 errno = saved_errno; 165 177 } 166 #ifdef __OS2__167 /* Workaround for path separator on OS/2 */168 else169 {170 if( (strstr(to_name, "949") != NULL) || /* Korean CP */171 (strstr(to_name, "932") != NULL) || /* Japanese CP */172 (strstr(to_name, "942") != NULL) || /* Japanese CP */173 (strstr(to_name, "943") != NULL) ) /* Japanese CP */174 {175 while(( char * )outbuf_uc < *outbuf )176 {177 if( *outbuf_uc == 0x20a9 || /* Korean WON */178 *outbuf_uc == 0x00a5 ) /* Japanese YEN */179 *outbuf_uc = '\\';180 181 outbuf_uc++;182 }183 }184 }185 #endif186 178 return ret; 187 179 } … … 202 194 size_t bufsize; 203 195 204 #ifdef __OS2__205 save_toname(cd->to_name, 0);206 #endif207 196 208 197 /* in many cases we can go direct */
Note:
See TracChangeset
for help on using the changeset viewer.