Revision: 76683 http://sourceforge.net/p/brlcad/code/76683 Author: starseeker Date: 2020-08-07 14:30:50 +0000 (Fri, 07 Aug 2020) Log Message: ----------- ws
Modified Paths: -------------- brlcad/trunk/src/fbserv/server.c Modified: brlcad/trunk/src/fbserv/server.c =================================================================== --- brlcad/trunk/src/fbserv/server.c 2020-08-07 14:23:49 UTC (rev 76682) +++ brlcad/trunk/src/fbserv/server.c 2020-08-07 14:30:50 UTC (rev 76683) @@ -85,8 +85,10 @@ char rbuf[5*NET_LONG_LEN+1]; int want; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; width = pkg_glong(&buf[0*NET_LONG_LEN]); height = pkg_glong(&buf[1*NET_LONG_LEN]); @@ -122,7 +124,8 @@ want = 5*NET_LONG_LEN; if (pkg_send(MSG_RETURN, rbuf, want, pcp) != want) fprintf(stderr, "pkg_send fb_open reply\n"); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -148,7 +151,8 @@ * If communication has broken, other end will know we are gone. */ (void)pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -176,7 +180,8 @@ if (pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp) != NET_LONG_LEN) fprintf(stderr, "pkg_send fb_free reply\n"); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); fb_server_got_fb_free = 1; } @@ -188,8 +193,10 @@ RGBpixel bg; char rbuf[NET_LONG_LEN+1]; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; bg[RED] = buf[0]; bg[GRN] = buf[1]; @@ -198,7 +205,8 @@ (void)pkg_plong(rbuf, fb_clear(fb_server_fbp, bg)); pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -211,8 +219,10 @@ static unsigned char *scanbuf = NULL; static size_t buflen = 0; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; x = pkg_glong(&buf[0*NET_LONG_LEN]); y = pkg_glong(&buf[1*NET_LONG_LEN]); @@ -226,7 +236,8 @@ if ((scanbuf = (unsigned char *)malloc(buflen)) == NULL) { fb_log("fb_read: malloc failed!"); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); buflen = 0; return; } @@ -237,7 +248,8 @@ /* sending a 0-length package indicates error */ pkg_send(MSG_RETURN, (char *)scanbuf, ret*sizeof(RGBpixel), pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -253,8 +265,10 @@ int ret; int type; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; x = pkg_glong(&buf[0*NET_LONG_LEN]); y = pkg_glong(&buf[1*NET_LONG_LEN]); @@ -266,7 +280,8 @@ (void)pkg_plong(&rbuf[0*NET_LONG_LEN], ret); pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); } - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -280,8 +295,10 @@ static unsigned char *scanbuf = NULL; static size_t buflen = 0; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; xmin = pkg_glong(&buf[0*NET_LONG_LEN]); ymin = pkg_glong(&buf[1*NET_LONG_LEN]); @@ -297,7 +314,8 @@ if ((scanbuf = (unsigned char *)malloc(buflen)) == NULL) { fb_log("fb_read: malloc failed!"); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); buflen = 0; return; } @@ -308,7 +326,8 @@ /* sending a 0-length package indicates error */ pkg_send(MSG_RETURN, (char *)scanbuf, ret*sizeof(RGBpixel), pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -324,8 +343,10 @@ int ret; int type; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; x = pkg_glong(&buf[0*NET_LONG_LEN]); y = pkg_glong(&buf[1*NET_LONG_LEN]); @@ -340,7 +361,8 @@ (void)pkg_plong(&rbuf[0*NET_LONG_LEN], ret); pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); } - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -354,8 +376,10 @@ static unsigned char *scanbuf = NULL; static size_t buflen = 0; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; xmin = pkg_glong(&buf[0*NET_LONG_LEN]); ymin = pkg_glong(&buf[1*NET_LONG_LEN]); @@ -371,7 +395,8 @@ if ((scanbuf = (unsigned char *)malloc(buflen)) == NULL) { fb_log("fb_bwreadrect: malloc failed!"); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); buflen = 0; return; } @@ -382,7 +407,8 @@ /* sending a 0-length package indicates error */ pkg_send(MSG_RETURN, (char *)scanbuf, ret, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -398,8 +424,10 @@ int ret; int type; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; x = pkg_glong(&buf[0*NET_LONG_LEN]); y = pkg_glong(&buf[1*NET_LONG_LEN]); @@ -416,9 +444,10 @@ } else { /* No formal return code. Note errors locally */ if (ret < 0) fb_log("fb_server_fb_bwwriterect(%d, %d, %d, %d) error %d\n", - x, y, width, height, ret); + x, y, width, height, ret); } - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -428,8 +457,10 @@ int mode, x, y; char rbuf[NET_LONG_LEN+1]; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; mode = pkg_glong(&buf[0*NET_LONG_LEN]); x = pkg_glong(&buf[1*NET_LONG_LEN]); @@ -437,7 +468,8 @@ (void)pkg_plong(&rbuf[0], fb_cursor(fb_server_fbp, mode, x, y)); pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -456,7 +488,8 @@ (void)pkg_plong(&rbuf[2*NET_LONG_LEN], x); (void)pkg_plong(&rbuf[3*NET_LONG_LEN], y); pkg_send(MSG_RETURN, rbuf, 4*NET_LONG_LEN, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -468,7 +501,8 @@ int xbits, ybits; int xorig, yorig; - if (buf == NULL) return; + if (buf == NULL) + return; if (pcp == PKC_NULL) return; xbits = pkg_glong(&buf[0*NET_LONG_LEN]); @@ -483,7 +517,8 @@ (void)pkg_plong(&rbuf[0*NET_LONG_LEN], ret); pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); } - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -496,8 +531,10 @@ int mode, x, y; char rbuf[NET_LONG_LEN+1]; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; mode = pkg_glong(&buf[0*NET_LONG_LEN]); x = pkg_glong(&buf[1*NET_LONG_LEN]); @@ -505,7 +542,8 @@ (void)pkg_plong(&rbuf[0], fb_scursor(fb_server_fbp, mode, x, y)); pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -518,8 +556,10 @@ int x, y; char rbuf[NET_LONG_LEN+1]; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; x = pkg_glong(&buf[0*NET_LONG_LEN]); y = pkg_glong(&buf[1*NET_LONG_LEN]); @@ -526,7 +566,8 @@ (void)pkg_plong(&rbuf[0], fb_window(fb_server_fbp, x, y)); pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -539,8 +580,10 @@ int x, y; char rbuf[NET_LONG_LEN+1]; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; x = pkg_glong(&buf[0*NET_LONG_LEN]); y = pkg_glong(&buf[1*NET_LONG_LEN]); @@ -547,7 +590,8 @@ (void)pkg_plong(&rbuf[0], fb_zoom(fb_server_fbp, x, y)); pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -558,8 +602,10 @@ int xcenter, ycenter, xzoom, yzoom; char rbuf[NET_LONG_LEN+1]; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; xcenter = pkg_glong(&buf[0*NET_LONG_LEN]); ycenter = pkg_glong(&buf[1*NET_LONG_LEN]); @@ -569,7 +615,8 @@ ret = fb_view(fb_server_fbp, xcenter, ycenter, xzoom, yzoom); (void)pkg_plong(&rbuf[0], ret); pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -589,7 +636,8 @@ (void)pkg_plong(&rbuf[3*NET_LONG_LEN], xzoom); (void)pkg_plong(&rbuf[4*NET_LONG_LEN], yzoom); pkg_send(MSG_RETURN, rbuf, 5*NET_LONG_LEN, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -611,7 +659,8 @@ } pkg_send(MSG_DATA, (char *)cm, sizeof(cm), pcp); pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -629,8 +678,10 @@ long ret; ColorMap map; - if (buf == NULL) return; - if (pcp == PKC_NULL) return; + if (buf == NULL) + return; + if (pcp == PKC_NULL) + return; if (pcp->pkc_len == 0) ret = fb_wmap(fb_server_fbp, COLORMAP_NULL); @@ -644,7 +695,8 @@ } (void)pkg_plong(&rbuf[0], ret); pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -663,7 +715,8 @@ pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); } - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -673,7 +726,8 @@ if (pcp == PKC_NULL) return; (void)fb_poll(fb_server_fbp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } @@ -687,8 +741,10 @@ long ret; char rbuf[NET_LONG_LEN+1]; - if (pcp == PKC_NULL) return; - if (buf == NULL) return; + if (pcp == PKC_NULL) + return; + if (buf == NULL) + return; (void)pkg_glong(&buf[0*NET_LONG_LEN]); @@ -695,7 +751,8 @@ ret = fb_help(fb_server_fbp); (void)pkg_plong(&rbuf[0], ret); pkg_send(MSG_RETURN, rbuf, NET_LONG_LEN, pcp); - if (buf) (void)free(buf); + if (buf) + (void)free(buf); } const struct pkg_switch pkg_switch[] = { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. _______________________________________________ BRL-CAD Source Commits mailing list brlcad-commits@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/brlcad-commits