Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1442)

Unified Diff: native_client_sdk/src/examples/demo/nacl_io_demo/nacl_io_demo.c

Issue 339393005: [NaCl SDK] Add examples for bionic (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix warning Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: native_client_sdk/src/examples/demo/nacl_io_demo/nacl_io_demo.c
diff --git a/native_client_sdk/src/examples/demo/nacl_io_demo/nacl_io_demo.c b/native_client_sdk/src/examples/demo/nacl_io_demo/nacl_io_demo.c
index 226d50f662ea4546ea45f62b2342dca5fb4840fc..d103c1f7c4dadc2d9eb14c379406409e220867be 100644
--- a/native_client_sdk/src/examples/demo/nacl_io_demo/nacl_io_demo.c
+++ b/native_client_sdk/src/examples/demo/nacl_io_demo/nacl_io_demo.c
@@ -41,6 +41,16 @@
#define va_copy(d, s) ((d) = (s))
#endif
+/**
+ * The location of MAX is inconsitantly between LIBCs, so instead
+ * we define it here for consistency.
+ */
+static int larger_int_of(int a, int b) {
+ if (a > b)
+ return a;
+ return b;
+}
+
typedef struct {
const char* name;
HandleFunc function;
@@ -312,8 +322,8 @@ static void* EchoThread(void* user_data) {
int fd1 = open("/dev/jspipe1", O_RDWR | O_NONBLOCK);
int fd2 = open("/dev/jspipe2", O_RDWR | O_NONBLOCK);
int fd3 = open("/dev/jspipe3", O_RDWR | O_NONBLOCK);
- int nfds = MAX(fd1, fd2);
- nfds = MAX(nfds, fd3);
+ int nfds = larger_int_of(fd1, fd2);
+ nfds = larger_int_of(nfds, fd3);
while (1) {
fd_set readfds;
FD_ZERO(&readfds);
« no previous file with comments | « native_client_sdk/src/examples/api/websocket/example.dsc ('k') | native_client_sdk/src/libraries/jsoncpp/library.dsc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698