From nobody Fri May 16 03:54:12 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) client-ip=209.132.183.28; envelope-from=libvir-list-bounces@redhat.com; helo=mx1.redhat.com; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of redhat.com designates 209.132.183.28 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com Return-Path: Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) by mx.zohomail.com with SMTPS id 150162549640085.11041817877708; Tue, 1 Aug 2017 15:11:36 -0700 (PDT) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 2974F159526; Tue, 1 Aug 2017 22:11:34 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C25FE5D6AA; Tue, 1 Aug 2017 22:11:33 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id 65429180B467; Tue, 1 Aug 2017 22:11:32 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.11]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id v71LkMLt007839 for ; Tue, 1 Aug 2017 17:46:22 -0400 Received: by smtp.corp.redhat.com (Postfix) id C8D1D60476; Tue, 1 Aug 2017 21:46:22 +0000 (UTC) Received: from mx1.redhat.com (ext-mx06.extmail.prod.ext.phx2.redhat.com [10.5.110.30]) by smtp.corp.redhat.com (Postfix) with ESMTPS id C13BC60462 for ; Tue, 1 Aug 2017 21:46:20 +0000 (UTC) Received: from mail-qt0-f173.google.com (mail-qt0-f173.google.com [209.85.216.173]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id 1725F64E9D for ; Tue, 1 Aug 2017 21:46:19 +0000 (UTC) Received: by mail-qt0-f173.google.com with SMTP id p3so17074013qtg.2 for ; Tue, 01 Aug 2017 14:46:19 -0700 (PDT) Received: from dawid-fedora.datto.lan ([47.19.105.250]) by smtp.gmail.com with ESMTPSA id f56sm1892090qta.79.2017.08.01.14.46.16 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 01 Aug 2017 14:46:16 -0700 (PDT) DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 2974F159526 Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=libvir-list-bounces@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 2974F159526 Authentication-Results: mx1.redhat.com; dkim=fail reason="signature verification failed" (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="A5KT2fsd" DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 1725F64E9D Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: ext-mx06.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=dzrudy@gmail.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 1725F64E9D DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:subject:date:message-id:in-reply-to:references; bh=+p1cGaglrUe+LTUIIw5/zZ0uvPNhW+sMkNscaUH6Ox8=; b=A5KT2fsdasUhq830Us1f1ikWT2i0pPuV+QdeNDVLW54Rt9r+Ho/1KK1XEojggFVe6x YMKXaqZHakEJr1cjGjOwtiznHf7FjkUqne8fWj2PM0w6JEiSUCLdtv1SMuE166bx3uwl EQq4X4kFUKBL65umM7TX2oNY7vQ9qLhYWc5RRDHnLoRbiGqmc/awWE50RnMv4FcVEArt pmuKeuH2EmmsKds+8dGed/OFOuUvCSLdygj6x2w+FyveUuXRfsuLxCveYmwbWgBRRRcR Fpy8GVbqGrJAiVp/JqFhLv3vvUUvU+hRx/tJORNUVBcrbMhYUi2SGBMIoF4YTODfElF2 SFCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=+p1cGaglrUe+LTUIIw5/zZ0uvPNhW+sMkNscaUH6Ox8=; b=KC6EcIWAblwo9imh5gwrOXYNRWBY1jL+eezoPteFqkLhjr6AR+gBvVYFxqL8Y4o3Qa t8OMTQwVssV+lXCapNItG94FCjYxnJ9abktilO51pQYE8Q5D0o2S6DYFbWrjJRYvpdIT JWv9vds4G3Cv+B1n7S+M9YYeg7Uue9OrYruY4zqWkMnImUUXvcVQ2acsW16/ZXlMdGKT Lc1eqNkpsi9X79pyZAY2QmkwpSvdBt2Ni6qtlwoFz733iab2tIH2g2jdmXZW08SLdytA y9nk9PzI/Fn5OIWeCV7oObANRb93B4taQy3GSheTRVCZzEvNHJP4lJ4WFIRAzvTs4VGq i1fQ== X-Gm-Message-State: AIVw111LXPzZEitLOYpmoRzrPmUfK7kTWp44R6d3ORuogp9h5B1racFh PE1c9jrjCxAJKP7enYk= X-Received: by 10.200.3.43 with SMTP id q43mr30758523qtg.274.1501623977643; Tue, 01 Aug 2017 14:46:17 -0700 (PDT) From: Dawid Zamirski To: libvir-list@redhat.com Date: Tue, 1 Aug 2017 17:46:04 -0400 Message-Id: <20170801214614.8915-4-dzrudy@gmail.com> In-Reply-To: <20170801214614.8915-1-dzrudy@gmail.com> References: <20170801214614.8915-1-dzrudy@gmail.com> X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 01 Aug 2017 21:46:19 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.30]); Tue, 01 Aug 2017 21:46:19 +0000 (UTC) for IP:'209.85.216.173' DOMAIN:'mail-qt0-f173.google.com' HELO:'mail-qt0-f173.google.com' FROM:'dzrudy@gmail.com' RCPT:'' X-RedHat-Spam-Score: -0.43 (DCC_REPUT_00_12, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL, RCVD_IN_SORBS_SPAM, SPF_PASS) 209.85.216.173 mail-qt0-f173.google.com 209.85.216.173 mail-qt0-f173.google.com X-Scanned-By: MIMEDefang 2.78 on 10.5.110.30 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.11 X-loop: libvir-list@redhat.com Subject: [libvirt] [libvirt-php PATCH 03/13] Do not reuse PHPFUNC macro definition X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 01 Aug 2017 22:11:35 +0000 (UTC) X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 Content-Type: text/plain; charset="utf-8" The sockets.c and vncfunc.c should have their own function macros as they are "helper" functions not directly related to PHP bindings themselves. This is simple s/PHPFUNC/SOCKETFUNC/ and s/PHPFUNC/VNCFUNC/ --- src/sockets.c | 44 +++++++++---------- src/vncfunc.c | 138 +++++++++++++++++++++++++++++-------------------------= ---- 2 files changed, 91 insertions(+), 91 deletions(-) diff --git a/src/sockets.c b/src/sockets.c index 9c66257..ef9d154 100644 --- a/src/sockets.c +++ b/src/sockets.c @@ -26,7 +26,7 @@ DEBUG_INIT("sockets"); =20 /* Function macro */ -#define PHPFUNC __FUNCTION__ +#define SOCKETFUNC __FUNCTION__ =20 /* * Private function name: connect_socket @@ -59,7 +59,7 @@ int connect_socket(char *server, char *port, int keepaliv= e, int nodelay, int all server =3D strdup("localhost"); } =20 - DPRINTF("%s: Connecting to %s:%s\n", PHPFUNC, server, port); + DPRINTF("%s: Connecting to %s:%s\n", SOCKETFUNC, server, port); =20 s =3D getaddrinfo(server, port, &hints, &result); if (s !=3D 0) @@ -80,18 +80,18 @@ int connect_socket(char *server, char *port, int keepal= ive, int nodelay, int all return -errno; =20 freeaddrinfo(result); - DPRINTF("%s: Socket descriptor #%d opened\n", PHPFUNC, sfd); + DPRINTF("%s: Socket descriptor #%d opened\n", SOCKETFUNC, sfd); =20 if (keepalive) { int on =3D 1; if (setsockopt(sfd, SOL_SOCKET, SO_KEEPALIVE, &on, sizeof(on)) < 0= ) { int err =3D errno; close(sfd); - DPRINTF("%s: Cannot set keep alive option on socket\n", PHPFUN= C); + DPRINTF("%s: Cannot set keep alive option on socket\n", SOCKET= FUNC); return -err; } =20 - DPRINTF("%s: Socket #%d set as keepalive socket\n", PHPFUNC, sfd); + DPRINTF("%s: Socket #%d set as keepalive socket\n", SOCKETFUNC, sf= d); } =20 if (nodelay) { @@ -99,11 +99,11 @@ int connect_socket(char *server, char *port, int keepal= ive, int nodelay, int all if (setsockopt(sfd, IPPROTO_TCP, TCP_NODELAY, &on, sizeof(on)) < 0= ) { int err =3D errno; close(sfd); - DPRINTF("%s: Cannot set no delay option on socket\n", PHPFUNC); + DPRINTF("%s: Cannot set no delay option on socket\n", SOCKETFU= NC); return -err; } =20 - DPRINTF("%s: Socket #%d set as no delay socket\n", PHPFUNC, sfd); + DPRINTF("%s: Socket #%d set as no delay socket\n", SOCKETFUNC, sfd= ); } =20 return sfd; @@ -130,7 +130,7 @@ int socket_has_data(int sfd, long maxtime, int ignorems= g) } =20 if (!ignoremsg) - DPRINTF("%s: Checking data on socket %d, timeout =3D { %ld, %ld }\= n", PHPFUNC, sfd, + DPRINTF("%s: Checking data on socket %d, timeout =3D { %ld, %ld }\= n", SOCKETFUNC, sfd, (long)timeout.tv_sec, (long)timeout.tv_usec); =20 FD_ZERO(&fds); @@ -141,12 +141,12 @@ int socket_has_data(int sfd, long maxtime, int ignore= msg) rc =3D select( sizeof(fds), &fds, NULL, NULL, NULL); =20 if (rc=3D=3D-1) { - DPRINTF("%s: Select with error %d (%s)\n", PHPFUNC, errno, strerro= r(-errno)); + DPRINTF("%s: Select with error %d (%s)\n", SOCKETFUNC, errno, stre= rror(-errno)); return -errno; } =20 if (!ignoremsg) - DPRINTF("%s: Select returned %d\n", PHPFUNC, rc); + DPRINTF("%s: Select returned %d\n", SOCKETFUNC, rc); =20 return (rc =3D=3D 1); } @@ -165,19 +165,19 @@ void socket_read(int sfd, long length) unsigned char bigbuf[1048576]; =20 if (socket_has_data(sfd, 50000, 0) !=3D 1) { - DPRINTF("%s: No data appears to be available\n", PHPFUNC); + DPRINTF("%s: No data appears to be available\n", SOCKETFUNC); return; } =20 if (length =3D=3D -1) { - DPRINTF("%s: Reading all the data from socket\n", PHPFUNC); + DPRINTF("%s: Reading all the data from socket\n", SOCKETFUNC); while (socket_has_data(sfd, 50000, 1) =3D=3D 1) while ((len =3D read(sfd, bigbuf, sizeof(bigbuf))) =3D=3D size= of(bigbuf)) ; - DPRINTF("%s: Read done ...\n", PHPFUNC); + DPRINTF("%s: Read done ...\n", SOCKETFUNC); return; } =20 - DPRINTF("%s: Reading %ld bytes\n", PHPFUNC, length); + DPRINTF("%s: Reading %ld bytes\n", SOCKETFUNC, length); while (length > 0) { len =3D read(sfd, bigbuf, sizeof(bigbuf)); =20 @@ -188,9 +188,9 @@ void socket_read(int sfd, long length) =20 if (length && read(sfd, bigbuf, length) !=3D length) - DPRINTF("%s: not all byes read\n", PHPFUNC); + DPRINTF("%s: not all byes read\n", SOCKETFUNC); else - DPRINTF("%s: All bytes read\n", PHPFUNC); + DPRINTF("%s: All bytes read\n", SOCKETFUNC); } =20 /* @@ -218,11 +218,11 @@ int socket_read_and_save(int sfd, char *fn, long leng= th) return -EPERM; =20 if (socket_has_data(sfd, 50000, 0) !=3D 1) { - DPRINTF("%s: No data appears to be available\n", PHPFUNC); + DPRINTF("%s: No data appears to be available\n", SOCKETFUNC); return -ENOENT; } =20 - DPRINTF("%s: Reading %ld bytes\n", PHPFUNC, length); + DPRINTF("%s: Reading %ld bytes\n", SOCKETFUNC, length); while (length > 0) { len =3D read(sfd, bigbuf, sizeof(bigbuf)); =20 @@ -230,7 +230,7 @@ int socket_read_and_save(int sfd, char *fn, long length) SWAP2_BYTES_ENDIAN(1, bigbuf[i+1], bigbuf[i+2]); =20 if (write(fd, bigbuf, len) !=3D len) - DPRINTF("%s: unable to write to %d", PHPFUNC, fd); + DPRINTF("%s: unable to write to %d", SOCKETFUNC, fd); =20 length -=3D len; if (length < 0) @@ -244,14 +244,14 @@ int socket_read_and_save(int sfd, char *fn, long leng= th) SWAP2_BYTES_ENDIAN(1, bigbuf[i+1], bigbuf[i+2]); =20 if (write(fd, bigbuf, len) !=3D len) - DPRINTF("%s: unable to write to %d", PHPFUNC, fd); + DPRINTF("%s: unable to write to %d", SOCKETFUNC, fd); } =20 if (ftruncate(fd, orig_len) < 0) - DPRINTF("%s: Unable to truncate %d", PHPFUNC, fd); + DPRINTF("%s: Unable to truncate %d", SOCKETFUNC, fd); =20 close(fd); =20 - DPRINTF("%s: All bytes read\n", PHPFUNC); + DPRINTF("%s: All bytes read\n", SOCKETFUNC); return 0; } diff --git a/src/vncfunc.c b/src/vncfunc.c index eeadf42..c1430d1 100644 --- a/src/vncfunc.c +++ b/src/vncfunc.c @@ -23,7 +23,7 @@ DEBUG_INIT("vncfunc"); =20 /* Function macro */ -#define PHPFUNC __FUNCTION__ +#define VNCFUNC __FUNCTION__ =20 #define UC(a) (unsigned char)a #define CALC_UINT32(a, b, c, d) (uint32_t)((a >> 24) + (b >> 16) + (c >> 8= ) + d) @@ -93,11 +93,11 @@ vnc_write_client_version(int sfd) if (write(sfd, buf, 12) < 0) { int err =3D errno; close(sfd); - DPRINTF("%s: Write of client version failed\n", PHPFUNC); + DPRINTF("%s: Write of client version failed\n", VNCFUNC); return -err; } =20 - DPRINTF("%s: VNC Client version packet sent\n", PHPFUNC); + DPRINTF("%s: VNC Client version packet sent\n", VNCFUNC); return 0; } =20 @@ -121,7 +121,7 @@ vnc_authorize(int sfd) /* Read number security types supported */ if ((num =3D read(sfd, buf, 1)) < 0) { int err =3D errno; - DPRINTF("%s: Cannot read number of security types, error code %d (= %s)\n", PHPFUNC, err, strerror(err)); + DPRINTF("%s: Cannot read number of security types, error code %d (= %s)\n", VNCFUNC, err, strerror(err)); close(sfd); return -err; } @@ -129,7 +129,7 @@ vnc_authorize(int sfd) /* Read all the security types */ if (read(sfd, buf2, num) < 0) { int err =3D errno; - DPRINTF("%s: Read function failed with error code %d (%s)\n", PHPF= UNC, err, strerror(err)); + DPRINTF("%s: Read function failed with error code %d (%s)\n", VNCF= UNC, err, strerror(err)); close(sfd); return -err; } @@ -144,7 +144,7 @@ vnc_authorize(int sfd) /* Bail if security type None is not supported */ if (ok =3D=3D 0) { close(sfd); - DPRINTF("%s: Security type None is not supported\n", PHPFUNC); + DPRINTF("%s: Security type None is not supported\n", VNCFUNC); return -ENOTSUP; } =20 @@ -156,7 +156,7 @@ vnc_authorize(int sfd) return -err; } =20 - DPRINTF("%s: Security None selected\n", PHPFUNC); + DPRINTF("%s: Security None selected\n", VNCFUNC); =20 /* Just bogus to wait for proper auth response */ i =3D 0; @@ -164,7 +164,7 @@ vnc_authorize(int sfd) while (buf[0] + buf[1] + buf[2] + buf[3] !=3D 0) { if (read(sfd, buf, 4) < 0) { int err =3D errno; - DPRINTF("%s: Read function failed with error code %d (%s)\n", = PHPFUNC, err, strerror(err)); + DPRINTF("%s: Read function failed with error code %d (%s)\n", = VNCFUNC, err, strerror(err)); close(sfd); return -err; } @@ -174,7 +174,7 @@ vnc_authorize(int sfd) } } =20 - DPRINTF("%s: VNC Client authorized\n", PHPFUNC); + DPRINTF("%s: VNC Client authorized\n", VNCFUNC); return 0; } =20 @@ -200,13 +200,13 @@ vnc_parse_fb_params(unsigned char *buf, int len) =20 little_endian =3D (buf[6] =3D=3D 0); =20 - DPRINTF("%s: Read dimension bytes: width =3D { 0x%02x, 0x%02x }, heigh= t =3D { 0x%02x, 0x%02x }, %s endian\n", PHPFUNC, + DPRINTF("%s: Read dimension bytes: width =3D { 0x%02x, 0x%02x }, heigh= t =3D { 0x%02x, 0x%02x }, %s endian\n", VNCFUNC, w1, w2, h1, h2, little_endian ? "little" : "big"); =20 w =3D SWAP2_BY_ENDIAN(little_endian, w1, w2); h =3D SWAP2_BY_ENDIAN(little_endian, h1, h2); =20 - DPRINTF("%s: Filling the parameters structure with width =3D %d, heigh= t =3D %d\n", PHPFUNC, w, h); + DPRINTF("%s: Filling the parameters structure with width =3D %d, heigh= t =3D %d\n", VNCFUNC, w, h); =20 params.width =3D w; params.height =3D h; @@ -229,14 +229,14 @@ vnc_parse_fb_params(unsigned char *buf, int len) params.desktopNameLen =3D nlen; params.desktopName =3D (unsigned char*) strdup((char *)buf + 24); =20 - DPRINTF("%s: Desktop name set to '%s'\n", PHPFUNC, params.desktopName); + DPRINTF("%s: Desktop name set to '%s'\n", VNCFUNC, params.desktopName); =20 DPRINTF("%s: width =3D %d, height =3D %d, bpp =3D %d, depth =3D %d, bi= gEndian =3D %d, trueColor =3D %d\n", - PHPFUNC, params.width, params.height, params.bpp, params.depth= , params.bigEndian, params.trueColor); - DPRINTF("%s: maxColors =3D { %d, %d, %d }, shifts =3D { %d, %d, %d }\n= ", PHPFUNC, params.maxRed, + VNCFUNC, params.width, params.height, params.bpp, params.depth= , params.bigEndian, params.trueColor); + DPRINTF("%s: maxColors =3D { %d, %d, %d }, shifts =3D { %d, %d, %d }\n= ", VNCFUNC, params.maxRed, params.maxGreen, params.maxBlue, params.shiftRed, params.shift= Green, params.shiftBlue); =20 - DPRINTF("%s: Desktop name is '%s' (%d bytes)\n", PHPFUNC, params.deskt= opName, params.desktopNameLen); + DPRINTF("%s: Desktop name is '%s' (%d bytes)\n", VNCFUNC, params.deskt= opName, params.desktopNameLen); =20 return params; } @@ -266,18 +266,18 @@ vnc_send_key(int sfd, unsigned char key, int modifier= , int release) buf[6] =3D modifier ? 0xff : 0x00; buf[7] =3D key; =20 - DPRINTF("%s: %s key %d [0x%02x], modifier: %s\n", PHPFUNC, (release ? = "Releasing" : "Pressing"), + DPRINTF("%s: %s key %d [0x%02x], modifier: %s\n", VNCFUNC, (release ? = "Releasing" : "Pressing"), key, key, modifier ? "true" : "false"); =20 if (write(sfd, buf, 8) < 0) { int err =3D errno; DPRINTF("%s: Error occured while writing to socket descriptor #%d:= %d (%s)\n", - PHPFUNC, sfd, err, strerror(err)); + VNCFUNC, sfd, err, strerror(err)); close(sfd); return -err; } =20 - DPRINTF("%s: Write of 8 bytes successful\n", PHPFUNC); + DPRINTF("%s: Write of 8 bytes successful\n", VNCFUNC); =20 return 0; } @@ -298,7 +298,7 @@ vnc_send_client_pointer(int sfd, int clicked, int pos_x= , int pos_y) unsigned char buf[6] =3D { 0 }; =20 if (sfd < 0) { - DPRINTF("%s: Socket is not opened!\n", PHPFUNC); + DPRINTF("%s: Socket is not opened!\n", VNCFUNC); return -EINVAL; } =20 @@ -311,14 +311,14 @@ vnc_send_client_pointer(int sfd, int clicked, int pos= _x, int pos_y) =20 if (write(sfd, buf, 6) < 0) { int err =3D errno; - DPRINTF("%s: Write function failed with error code %d (%s)\n", PHP= FUNC, err, strerror(err)); + DPRINTF("%s: Write function failed with error code %d (%s)\n", VNC= FUNC, err, strerror(err)); close(sfd); return -err; } =20 =20 DPRINTF("%s: Wrote 6 bytes of client pointer event, clicked =3D %d, x = =3D { 0x%02x, 0x%02x }, y =3D { 0x%02x, 0x%02x }\n", - PHPFUNC, buf[1], buf[2], buf[3], buf[4], buf[5]); + VNCFUNC, buf[1], buf[2], buf[3], buf[4], buf[5]); return 0; } =20 @@ -336,11 +336,11 @@ vnc_set_pixel_format(int sfd, tServerFBParams params) unsigned char buf[20]; =20 if (sfd < 0) { - DPRINTF("%s: Socket is not opened!\n", PHPFUNC); + DPRINTF("%s: Socket is not opened!\n", VNCFUNC); return -EINVAL; } =20 - DPRINTF("%s: Setting up pixel format\n", PHPFUNC); + DPRINTF("%s: Setting up pixel format\n", VNCFUNC); =20 memset(buf, 0, 20); /* Message type 0 is SetPixelFormat message */ @@ -370,12 +370,12 @@ vnc_set_pixel_format(int sfd, tServerFBParams params) =20 if (write(sfd, buf, 20) < 0) { int err =3D errno; - DPRINTF("%s: Write function failed with error code %d (%s)\n", PHP= FUNC, err, strerror(err)); + DPRINTF("%s: Write function failed with error code %d (%s)\n", VNC= FUNC, err, strerror(err)); close(sfd); return -err; } =20 - DPRINTF("%s: Pixel format set\n", PHPFUNC); + DPRINTF("%s: Pixel format set\n", VNCFUNC); =20 return 0; } @@ -393,11 +393,11 @@ vnc_set_encoding(int sfd) unsigned char buf[8]; =20 if (sfd < 0) { - DPRINTF("%s: Socket is not opened!\n", PHPFUNC); + DPRINTF("%s: Socket is not opened!\n", VNCFUNC); return -EINVAL; } =20 - DPRINTF("%s: Setting up encoding\n", PHPFUNC); + DPRINTF("%s: Setting up encoding\n", VNCFUNC); =20 memset(buf, 0, 8); buf[0] =3D 0x02; @@ -412,12 +412,12 @@ vnc_set_encoding(int sfd) =20 if (write(sfd, buf, 8) < 0) { int err =3D errno; - DPRINTF("%s: Write function failed with error code %d (%s)\n", PHP= FUNC, err, strerror(err)); + DPRINTF("%s: Write function failed with error code %d (%s)\n", VNC= FUNC, err, strerror(err)); close(sfd); return -err; } =20 - DPRINTF("%s: Client encoding set\n", PHPFUNC); + DPRINTF("%s: Client encoding set\n", VNCFUNC); return 0; } =20 @@ -439,11 +439,11 @@ vnc_send_framebuffer_update(int sfd, int incrementalU= pdate, int x, int y, int w, unsigned char buf[10]; =20 if (sfd < 0) { - DPRINTF("%s: Socket is not opened!\n", PHPFUNC); + DPRINTF("%s: Socket is not opened!\n", VNCFUNC); return -EINVAL; } =20 - DPRINTF("%s: Sending %s update request\n", PHPFUNC, (incrementalUpdate= ? "standard" : "incremental")); + DPRINTF("%s: Sending %s update request\n", VNCFUNC, (incrementalUpdate= ? "standard" : "incremental")); memset(buf, 0, 10); buf[0] =3D 0x03; buf[1] =3D incrementalUpdate; @@ -455,12 +455,12 @@ vnc_send_framebuffer_update(int sfd, int incrementalU= pdate, int x, int y, int w, =20 if (write(sfd, buf, 10) < 0) { int err =3D errno; - DPRINTF("%s: Write function failed with error code %d (%s)\n", PHP= FUNC, err, strerror(err)); + DPRINTF("%s: Write function failed with error code %d (%s)\n", VNC= FUNC, err, strerror(err)); close(sfd); return -err; } =20 - DPRINTF("%s: Request sent\n", PHPFUNC); + DPRINTF("%s: Request sent\n", VNCFUNC); =20 return 0; } @@ -499,11 +499,11 @@ vnc_connect(char *server, char *port, int share) if (sfd < 0) return sfd; =20 - DPRINTF("%s: Opened socket with descriptor #%d\n", PHPFUNC, sfd); + DPRINTF("%s: Opened socket with descriptor #%d\n", VNCFUNC, sfd); =20 if (read(sfd, buf, 1024) < 0) { int err =3D errno; - DPRINTF("%s: Read function failed with error code %d (%s)\n", PHPF= UNC, err, strerror(err)); + DPRINTF("%s: Read function failed with error code %d (%s)\n", VNCF= UNC, err, strerror(err)); close(sfd); return -err; } @@ -522,7 +522,7 @@ vnc_connect(char *server, char *port, int share) return -err; } =20 - DPRINTF("%s: Share desktop flag sent (%d)\n", PHPFUNC, buf[0]); + DPRINTF("%s: Share desktop flag sent (%d)\n", VNCFUNC, buf[0]); =20 return sfd; } @@ -542,16 +542,16 @@ vnc_read_server_init(int sfd) tServerFBParams params =3D { 0 }; int len =3D 0, namelen =3D 0; =20 - DPRINTF("%s: Server init - reading framebuffer parameters\n", PHPFUNC); + DPRINTF("%s: Server init - reading framebuffer parameters\n", VNCFUNC); if (read(sfd, tmpbuf, 24) < 0) { int err =3D errno; - DPRINTF("%s: Read function failed with error code %d (%s)\n", PHPF= UNC, err, strerror(err)); + DPRINTF("%s: Read function failed with error code %d (%s)\n", VNCF= UNC, err, strerror(err)); close(sfd); goto cleanup; } =20 namelen =3D (int)CALC_UINT32(tmpbuf[20], tmpbuf[21], tmpbuf[22], tmpbu= f[23]); - DPRINTF("%s: Name length is %d\n", PHPFUNC, namelen); + DPRINTF("%s: Name length is %d\n", VNCFUNC, namelen); =20 buf =3D (unsigned char *)malloc(namelen + 25); memset(buf, 0, namelen + 25); @@ -559,7 +559,7 @@ vnc_read_server_init(int sfd) =20 if ((len =3D read(sfd, buf + 24, namelen)) < 0) { int err =3D errno; - DPRINTF("%s: Read function failed with error code %d (%s)\n", PHPF= UNC, err, strerror(err)); + DPRINTF("%s: Read function failed with error code %d (%s)\n", VNCF= UNC, err, strerror(err)); close(sfd); goto cleanup; } @@ -587,16 +587,16 @@ int vnc_get_dimensions(char *server, char *port, int = *width, int *height) tServerFBParams params; =20 if (!width && !height) { - DPRINTF("%s: Neither width or height output value not defined\n", = PHPFUNC); + DPRINTF("%s: Neither width or height output value not defined\n", = VNCFUNC); return -EINVAL; } =20 - DPRINTF("%s: server is %s, port is %s\n", PHPFUNC, server, port); + DPRINTF("%s: server is %s, port is %s\n", VNCFUNC, server, port); =20 sfd =3D vnc_connect(server, port, 1); if (sfd < 0) { int err =3D errno; - DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", PHP= FUNC, err, strerror(err)); + DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", VNC= FUNC, err, strerror(err)); close(sfd); return -err; } @@ -606,13 +606,13 @@ int vnc_get_dimensions(char *server, char *port, int = *width, int *height) if (width) { *width =3D params.width; =20 - DPRINTF("%s: Output parameter of width set to %d\n", PHPFUNC, *wid= th); + DPRINTF("%s: Output parameter of width set to %d\n", VNCFUNC, *wid= th); } =20 if (height) { *height =3D params.height; =20 - DPRINTF("%s: Output parameter of height set to %d\n", PHPFUNC, *he= ight); + DPRINTF("%s: Output parameter of height set to %d\n", VNCFUNC, *he= ight); } =20 while (socket_has_data(sfd, 500000, 0) =3D=3D 1) @@ -620,7 +620,7 @@ int vnc_get_dimensions(char *server, char *port, int *w= idth, int *height) =20 shutdown(sfd, SHUT_RDWR); close(sfd); - DPRINTF("%s: Closed descriptor #%d\n", PHPFUNC, sfd); + DPRINTF("%s: Closed descriptor #%d\n", VNCFUNC, sfd); return 0; } =20 @@ -740,7 +740,7 @@ int vnc_get_bitmap(char *server, char *port, char *fn) sfd =3D vnc_connect(server, port, 1); if (sfd < 0) { int err =3D errno; - DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", PHP= FUNC, err, strerror(err)); + DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", VNC= FUNC, err, strerror(err)); close(sfd); return -err; } @@ -748,12 +748,12 @@ int vnc_get_bitmap(char *server, char *port, char *fn) params =3D vnc_read_server_init(sfd); =20 pattern_size =3D params.width * params.height * (params.bpp / 8); - DPRINTF("%s: %ld\n", PHPFUNC, pattern_size); + DPRINTF("%s: %ld\n", VNCFUNC, pattern_size); =20 vnc_set_pixel_format(sfd, params); vnc_set_encoding(sfd); =20 - DPRINTF("%s: Requesting framebuffer update\n", PHPFUNC); + DPRINTF("%s: Requesting framebuffer update\n", VNCFUNC); vnc_send_framebuffer_update_request(sfd, 1, params); =20 while (socket_has_data(sfd, 50000, 0) =3D=3D 0) { @@ -766,7 +766,7 @@ int vnc_get_bitmap(char *server, char *port, char *fn) =20 vnc_raw_to_bmp(file, fn, params.width, params.height); unlink(file); - DPRINTF("%s: Closed descriptor #%d\n", PHPFUNC, sfd); + DPRINTF("%s: Closed descriptor #%d\n", VNCFUNC, sfd); return 0; } =20 @@ -785,12 +785,12 @@ int vnc_send_keys(char *server, char *port, char *key= s) int i, skip_next; tServerFBParams params; =20 - DPRINTF("%s: server is %s, port is %s, keys are '%s'\n", PHPFUNC, serv= er, port, keys); + DPRINTF("%s: server is %s, port is %s, keys are '%s'\n", VNCFUNC, serv= er, port, keys); =20 sfd =3D vnc_connect(server, port, 1); if (sfd < 0) { int err =3D errno; - DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", PHP= FUNC, err, strerror(err)); + DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", VNC= FUNC, err, strerror(err)); close(sfd); return -err; } @@ -798,9 +798,9 @@ int vnc_send_keys(char *server, char *port, char *keys) params =3D vnc_read_server_init(sfd); =20 skip_next =3D 0; - DPRINTF("%s: About to process key sequence '%s' (%d keys)\n", PHPFUNC,= keys, (int)strlen(keys)); + DPRINTF("%s: About to process key sequence '%s' (%d keys)\n", VNCFUNC,= keys, (int)strlen(keys)); for (i =3D 0; i < strlen(keys); i++) { - DPRINTF("%s: Processing key %d: %d [0x%02x]\n", PHPFUNC, i, keys[i= ], keys[i]); + DPRINTF("%s: Processing key %d: %d [0x%02x]\n", VNCFUNC, i, keys[i= ], keys[i]); if (skip_next) { skip_next =3D 0; continue; @@ -815,25 +815,25 @@ int vnc_send_keys(char *server, char *port, char *key= s) skip_next =3D 1; } =20 - DPRINTF("%s: Sending key press emulation for key %d\n", PHPFUNC, k= eys[i]); + DPRINTF("%s: Sending key press emulation for key %d\n", VNCFUNC, k= eys[i]); vnc_send_key(sfd, keys[i], skip_next, 0); - DPRINTF("%s: Requesting framebuffer update\n", PHPFUNC); + DPRINTF("%s: Requesting framebuffer update\n", VNCFUNC); vnc_send_framebuffer_update_request(sfd, 1, params); - DPRINTF("%s: Sending key release emulation for key %d\n", PHPFUNC,= keys[i]); + DPRINTF("%s: Sending key release emulation for key %d\n", VNCFUNC,= keys[i]); vnc_send_key(sfd, keys[i], skip_next, 1); =20 /* Sleep for 50 ms, required to make VNC server accept the keystro= ke emulation */ usleep(50000); } =20 - DPRINTF("%s: All %d keys sent\n", PHPFUNC, (int)strlen(keys)); + DPRINTF("%s: All %d keys sent\n", VNCFUNC, (int)strlen(keys)); =20 while (socket_has_data(sfd, 500000, 0) =3D=3D 1) socket_read(sfd, -1); =20 shutdown(sfd, SHUT_RDWR); close(sfd); - DPRINTF("%s: Closed descriptor #%d\n", PHPFUNC, sfd); + DPRINTF("%s: Closed descriptor #%d\n", VNCFUNC, sfd); return 0; } =20 @@ -854,13 +854,13 @@ int vnc_send_pointer_event(char *server, char *port, = int pos_x, int pos_y, int c int sfd; tServerFBParams params; =20 - DPRINTF("%s: Server is %s, port is %s, x is %d, y is %d, clicked is %d= , release is %d\n", PHPFUNC, + DPRINTF("%s: Server is %s, port is %s, x is %d, y is %d, clicked is %d= , release is %d\n", VNCFUNC, server, port, pos_x, pos_y, clicked, release); =20 sfd =3D vnc_connect(server, port, 0); if (sfd < 0) { int err =3D errno; - DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", PHP= FUNC, err, strerror(err)); + DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", VNC= FUNC, err, strerror(err)); close(sfd); return -err; } @@ -870,7 +870,7 @@ int vnc_send_pointer_event(char *server, char *port, in= t pos_x, int pos_y, int c if (((pos_x > params.width) || (pos_y < 0)) || ((pos_y > params.height) || (pos_y < 0))) { DPRINTF("%s: Required positions out of range (width =3D %d, height= =3D %d, x =3D %d, y =3D %d) for '%s'\n", - PHPFUNC, params.width, params.height, pos_x, pos_y, params= .desktopName); + VNCFUNC, params.width, params.height, pos_x, pos_y, params= .desktopName); return -EINVAL; } =20 @@ -901,7 +901,7 @@ int vnc_send_pointer_event(char *server, char *port, in= t pos_x, int pos_y, int c shutdown(sfd, SHUT_RDWR); close(sfd); =20 - DPRINTF("%s: Closed descriptor #%d\n", PHPFUNC, sfd); + DPRINTF("%s: Closed descriptor #%d\n", VNCFUNC, sfd); =20 return 0; } @@ -920,29 +920,29 @@ int vnc_refresh_screen(char *server, char *port, int = scancode) int sfd; tServerFBParams params; =20 - DPRINTF("%s: Server is %s, port is %s, scancode is %d\n", PHPFUNC, ser= ver, port, scancode); + DPRINTF("%s: Server is %s, port is %s, scancode is %d\n", VNCFUNC, ser= ver, port, scancode); =20 - DPRINTF("%s: server is %s, port is %s\n", PHPFUNC, server, port); + DPRINTF("%s: server is %s, port is %s\n", VNCFUNC, server, port); =20 sfd =3D vnc_connect(server, port, 1); if (sfd < 0) { int err =3D errno; - DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", PHP= FUNC, err, strerror(err)); + DPRINTF("%s: VNC Connection failed with error code %d (%s)\n", VNC= FUNC, err, strerror(err)); close(sfd); return -err; } =20 params =3D vnc_read_server_init(sfd); =20 - DPRINTF("%s: Sending key press emulation for key %d\n", PHPFUNC, scanc= ode); + DPRINTF("%s: Sending key press emulation for key %d\n", VNCFUNC, scanc= ode); if (scancode > -1) vnc_send_key(sfd, scancode, 1, 0); =20 - DPRINTF("%s: Requesting framebuffer update\n", PHPFUNC); + DPRINTF("%s: Requesting framebuffer update\n", VNCFUNC); vnc_send_framebuffer_update_request(sfd, 1, params); =20 shutdown(sfd, SHUT_RDWR); close(sfd); - DPRINTF("%s: Closed descriptor #%d\n", PHPFUNC, sfd); + DPRINTF("%s: Closed descriptor #%d\n", VNCFUNC, sfd); return 0; } --=20 2.13.3 -- libvir-list mailing list libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list