From 51537e8725ada4acf61912c17be581fe0f0eff60 Mon Sep 17 00:00:00 2001 From: Carlos Fernandez Date: Thu, 26 Jan 2017 10:16:52 -0800 Subject: [PATCH] networking, multicast: In linux, bind to the specific IP address of the multicast source. OCR: init some variables that didn't have a default value. --- src/lib_ccx/networking.c | 8 ++++++++ src/lib_ccx/ocr.c | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/src/lib_ccx/networking.c b/src/lib_ccx/networking.c index 2e73d319..62950263 100644 --- a/src/lib_ccx/networking.c +++ b/src/lib_ccx/networking.c @@ -977,7 +977,15 @@ int start_upd_srv(const char *addr_str, unsigned port) struct sockaddr_in servaddr; servaddr.sin_family = AF_INET; servaddr.sin_port = htons(port); +#if _WIN32 + // Doesn't seem correct, if there's more than one multicast stream with the same + // port number we get corruption - IP address needs to be specified, but + // in Windows we get an error 10049 (cannot bind). + // http ://stackoverflow.com/questions/6140734/cannot-bind-to-multicast-address-windows servaddr.sin_addr.s_addr = htonl(IN_MULTICAST(addr) ? INADDR_ANY : addr); +#else + servaddr.sin_addr.s_addr = htonl(addr); +#endif if (bind(sockfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) != 0) { diff --git a/src/lib_ccx/ocr.c b/src/lib_ccx/ocr.c index ebd76194..b71038f7 100644 --- a/src/lib_ccx/ocr.c +++ b/src/lib_ccx/ocr.c @@ -161,7 +161,7 @@ fail: BOX* ignore_alpha_at_edge(png_byte *alpha, unsigned char* indata, int w, int h, PIX *in, PIX **out) { - int i, j, index, start_y, end_y; + int i, j, index, start_y=0, end_y=0; int find_end_x = CCX_FALSE; BOX* cropWindow; for (j = 1; j < w-1; j++)