r1596: Expanded c-test-fns
[uffi.git] / examples / c-test-fns.c
index 3ff1fde6d8ba938b6b2083cf0b6fb9a4c8970cc8..05244b80601358519d072453e65da11a8763d399 100644 (file)
@@ -6,7 +6,7 @@
  *  Programer:    Kevin M. Rosenberg
  *  Date Started: Mar 2002
  *
- *  CVS Id:   $Id: c-test-fns.c,v 1.1 2002/03/21 02:41:30 kevin Exp $
+ *  CVS Id:   $Id: c-test-fns.c,v 1.2 2002/03/21 04:04:45 kevin Exp $
  *
  * This file, part of UFFI, is Copyright (c) 2002 by Kevin M. Rosenberg
  *
  * you'll need to modify these for other compilers
  ***************************************************************************/
 
+#ifdef WIN32
+#include <windows.h>
+#endif
+
 #include <ctype.h>
 #include <stdlib.h>
 
 
 /* Test of constant input string */
 int
-cstring_count_upper (char* psz)
+#ifdef WIN32
+WINAPI
+#endif
+cs_count_upper (char* psz)
 {
   int count = 0;
-  while (*psz) {
-    if (isupper (*psz))
-      ++count;
-    ++psz;
-  }
+
+  if (psz) {
+    while (*psz) {
+      if (isupper (*psz))
+       ++count;
+      ++psz;
+    }
+    return count;
+  } else 
+    return -1;
 }
 
 /* Test of input and output of a string */
 void
-cstring_to_upper (char* psz)
+#ifdef WIN32
+WINAPI
+#endif
+cs_to_upper (char* psz)
 {
-  while (*psz) {
-    *psz = toupper (*psz);
-    ++psz;
+  if (psz) {
+    while (*psz) {
+      *psz = toupper (*psz);
+      ++psz;
+    }
   }
 }
 
 /* Test of an output only string */
 void
-cstring_make_random (int size, char* buffer)
+#ifdef WIN32
+WINAPI
+#endif
+cs_make_random (int size, char* buffer)
 {
   int i;
   for (i = 0; i < size; i++)