Changeset 907 for pjproject/trunk
- Timestamp:
- Jan 26, 2007 5:09:14 PM (18 years ago)
- Location:
- pjproject/trunk/pjlib/src/pj
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjlib/src/pj/addr_resolv_sock.c
r897 r907 38 38 39 39 he = gethostbyname(copy); 40 if (!he) 41 return PJ_ERESOLVE; 40 if (!he) { 41 return pj_get_netos_error(); 42 } 42 43 43 44 phe->h_name = he->h_name; -
pjproject/trunk/pjlib/src/pj/os_error_win32.c
r552 r907 142 142 char *buf, pj_size_t bufsize) 143 143 { 144 int len ;144 int len = 0; 145 145 PJ_DECL_UNICODE_TEMP_BUF(wbuf,128); 146 146 … … 154 154 */ 155 155 156 #if PJ_NATIVE_STRING_IS_UNICODE157 len = FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM158 | FORMAT_MESSAGE_IGNORE_INSERTS,159 NULL,160 os_errcode,161 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),162 wbuf,163 sizeof(wbuf),164 NULL);165 if (len) {166 pj_unicode_to_ansi(wbuf, len, buf, bufsize);167 }168 #else169 len = FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM170 | FORMAT_MESSAGE_IGNORE_INSERTS,171 NULL,172 os_errcode,173 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),174 buf,175 bufsize,176 NULL);177 #endif178 179 156 if (!len) { 180 181 157 #if defined(PJ_HAS_ERROR_STRING) && (PJ_HAS_ERROR_STRING!=0) 182 158 int i; … … 194 170 #endif /* PJ_HAS_ERROR_STRING */ 195 171 196 } else { 197 /* Remove trailing newlines. */ 198 while (len && (buf[len-1] == '\n' || buf[len-1] == '\r')) { 199 buf[len-1] = '\0'; 200 --len; 172 } 173 174 175 if (!len) { 176 #if PJ_NATIVE_STRING_IS_UNICODE 177 len = FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM 178 | FORMAT_MESSAGE_IGNORE_INSERTS, 179 NULL, 180 os_errcode, 181 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 182 wbuf, 183 sizeof(wbuf), 184 NULL); 185 if (len) { 186 pj_unicode_to_ansi(wbuf, len, buf, bufsize); 187 } 188 #else 189 len = FormatMessage( FORMAT_MESSAGE_FROM_SYSTEM 190 | FORMAT_MESSAGE_IGNORE_INSERTS, 191 NULL, 192 os_errcode, 193 MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), 194 buf, 195 bufsize, 196 NULL); 197 #endif 198 199 if (len) { 200 /* Remove trailing newlines. */ 201 while (len && (buf[len-1] == '\n' || buf[len-1] == '\r')) { 202 buf[len-1] = '\0'; 203 --len; 204 } 201 205 } 202 206 }
Note: See TracChangeset
for help on using the changeset viewer.