Thrift: Better handling of strerror_r.

Summary:
Someone thought it would be a good idea to have two different signatures
for strerror_r, with subtly different semantics (strlcpy = smart).
We now work properly with either of them.

Also fixed a test to work on 32-bit, you sloppy <expletive>s.

Reviewed By: mcslee

Test Plan:
Rebuild thrift.
Force one of these errors to be thrown.

Revert Plan: ok


git-svn-id: https://svn.apache.org/repos/asf/incubator/thrift/trunk@665215 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/test/cpp/src/TestClient.cpp b/test/cpp/src/TestClient.cpp
index e1110b4..c2efb1a 100644
--- a/test/cpp/src/TestClient.cpp
+++ b/test/cpp/src/TestClient.cpp
@@ -8,6 +8,9 @@
 #include <boost/shared_ptr.hpp>
 #include "ThriftTest.h"
 
+#define __STDC_FORMAT_MACROS
+#include <inttypes.h>
+
 using namespace boost;
 using namespace std;
 using namespace facebook::thrift;
@@ -137,7 +140,7 @@
      */
     printf("testI64(-34359738368)");
     int64_t i64 = testClient.testI64(-34359738368LL);
-    printf(" = %ld\n", i64);
+    printf(" = %"PRId64"\n", i64);
 
     /**
      * DOUBLE TEST
@@ -157,7 +160,7 @@
     out.i64_thing = -5;
     Xtruct in;
     testClient.testStruct(in, out);
-    printf(" = {\"%s\", %d, %d, %ld}\n",
+    printf(" = {\"%s\", %d, %d, %"PRId64"}\n",
            in.string_thing.c_str(),
            (int)in.byte_thing,
            in.i32_thing,
@@ -174,7 +177,7 @@
     Xtruct2 in2;
     testClient.testNest(in2, out2);
     in = in2.struct_thing;
-    printf(" = {%d, {\"%s\", %d, %d, %ld}, %d}\n",
+    printf(" = {%d, {\"%s\", %d, %d, %"PRId64"}, %d}\n",
            in2.byte_thing,
            in.string_thing.c_str(),
            (int)in.byte_thing,
@@ -309,7 +312,7 @@
      */
     printf("testTypedef(309858235082523)");
     UserId uid = testClient.testTypedef(309858235082523LL);
-    printf(" = %ld\n", uid);
+    printf(" = %"PRId64"\n", uid);
 
     /**
      * NESTED MAP TEST
@@ -346,7 +349,7 @@
     printf(" = {");
     map<UserId, map<Numberz,Insanity> >::const_iterator i_iter;
     for (i_iter = whoa.begin(); i_iter != whoa.end(); ++i_iter) {
-      printf("%ld => {", i_iter->first);
+      printf("%"PRId64" => {", i_iter->first);
       map<Numberz,Insanity>::const_iterator i2_iter;
       for (i2_iter = i_iter->second.begin();
            i2_iter != i_iter->second.end();
@@ -356,7 +359,7 @@
         map<Numberz, UserId>::const_iterator um;
         printf("{");
         for (um = userMap.begin(); um != userMap.end(); ++um) {
-          printf("%d => %ld, ", um->first, um->second);
+          printf("%d => %"PRId64", ", um->first, um->second);
         }
         printf("}, ");
 
@@ -364,7 +367,7 @@
         vector<Xtruct>::const_iterator x;
         printf("{");
         for (x = xtructs.begin(); x != xtructs.end(); ++x) {
-          printf("{\"%s\", %d, %d, %ld}, ",
+          printf("{\"%s\", %d, %d, %"PRId64"}, ",
                  x->string_thing.c_str(),
                  (int)x->byte_thing,
                  x->i32_thing,
@@ -430,7 +433,7 @@
     uint64_t stop = now();
     uint64_t tot = stop-start;
 
-    printf("Total time: %lu us\n", stop-start);
+    printf("Total time: %"PRIu64" us\n", stop-start);
     
     time_tot += tot;
     if (time_min == 0 || tot < time_min) {
@@ -448,9 +451,9 @@
 
   uint64_t time_avg = time_tot / numTests;
 
-  printf("Min time: %lu us\n", time_min);
-  printf("Max time: %lu us\n", time_max);
-  printf("Avg time: %lu us\n", time_avg);
+  printf("Min time: %"PRIu64" us\n", time_min);
+  printf("Max time: %"PRIu64" us\n", time_max);
+  printf("Avg time: %"PRIu64" us\n", time_avg);
 
   return 0;
 }