no strerror or errno, no getprotoby* apis in WinCE WINCE_NSPRPUB_RELEASE_4_2_BETA1
authorblythe%netscape.com
Thu, 07 Feb 2002 22:18:12 +0000
branchWINCE_NSPRPUB_RELEASE_4_2_BETA1
changeset 2225 5fba6f0782e3948237f627cb63ddb11b04abafe0
parent 2224 f9706e37cd09efeaeea00ae47e83b4e5fd15cc96
child 2226 90e6fb0388ae1319837b3fcad4d400eedd05109c
push idunknown
push userunknown
push dateunknown
no strerror or errno, no getprotoby* apis in WinCE
pr/include/md/_wince.h
pr/src/misc/prerrortable.c
pr/src/misc/prnetdb.c
--- a/pr/include/md/_wince.h
+++ b/pr/include/md/_wince.h
@@ -526,11 +526,11 @@ struct stat {
 /*
  * Missing constants.
  */
 #define HINSTANCE_ERROR 1 /* LoadLibrary, NULL on failure for WinCE */
 #define _S_IFDIR    0040000 /* stat, is a directory */
 #define _S_IFREG    0100000 /* stat, is a normal file */
 #define _S_IREAD    0000400 /* stat, can read */
 #define _S_IWRITE   0000200 /* stat, can write */
-#define ENOMEM /* errno, out of memory */
+#define ENOMEM 12 /* errno, out of memory */
 
 #endif /* nspr_wince_defs_h___ */
--- a/pr/src/misc/prerrortable.c
+++ b/pr/src/misc/prerrortable.c
@@ -144,17 +144,21 @@ PR_ErrorToString(PRErrorCode code, PRLan
 		if (msg) return msg;
 	    }
     
 	    return(et->table->msgs[code - et->table->base].en_text);
 	}
     }
 
     if (code >= 0 && code < 256) {
+#if !defined(WINCE)
 	return strerror(code);
+#else
+        return "errno range error";
+#endif
     }
 
     offset = (int) (code & ((1<<ERRCODE_RANGE)-1));
     table_num = code - offset;
     strcpy (buffer, "Unknown code ");
     if (table_num) {
 	strcat(buffer, error_table_name (table_num));
 	strcat(buffer, " ");
@@ -199,24 +203,21 @@ PR_ErrorLanguages(void)
 
 PR_IMPLEMENT(PRErrorCode)
 PR_ErrorInstallTable(const struct PRErrorTable *table)
 {
     struct PRErrorTableList * new_et;
 
     new_et = (struct PRErrorTableList *)
 					PR_Malloc(sizeof(struct PRErrorTableList));
+    if (!new_et)
 #if !defined(WINCE)
-    if (!new_et)
 	return errno;	/* oops */
 #else
-    if(NULL == new_et)
-    {
         return ENOMEM;
-    }
 #endif
     new_et->table = table;
     if (callback_newtable) {
 	new_et->table_private = callback_newtable(table, callback_private);
     } else {
 	new_et->table_private = 0;
     }
     new_et->next = Table_List;
@@ -227,18 +228,23 @@ PR_ErrorInstallTable(const struct PRErro
 PR_IMPLEMENT(void)
 PR_ErrorInstallCallback(const char * const * languages,
 		       PRErrorCallbackLookupFn *lookup, 
 		       PRErrorCallbackNewTableFn *newtable,
 		       struct PRErrorCallbackPrivate *cb_private)
 {
     struct PRErrorTableList *et;
 
+#if !defined(WINCE)
     assert(strcmp(languages[0], "i-default") == 0);
     assert(strcmp(languages[1], "en") == 0);
+#else
+    PR_ASSERT(strcmp(languages[0], "i-default") == 0);
+    PR_ASSERT(strcmp(languages[1], "en") == 0);
+#endif
     
     callback_languages = languages;
     callback_lookup = lookup;
     callback_newtable = newtable;
     callback_private = cb_private;
 
     if (callback_newtable) {
 	for (et = Table_List; et; et = et->next) {
--- a/pr/src/misc/prnetdb.c
+++ b/pr/src/misc/prnetdb.c
@@ -837,24 +837,30 @@ PR_IMPLEMENT(PRStatus) PR_GetHostByAddr(
  * we're not using it. For sure these signatures are different than
  * any usable implementation.
  */
 
 static struct protoent *getprotobyname_r(const char* name)
 {
 #ifdef XP_OS2_VACPP
 	return getprotobyname((char *)name);
+#elif defined(WINCE)
+    return NULL;
 #else
 	return getprotobyname(name);
 #endif
 } /* getprotobyname_r */
 
 static struct protoent *getprotobynumber_r(PRInt32 number)
 {
+#if !defined(WINCE)
 	return getprotobynumber(number);
+#else
+    return NULL;
+#endif
 } /* getprotobynumber_r */
 
 #endif /* !defined(_PR_HAVE_GETPROTO_R) */
 
 PR_IMPLEMENT(PRStatus) PR_GetProtoByName(
     const char* name, char* buffer, PRInt32 buflen, PRProtoEnt* result)
 {
 	PRStatus rv = PR_SUCCESS;