Fixed unreached code, deprecated fopen(), unused arguments, and other warnings with MSVC

git-svn-id: https://svn.pjsip.org/repos/pjproject/trunk@2407 74dad513-b988-da41-8d7b-12977e46ad98
diff --git a/pjlib/include/pj/compat/cc_armcc.h b/pjlib/include/pj/compat/cc_armcc.h
index 095d4ab..1761c22 100644
--- a/pjlib/include/pj/compat/cc_armcc.h
+++ b/pjlib/include/pj/compat/cc_armcc.h
@@ -51,5 +51,7 @@
 
 #define PJ_INT64_FMT		"L"
 
+#define PJ_UNREACHED(x)	    	
+
 #endif	/* __PJ_COMPAT_CC_ARMCC_H__ */
 
diff --git a/pjlib/include/pj/compat/cc_codew.h b/pjlib/include/pj/compat/cc_codew.h
index 7dcaae5..3f8b46e 100644
--- a/pjlib/include/pj/compat/cc_codew.h
+++ b/pjlib/include/pj/compat/cc_codew.h
@@ -49,6 +49,7 @@
 #define PJ_UINT64(val)		val##LLU
 #define PJ_INT64_FMT		"L"
 
+#define PJ_UNREACHED(x)	    	
 
 #endif	/* __PJ_COMPAT_CC_CODEW_H__ */
 
diff --git a/pjlib/include/pj/compat/cc_gcc.h b/pjlib/include/pj/compat/cc_gcc.h
index 35aecf2..edf0479 100644
--- a/pjlib/include/pj/compat/cc_gcc.h
+++ b/pjlib/include/pj/compat/cc_gcc.h
@@ -69,6 +69,7 @@
 #   define PJ_HAS_BZERO		1
 #endif
 
+#define PJ_UNREACHED(x)	    	
 
 #endif	/* __PJ_COMPAT_CC_GCC_H__ */
 
diff --git a/pjlib/include/pj/compat/cc_msvc.h b/pjlib/include/pj/compat/cc_msvc.h
index b5a0e08..e6c139d 100644
--- a/pjlib/include/pj/compat/cc_msvc.h
+++ b/pjlib/include/pj/compat/cc_msvc.h
@@ -38,6 +38,13 @@
 #if PJ_CC_VER_1 >= 8 && !defined(_CRT_SECURE_NO_DEPRECATE)
 #   define _CRT_SECURE_NO_DEPRECATE
 #endif
+#if PJ_CC_VER_1 >= 8 && !defined(_CRT_SECURE_NO_WARNINGS)
+#   define _CRT_SECURE_NO_WARNINGS
+    /* The above doesn't seem to work, at least on VS2005, so lets use
+     * this construct as well.
+     */
+#   pragma warning(disable: 4996)
+#endif
 
 #pragma warning(disable: 4127) // conditional expression is constant
 #pragma warning(disable: 4611) // not wise to mix setjmp with C++
@@ -71,5 +78,7 @@
 #define PJ_UINT64(val)		val##ui64
 #define PJ_INT64_FMT		"I64"
 
+#define PJ_UNREACHED(x)	    	
 
 #endif	/* __PJ_COMPAT_CC_MSVC_H__ */
+
diff --git a/pjlib/include/pj/compat/cc_mwcc.h b/pjlib/include/pj/compat/cc_mwcc.h
index 511fed7..6c768b9 100644
--- a/pjlib/include/pj/compat/cc_mwcc.h
+++ b/pjlib/include/pj/compat/cc_mwcc.h
@@ -49,6 +49,7 @@
 #define PJ_UINT64(val)		val##LLU
 #define PJ_INT64_FMT		"L"
 
+#define PJ_UNREACHED(x)	    	
 
 #endif	/* __PJ_COMPAT_CC_MWCC_H__ */
 
diff --git a/pjlib/src/pjlib-test/exception.c b/pjlib/src/pjlib-test/exception.c
index 9a479a1..94ab861 100644
--- a/pjlib/src/pjlib-test/exception.c
+++ b/pjlib/src/pjlib-test/exception.c
@@ -54,13 +54,13 @@
 static int throw_id_1(void)
 {
     PJ_THROW( ID_1 );
-    return -1;
+    PJ_UNREACHED(return -1;)
 }
 
 static int throw_id_2(void)
 {
     PJ_THROW( ID_2 );
-    return -1;
+    PJ_UNREACHED(return -1;)
 }
 
 
diff --git a/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c b/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c
index f23350e..8646985 100644
--- a/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c
+++ b/pjlib/src/pjlib-test/udp_echo_srv_ioqueue.c
@@ -150,7 +150,7 @@
         timeout.sec = 0; timeout.msec = 10;
         rc = pj_ioqueue_poll(ioqueue, &timeout);
     }
-    return 0;
+    PJ_UNREACHED(return 0;)
 }
 
 int udp_echo_srv_ioqueue(void)
diff --git a/pjlib/src/pjlib-test/udp_echo_srv_sync.c b/pjlib/src/pjlib-test/udp_echo_srv_sync.c
index 3b0a02b..1b4670e 100644
--- a/pjlib/src/pjlib-test/udp_echo_srv_sync.c
+++ b/pjlib/src/pjlib-test/udp_echo_srv_sync.c
@@ -56,7 +56,7 @@
             continue;
         }
     }
-    return 0;
+    PJ_UNREACHED(return 0;)
 }
 
 
@@ -160,7 +160,7 @@
                           (unsigned)(highest_bw/1000)));
         }
     }
-    return 0;
+    PJ_UNREACHED(return 0;)
 }