diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index c10dca62..4ee77129 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -21,7 +21,3 @@ if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "IRIX")
endif()
add_subdirectory(plugin)
add_subdirectory(micro)
-
-if (VNC_SUPPORT)
- add_subdirectory(vnc)
-endif()
diff --git a/src/vnc/CMakeLists.txt b/src/vnc/CMakeLists.txt
deleted file mode 100644
index 56fce6da..00000000
--- a/src/vnc/CMakeLists.txt
+++ /dev/null
@@ -1,23 +0,0 @@
-# synergy -- mouse and keyboard sharing utility
-# Copyright (C) 2012 Nick Bolton
-#
-# This package is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# found in the file COPYING that should have accompanied this file.
-#
-# This package is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-
-if (WIN32)
-add_subdirectory(common)
- add_subdirectory(win)
-elseif (UNIX)
- #add_subdirectory(unix)
-endif()
-
diff --git a/src/vnc/LICENCE.txt b/src/vnc/LICENCE.txt
deleted file mode 100644
index ae3b5319..00000000
--- a/src/vnc/LICENCE.txt
+++ /dev/null
@@ -1,340 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.
- 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Library General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- Appendix: How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
-
- Copyright (C) 19yy
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) 19yy name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- , 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Library General
-Public License instead of this License.
diff --git a/src/vnc/common/CMakeLists.txt b/src/vnc/common/CMakeLists.txt
deleted file mode 100644
index 2754c024..00000000
--- a/src/vnc/common/CMakeLists.txt
+++ /dev/null
@@ -1,20 +0,0 @@
-# synergy -- mouse and keyboard sharing utility
-# Copyright (C) 2012 Nick Bolton
-#
-# This package is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# found in the file COPYING that should have accompanied this file.
-#
-# This package is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-add_subdirectory(rfb)
-add_subdirectory(network)
-add_subdirectory(rdr)
-add_subdirectory(Xregion)
-add_subdirectory(zlib)
diff --git a/src/vnc/common/Makefile.in b/src/vnc/common/Makefile.in
deleted file mode 100644
index b55d23e3..00000000
--- a/src/vnc/common/Makefile.in
+++ /dev/null
@@ -1,4 +0,0 @@
-
-SUBDIRS = @ZLIB_DIR@ rdr network Xregion rfb
-
-# followed by boilerplate.mk
diff --git a/src/vnc/common/Xregion/CMakeLists.txt b/src/vnc/common/Xregion/CMakeLists.txt
deleted file mode 100644
index 3276ce35..00000000
--- a/src/vnc/common/Xregion/CMakeLists.txt
+++ /dev/null
@@ -1,36 +0,0 @@
-# synergy -- mouse and keyboard sharing utility
-# Copyright (C) 2012 Nick Bolton
-#
-# This package is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# found in the file COPYING that should have accompanied this file.
-#
-# This package is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-set(inc
- region.h
-
- Xregion.h
-)
-
-set(src
- Region.c
-)
-
-if (WIN32)
- list(APPEND src ${inc})
-endif()
-
-set(inc
- ..
- ../../win
-)
-
-include_directories(${inc})
-add_library(vnc_Xregion STATIC ${src})
diff --git a/src/vnc/common/Xregion/Makefile.in b/src/vnc/common/Xregion/Makefile.in
deleted file mode 100644
index 878a29b6..00000000
--- a/src/vnc/common/Xregion/Makefile.in
+++ /dev/null
@@ -1,15 +0,0 @@
-
-SRCS = Region.c
-
-OBJS = $(SRCS:.c=.o)
-
-library = libXregion.a
-
-all:: $(library)
-
-$(library): $(OBJS)
- rm -f $(library)
- $(AR) $(library) $(OBJS)
- $(RANLIB) $(library)
-
-# followed by boilerplate.mk
diff --git a/src/vnc/common/Xregion/Region.c b/src/vnc/common/Xregion/Region.c
deleted file mode 100644
index bf2d123b..00000000
--- a/src/vnc/common/Xregion/Region.c
+++ /dev/null
@@ -1,1687 +0,0 @@
-/* $Xorg: Region.c,v 1.6 2001/02/09 02:03:35 xorgcvs Exp $ */
-/************************************************************************
-
-Copyright 1987, 1988, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987, 1988 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-************************************************************************/
-/* $XFree86: xc/lib/X11/Region.c,v 1.8 2001/12/14 19:54:05 dawes Exp $ */
-/*
- * The functions in this file implement the Region abstraction, similar to one
- * used in the X11 sample server. A Region is simply an area, as the name
- * implies, and is implemented as a "y-x-banded" array of rectangles. To
- * explain: Each Region is made up of a certain number of rectangles sorted
- * by y coordinate first, and then by x coordinate.
- *
- * Furthermore, the rectangles are banded such that every rectangle with a
- * given upper-left y coordinate (y1) will have the same lower-right y
- * coordinate (y2) and vice versa. If a rectangle has scanlines in a band, it
- * will span the entire vertical distance of the band. This means that some
- * areas that could be merged into a taller rectangle will be represented as
- * several shorter rectangles to account for shorter rectangles to its left
- * or right but within its "vertical scope".
- *
- * An added constraint on the rectangles is that they must cover as much
- * horizontal area as possible. E.g. no two rectangles in a band are allowed
- * to touch.
- *
- * Whenever possible, bands will be merged together to cover a greater vertical
- * distance (and thus reduce the number of rectangles). Two bands can be merged
- * only if the bottom of one touches the top of the other and they have
- * rectangles in the same places (of the same width, of course). This maintains
- * the y-x-banding that's so nice to have...
- */
-
-#include "Xregion.h"
-//#include "Xlibint.h"
-//#include "Xutil.h"
-#include "region.h"
-//#include "poly.h"
-
-#ifdef DEBUG
-#include
-#define assert(expr) {if (!(expr)) fprintf(stderr,\
-"Assertion failed file %s, line %d: expr\n", __FILE__, __LINE__); }
-#else
-#define assert(expr)
-#endif
-
-typedef void (*voidProcp)();
-
-static void miRegionOp();
-/* Create a new empty region */
-Region
-XCreateRegion()
-{
- Region temp;
-
- if (! (temp = ( Region )Xmalloc( (unsigned) sizeof( REGION ))))
- return (Region) NULL;
- if (! (temp->rects = ( BOX * )Xmalloc( (unsigned) sizeof( BOX )))) {
- Xfree((char *) temp);
- return (Region) NULL;
- }
- temp->numRects = 0;
- temp->extents.x1 = 0;
- temp->extents.y1 = 0;
- temp->extents.x2 = 0;
- temp->extents.y2 = 0;
- temp->size = 1;
- return( temp );
-}
-
-int
-XClipBox( r, rect )
- Region r;
- XRectangle *rect;
-{
- rect->x = r->extents.x1;
- rect->y = r->extents.y1;
- rect->width = r->extents.x2 - r->extents.x1;
- rect->height = r->extents.y2 - r->extents.y1;
- return 1;
-}
-
-int
-XUnionRectWithRegion(rect, source, dest)
- register XRectangle *rect;
- Region source, dest;
-{
- REGION region;
-
- if (!rect->width || !rect->height)
- return 0;
- region.rects = ®ion.extents;
- region.numRects = 1;
- region.extents.x1 = rect->x;
- region.extents.y1 = rect->y;
- region.extents.x2 = rect->x + rect->width;
- region.extents.y2 = rect->y + rect->height;
- region.size = 1;
-
- return XUnionRegion(®ion, source, dest);
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miSetExtents --
- * Reset the extents of a region to what they should be. Called by
- * miSubtract and miIntersect b/c they can't figure it out along the
- * way or do so easily, as miUnion can.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * The region's 'extents' structure is overwritten.
- *
- *-----------------------------------------------------------------------
- */
-static void
-miSetExtents (pReg)
- Region pReg;
-{
- register BoxPtr pBox,
- pBoxEnd,
- pExtents;
-
- if (pReg->numRects == 0)
- {
- pReg->extents.x1 = 0;
- pReg->extents.y1 = 0;
- pReg->extents.x2 = 0;
- pReg->extents.y2 = 0;
- return;
- }
-
- pExtents = &pReg->extents;
- pBox = pReg->rects;
- pBoxEnd = &pBox[pReg->numRects - 1];
-
- /*
- * Since pBox is the first rectangle in the region, it must have the
- * smallest y1 and since pBoxEnd is the last rectangle in the region,
- * it must have the largest y2, because of banding. Initialize x1 and
- * x2 from pBox and pBoxEnd, resp., as good things to initialize them
- * to...
- */
- pExtents->x1 = pBox->x1;
- pExtents->y1 = pBox->y1;
- pExtents->x2 = pBoxEnd->x2;
- pExtents->y2 = pBoxEnd->y2;
-
- assert(pExtents->y1 < pExtents->y2);
- while (pBox <= pBoxEnd)
- {
- if (pBox->x1 < pExtents->x1)
- {
- pExtents->x1 = pBox->x1;
- }
- if (pBox->x2 > pExtents->x2)
- {
- pExtents->x2 = pBox->x2;
- }
- pBox++;
- }
- assert(pExtents->x1 < pExtents->x2);
-}
-
-extern void _XSetClipRectangles();
-
-#if 0
-int
-XSetRegion( dpy, gc, r )
- Display *dpy;
- GC gc;
- register Region r;
-{
- register int i;
- register XRectangle *xr, *pr;
- register BOX *pb;
- unsigned long total;
-
- LockDisplay (dpy);
- total = r->numRects * sizeof (XRectangle);
- if ((xr = (XRectangle *) _XAllocTemp(dpy, total))) {
- for (pr = xr, pb = r->rects, i = r->numRects; --i >= 0; pr++, pb++) {
- pr->x = pb->x1;
- pr->y = pb->y1;
- pr->width = pb->x2 - pb->x1;
- pr->height = pb->y2 - pb->y1;
- }
- }
- if (xr || !r->numRects)
- _XSetClipRectangles(dpy, gc, 0, 0, xr, r->numRects, YXBanded);
- if (xr)
- _XFreeTemp(dpy, (char *)xr, total);
- UnlockDisplay(dpy);
- SyncHandle();
- return 1;
-}
-#endif
-
-int
-XDestroyRegion( r )
- Region r;
-{
- Xfree( (char *) r->rects );
- Xfree( (char *) r );
- return 1;
-}
-
-
-/* TranslateRegion(pRegion, x, y)
- translates in place
- added by raymond
-*/
-
-int
-XOffsetRegion(pRegion, x, y)
- register Region pRegion;
- register int x;
- register int y;
-{
- register int nbox;
- register BOX *pbox;
-
- pbox = pRegion->rects;
- nbox = pRegion->numRects;
-
- while(nbox--)
- {
- pbox->x1 += x;
- pbox->x2 += x;
- pbox->y1 += y;
- pbox->y2 += y;
- pbox++;
- }
- pRegion->extents.x1 += x;
- pRegion->extents.x2 += x;
- pRegion->extents.y1 += y;
- pRegion->extents.y2 += y;
- return 1;
-}
-
-/*
- Utility procedure Compress:
- Replace r by the region r', where
- p in r' iff (Quantifer m <= dx) (p + m in r), and
- Quantifier is Exists if grow is TRUE, For all if grow is FALSE, and
- (x,y) + m = (x+m,y) if xdir is TRUE; (x,y+m) if xdir is FALSE.
-
- Thus, if xdir is TRUE and grow is FALSE, r is replaced by the region
- of all points p such that p and the next dx points on the same
- horizontal scan line are all in r. We do this using by noting
- that p is the head of a run of length 2^i + k iff p is the head
- of a run of length 2^i and p+2^i is the head of a run of length
- k. Thus, the loop invariant: s contains the region corresponding
- to the runs of length shift. r contains the region corresponding
- to the runs of length 1 + dxo & (shift-1), where dxo is the original
- value of dx. dx = dxo & ~(shift-1). As parameters, s and t are
- scratch regions, so that we don't have to allocate them on every
- call.
-*/
-
-#define ZOpRegion(a,b,c) if (grow) XUnionRegion(a,b,c); \
- else XIntersectRegion(a,b,c)
-#define ZShiftRegion(a,b) if (xdir) XOffsetRegion(a,b,0); \
- else XOffsetRegion(a,0,b)
-#define ZCopyRegion(a,b) XUnionRegion(a,a,b)
-
-static void
-Compress(r, s, t, dx, xdir, grow)
- Region r, s, t;
- register unsigned dx;
- register int xdir, grow;
-{
- register unsigned shift = 1;
-
- ZCopyRegion(r, s);
- while (dx) {
- if (dx & shift) {
- ZShiftRegion(r, -(int)shift);
- ZOpRegion(r, s, r);
- dx -= shift;
- if (!dx) break;
- }
- ZCopyRegion(s, t);
- ZShiftRegion(s, -(int)shift);
- ZOpRegion(s, t, s);
- shift <<= 1;
- }
-}
-
-#undef ZOpRegion
-#undef ZShiftRegion
-#undef ZCopyRegion
-
-int
-XShrinkRegion(r, dx, dy)
- Region r;
- int dx, dy;
-{
- Region s, t;
- int grow;
-
- if (!dx && !dy) return 0;
- if ((! (s = XCreateRegion())) || (! (t = XCreateRegion()))) return 0;
- if ((grow = (dx < 0))) dx = -dx;
- if (dx) Compress(r, s, t, (unsigned) 2*dx, TRUE, grow);
- if ((grow = (dy < 0))) dy = -dy;
- if (dy) Compress(r, s, t, (unsigned) 2*dy, FALSE, grow);
- XOffsetRegion(r, dx, dy);
- XDestroyRegion(s);
- XDestroyRegion(t);
- return 0;
-}
-
-#ifdef notdef
-/***********************************************************
- * Bop down the array of rects until we have passed
- * scanline y. numRects is the size of the array.
- ***********************************************************/
-
-static BOX
-*IndexRects(rects, numRects, y)
- register BOX *rects;
- register int numRects;
- register int y;
-{
- while ((numRects--) && (rects->y2 <= y))
- rects++;
- return(rects);
-}
-#endif
-
-/*======================================================================
- * Region Intersection
- *====================================================================*/
-/*-
- *-----------------------------------------------------------------------
- * miIntersectO --
- * Handle an overlapping band for miIntersect.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * Rectangles may be added to the region.
- *
- *-----------------------------------------------------------------------
- */
-/* static void*/
-static int
-miIntersectO (pReg, r1, r1End, r2, r2End, y1, y2)
- register Region pReg;
- register BoxPtr r1;
- BoxPtr r1End;
- register BoxPtr r2;
- BoxPtr r2End;
- short y1;
- short y2;
-{
- register short x1;
- register short x2;
- register BoxPtr pNextRect;
-
- pNextRect = &pReg->rects[pReg->numRects];
-
- while ((r1 != r1End) && (r2 != r2End))
- {
- x1 = max(r1->x1,r2->x1);
- x2 = min(r1->x2,r2->x2);
-
- /*
- * If there's any overlap between the two rectangles, add that
- * overlap to the new region.
- * There's no need to check for subsumption because the only way
- * such a need could arise is if some region has two rectangles
- * right next to each other. Since that should never happen...
- */
- if (x1 < x2)
- {
- assert(y1rects);
- pNextRect->x1 = x1;
- pNextRect->y1 = y1;
- pNextRect->x2 = x2;
- pNextRect->y2 = y2;
- pReg->numRects += 1;
- pNextRect++;
- assert(pReg->numRects <= pReg->size);
- }
-
- /*
- * Need to advance the pointers. Shift the one that extends
- * to the right the least, since the other still has a chance to
- * overlap with that region's next rectangle, if you see what I mean.
- */
- if (r1->x2 < r2->x2)
- {
- r1++;
- }
- else if (r2->x2 < r1->x2)
- {
- r2++;
- }
- else
- {
- r1++;
- r2++;
- }
- }
- return 0; /* lint */
-}
-
-int
-XIntersectRegion(reg1, reg2, newReg)
- Region reg1;
- Region reg2; /* source regions */
- register Region newReg; /* destination Region */
-{
- /* check for trivial reject */
- if ( (!(reg1->numRects)) || (!(reg2->numRects)) ||
- (!EXTENTCHECK(®1->extents, ®2->extents)))
- newReg->numRects = 0;
- else
- miRegionOp (newReg, reg1, reg2,
- (voidProcp) miIntersectO, (voidProcp) NULL, (voidProcp) NULL);
-
- /*
- * Can't alter newReg's extents before we call miRegionOp because
- * it might be one of the source regions and miRegionOp depends
- * on the extents of those regions being the same. Besides, this
- * way there's no checking against rectangles that will be nuked
- * due to coalescing, so we have to examine fewer rectangles.
- */
- miSetExtents(newReg);
- return 1;
-}
-
-static void
-miRegionCopy(dstrgn, rgn)
- register Region dstrgn;
- register Region rgn;
-
-{
- if (dstrgn != rgn) /* don't want to copy to itself */
- {
- if (dstrgn->size < rgn->numRects)
- {
- if (dstrgn->rects)
- {
- BOX *prevRects = dstrgn->rects;
-
- if (! (dstrgn->rects = (BOX *)
- Xrealloc((char *) dstrgn->rects,
- (unsigned) rgn->numRects * (sizeof(BOX))))) {
- Xfree(prevRects);
- return;
- }
- }
- dstrgn->size = rgn->numRects;
- }
- dstrgn->numRects = rgn->numRects;
- dstrgn->extents.x1 = rgn->extents.x1;
- dstrgn->extents.y1 = rgn->extents.y1;
- dstrgn->extents.x2 = rgn->extents.x2;
- dstrgn->extents.y2 = rgn->extents.y2;
-
- memcpy((char *) dstrgn->rects, (char *) rgn->rects,
- (int) (rgn->numRects * sizeof(BOX)));
- }
-}
-
-#ifdef notdef
-
-/*
- * combinRegs(newReg, reg1, reg2)
- * if one region is above or below the other.
-*/
-
-static void
-combineRegs(newReg, reg1, reg2)
- register Region newReg;
- Region reg1;
- Region reg2;
-{
- register Region tempReg;
- register BOX *rects;
- register BOX *rects1;
- register BOX *rects2;
- register int total;
-
- rects1 = reg1->rects;
- rects2 = reg2->rects;
-
- total = reg1->numRects + reg2->numRects;
- if (! (tempReg = XCreateRegion()))
- return;
- tempReg->size = total;
- /* region 1 is below region 2 */
- if (reg1->extents.y1 > reg2->extents.y1)
- {
- miRegionCopy(tempReg, reg2);
- rects = &tempReg->rects[tempReg->numRects];
- total -= tempReg->numRects;
- while (total--)
- *rects++ = *rects1++;
- }
- else
- {
- miRegionCopy(tempReg, reg1);
- rects = &tempReg->rects[tempReg->numRects];
- total -= tempReg->numRects;
- while (total--)
- *rects++ = *rects2++;
- }
- tempReg->extents = reg1->extents;
- tempReg->numRects = reg1->numRects + reg2->numRects;
- EXTENTS(®2->extents, tempReg);
- miRegionCopy(newReg, tempReg);
- Xfree((char *)tempReg);
-}
-
-/*
- * QuickCheck checks to see if it does not have to go through all the
- * the ugly code for the region call. It returns 1 if it did all
- * the work for Union, otherwise 0 - still work to be done.
-*/
-
-static int
-QuickCheck(newReg, reg1, reg2)
- Region newReg, reg1, reg2;
-{
-
- /* if unioning with itself or no rects to union with */
- if ( (reg1 == reg2) || (!(reg1->numRects)) )
- {
- miRegionCopy(newReg, reg2);
- return TRUE;
- }
-
- /* if nothing to union */
- if (!(reg2->numRects))
- {
- miRegionCopy(newReg, reg1);
- return TRUE;
- }
-
- /* could put an extent check to see if add above or below */
-
- if ((reg1->extents.y1 >= reg2->extents.y2) ||
- (reg2->extents.y1 >= reg1->extents.y2) )
- {
- combineRegs(newReg, reg1, reg2);
- return TRUE;
- }
- return FALSE;
-}
-
-/* TopRects(rects, reg1, reg2)
- * N.B. We now assume that reg1 and reg2 intersect. Therefore we are
- * NOT checking in the two while loops for stepping off the end of the
- * region.
- */
-
-static int
-TopRects(newReg, rects, reg1, reg2, FirstRect)
- register Region newReg;
- register BOX *rects;
- register Region reg1;
- register Region reg2;
- BOX *FirstRect;
-{
- register BOX *tempRects;
-
- /* need to add some rects from region 1 */
- if (reg1->extents.y1 < reg2->extents.y1)
- {
- tempRects = reg1->rects;
- while(tempRects->y1 < reg2->extents.y1)
- {
- MEMCHECK(newReg, rects, FirstRect);
- ADDRECTNOX(newReg,rects, tempRects->x1, tempRects->y1,
- tempRects->x2, MIN(tempRects->y2, reg2->extents.y1));
- tempRects++;
- }
- }
- /* need to add some rects from region 2 */
- if (reg2->extents.y1 < reg1->extents.y1)
- {
- tempRects = reg2->rects;
- while (tempRects->y1 < reg1->extents.y1)
- {
- MEMCHECK(newReg, rects, FirstRect);
- ADDRECTNOX(newReg, rects, tempRects->x1,tempRects->y1,
- tempRects->x2, MIN(tempRects->y2, reg1->extents.y1));
- tempRects++;
- }
- }
- return 1;
-}
-#endif
-
-/*======================================================================
- * Generic Region Operator
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miCoalesce --
- * Attempt to merge the boxes in the current band with those in the
- * previous one. Used only by miRegionOp.
- *
- * Results:
- * The new index for the previous band.
- *
- * Side Effects:
- * If coalescing takes place:
- * - rectangles in the previous band will have their y2 fields
- * altered.
- * - pReg->numRects will be decreased.
- *
- *-----------------------------------------------------------------------
- */
-/* static int*/
-static int
-miCoalesce (pReg, prevStart, curStart)
- register Region pReg; /* Region to coalesce */
- int prevStart; /* Index of start of previous band */
- int curStart; /* Index of start of current band */
-{
- register BoxPtr pPrevBox; /* Current box in previous band */
- register BoxPtr pCurBox; /* Current box in current band */
- register BoxPtr pRegEnd; /* End of region */
- int curNumRects; /* Number of rectangles in current
- * band */
- int prevNumRects; /* Number of rectangles in previous
- * band */
- int bandY1; /* Y1 coordinate for current band */
-
- pRegEnd = &pReg->rects[pReg->numRects];
-
- pPrevBox = &pReg->rects[prevStart];
- prevNumRects = curStart - prevStart;
-
- /*
- * Figure out how many rectangles are in the current band. Have to do
- * this because multiple bands could have been added in miRegionOp
- * at the end when one region has been exhausted.
- */
- pCurBox = &pReg->rects[curStart];
- bandY1 = pCurBox->y1;
- for (curNumRects = 0;
- (pCurBox != pRegEnd) && (pCurBox->y1 == bandY1);
- curNumRects++)
- {
- pCurBox++;
- }
-
- if (pCurBox != pRegEnd)
- {
- /*
- * If more than one band was added, we have to find the start
- * of the last band added so the next coalescing job can start
- * at the right place... (given when multiple bands are added,
- * this may be pointless -- see above).
- */
- pRegEnd--;
- while (pRegEnd[-1].y1 == pRegEnd->y1)
- {
- pRegEnd--;
- }
- curStart = pRegEnd - pReg->rects;
- pRegEnd = pReg->rects + pReg->numRects;
- }
-
- if ((curNumRects == prevNumRects) && (curNumRects != 0)) {
- pCurBox -= curNumRects;
- /*
- * The bands may only be coalesced if the bottom of the previous
- * matches the top scanline of the current.
- */
- if (pPrevBox->y2 == pCurBox->y1)
- {
- /*
- * Make sure the bands have boxes in the same places. This
- * assumes that boxes have been added in such a way that they
- * cover the most area possible. I.e. two boxes in a band must
- * have some horizontal space between them.
- */
- do
- {
- if ((pPrevBox->x1 != pCurBox->x1) ||
- (pPrevBox->x2 != pCurBox->x2))
- {
- /*
- * The bands don't line up so they can't be coalesced.
- */
- return (curStart);
- }
- pPrevBox++;
- pCurBox++;
- prevNumRects -= 1;
- } while (prevNumRects != 0);
-
- pReg->numRects -= curNumRects;
- pCurBox -= curNumRects;
- pPrevBox -= curNumRects;
-
- /*
- * The bands may be merged, so set the bottom y of each box
- * in the previous band to that of the corresponding box in
- * the current band.
- */
- do
- {
- pPrevBox->y2 = pCurBox->y2;
- pPrevBox++;
- pCurBox++;
- curNumRects -= 1;
- } while (curNumRects != 0);
-
- /*
- * If only one band was added to the region, we have to backup
- * curStart to the start of the previous band.
- *
- * If more than one band was added to the region, copy the
- * other bands down. The assumption here is that the other bands
- * came from the same region as the current one and no further
- * coalescing can be done on them since it's all been done
- * already... curStart is already in the right place.
- */
- if (pCurBox == pRegEnd)
- {
- curStart = prevStart;
- }
- else
- {
- do
- {
- *pPrevBox++ = *pCurBox++;
- } while (pCurBox != pRegEnd);
- }
-
- }
- }
- return (curStart);
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miRegionOp --
- * Apply an operation to two regions. Called by miUnion, miInverse,
- * miSubtract, miIntersect...
- *
- * Results:
- * None.
- *
- * Side Effects:
- * The new region is overwritten.
- *
- * Notes:
- * The idea behind this function is to view the two regions as sets.
- * Together they cover a rectangle of area that this function divides
- * into horizontal bands where points are covered only by one region
- * or by both. For the first case, the nonOverlapFunc is called with
- * each the band and the band's upper and lower extents. For the
- * second, the overlapFunc is called to process the entire band. It
- * is responsible for clipping the rectangles in the band, though
- * this function provides the boundaries.
- * At the end of each band, the new region is coalesced, if possible,
- * to reduce the number of rectangles in the region.
- *
- *-----------------------------------------------------------------------
- */
-/* static void*/
-static void
-miRegionOp(newReg, reg1, reg2, overlapFunc, nonOverlap1Func, nonOverlap2Func)
- register Region newReg; /* Place to store result */
- Region reg1; /* First region in operation */
- Region reg2; /* 2d region in operation */
- void (*overlapFunc)(); /* Function to call for over-
- * lapping bands */
- void (*nonOverlap1Func)(); /* Function to call for non-
- * overlapping bands in region
- * 1 */
- void (*nonOverlap2Func)(); /* Function to call for non-
- * overlapping bands in region
- * 2 */
-{
- register BoxPtr r1; /* Pointer into first region */
- register BoxPtr r2; /* Pointer into 2d region */
- BoxPtr r1End; /* End of 1st region */
- BoxPtr r2End; /* End of 2d region */
- register short ybot; /* Bottom of intersection */
- register short ytop; /* Top of intersection */
- BoxPtr oldRects; /* Old rects for newReg */
- int prevBand; /* Index of start of
- * previous band in newReg */
- int curBand; /* Index of start of current
- * band in newReg */
- register BoxPtr r1BandEnd; /* End of current band in r1 */
- register BoxPtr r2BandEnd; /* End of current band in r2 */
- short top; /* Top of non-overlapping
- * band */
- short bot; /* Bottom of non-overlapping
- * band */
-
- /*
- * Initialization:
- * set r1, r2, r1End and r2End appropriately, preserve the important
- * parts of the destination region until the end in case it's one of
- * the two source regions, then mark the "new" region empty, allocating
- * another array of rectangles for it to use.
- */
- r1 = reg1->rects;
- r2 = reg2->rects;
- r1End = r1 + reg1->numRects;
- r2End = r2 + reg2->numRects;
-
- oldRects = newReg->rects;
-
- EMPTY_REGION(newReg);
-
- /*
- * Allocate a reasonable number of rectangles for the new region. The idea
- * is to allocate enough so the individual functions don't need to
- * reallocate and copy the array, which is time consuming, yet we don't
- * have to worry about using too much memory. I hope to be able to
- * nuke the Xrealloc() at the end of this function eventually.
- */
- newReg->size = max(reg1->numRects,reg2->numRects) * 2;
-
- if (! (newReg->rects = (BoxPtr)
- Xmalloc ((unsigned) (sizeof(BoxRec) * newReg->size)))) {
- newReg->size = 0;
- return;
- }
-
- /*
- * Initialize ybot and ytop.
- * In the upcoming loop, ybot and ytop serve different functions depending
- * on whether the band being handled is an overlapping or non-overlapping
- * band.
- * In the case of a non-overlapping band (only one of the regions
- * has points in the band), ybot is the bottom of the most recent
- * intersection and thus clips the top of the rectangles in that band.
- * ytop is the top of the next intersection between the two regions and
- * serves to clip the bottom of the rectangles in the current band.
- * For an overlapping band (where the two regions intersect), ytop clips
- * the top of the rectangles of both regions and ybot clips the bottoms.
- */
- if (reg1->extents.y1 < reg2->extents.y1)
- ybot = reg1->extents.y1;
- else
- ybot = reg2->extents.y1;
-
- /*
- * prevBand serves to mark the start of the previous band so rectangles
- * can be coalesced into larger rectangles. qv. miCoalesce, above.
- * In the beginning, there is no previous band, so prevBand == curBand
- * (curBand is set later on, of course, but the first band will always
- * start at index 0). prevBand and curBand must be indices because of
- * the possible expansion, and resultant moving, of the new region's
- * array of rectangles.
- */
- prevBand = 0;
-
- do
- {
- curBand = newReg->numRects;
-
- /*
- * This algorithm proceeds one source-band (as opposed to a
- * destination band, which is determined by where the two regions
- * intersect) at a time. r1BandEnd and r2BandEnd serve to mark the
- * rectangle after the last one in the current band for their
- * respective regions.
- */
- r1BandEnd = r1;
- while ((r1BandEnd != r1End) && (r1BandEnd->y1 == r1->y1))
- {
- r1BandEnd++;
- }
-
- r2BandEnd = r2;
- while ((r2BandEnd != r2End) && (r2BandEnd->y1 == r2->y1))
- {
- r2BandEnd++;
- }
-
- /*
- * First handle the band that doesn't intersect, if any.
- *
- * Note that attention is restricted to one band in the
- * non-intersecting region at once, so if a region has n
- * bands between the current position and the next place it overlaps
- * the other, this entire loop will be passed through n times.
- */
- if (r1->y1 < r2->y1)
- {
- top = max(r1->y1,ybot);
- bot = min(r1->y2,r2->y1);
-
- if ((top != bot) && (nonOverlap1Func != (void (*)())NULL))
- {
- (* nonOverlap1Func) (newReg, r1, r1BandEnd, top, bot);
- }
-
- ytop = r2->y1;
- }
- else if (r2->y1 < r1->y1)
- {
- top = max(r2->y1,ybot);
- bot = min(r2->y2,r1->y1);
-
- if ((top != bot) && (nonOverlap2Func != (void (*)())NULL))
- {
- (* nonOverlap2Func) (newReg, r2, r2BandEnd, top, bot);
- }
-
- ytop = r1->y1;
- }
- else
- {
- ytop = r1->y1;
- }
-
- /*
- * If any rectangles got added to the region, try and coalesce them
- * with rectangles from the previous band. Note we could just do
- * this test in miCoalesce, but some machines incur a not
- * inconsiderable cost for function calls, so...
- */
- if (newReg->numRects != curBand)
- {
- prevBand = miCoalesce (newReg, prevBand, curBand);
- }
-
- /*
- * Now see if we've hit an intersecting band. The two bands only
- * intersect if ybot > ytop
- */
- ybot = min(r1->y2, r2->y2);
- curBand = newReg->numRects;
- if (ybot > ytop)
- {
- (* overlapFunc) (newReg, r1, r1BandEnd, r2, r2BandEnd, ytop, ybot);
-
- }
-
- if (newReg->numRects != curBand)
- {
- prevBand = miCoalesce (newReg, prevBand, curBand);
- }
-
- /*
- * If we've finished with a band (y2 == ybot) we skip forward
- * in the region to the next band.
- */
- if (r1->y2 == ybot)
- {
- r1 = r1BandEnd;
- }
- if (r2->y2 == ybot)
- {
- r2 = r2BandEnd;
- }
- } while ((r1 != r1End) && (r2 != r2End));
-
- /*
- * Deal with whichever region still has rectangles left.
- */
- curBand = newReg->numRects;
- if (r1 != r1End)
- {
- if (nonOverlap1Func != (void (*)())NULL)
- {
- do
- {
- r1BandEnd = r1;
- while ((r1BandEnd < r1End) && (r1BandEnd->y1 == r1->y1))
- {
- r1BandEnd++;
- }
- (* nonOverlap1Func) (newReg, r1, r1BandEnd,
- max(r1->y1,ybot), r1->y2);
- r1 = r1BandEnd;
- } while (r1 != r1End);
- }
- }
- else if ((r2 != r2End) && (nonOverlap2Func != (void (*)())NULL))
- {
- do
- {
- r2BandEnd = r2;
- while ((r2BandEnd < r2End) && (r2BandEnd->y1 == r2->y1))
- {
- r2BandEnd++;
- }
- (* nonOverlap2Func) (newReg, r2, r2BandEnd,
- max(r2->y1,ybot), r2->y2);
- r2 = r2BandEnd;
- } while (r2 != r2End);
- }
-
- if (newReg->numRects != curBand)
- {
- (void) miCoalesce (newReg, prevBand, curBand);
- }
-
- /*
- * A bit of cleanup. To keep regions from growing without bound,
- * we shrink the array of rectangles to match the new number of
- * rectangles in the region. This never goes to 0, however...
- *
- * Only do this stuff if the number of rectangles allocated is more than
- * twice the number of rectangles in the region (a simple optimization...).
- */
- if (newReg->numRects < (newReg->size >> 1))
- {
- if (REGION_NOT_EMPTY(newReg))
- {
- BoxPtr prev_rects = newReg->rects;
- newReg->size = newReg->numRects;
- newReg->rects = (BoxPtr) Xrealloc ((char *) newReg->rects,
- (unsigned) (sizeof(BoxRec) * newReg->size));
- if (! newReg->rects)
- newReg->rects = prev_rects;
- }
- else
- {
- /*
- * No point in doing the extra work involved in an Xrealloc if
- * the region is empty
- */
- newReg->size = 1;
- Xfree((char *) newReg->rects);
- newReg->rects = (BoxPtr) Xmalloc(sizeof(BoxRec));
- }
- }
- Xfree ((char *) oldRects);
- return;
-}
-
-
-/*======================================================================
- * Region Union
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miUnionNonO --
- * Handle a non-overlapping band for the union operation. Just
- * Adds the rectangles into the region. Doesn't have to check for
- * subsumption or anything.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * pReg->numRects is incremented and the final rectangles overwritten
- * with the rectangles we're passed.
- *
- *-----------------------------------------------------------------------
- */
-/* static void*/
-static int
-miUnionNonO (pReg, r, rEnd, y1, y2)
- register Region pReg;
- register BoxPtr r;
- BoxPtr rEnd;
- register short y1;
- register short y2;
-{
- register BoxPtr pNextRect;
-
- pNextRect = &pReg->rects[pReg->numRects];
-
- assert(y1 < y2);
-
- while (r != rEnd)
- {
- assert(r->x1 < r->x2);
- MEMCHECK(pReg, pNextRect, pReg->rects);
- pNextRect->x1 = r->x1;
- pNextRect->y1 = y1;
- pNextRect->x2 = r->x2;
- pNextRect->y2 = y2;
- pReg->numRects += 1;
- pNextRect++;
-
- assert(pReg->numRects<=pReg->size);
- r++;
- }
- return 0; /* lint */
-}
-
-
-/*-
- *-----------------------------------------------------------------------
- * miUnionO --
- * Handle an overlapping band for the union operation. Picks the
- * left-most rectangle each time and merges it into the region.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * Rectangles are overwritten in pReg->rects and pReg->numRects will
- * be changed.
- *
- *-----------------------------------------------------------------------
- */
-
-/* static void*/
-static int
-miUnionO (pReg, r1, r1End, r2, r2End, y1, y2)
- register Region pReg;
- register BoxPtr r1;
- BoxPtr r1End;
- register BoxPtr r2;
- BoxPtr r2End;
- register short y1;
- register short y2;
-{
- register BoxPtr pNextRect;
-
- pNextRect = &pReg->rects[pReg->numRects];
-
-#define MERGERECT(r) \
- if ((pReg->numRects != 0) && \
- (pNextRect[-1].y1 == y1) && \
- (pNextRect[-1].y2 == y2) && \
- (pNextRect[-1].x2 >= r->x1)) \
- { \
- if (pNextRect[-1].x2 < r->x2) \
- { \
- pNextRect[-1].x2 = r->x2; \
- assert(pNextRect[-1].x1rects); \
- pNextRect->y1 = y1; \
- pNextRect->y2 = y2; \
- pNextRect->x1 = r->x1; \
- pNextRect->x2 = r->x2; \
- pReg->numRects += 1; \
- pNextRect += 1; \
- } \
- assert(pReg->numRects<=pReg->size);\
- r++;
-
- assert (y1x1 < r2->x1)
- {
- MERGERECT(r1);
- }
- else
- {
- MERGERECT(r2);
- }
- }
-
- if (r1 != r1End)
- {
- do
- {
- MERGERECT(r1);
- } while (r1 != r1End);
- }
- else while (r2 != r2End)
- {
- MERGERECT(r2);
- }
- return 0; /* lint */
-}
-
-int
-XUnionRegion(reg1, reg2, newReg)
- Region reg1;
- Region reg2; /* source regions */
- Region newReg; /* destination Region */
-{
- /* checks all the simple cases */
-
- /*
- * Region 1 and 2 are the same or region 1 is empty
- */
- if ( (reg1 == reg2) || (!(reg1->numRects)) )
- {
- if (newReg != reg2)
- miRegionCopy(newReg, reg2);
- return 1;
- }
-
- /*
- * if nothing to union (region 2 empty)
- */
- if (!(reg2->numRects))
- {
- if (newReg != reg1)
- miRegionCopy(newReg, reg1);
- return 1;
- }
-
- /*
- * Region 1 completely subsumes region 2
- */
- if ((reg1->numRects == 1) &&
- (reg1->extents.x1 <= reg2->extents.x1) &&
- (reg1->extents.y1 <= reg2->extents.y1) &&
- (reg1->extents.x2 >= reg2->extents.x2) &&
- (reg1->extents.y2 >= reg2->extents.y2))
- {
- if (newReg != reg1)
- miRegionCopy(newReg, reg1);
- return 1;
- }
-
- /*
- * Region 2 completely subsumes region 1
- */
- if ((reg2->numRects == 1) &&
- (reg2->extents.x1 <= reg1->extents.x1) &&
- (reg2->extents.y1 <= reg1->extents.y1) &&
- (reg2->extents.x2 >= reg1->extents.x2) &&
- (reg2->extents.y2 >= reg1->extents.y2))
- {
- if (newReg != reg2)
- miRegionCopy(newReg, reg2);
- return 1;
- }
-
- miRegionOp (newReg, reg1, reg2, (voidProcp) miUnionO,
- (voidProcp) miUnionNonO, (voidProcp) miUnionNonO);
-
- newReg->extents.x1 = min(reg1->extents.x1, reg2->extents.x1);
- newReg->extents.y1 = min(reg1->extents.y1, reg2->extents.y1);
- newReg->extents.x2 = max(reg1->extents.x2, reg2->extents.x2);
- newReg->extents.y2 = max(reg1->extents.y2, reg2->extents.y2);
-
- return 1;
-}
-
-
-/*======================================================================
- * Region Subtraction
- *====================================================================*/
-
-/*-
- *-----------------------------------------------------------------------
- * miSubtractNonO --
- * Deal with non-overlapping band for subtraction. Any parts from
- * region 2 we discard. Anything from region 1 we add to the region.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * pReg may be affected.
- *
- *-----------------------------------------------------------------------
- */
-/* static void*/
-static int
-miSubtractNonO1 (pReg, r, rEnd, y1, y2)
- register Region pReg;
- register BoxPtr r;
- BoxPtr rEnd;
- register short y1;
- register short y2;
-{
- register BoxPtr pNextRect;
-
- pNextRect = &pReg->rects[pReg->numRects];
-
- assert(y1x1x2);
- MEMCHECK(pReg, pNextRect, pReg->rects);
- pNextRect->x1 = r->x1;
- pNextRect->y1 = y1;
- pNextRect->x2 = r->x2;
- pNextRect->y2 = y2;
- pReg->numRects += 1;
- pNextRect++;
-
- assert(pReg->numRects <= pReg->size);
-
- r++;
- }
- return 0; /* lint */
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miSubtractO --
- * Overlapping band subtraction. x1 is the left-most point not yet
- * checked.
- *
- * Results:
- * None.
- *
- * Side Effects:
- * pReg may have rectangles added to it.
- *
- *-----------------------------------------------------------------------
- */
-/* static void*/
-static int
-miSubtractO (pReg, r1, r1End, r2, r2End, y1, y2)
- register Region pReg;
- register BoxPtr r1;
- BoxPtr r1End;
- register BoxPtr r2;
- BoxPtr r2End;
- register short y1;
- register short y2;
-{
- register BoxPtr pNextRect;
- register int x1;
-
- x1 = r1->x1;
-
- assert(y1rects[pReg->numRects];
-
- while ((r1 != r1End) && (r2 != r2End))
- {
- if (r2->x2 <= x1)
- {
- /*
- * Subtrahend missed the boat: go to next subtrahend.
- */
- r2++;
- }
- else if (r2->x1 <= x1)
- {
- /*
- * Subtrahend preceeds minuend: nuke left edge of minuend.
- */
- x1 = r2->x2;
- if (x1 >= r1->x2)
- {
- /*
- * Minuend completely covered: advance to next minuend and
- * reset left fence to edge of new minuend.
- */
- r1++;
- if (r1 != r1End)
- x1 = r1->x1;
- }
- else
- {
- /*
- * Subtrahend now used up since it doesn't extend beyond
- * minuend
- */
- r2++;
- }
- }
- else if (r2->x1 < r1->x2)
- {
- /*
- * Left part of subtrahend covers part of minuend: add uncovered
- * part of minuend to region and skip to next subtrahend.
- */
- assert(x1x1);
- MEMCHECK(pReg, pNextRect, pReg->rects);
- pNextRect->x1 = x1;
- pNextRect->y1 = y1;
- pNextRect->x2 = r2->x1;
- pNextRect->y2 = y2;
- pReg->numRects += 1;
- pNextRect++;
-
- assert(pReg->numRects<=pReg->size);
-
- x1 = r2->x2;
- if (x1 >= r1->x2)
- {
- /*
- * Minuend used up: advance to new...
- */
- r1++;
- if (r1 != r1End)
- x1 = r1->x1;
- }
- else
- {
- /*
- * Subtrahend used up
- */
- r2++;
- }
- }
- else
- {
- /*
- * Minuend used up: add any remaining piece before advancing.
- */
- if (r1->x2 > x1)
- {
- MEMCHECK(pReg, pNextRect, pReg->rects);
- pNextRect->x1 = x1;
- pNextRect->y1 = y1;
- pNextRect->x2 = r1->x2;
- pNextRect->y2 = y2;
- pReg->numRects += 1;
- pNextRect++;
- assert(pReg->numRects<=pReg->size);
- }
- r1++;
- if (r1 != r1End)
- x1 = r1->x1;
- }
- }
-
- /*
- * Add remaining minuend rectangles to region.
- */
- while (r1 != r1End)
- {
- assert(x1x2);
- MEMCHECK(pReg, pNextRect, pReg->rects);
- pNextRect->x1 = x1;
- pNextRect->y1 = y1;
- pNextRect->x2 = r1->x2;
- pNextRect->y2 = y2;
- pReg->numRects += 1;
- pNextRect++;
-
- assert(pReg->numRects<=pReg->size);
-
- r1++;
- if (r1 != r1End)
- {
- x1 = r1->x1;
- }
- }
- return 0; /* lint */
-}
-
-/*-
- *-----------------------------------------------------------------------
- * miSubtract --
- * Subtract regS from regM and leave the result in regD.
- * S stands for subtrahend, M for minuend and D for difference.
- *
- * Results:
- * TRUE.
- *
- * Side Effects:
- * regD is overwritten.
- *
- *-----------------------------------------------------------------------
- */
-
-int
-XSubtractRegion(regM, regS, regD)
- Region regM;
- Region regS;
- register Region regD;
-{
- /* check for trivial reject */
- if ( (!(regM->numRects)) || (!(regS->numRects)) ||
- (!EXTENTCHECK(®M->extents, ®S->extents)) )
- {
- miRegionCopy(regD, regM);
- return 1;
- }
-
- miRegionOp (regD, regM, regS, (voidProcp) miSubtractO,
- (voidProcp) miSubtractNonO1, (voidProcp) NULL);
-
- /*
- * Can't alter newReg's extents before we call miRegionOp because
- * it might be one of the source regions and miRegionOp depends
- * on the extents of those regions being the unaltered. Besides, this
- * way there's no checking against rectangles that will be nuked
- * due to coalescing, so we have to examine fewer rectangles.
- */
- miSetExtents (regD);
- return 1;
-}
-
-int
-XXorRegion( sra, srb, dr )
- Region sra, srb, dr;
-{
- Region tra, trb;
-
- if ((! (tra = XCreateRegion())) || (! (trb = XCreateRegion())))
- return 0;
- (void) XSubtractRegion(sra,srb,tra);
- (void) XSubtractRegion(srb,sra,trb);
- (void) XUnionRegion(tra,trb,dr);
- XDestroyRegion(tra);
- XDestroyRegion(trb);
- return 0;
-}
-
-/*
- * Check to see if the region is empty. Assumes a region is passed
- * as a parameter
- */
-int
-XEmptyRegion( r )
- Region r;
-{
- if( r->numRects == 0 ) return TRUE;
- else return FALSE;
-}
-
-/*
- * Check to see if two regions are equal
- */
-int
-XEqualRegion( r1, r2 )
- Region r1, r2;
-{
- int i;
-
- if( r1->numRects != r2->numRects ) return FALSE;
- else if( r1->numRects == 0 ) return TRUE;
- else if ( r1->extents.x1 != r2->extents.x1 ) return FALSE;
- else if ( r1->extents.x2 != r2->extents.x2 ) return FALSE;
- else if ( r1->extents.y1 != r2->extents.y1 ) return FALSE;
- else if ( r1->extents.y2 != r2->extents.y2 ) return FALSE;
- else for( i=0; i < r1->numRects; i++ ) {
- if ( r1->rects[i].x1 != r2->rects[i].x1 ) return FALSE;
- else if ( r1->rects[i].x2 != r2->rects[i].x2 ) return FALSE;
- else if ( r1->rects[i].y1 != r2->rects[i].y1 ) return FALSE;
- else if ( r1->rects[i].y2 != r2->rects[i].y2 ) return FALSE;
- }
- return TRUE;
-}
-
-int
-XPointInRegion( pRegion, x, y )
- Region pRegion;
- int x, y;
-{
- int i;
-
- if (pRegion->numRects == 0)
- return FALSE;
- if (!INBOX(pRegion->extents, x, y))
- return FALSE;
- for (i=0; inumRects; i++)
- {
- if (INBOX (pRegion->rects[i], x, y))
- return TRUE;
- }
- return FALSE;
-}
-
-int
-XRectInRegion(region, rx, ry, rwidth, rheight)
- register Region region;
- int rx, ry;
- unsigned int rwidth, rheight;
-{
- register BoxPtr pbox;
- register BoxPtr pboxEnd;
- Box rect;
- register BoxPtr prect = ▭
- int partIn, partOut;
-
- prect->x1 = rx;
- prect->y1 = ry;
- prect->x2 = rwidth + rx;
- prect->y2 = rheight + ry;
-
- /* this is (just) a useful optimization */
- if ((region->numRects == 0) || !EXTENTCHECK(®ion->extents, prect))
- return(RectangleOut);
-
- partOut = FALSE;
- partIn = FALSE;
-
- /* can stop when both partOut and partIn are TRUE, or we reach prect->y2 */
- for (pbox = region->rects, pboxEnd = pbox + region->numRects;
- pbox < pboxEnd;
- pbox++)
- {
-
- if (pbox->y2 <= ry)
- continue; /* getting up to speed or skipping remainder of band */
-
- if (pbox->y1 > ry)
- {
- partOut = TRUE; /* missed part of rectangle above */
- if (partIn || (pbox->y1 >= prect->y2))
- break;
- ry = pbox->y1; /* x guaranteed to be == prect->x1 */
- }
-
- if (pbox->x2 <= rx)
- continue; /* not far enough over yet */
-
- if (pbox->x1 > rx)
- {
- partOut = TRUE; /* missed part of rectangle to left */
- if (partIn)
- break;
- }
-
- if (pbox->x1 < prect->x2)
- {
- partIn = TRUE; /* definitely overlap */
- if (partOut)
- break;
- }
-
- if (pbox->x2 >= prect->x2)
- {
- ry = pbox->y2; /* finished with this band */
- if (ry >= prect->y2)
- break;
- rx = prect->x1; /* reset x out to left again */
- } else
- {
- /*
- * Because boxes in a band are maximal width, if the first box
- * to overlap the rectangle doesn't completely cover it in that
- * band, the rectangle must be partially out, since some of it
- * will be uncovered in that band. partIn will have been set true
- * by now...
- */
- break;
- }
-
- }
-
- return(partIn ? ((ry < prect->y2) ? RectanglePart : RectangleIn) :
- RectangleOut);
-}
diff --git a/src/vnc/common/Xregion/Xregion.h b/src/vnc/common/Xregion/Xregion.h
deleted file mode 100644
index 7fa44d96..00000000
--- a/src/vnc/common/Xregion/Xregion.h
+++ /dev/null
@@ -1,220 +0,0 @@
-/* $Xorg: Xutil.h,v 1.8 2001/02/09 02:03:39 xorgcvs Exp $ */
-
-/***********************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-******************************************************************/
-/* $XFree86: xc/lib/X11/Xutil.h,v 3.4 2001/12/14 19:54:10 dawes Exp $ */
-
-#ifndef _XREGION_H_
-#define _XREGION_H_
-
-// - Faked defines to fool the X11 region code
-
-#include
-#include
-
-#define Bool int
-#define Xmalloc malloc
-#define Xfree free
-#define Xrealloc realloc
-
-#ifndef max
-#define max(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-
-#ifndef min
-#define min(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
-#define NeedFunctionPrototypes 1
-
-// - Cribbed from Xlib.h
-
-typedef struct {
- short x, y;
-} XPoint;
-
-typedef struct {
- short x, y;
- unsigned short width, height;
-} XRectangle;
-
-/*
- * opaque reference to Region data type
- */
-typedef struct _XRegion *Region;
-
-/* Return values from XRectInRegion() */
-
-#define RectangleOut 0
-#define RectangleIn 1
-#define RectanglePart 2
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-extern int XClipBox(
-#if NeedFunctionPrototypes
- Region /* r */,
- XRectangle* /* rect_return */
-#endif
-);
-
-extern Region XCreateRegion(
-#if NeedFunctionPrototypes
- void
-#endif
-);
-
-extern const char *XDefaultString (void);
-
-extern int XDestroyRegion(
-#if NeedFunctionPrototypes
- Region /* r */
-#endif
-);
-
-extern int XEmptyRegion(
-#if NeedFunctionPrototypes
- Region /* r */
-#endif
-);
-
-extern int XEqualRegion(
-#if NeedFunctionPrototypes
- Region /* r1 */,
- Region /* r2 */
-#endif
-);
-
-extern int XIntersectRegion(
-#if NeedFunctionPrototypes
- Region /* sra */,
- Region /* srb */,
- Region /* dr_return */
-#endif
-);
-
-extern int XOffsetRegion(
-#if NeedFunctionPrototypes
- Region /* r */,
- int /* dx */,
- int /* dy */
-#endif
-);
-
-extern Bool XPointInRegion(
-#if NeedFunctionPrototypes
- Region /* r */,
- int /* x */,
- int /* y */
-#endif
-);
-
-extern Region XPolygonRegion(
-#if NeedFunctionPrototypes
- XPoint* /* points */,
- int /* n */,
- int /* fill_rule */
-#endif
-);
-
-extern int XRectInRegion(
-#if NeedFunctionPrototypes
- Region /* r */,
- int /* x */,
- int /* y */,
- unsigned int /* width */,
- unsigned int /* height */
-#endif
-);
-
-extern int XShrinkRegion(
-#if NeedFunctionPrototypes
- Region /* r */,
- int /* dx */,
- int /* dy */
-#endif
-);
-
-extern int XSubtractRegion(
-#if NeedFunctionPrototypes
- Region /* sra */,
- Region /* srb */,
- Region /* dr_return */
-#endif
-);
-
-extern int XUnionRectWithRegion(
-#if NeedFunctionPrototypes
- XRectangle* /* rectangle */,
- Region /* src_region */,
- Region /* dest_region_return */
-#endif
-);
-
-extern int XUnionRegion(
-#if NeedFunctionPrototypes
- Region /* sra */,
- Region /* srb */,
- Region /* dr_return */
-#endif
-);
-
-extern int XXorRegion(
-#if NeedFunctionPrototypes
- Region /* sra */,
- Region /* srb */,
- Region /* dr_return */
-#endif
-);
-
-#ifdef __cplusplus
-};
-#endif
-
-#endif /* _XUTIL_H_ */
diff --git a/src/vnc/common/Xregion/region.h b/src/vnc/common/Xregion/region.h
deleted file mode 100644
index 2ddf12ca..00000000
--- a/src/vnc/common/Xregion/region.h
+++ /dev/null
@@ -1,190 +0,0 @@
-/* $Xorg: region.h,v 1.4 2001/02/09 02:03:40 xorgcvs Exp $ */
-/************************************************************************
-
-Copyright 1987, 1998 The Open Group
-
-Permission to use, copy, modify, distribute, and sell this software and its
-documentation for any purpose is hereby granted without fee, provided that
-the above copyright notice appear in all copies and that both that
-copyright notice and this permission notice appear in supporting
-documentation.
-
-The above copyright notice and this permission notice shall be included in
-all copies or substantial portions of the Software.
-
-THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
-OPEN GROUP BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
-AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
-CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-
-Except as contained in this notice, the name of The Open Group shall not be
-used in advertising or otherwise to promote the sale, use or other dealings
-in this Software without prior written authorization from The Open Group.
-
-
-Copyright 1987 by Digital Equipment Corporation, Maynard, Massachusetts.
-
- All Rights Reserved
-
-Permission to use, copy, modify, and distribute this software and its
-documentation for any purpose and without fee is hereby granted,
-provided that the above copyright notice appear in all copies and that
-both that copyright notice and this permission notice appear in
-supporting documentation, and that the name of Digital not be
-used in advertising or publicity pertaining to distribution of the
-software without specific, written prior permission.
-
-DIGITAL DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING
-ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL
-DIGITAL BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR
-ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS,
-WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
-ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
-SOFTWARE.
-
-************************************************************************/
-
-#ifndef _XREGION_H
-#define _XREGION_H
-
-typedef struct {
- short x1, x2, y1, y2;
-} Box, BOX, BoxRec, *BoxPtr;
-
-typedef struct {
- short x, y, width, height;
-}RECTANGLE, RectangleRec, *RectanglePtr;
-
-#define TRUE 1
-#define FALSE 0
-#define MAXSHORT 32767
-#define MINSHORT -MAXSHORT
-#ifndef MAX
-#define MAX(a,b) (((a) > (b)) ? (a) : (b))
-#endif
-#ifndef MIN
-#define MIN(a,b) (((a) < (b)) ? (a) : (b))
-#endif
-
-
-/*
- * clip region
- */
-
-typedef struct _XRegion {
- long size;
- long numRects;
- BOX *rects;
- BOX extents;
-} REGION;
-
-/* Xutil.h contains the declaration:
- * typedef struct _XRegion *Region;
- */
-
-/* 1 if two BOXs overlap.
- * 0 if two BOXs do not overlap.
- * Remember, x2 and y2 are not in the region
- */
-#define EXTENTCHECK(r1, r2) \
- ((r1)->x2 > (r2)->x1 && \
- (r1)->x1 < (r2)->x2 && \
- (r1)->y2 > (r2)->y1 && \
- (r1)->y1 < (r2)->y2)
-
-/*
- * update region extents
- */
-#define EXTENTS(r,idRect){\
- if((r)->x1 < (idRect)->extents.x1)\
- (idRect)->extents.x1 = (r)->x1;\
- if((r)->y1 < (idRect)->extents.y1)\
- (idRect)->extents.y1 = (r)->y1;\
- if((r)->x2 > (idRect)->extents.x2)\
- (idRect)->extents.x2 = (r)->x2;\
- if((r)->y2 > (idRect)->extents.y2)\
- (idRect)->extents.y2 = (r)->y2;\
- }
-
-/*
- * Check to see if there is enough memory in the present region.
- */
-#define MEMCHECK(reg, rect, firstrect){\
- if ((reg)->numRects >= ((reg)->size - 1)){\
- (firstrect) = (BOX *) Xrealloc \
- ((char *)(firstrect), (unsigned) (2 * (sizeof(BOX)) * ((reg)->size)));\
- if ((firstrect) == 0)\
- return(0);\
- (reg)->size *= 2;\
- (rect) = &(firstrect)[(reg)->numRects];\
- }\
- }
-
-/* this routine checks to see if the previous rectangle is the same
- * or subsumes the new rectangle to add.
- */
-
-#define CHECK_PREVIOUS(Reg, R, Rx1, Ry1, Rx2, Ry2)\
- (!(((Reg)->numRects > 0)&&\
- ((R-1)->y1 == (Ry1)) &&\
- ((R-1)->y2 == (Ry2)) &&\
- ((R-1)->x1 <= (Rx1)) &&\
- ((R-1)->x2 >= (Rx2))))
-
-/* add a rectangle to the given Region */
-#define ADDRECT(reg, r, rx1, ry1, rx2, ry2){\
- if (((rx1) < (rx2)) && ((ry1) < (ry2)) &&\
- CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
- (r)->x1 = (rx1);\
- (r)->y1 = (ry1);\
- (r)->x2 = (rx2);\
- (r)->y2 = (ry2);\
- EXTENTS((r), (reg));\
- (reg)->numRects++;\
- (r)++;\
- }\
- }
-
-
-
-/* add a rectangle to the given Region */
-#define ADDRECTNOX(reg, r, rx1, ry1, rx2, ry2){\
- if ((rx1 < rx2) && (ry1 < ry2) &&\
- CHECK_PREVIOUS((reg), (r), (rx1), (ry1), (rx2), (ry2))){\
- (r)->x1 = (rx1);\
- (r)->y1 = (ry1);\
- (r)->x2 = (rx2);\
- (r)->y2 = (ry2);\
- (reg)->numRects++;\
- (r)++;\
- }\
- }
-
-#define EMPTY_REGION(pReg) pReg->numRects = 0
-
-#define REGION_NOT_EMPTY(pReg) pReg->numRects
-
-#define INBOX(r, x, y) \
- ( ( ((r).x2 > x)) && \
- ( ((r).x1 <= x)) && \
- ( ((r).y2 > y)) && \
- ( ((r).y1 <= y)) )
-
-/*
- * number of points to buffer before sending them off
- * to scanlines() : Must be an even number
- */
-#define NUMPTSTOBUFFER 200
-
-/*
- * used to allocate buffers for points and link
- * the buffers together
- */
-typedef struct _POINTBLOCK {
- XPoint pts[NUMPTSTOBUFFER];
- struct _POINTBLOCK *next;
-} POINTBLOCK;
-
-#endif
diff --git a/src/vnc/common/boilerplate.mk b/src/vnc/common/boilerplate.mk
deleted file mode 100644
index 979731c5..00000000
--- a/src/vnc/common/boilerplate.mk
+++ /dev/null
@@ -1,35 +0,0 @@
-
-all::
- @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done
-
-clean::
- @subdirs="$(SUBDIRS)"; for d in $$subdirs; do (cd $$d; $(MAKE) $@) || exit 1; done
-
-clean::
- rm -f $(program) $(library) *.o
-
-SHELL = @SHELL@
-top_srcdir = @top_srcdir@
-@SET_MAKE@
-CC = @CC@
-CFLAGS = @CFLAGS@ $(DIR_CFLAGS)
-CCLD = $(CC)
-CXX = @CXX@
-CXXFLAGS = @CXXFLAGS@
-CXXLD = $(CXX)
-CPPFLAGS = @CPPFLAGS@
-DEFS = @DEFS@
-ALL_CPPFLAGS = $(CPPFLAGS) $(DEFS) $(DIR_CPPFLAGS)
-LIBS = @LIBS@
-LDFLAGS = @LDFLAGS@
-RANLIB = @RANLIB@
-AR = ar cq
-
-.SUFFIXES:
-.SUFFIXES: .cxx .c .o
-
-.c.o:
- $(CC) $(ALL_CPPFLAGS) $(CFLAGS) -c $<
-
-.cxx.o:
- $(CXX) $(ALL_CPPFLAGS) $(CXXFLAGS) -c $<
diff --git a/src/vnc/common/configure b/src/vnc/common/configure
deleted file mode 100644
index c7be2edd..00000000
--- a/src/vnc/common/configure
+++ /dev/null
@@ -1,2344 +0,0 @@
-#! /bin/sh
-
-# Guess values for system-dependent variables and create Makefiles.
-# Generated automatically using autoconf version 2.13
-# Copyright (C) 1992, 93, 94, 95, 96 Free Software Foundation, Inc.
-#
-# This configure script is free software; the Free Software Foundation
-# gives unlimited permission to copy, distribute and modify it.
-
-# Defaults:
-ac_help=
-ac_default_prefix=/usr/local
-# Any additions from configure.in:
-ac_help="$ac_help
- --with-x use the X Window System"
-ac_help="$ac_help
- --with-installed-zlib use the version of zlib which is installed on the
- system instead of the one distributed with VNC"
-
-# Initialize some variables set by options.
-# The variables have the same names as the options, with
-# dashes changed to underlines.
-build=NONE
-cache_file=./config.cache
-exec_prefix=NONE
-host=NONE
-no_create=
-nonopt=NONE
-no_recursion=
-prefix=NONE
-program_prefix=NONE
-program_suffix=NONE
-program_transform_name=s,x,x,
-silent=
-site=
-srcdir=
-target=NONE
-verbose=
-x_includes=NONE
-x_libraries=NONE
-bindir='${exec_prefix}/bin'
-sbindir='${exec_prefix}/sbin'
-libexecdir='${exec_prefix}/libexec'
-datadir='${prefix}/share'
-sysconfdir='${prefix}/etc'
-sharedstatedir='${prefix}/com'
-localstatedir='${prefix}/var'
-libdir='${exec_prefix}/lib'
-includedir='${prefix}/include'
-oldincludedir='/usr/include'
-infodir='${prefix}/info'
-mandir='${prefix}/man'
-
-# Initialize some other variables.
-subdirs=
-MFLAGS= MAKEFLAGS=
-SHELL=${CONFIG_SHELL-/bin/sh}
-# Maximum number of lines to put in a shell here document.
-ac_max_here_lines=12
-
-ac_prev=
-for ac_option
-do
-
- # If the previous option needs an argument, assign it.
- if test -n "$ac_prev"; then
- eval "$ac_prev=\$ac_option"
- ac_prev=
- continue
- fi
-
- case "$ac_option" in
- -*=*) ac_optarg=`echo "$ac_option" | sed 's/[-_a-zA-Z0-9]*=//'` ;;
- *) ac_optarg= ;;
- esac
-
- # Accept the important Cygnus configure options, so we can diagnose typos.
-
- case "$ac_option" in
-
- -bindir | --bindir | --bindi | --bind | --bin | --bi)
- ac_prev=bindir ;;
- -bindir=* | --bindir=* | --bindi=* | --bind=* | --bin=* | --bi=*)
- bindir="$ac_optarg" ;;
-
- -build | --build | --buil | --bui | --bu)
- ac_prev=build ;;
- -build=* | --build=* | --buil=* | --bui=* | --bu=*)
- build="$ac_optarg" ;;
-
- -cache-file | --cache-file | --cache-fil | --cache-fi \
- | --cache-f | --cache- | --cache | --cach | --cac | --ca | --c)
- ac_prev=cache_file ;;
- -cache-file=* | --cache-file=* | --cache-fil=* | --cache-fi=* \
- | --cache-f=* | --cache-=* | --cache=* | --cach=* | --cac=* | --ca=* | --c=*)
- cache_file="$ac_optarg" ;;
-
- -datadir | --datadir | --datadi | --datad | --data | --dat | --da)
- ac_prev=datadir ;;
- -datadir=* | --datadir=* | --datadi=* | --datad=* | --data=* | --dat=* \
- | --da=*)
- datadir="$ac_optarg" ;;
-
- -disable-* | --disable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*disable-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- eval "enable_${ac_feature}=no" ;;
-
- -enable-* | --enable-*)
- ac_feature=`echo $ac_option|sed -e 's/-*enable-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_feature| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_feature: invalid feature name" 1>&2; exit 1; }
- fi
- ac_feature=`echo $ac_feature| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "enable_${ac_feature}='$ac_optarg'" ;;
-
- -exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
- | --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
- | --exec | --exe | --ex)
- ac_prev=exec_prefix ;;
- -exec-prefix=* | --exec_prefix=* | --exec-prefix=* | --exec-prefi=* \
- | --exec-pref=* | --exec-pre=* | --exec-pr=* | --exec-p=* | --exec-=* \
- | --exec=* | --exe=* | --ex=*)
- exec_prefix="$ac_optarg" ;;
-
- -gas | --gas | --ga | --g)
- # Obsolete; use --with-gas.
- with_gas=yes ;;
-
- -help | --help | --hel | --he)
- # Omit some internal or obsolete options to make the list less imposing.
- # This message is too long to be a string in the A/UX 3.1 sh.
- cat << EOF
-Usage: configure [options] [host]
-Options: [defaults in brackets after descriptions]
-Configuration:
- --cache-file=FILE cache test results in FILE
- --help print this message
- --no-create do not create output files
- --quiet, --silent do not print \`checking...' messages
- --version print the version of autoconf that created configure
-Directory and file names:
- --prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
- --exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [same as prefix]
- --bindir=DIR user executables in DIR [EPREFIX/bin]
- --sbindir=DIR system admin executables in DIR [EPREFIX/sbin]
- --libexecdir=DIR program executables in DIR [EPREFIX/libexec]
- --datadir=DIR read-only architecture-independent data in DIR
- [PREFIX/share]
- --sysconfdir=DIR read-only single-machine data in DIR [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data in DIR
- [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data in DIR [PREFIX/var]
- --libdir=DIR object code libraries in DIR [EPREFIX/lib]
- --includedir=DIR C header files in DIR [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc in DIR [/usr/include]
- --infodir=DIR info documentation in DIR [PREFIX/info]
- --mandir=DIR man documentation in DIR [PREFIX/man]
- --srcdir=DIR find the sources in DIR [configure dir or ..]
- --program-prefix=PREFIX prepend PREFIX to installed program names
- --program-suffix=SUFFIX append SUFFIX to installed program names
- --program-transform-name=PROGRAM
- run sed PROGRAM on installed program names
-EOF
- cat << EOF
-Host type:
- --build=BUILD configure for building on BUILD [BUILD=HOST]
- --host=HOST configure for HOST [guessed]
- --target=TARGET configure for TARGET [TARGET=HOST]
-Features and packages:
- --disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
- --enable-FEATURE[=ARG] include FEATURE [ARG=yes]
- --with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
- --without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
- --x-includes=DIR X include files are in DIR
- --x-libraries=DIR X library files are in DIR
-EOF
- if test -n "$ac_help"; then
- echo "--enable and --with options recognized:$ac_help"
- fi
- exit 0 ;;
-
- -host | --host | --hos | --ho)
- ac_prev=host ;;
- -host=* | --host=* | --hos=* | --ho=*)
- host="$ac_optarg" ;;
-
- -includedir | --includedir | --includedi | --included | --include \
- | --includ | --inclu | --incl | --inc)
- ac_prev=includedir ;;
- -includedir=* | --includedir=* | --includedi=* | --included=* | --include=* \
- | --includ=* | --inclu=* | --incl=* | --inc=*)
- includedir="$ac_optarg" ;;
-
- -infodir | --infodir | --infodi | --infod | --info | --inf)
- ac_prev=infodir ;;
- -infodir=* | --infodir=* | --infodi=* | --infod=* | --info=* | --inf=*)
- infodir="$ac_optarg" ;;
-
- -libdir | --libdir | --libdi | --libd)
- ac_prev=libdir ;;
- -libdir=* | --libdir=* | --libdi=* | --libd=*)
- libdir="$ac_optarg" ;;
-
- -libexecdir | --libexecdir | --libexecdi | --libexecd | --libexec \
- | --libexe | --libex | --libe)
- ac_prev=libexecdir ;;
- -libexecdir=* | --libexecdir=* | --libexecdi=* | --libexecd=* | --libexec=* \
- | --libexe=* | --libex=* | --libe=*)
- libexecdir="$ac_optarg" ;;
-
- -localstatedir | --localstatedir | --localstatedi | --localstated \
- | --localstate | --localstat | --localsta | --localst \
- | --locals | --local | --loca | --loc | --lo)
- ac_prev=localstatedir ;;
- -localstatedir=* | --localstatedir=* | --localstatedi=* | --localstated=* \
- | --localstate=* | --localstat=* | --localsta=* | --localst=* \
- | --locals=* | --local=* | --loca=* | --loc=* | --lo=*)
- localstatedir="$ac_optarg" ;;
-
- -mandir | --mandir | --mandi | --mand | --man | --ma | --m)
- ac_prev=mandir ;;
- -mandir=* | --mandir=* | --mandi=* | --mand=* | --man=* | --ma=* | --m=*)
- mandir="$ac_optarg" ;;
-
- -nfp | --nfp | --nf)
- # Obsolete; use --without-fp.
- with_fp=no ;;
-
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c)
- no_create=yes ;;
-
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r)
- no_recursion=yes ;;
-
- -oldincludedir | --oldincludedir | --oldincludedi | --oldincluded \
- | --oldinclude | --oldinclud | --oldinclu | --oldincl | --oldinc \
- | --oldin | --oldi | --old | --ol | --o)
- ac_prev=oldincludedir ;;
- -oldincludedir=* | --oldincludedir=* | --oldincludedi=* | --oldincluded=* \
- | --oldinclude=* | --oldinclud=* | --oldinclu=* | --oldincl=* | --oldinc=* \
- | --oldin=* | --oldi=* | --old=* | --ol=* | --o=*)
- oldincludedir="$ac_optarg" ;;
-
- -prefix | --prefix | --prefi | --pref | --pre | --pr | --p)
- ac_prev=prefix ;;
- -prefix=* | --prefix=* | --prefi=* | --pref=* | --pre=* | --pr=* | --p=*)
- prefix="$ac_optarg" ;;
-
- -program-prefix | --program-prefix | --program-prefi | --program-pref \
- | --program-pre | --program-pr | --program-p)
- ac_prev=program_prefix ;;
- -program-prefix=* | --program-prefix=* | --program-prefi=* \
- | --program-pref=* | --program-pre=* | --program-pr=* | --program-p=*)
- program_prefix="$ac_optarg" ;;
-
- -program-suffix | --program-suffix | --program-suffi | --program-suff \
- | --program-suf | --program-su | --program-s)
- ac_prev=program_suffix ;;
- -program-suffix=* | --program-suffix=* | --program-suffi=* \
- | --program-suff=* | --program-suf=* | --program-su=* | --program-s=*)
- program_suffix="$ac_optarg" ;;
-
- -program-transform-name | --program-transform-name \
- | --program-transform-nam | --program-transform-na \
- | --program-transform-n | --program-transform- \
- | --program-transform | --program-transfor \
- | --program-transfo | --program-transf \
- | --program-trans | --program-tran \
- | --progr-tra | --program-tr | --program-t)
- ac_prev=program_transform_name ;;
- -program-transform-name=* | --program-transform-name=* \
- | --program-transform-nam=* | --program-transform-na=* \
- | --program-transform-n=* | --program-transform-=* \
- | --program-transform=* | --program-transfor=* \
- | --program-transfo=* | --program-transf=* \
- | --program-trans=* | --program-tran=* \
- | --progr-tra=* | --program-tr=* | --program-t=*)
- program_transform_name="$ac_optarg" ;;
-
- -q | -quiet | --quiet | --quie | --qui | --qu | --q \
- | -silent | --silent | --silen | --sile | --sil)
- silent=yes ;;
-
- -sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
- ac_prev=sbindir ;;
- -sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
- | --sbi=* | --sb=*)
- sbindir="$ac_optarg" ;;
-
- -sharedstatedir | --sharedstatedir | --sharedstatedi \
- | --sharedstated | --sharedstate | --sharedstat | --sharedsta \
- | --sharedst | --shareds | --shared | --share | --shar \
- | --sha | --sh)
- ac_prev=sharedstatedir ;;
- -sharedstatedir=* | --sharedstatedir=* | --sharedstatedi=* \
- | --sharedstated=* | --sharedstate=* | --sharedstat=* | --sharedsta=* \
- | --sharedst=* | --shareds=* | --shared=* | --share=* | --shar=* \
- | --sha=* | --sh=*)
- sharedstatedir="$ac_optarg" ;;
-
- -site | --site | --sit)
- ac_prev=site ;;
- -site=* | --site=* | --sit=*)
- site="$ac_optarg" ;;
-
- -srcdir | --srcdir | --srcdi | --srcd | --src | --sr)
- ac_prev=srcdir ;;
- -srcdir=* | --srcdir=* | --srcdi=* | --srcd=* | --src=* | --sr=*)
- srcdir="$ac_optarg" ;;
-
- -sysconfdir | --sysconfdir | --sysconfdi | --sysconfd | --sysconf \
- | --syscon | --sysco | --sysc | --sys | --sy)
- ac_prev=sysconfdir ;;
- -sysconfdir=* | --sysconfdir=* | --sysconfdi=* | --sysconfd=* | --sysconf=* \
- | --syscon=* | --sysco=* | --sysc=* | --sys=* | --sy=*)
- sysconfdir="$ac_optarg" ;;
-
- -target | --target | --targe | --targ | --tar | --ta | --t)
- ac_prev=target ;;
- -target=* | --target=* | --targe=* | --targ=* | --tar=* | --ta=* | --t=*)
- target="$ac_optarg" ;;
-
- -v | -verbose | --verbose | --verbos | --verbo | --verb)
- verbose=yes ;;
-
- -version | --version | --versio | --versi | --vers)
- echo "configure generated by autoconf version 2.13"
- exit 0 ;;
-
- -with-* | --with-*)
- ac_package=`echo $ac_option|sed -e 's/-*with-//' -e 's/=.*//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-_a-zA-Z0-9]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- case "$ac_option" in
- *=*) ;;
- *) ac_optarg=yes ;;
- esac
- eval "with_${ac_package}='$ac_optarg'" ;;
-
- -without-* | --without-*)
- ac_package=`echo $ac_option|sed -e 's/-*without-//'`
- # Reject names that are not valid shell variable names.
- if test -n "`echo $ac_package| sed 's/[-a-zA-Z0-9_]//g'`"; then
- { echo "configure: error: $ac_package: invalid package name" 1>&2; exit 1; }
- fi
- ac_package=`echo $ac_package| sed 's/-/_/g'`
- eval "with_${ac_package}=no" ;;
-
- --x)
- # Obsolete; use --with-x.
- with_x=yes ;;
-
- -x-includes | --x-includes | --x-include | --x-includ | --x-inclu \
- | --x-incl | --x-inc | --x-in | --x-i)
- ac_prev=x_includes ;;
- -x-includes=* | --x-includes=* | --x-include=* | --x-includ=* | --x-inclu=* \
- | --x-incl=* | --x-inc=* | --x-in=* | --x-i=*)
- x_includes="$ac_optarg" ;;
-
- -x-libraries | --x-libraries | --x-librarie | --x-librari \
- | --x-librar | --x-libra | --x-libr | --x-lib | --x-li | --x-l)
- ac_prev=x_libraries ;;
- -x-libraries=* | --x-libraries=* | --x-librarie=* | --x-librari=* \
- | --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
- x_libraries="$ac_optarg" ;;
-
- -*) { echo "configure: error: $ac_option: invalid option; use --help to show usage" 1>&2; exit 1; }
- ;;
-
- *)
- if test -n "`echo $ac_option| sed 's/[-a-z0-9.]//g'`"; then
- echo "configure: warning: $ac_option: invalid host type" 1>&2
- fi
- if test "x$nonopt" != xNONE; then
- { echo "configure: error: can only configure for one host and one target at a time" 1>&2; exit 1; }
- fi
- nonopt="$ac_option"
- ;;
-
- esac
-done
-
-if test -n "$ac_prev"; then
- { echo "configure: error: missing argument to --`echo $ac_prev | sed 's/_/-/g'`" 1>&2; exit 1; }
-fi
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-# File descriptor usage:
-# 0 standard input
-# 1 file creation
-# 2 errors and warnings
-# 3 some systems may open it to /dev/tty
-# 4 used on the Kubota Titan
-# 6 checking for... messages and results
-# 5 compiler messages saved in config.log
-if test "$silent" = yes; then
- exec 6>/dev/null
-else
- exec 6>&1
-fi
-exec 5>./config.log
-
-echo "\
-This file contains any messages produced by compilers while
-running configure, to aid debugging if configure makes a mistake.
-" 1>&5
-
-# Strip out --no-create and --no-recursion so they do not pile up.
-# Also quote any args containing shell metacharacters.
-ac_configure_args=
-for ac_arg
-do
- case "$ac_arg" in
- -no-create | --no-create | --no-creat | --no-crea | --no-cre \
- | --no-cr | --no-c) ;;
- -no-recursion | --no-recursion | --no-recursio | --no-recursi \
- | --no-recurs | --no-recur | --no-recu | --no-rec | --no-re | --no-r) ;;
- *" "*|*" "*|*[\[\]\~\#\$\^\&\*\(\)\{\}\\\|\;\<\>\?]*)
- ac_configure_args="$ac_configure_args '$ac_arg'" ;;
- *) ac_configure_args="$ac_configure_args $ac_arg" ;;
- esac
-done
-
-# NLS nuisances.
-# Only set these to C if already set. These must not be set unconditionally
-# because not all systems understand e.g. LANG=C (notably SCO).
-# Fixing LC_MESSAGES prevents Solaris sh from translating var values in `set'!
-# Non-C LC_CTYPE values break the ctype check.
-if test "${LANG+set}" = set; then LANG=C; export LANG; fi
-if test "${LC_ALL+set}" = set; then LC_ALL=C; export LC_ALL; fi
-if test "${LC_MESSAGES+set}" = set; then LC_MESSAGES=C; export LC_MESSAGES; fi
-if test "${LC_CTYPE+set}" = set; then LC_CTYPE=C; export LC_CTYPE; fi
-
-# confdefs.h avoids OS command line length limits that DEFS can exceed.
-rm -rf conftest* confdefs.h
-# AIX cpp loses on an empty file, so make sure it contains at least a newline.
-echo > confdefs.h
-
-# A filename unique to this package, relative to the directory that
-# configure is in, which we can look for to find out if srcdir is correct.
-ac_unique_file=rdr/InStream.h
-
-# Find the source files, if location was not specified.
-if test -z "$srcdir"; then
- ac_srcdir_defaulted=yes
- # Try the directory containing this script, then its parent.
- ac_prog=$0
- ac_confdir=`echo $ac_prog|sed 's%/[^/][^/]*$%%'`
- test "x$ac_confdir" = "x$ac_prog" && ac_confdir=.
- srcdir=$ac_confdir
- if test ! -r $srcdir/$ac_unique_file; then
- srcdir=..
- fi
-else
- ac_srcdir_defaulted=no
-fi
-if test ! -r $srcdir/$ac_unique_file; then
- if test "$ac_srcdir_defaulted" = yes; then
- { echo "configure: error: can not find sources in $ac_confdir or .." 1>&2; exit 1; }
- else
- { echo "configure: error: can not find sources in $srcdir" 1>&2; exit 1; }
- fi
-fi
-srcdir=`echo "${srcdir}" | sed 's%\([^/]\)/*$%\1%'`
-
-# Prefer explicitly selected file to automatically selected ones.
-if test -z "$CONFIG_SITE"; then
- if test "x$prefix" != xNONE; then
- CONFIG_SITE="$prefix/share/config.site $prefix/etc/config.site"
- else
- CONFIG_SITE="$ac_default_prefix/share/config.site $ac_default_prefix/etc/config.site"
- fi
-fi
-for ac_site_file in $CONFIG_SITE; do
- if test -r "$ac_site_file"; then
- echo "loading site script $ac_site_file"
- . "$ac_site_file"
- fi
-done
-
-if test -r "$cache_file"; then
- echo "loading cache $cache_file"
- . $cache_file
-else
- echo "creating cache $cache_file"
- > $cache_file
-fi
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-ac_exeext=
-ac_objext=o
-if (echo "testing\c"; echo 1,2,3) | grep c >/dev/null; then
- # Stardent Vistra SVR4 grep lacks -e, says ghazi@caip.rutgers.edu.
- if (echo -n testing; echo 1,2,3) | sed s/-n/xn/ | grep xn >/dev/null; then
- ac_n= ac_c='
-' ac_t=' '
- else
- ac_n=-n ac_c= ac_t=
- fi
-else
- ac_n= ac_c='\c' ac_t=
-fi
-
-
-
-ac_cv_prog_cc_g=no
-ac_cv_prog_cxx_g=no
-
-# Extract the first word of "gcc", so it can be a program name with args.
-set dummy gcc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:537: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="gcc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-if test -z "$CC"; then
- # Extract the first word of "cc", so it can be a program name with args.
-set dummy cc; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:567: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_prog_rejected=no
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- if test "$ac_dir/$ac_word" = "/usr/ucb/cc"; then
- ac_prog_rejected=yes
- continue
- fi
- ac_cv_prog_CC="cc"
- break
- fi
- done
- IFS="$ac_save_ifs"
-if test $ac_prog_rejected = yes; then
- # We found a bogon in the path, so make sure we never use it.
- set dummy $ac_cv_prog_CC
- shift
- if test $# -gt 0; then
- # We chose a different compiler from the bogus one.
- # However, it has the same basename, so the bogon will be chosen
- # first if we set CC to just the basename; use the full file name.
- shift
- set dummy "$ac_dir/$ac_word" "$@"
- shift
- ac_cv_prog_CC="$@"
- fi
-fi
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test -z "$CC"; then
- case "`uname -s`" in
- *win32* | *WIN32*)
- # Extract the first word of "cl", so it can be a program name with args.
-set dummy cl; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:618: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CC'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CC"; then
- ac_cv_prog_CC="$CC" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CC="cl"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CC="$ac_cv_prog_CC"
-if test -n "$CC"; then
- echo "$ac_t""$CC" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
- ;;
- esac
- fi
- test -z "$CC" && { echo "configure: error: no acceptable cc found in \$PATH" 1>&2; exit 1; }
-fi
-
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:650: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) works" >&5
-
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 661 "configure"
-#include "confdefs.h"
-
-main(){return(0);}
-EOF
-if { (eval echo configure:666: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cc_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cc_cross=no
- else
- ac_cv_prog_cc_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cc_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cc_works" 1>&6
-if test $ac_cv_prog_cc_works = no; then
- { echo "configure: error: installation or configuration problem: C compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:692: checking whether the C compiler ($CC $CFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cc_cross" 1>&6
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo $ac_n "checking whether we are using GNU C""... $ac_c" 1>&6
-echo "configure:697: checking whether we are using GNU C" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gcc'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.c <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gcc=yes
-else
- ac_cv_prog_gcc=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gcc" 1>&6
-
-if test $ac_cv_prog_gcc = yes; then
- GCC=yes
-else
- GCC=
-fi
-
-ac_test_CFLAGS="${CFLAGS+set}"
-ac_save_CFLAGS="$CFLAGS"
-CFLAGS=
-echo $ac_n "checking whether ${CC-cc} accepts -g""... $ac_c" 1>&6
-echo "configure:725: checking whether ${CC-cc} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cc_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.c
-if test -z "`${CC-cc} -g -c conftest.c 2>&1`"; then
- ac_cv_prog_cc_g=yes
-else
- ac_cv_prog_cc_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cc_g" 1>&6
-if test "$ac_test_CFLAGS" = set; then
- CFLAGS="$ac_save_CFLAGS"
-elif test $ac_cv_prog_cc_g = yes; then
- if test "$GCC" = yes; then
- CFLAGS="-g -O2"
- else
- CFLAGS="-g"
- fi
-else
- if test "$GCC" = yes; then
- CFLAGS="-O2"
- else
- CFLAGS=
- fi
-fi
-
-for ac_prog in $CCC c++ g++ gcc CC cxx cc++ cl
-do
-# Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:761: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_CXX'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$CXX"; then
- ac_cv_prog_CXX="$CXX" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_CXX="$ac_prog"
- break
- fi
- done
- IFS="$ac_save_ifs"
-fi
-fi
-CXX="$ac_cv_prog_CXX"
-if test -n "$CXX"; then
- echo "$ac_t""$CXX" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-test -n "$CXX" && break
-done
-test -n "$CXX" || CXX="gcc"
-
-
-echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works""... $ac_c" 1>&6
-echo "configure:793: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) works" >&5
-
-ac_ext=C
-# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cxx_cross
-
-cat > conftest.$ac_ext << EOF
-
-#line 804 "configure"
-#include "confdefs.h"
-
-int main(){return(0);}
-EOF
-if { (eval echo configure:809: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- ac_cv_prog_cxx_works=yes
- # If we can't run a trivial program, we are probably using a cross compiler.
- if (./conftest; exit) 2>/dev/null; then
- ac_cv_prog_cxx_cross=no
- else
- ac_cv_prog_cxx_cross=yes
- fi
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- ac_cv_prog_cxx_works=no
-fi
-rm -fr conftest*
-ac_ext=c
-# CFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CPP $CPPFLAGS'
-ac_compile='${CC-cc} -c $CFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CC-cc} -o conftest${ac_exeext} $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cc_cross
-
-echo "$ac_t""$ac_cv_prog_cxx_works" 1>&6
-if test $ac_cv_prog_cxx_works = no; then
- { echo "configure: error: installation or configuration problem: C++ compiler cannot create executables." 1>&2; exit 1; }
-fi
-echo $ac_n "checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler""... $ac_c" 1>&6
-echo "configure:835: checking whether the C++ compiler ($CXX $CXXFLAGS $LDFLAGS) is a cross-compiler" >&5
-echo "$ac_t""$ac_cv_prog_cxx_cross" 1>&6
-cross_compiling=$ac_cv_prog_cxx_cross
-
-echo $ac_n "checking whether we are using GNU C++""... $ac_c" 1>&6
-echo "configure:840: checking whether we are using GNU C++" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_gxx'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.C <&5; (eval $ac_try) 2>&5; }; } | egrep yes >/dev/null 2>&1; then
- ac_cv_prog_gxx=yes
-else
- ac_cv_prog_gxx=no
-fi
-fi
-
-echo "$ac_t""$ac_cv_prog_gxx" 1>&6
-
-if test $ac_cv_prog_gxx = yes; then
- GXX=yes
-else
- GXX=
-fi
-
-ac_test_CXXFLAGS="${CXXFLAGS+set}"
-ac_save_CXXFLAGS="$CXXFLAGS"
-CXXFLAGS=
-echo $ac_n "checking whether ${CXX-g++} accepts -g""... $ac_c" 1>&6
-echo "configure:868: checking whether ${CXX-g++} accepts -g" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_cxx_g'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- echo 'void f(){}' > conftest.cc
-if test -z "`${CXX-g++} -g -c conftest.cc 2>&1`"; then
- ac_cv_prog_cxx_g=yes
-else
- ac_cv_prog_cxx_g=no
-fi
-rm -f conftest*
-
-fi
-
-echo "$ac_t""$ac_cv_prog_cxx_g" 1>&6
-if test "$ac_test_CXXFLAGS" = set; then
- CXXFLAGS="$ac_save_CXXFLAGS"
-elif test $ac_cv_prog_cxx_g = yes; then
- if test "$GXX" = yes; then
- CXXFLAGS="-g -O2"
- else
- CXXFLAGS="-g"
- fi
-else
- if test "$GXX" = yes; then
- CXXFLAGS="-O2"
- else
- CXXFLAGS=
- fi
-fi
-
-for ac_declaration in \
- ''\
- '#include ' \
- 'extern "C" void std::exit (int) throw (); using std::exit;' \
- 'extern "C" void std::exit (int); using std::exit;' \
- 'extern "C" void exit (int) throw ();' \
- 'extern "C" void exit (int);' \
- 'void exit (int);'
-do
- cat > conftest.$ac_ext <
-$ac_declaration
-int main() {
-exit (42);
-; return 0; }
-EOF
-if { (eval echo configure:917: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- :
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- continue
-fi
-rm -f conftest*
- cat > conftest.$ac_ext <&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- break
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
-fi
-rm -f conftest*
-done
-if test -n "$ac_declaration"; then
- echo '#ifdef __cplusplus' >>confdefs.h
- echo $ac_declaration >>confdefs.h
- echo '#endif' >>confdefs.h
-fi
-
-
-# Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:953: checking for $ac_word" >&5
-if eval "test \"`echo '$''{'ac_cv_prog_RANLIB'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
- IFS="${IFS= }"; ac_save_ifs="$IFS"; IFS=":"
- ac_dummy="$PATH"
- for ac_dir in $ac_dummy; do
- test -z "$ac_dir" && ac_dir=.
- if test -f $ac_dir/$ac_word; then
- ac_cv_prog_RANLIB="ranlib"
- break
- fi
- done
- IFS="$ac_save_ifs"
- test -z "$ac_cv_prog_RANLIB" && ac_cv_prog_RANLIB=":"
-fi
-fi
-RANLIB="$ac_cv_prog_RANLIB"
-if test -n "$RANLIB"; then
- echo "$ac_t""$RANLIB" 1>&6
-else
- echo "$ac_t""no" 1>&6
-fi
-
-echo $ac_n "checking whether ${MAKE-make} sets \${MAKE}""... $ac_c" 1>&6
-echo "configure:981: checking whether ${MAKE-make} sets \${MAKE}" >&5
-set dummy ${MAKE-make}; ac_make=`echo "$2" | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_prog_make_${ac_make}_set'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftestmake <<\EOF
-all:
- @echo 'ac_maketemp="${MAKE}"'
-EOF
-# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
-eval `${MAKE-make} -f conftestmake 2>/dev/null | grep temp=`
-if test -n "$ac_maketemp"; then
- eval ac_cv_prog_make_${ac_make}_set=yes
-else
- eval ac_cv_prog_make_${ac_make}_set=no
-fi
-rm -f conftestmake
-fi
-if eval "test \"`echo '$ac_cv_prog_make_'${ac_make}_set`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- SET_MAKE=
-else
- echo "$ac_t""no" 1>&6
- SET_MAKE="MAKE=${MAKE-make}"
-fi
-
-ac_ext=C
-# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cxx_cross
-
-
-case "`(uname -sr) 2>/dev/null`" in
-"SunOS 5"*)
- SOLARIS=yes
- USE_MITSHM=yes
- ;;
-"Linux"*)
- LINUX=yes
- USE_MITSHM=yes
- ;;
-esac
-
-if test "$USE_MITSHM" = yes; then
- MITSHM_CPPFLAGS="-DMITSHM"
-fi
-
-
-if test "$GCC" = yes; then
- CFLAGS="$CFLAGS -Wall"
- if test "$SOLARIS" = yes; then
- CFLAGS="$CFLAGS -Wno-unknown-pragmas -Wno-implicit-int"
- fi
-fi
-if test "$GXX" = yes; then
- CXXFLAGS="$CXXFLAGS -Wall"
- if test "$SOLARIS" = yes; then
- CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas -Wno-implicit-int -fpermissive"
- fi
-fi
-
-echo $ac_n "checking how to run the C++ preprocessor""... $ac_c" 1>&6
-echo "configure:1045: checking how to run the C++ preprocessor" >&5
-if test -z "$CXXCPP"; then
-if eval "test \"`echo '$''{'ac_cv_prog_CXXCPP'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_ext=C
-# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cxx_cross
- CXXCPP="${CXX-g++} -E"
- cat > conftest.$ac_ext <
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1063: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- :
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- CXXCPP=/lib/cpp
-fi
-rm -f conftest*
- ac_cv_prog_CXXCPP="$CXXCPP"
-ac_ext=C
-# CXXFLAGS is not in ac_cpp because -g, -O, etc. are not valid cpp options.
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='${CXX-g++} -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext 1>&5'
-ac_link='${CXX-g++} -o conftest${ac_exeext} $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS 1>&5'
-cross_compiling=$ac_cv_prog_cxx_cross
-fi
-fi
-CXXCPP="$ac_cv_prog_CXXCPP"
-echo "$ac_t""$CXXCPP" 1>&6
-
-# If we find X, set shell vars x_includes and x_libraries to the
-# paths, otherwise set no_x=yes.
-# Uses ac_ vars as temps to allow command line to override cache and checks.
-# --without-x overrides everything else, but does not touch the cache.
-echo $ac_n "checking for X""... $ac_c" 1>&6
-echo "configure:1092: checking for X" >&5
-
-# Check whether --with-x or --without-x was given.
-if test "${with_x+set}" = set; then
- withval="$with_x"
- :
-fi
-
-# $have_x is `yes', `no', `disabled', or empty when we do not yet know.
-if test "x$with_x" = xno; then
- # The user explicitly disabled X.
- have_x=disabled
-else
- if test "x$x_includes" != xNONE && test "x$x_libraries" != xNONE; then
- # Both variables are already set.
- have_x=yes
- else
-if eval "test \"`echo '$''{'ac_cv_have_x'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- # One or both of the vars are not set, and there is no cached value.
-ac_x_includes=NO ac_x_libraries=NO
-rm -fr conftestdir
-if mkdir conftestdir; then
- cd conftestdir
- # Make sure to not put "make" in the Imakefile rules, since we grep it out.
- cat > Imakefile <<'EOF'
-acfindx:
- @echo 'ac_im_incroot="${INCROOT}"; ac_im_usrlibdir="${USRLIBDIR}"; ac_im_libdir="${LIBDIR}"'
-EOF
- if (xmkmf) >/dev/null 2>/dev/null && test -f Makefile; then
- # GNU make sometimes prints "make[1]: Entering...", which would confuse us.
- eval `${MAKE-make} acfindx 2>/dev/null | grep -v make`
- # Open Windows xmkmf reportedly sets LIBDIR instead of USRLIBDIR.
- for ac_extension in a so sl; do
- if test ! -f $ac_im_usrlibdir/libX11.$ac_extension &&
- test -f $ac_im_libdir/libX11.$ac_extension; then
- ac_im_usrlibdir=$ac_im_libdir; break
- fi
- done
- # Screen out bogus values from the imake configuration. They are
- # bogus both because they are the default anyway, and because
- # using them would break gcc on systems where it needs fixed includes.
- case "$ac_im_incroot" in
- /usr/include) ;;
- *) test -f "$ac_im_incroot/X11/Xos.h" && ac_x_includes="$ac_im_incroot" ;;
- esac
- case "$ac_im_usrlibdir" in
- /usr/lib | /lib) ;;
- *) test -d "$ac_im_usrlibdir" && ac_x_libraries="$ac_im_usrlibdir" ;;
- esac
- fi
- cd ..
- rm -fr conftestdir
-fi
-
-if test "$ac_x_includes" = NO; then
- # Guess where to find include files, by looking for this one X11 .h file.
- test -z "$x_direct_test_include" && x_direct_test_include=X11/Intrinsic.h
-
- # First, try using that file with no special directory specified.
-cat > conftest.$ac_ext <
-EOF
-ac_try="$ac_cpp conftest.$ac_ext >/dev/null 2>conftest.out"
-{ (eval echo configure:1159: \"$ac_try\") 1>&5; (eval $ac_try) 2>&5; }
-ac_err=`grep -v '^ *+' conftest.out | grep -v "^conftest.${ac_ext}\$"`
-if test -z "$ac_err"; then
- rm -rf conftest*
- # We can compile using X headers with no special include directory.
-ac_x_includes=
-else
- echo "$ac_err" >&5
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- # Look for the header file in a standard set of common directories.
-# Check X11 before X11Rn because it is often a symlink to the current release.
- for ac_dir in \
- /usr/X11/include \
- /usr/X11R6/include \
- /usr/X11R5/include \
- /usr/X11R4/include \
- \
- /usr/include/X11 \
- /usr/include/X11R6 \
- /usr/include/X11R5 \
- /usr/include/X11R4 \
- \
- /usr/local/X11/include \
- /usr/local/X11R6/include \
- /usr/local/X11R5/include \
- /usr/local/X11R4/include \
- \
- /usr/local/include/X11 \
- /usr/local/include/X11R6 \
- /usr/local/include/X11R5 \
- /usr/local/include/X11R4 \
- \
- /usr/X386/include \
- /usr/x386/include \
- /usr/XFree86/include/X11 \
- \
- /usr/include \
- /usr/local/include \
- /usr/unsupported/include \
- /usr/athena/include \
- /usr/local/x11r5/include \
- /usr/lpp/Xamples/include \
- \
- /usr/openwin/include \
- /usr/openwin/share/include \
- ; \
- do
- if test -r "$ac_dir/$x_direct_test_include"; then
- ac_x_includes=$ac_dir
- break
- fi
- done
-fi
-rm -f conftest*
-fi # $ac_x_includes = NO
-
-if test "$ac_x_libraries" = NO; then
- # Check for the libraries.
-
- test -z "$x_direct_test_library" && x_direct_test_library=Xt
- test -z "$x_direct_test_function" && x_direct_test_function=XtMalloc
-
- # See if we find them without any special options.
- # Don't add to $LIBS permanently.
- ac_save_LIBS="$LIBS"
- LIBS="-l$x_direct_test_library $LIBS"
-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- LIBS="$ac_save_LIBS"
-# We can link X programs with no special library path.
-ac_x_libraries=
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- LIBS="$ac_save_LIBS"
-# First see if replacing the include by lib works.
-# Check X11 before X11Rn because it is often a symlink to the current release.
-for ac_dir in `echo "$ac_x_includes" | sed s/include/lib/` \
- /usr/X11/lib \
- /usr/X11R6/lib \
- /usr/X11R5/lib \
- /usr/X11R4/lib \
- \
- /usr/lib/X11 \
- /usr/lib/X11R6 \
- /usr/lib/X11R5 \
- /usr/lib/X11R4 \
- \
- /usr/local/X11/lib \
- /usr/local/X11R6/lib \
- /usr/local/X11R5/lib \
- /usr/local/X11R4/lib \
- \
- /usr/local/lib/X11 \
- /usr/local/lib/X11R6 \
- /usr/local/lib/X11R5 \
- /usr/local/lib/X11R4 \
- \
- /usr/X386/lib \
- /usr/x386/lib \
- /usr/XFree86/lib/X11 \
- \
- /usr/lib \
- /usr/local/lib \
- /usr/unsupported/lib \
- /usr/athena/lib \
- /usr/local/x11r5/lib \
- /usr/lpp/Xamples/lib \
- /lib/usr/lib/X11 \
- \
- /usr/openwin/lib \
- /usr/openwin/share/lib \
- ; \
-do
- for ac_extension in a so sl; do
- if test -r $ac_dir/lib${x_direct_test_library}.$ac_extension; then
- ac_x_libraries=$ac_dir
- break 2
- fi
- done
-done
-fi
-rm -f conftest*
-fi # $ac_x_libraries = NO
-
-if test "$ac_x_includes" = NO || test "$ac_x_libraries" = NO; then
- # Didn't find X anywhere. Cache the known absence of X.
- ac_cv_have_x="have_x=no"
-else
- # Record where we found X for the cache.
- ac_cv_have_x="have_x=yes \
- ac_x_includes=$ac_x_includes ac_x_libraries=$ac_x_libraries"
-fi
-fi
- fi
- eval "$ac_cv_have_x"
-fi # $with_x != no
-
-if test "$have_x" != yes; then
- echo "$ac_t""$have_x" 1>&6
- no_x=yes
-else
- # If each of the values was on the command line, it overrides each guess.
- test "x$x_includes" = xNONE && x_includes=$ac_x_includes
- test "x$x_libraries" = xNONE && x_libraries=$ac_x_libraries
- # Update the cache value to reflect the command line values.
- ac_cv_have_x="have_x=yes \
- ac_x_includes=$x_includes ac_x_libraries=$x_libraries"
- echo "$ac_t""libraries $x_libraries, headers $x_includes" 1>&6
-fi
-
-if test "$no_x" = yes; then
- # Not all programs may use this symbol, but it does not hurt to define it.
- cat >> confdefs.h <<\EOF
-#define X_DISPLAY_MISSING 1
-EOF
-
- X_CFLAGS= X_PRE_LIBS= X_LIBS= X_EXTRA_LIBS=
-else
- if test -n "$x_includes"; then
- X_CFLAGS="$X_CFLAGS -I$x_includes"
- fi
-
- # It would also be nice to do this for all -L options, not just this one.
- if test -n "$x_libraries"; then
- X_LIBS="$X_LIBS -L$x_libraries"
- # For Solaris; some versions of Sun CC require a space after -R and
- # others require no space. Words are not sufficient . . . .
- case "`(uname -sr) 2>/dev/null`" in
- "SunOS 5"*)
- echo $ac_n "checking whether -R must be followed by a space""... $ac_c" 1>&6
-echo "configure:1341: checking whether -R must be followed by a space" >&5
- ac_xsave_LIBS="$LIBS"; LIBS="$LIBS -R$x_libraries"
- cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ac_R_nospace=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_R_nospace=no
-fi
-rm -f conftest*
- if test $ac_R_nospace = yes; then
- echo "$ac_t""no" 1>&6
- X_LIBS="$X_LIBS -R$x_libraries"
- else
- LIBS="$ac_xsave_LIBS -R $x_libraries"
- cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- ac_R_space=yes
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- ac_R_space=no
-fi
-rm -f conftest*
- if test $ac_R_space = yes; then
- echo "$ac_t""yes" 1>&6
- X_LIBS="$X_LIBS -R $x_libraries"
- else
- echo "$ac_t""neither works" 1>&6
- fi
- fi
- LIBS="$ac_xsave_LIBS"
- esac
- fi
-
- # Check for system-dependent libraries X programs must link with.
- # Do this before checking for the system-independent R6 libraries
- # (-lICE), since we may need -lsocket or whatever for X linking.
-
- if test "$ISC" = yes; then
- X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl_s -linet"
- else
- # Martyn.Johnson@cl.cam.ac.uk says this is needed for Ultrix, if the X
- # libraries were built with DECnet support. And karl@cs.umb.edu says
- # the Alpha needs dnet_stub (dnet does not exist).
- echo $ac_n "checking for dnet_ntoa in -ldnet""... $ac_c" 1>&6
-echo "configure:1406: checking for dnet_ntoa in -ldnet" >&5
-ac_lib_var=`echo dnet'_'dnet_ntoa | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-ldnet $LIBS"
-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet"
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test $ac_cv_lib_dnet_dnet_ntoa = no; then
- echo $ac_n "checking for dnet_ntoa in -ldnet_stub""... $ac_c" 1>&6
-echo "configure:1450: checking for dnet_ntoa in -ldnet_stub" >&5
-ac_lib_var=`echo dnet_stub'_'dnet_ntoa | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-ldnet_stub $LIBS"
-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- X_EXTRA_LIBS="$X_EXTRA_LIBS -ldnet_stub"
-else
- echo "$ac_t""no" 1>&6
-fi
-
- fi
-
- # msh@cis.ufl.edu says -lnsl (and -lsocket) are needed for his 386/AT,
- # to get the SysV transport functions.
- # chad@anasazi.com says the Pyramis MIS-ES running DC/OSx (SVR4)
- # needs -lnsl.
- # The nsl library prevents programs from opening the X display
- # on Irix 5.2, according to dickey@clark.net.
- echo $ac_n "checking for gethostbyname""... $ac_c" 1>&6
-echo "configure:1501: checking for gethostbyname" >&5
-if eval "test \"`echo '$''{'ac_cv_func_gethostbyname'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char gethostbyname();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_gethostbyname) || defined (__stub___gethostbyname)
-choke me
-#else
-gethostbyname();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1532: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_gethostbyname=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_gethostbyname=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'gethostbyname`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test $ac_cv_func_gethostbyname = no; then
- echo $ac_n "checking for gethostbyname in -lnsl""... $ac_c" 1>&6
-echo "configure:1553: checking for gethostbyname in -lnsl" >&5
-ac_lib_var=`echo nsl'_'gethostbyname | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lnsl $LIBS"
-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- X_EXTRA_LIBS="$X_EXTRA_LIBS -lnsl"
-else
- echo "$ac_t""no" 1>&6
-fi
-
- fi
-
- # lieder@skyler.mavd.honeywell.com says without -lsocket,
- # socket/setsockopt and other routines are undefined under SCO ODT
- # 2.0. But -lsocket is broken on IRIX 5.2 (and is not necessary
- # on later versions), says simon@lia.di.epfl.ch: it contains
- # gethostby* variants that don't use the nameserver (or something).
- # -lsocket must be given before -lnsl if both are needed.
- # We assume that if connect needs -lnsl, so does gethostbyname.
- echo $ac_n "checking for connect""... $ac_c" 1>&6
-echo "configure:1605: checking for connect" >&5
-if eval "test \"`echo '$''{'ac_cv_func_connect'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char connect();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_connect) || defined (__stub___connect)
-choke me
-#else
-connect();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1636: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_connect=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_connect=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'connect`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test $ac_cv_func_connect = no; then
- echo $ac_n "checking for connect in -lsocket""... $ac_c" 1>&6
-echo "configure:1657: checking for connect in -lsocket" >&5
-ac_lib_var=`echo socket'_'connect | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lsocket $X_EXTRA_LIBS $LIBS"
-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- X_EXTRA_LIBS="-lsocket $X_EXTRA_LIBS"
-else
- echo "$ac_t""no" 1>&6
-fi
-
- fi
-
- # gomez@mi.uni-erlangen.de says -lposix is necessary on A/UX.
- echo $ac_n "checking for remove""... $ac_c" 1>&6
-echo "configure:1703: checking for remove" >&5
-if eval "test \"`echo '$''{'ac_cv_func_remove'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char remove();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_remove) || defined (__stub___remove)
-choke me
-#else
-remove();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1734: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_remove=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_remove=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'remove`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test $ac_cv_func_remove = no; then
- echo $ac_n "checking for remove in -lposix""... $ac_c" 1>&6
-echo "configure:1755: checking for remove in -lposix" >&5
-ac_lib_var=`echo posix'_'remove | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lposix $LIBS"
-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- X_EXTRA_LIBS="$X_EXTRA_LIBS -lposix"
-else
- echo "$ac_t""no" 1>&6
-fi
-
- fi
-
- # BSDI BSD/OS 2.1 needs -lipc for XOpenDisplay.
- echo $ac_n "checking for shmat""... $ac_c" 1>&6
-echo "configure:1801: checking for shmat" >&5
-if eval "test \"`echo '$''{'ac_cv_func_shmat'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char shmat();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_shmat) || defined (__stub___shmat)
-choke me
-#else
-shmat();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:1832: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_shmat=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_shmat=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'shmat`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- :
-else
- echo "$ac_t""no" 1>&6
-fi
-
- if test $ac_cv_func_shmat = no; then
- echo $ac_n "checking for shmat in -lipc""... $ac_c" 1>&6
-echo "configure:1853: checking for shmat in -lipc" >&5
-ac_lib_var=`echo ipc'_'shmat | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lipc $LIBS"
-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- X_EXTRA_LIBS="$X_EXTRA_LIBS -lipc"
-else
- echo "$ac_t""no" 1>&6
-fi
-
- fi
- fi
-
- # Check for libraries that X11R6 Xt/Xaw programs need.
- ac_save_LDFLAGS="$LDFLAGS"
- test -n "$x_libraries" && LDFLAGS="$LDFLAGS -L$x_libraries"
- # SM needs ICE to (dynamically) link under SunOS 4.x (so we have to
- # check for ICE first), but we must link in the order -lSM -lICE or
- # we get undefined symbols. So assume we have SM if we have ICE.
- # These have to be linked with before -lX11, unlike the other
- # libraries we check for below, so use a different variable.
- # --interran@uluru.Stanford.EDU, kb@cs.umb.edu.
- echo $ac_n "checking for IceConnectionNumber in -lICE""... $ac_c" 1>&6
-echo "configure:1908: checking for IceConnectionNumber in -lICE" >&5
-ac_lib_var=`echo ICE'_'IceConnectionNumber | sed 'y%./+-%__p_%'`
-if eval "test \"`echo '$''{'ac_cv_lib_$ac_lib_var'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- ac_save_LIBS="$LIBS"
-LIBS="-lICE $X_EXTRA_LIBS $LIBS"
-cat > conftest.$ac_ext <&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_lib_$ac_lib_var=no"
-fi
-rm -f conftest*
-LIBS="$ac_save_LIBS"
-
-fi
-if eval "test \"`echo '$ac_cv_lib_'$ac_lib_var`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- X_PRE_LIBS="$X_PRE_LIBS -lSM -lICE"
-else
- echo "$ac_t""no" 1>&6
-fi
-
- LDFLAGS="$ac_save_LDFLAGS"
-
-fi
-
-
-# Check whether --with-installed-zlib or --without-installed-zlib was given.
-if test "${with_installed_zlib+set}" = set; then
- withval="$with_installed_zlib"
- :
-fi
-
-
-if test "$with_installed_zlib" = yes; then
- echo "using installed zlib"
- ZLIB_LIB=-lz
-else
- ZLIB_DIR=zlib
- ZLIB_INCLUDE='-I$(top_srcdir)/zlib'
- ZLIB_LIB='$(top_srcdir)/zlib/libz.a'
- echo "configuring zlib..."
- (cd zlib; ./configure)
- echo "...done configuring zlib"
-fi
-
-
-
-
-
-if test "$SOLARIS" = yes; then
- VSNPRINTF_DEFINE=
-else
- echo $ac_n "checking for vsnprintf""... $ac_c" 1>&6
-echo "configure:1982: checking for vsnprintf" >&5
-if eval "test \"`echo '$''{'ac_cv_func_vsnprintf'+set}'`\" = set"; then
- echo $ac_n "(cached) $ac_c" 1>&6
-else
- cat > conftest.$ac_ext <
-/* Override any gcc2 internal prototype to avoid an error. */
-#ifdef __cplusplus
-extern "C"
-#endif
-/* We use char because int might match the return type of a gcc2
- builtin and then its argument prototype would still apply. */
-char vsnprintf();
-
-int main() {
-
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined (__stub_vsnprintf) || defined (__stub___vsnprintf)
-choke me
-#else
-vsnprintf();
-#endif
-
-; return 0; }
-EOF
-if { (eval echo configure:2013: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
- rm -rf conftest*
- eval "ac_cv_func_vsnprintf=yes"
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- eval "ac_cv_func_vsnprintf=no"
-fi
-rm -f conftest*
-fi
-
-if eval "test \"`echo '$ac_cv_func_'vsnprintf`\" = yes"; then
- echo "$ac_t""yes" 1>&6
- VSNPRINTF_DEFINE='-DHAVE_VSNPRINTF'
-else
- echo "$ac_t""no" 1>&6
-VSNPRINTF_DEFINE=
-fi
-
-fi
-
-
-echo $ac_n "checking for socklen_t""... $ac_c" 1>&6
-echo "configure:2037: checking for socklen_t" >&5
-cat > conftest.$ac_ext <
- #include
-int main() {
-socklen_t x;
-accept(0, 0, &x);
-; return 0; }
-EOF
-if { (eval echo configure:2048: \"$ac_compile\") 1>&5; (eval $ac_compile) 2>&5; }; then
- rm -rf conftest*
- echo "$ac_t""yes" 1>&6
-SOCKLEN_T_DEFINE='-DVNC_SOCKLEN_T=socklen_t'
-else
- echo "configure: failed program was:" >&5
- cat conftest.$ac_ext >&5
- rm -rf conftest*
- echo "$ac_t""using int" 1>&6
-SOCKLEN_T_DEFINE='-DVNC_SOCKLEN_T=int'
-fi
-rm -f conftest*
-
-
-BOILERPLATE=boilerplate.mk
-
-if (sh -c "make --version" 2>/dev/null | grep GNU 2>&1 >/dev/null); then
- if sh -c "vncmkdepend" >/dev/null 2>&1; then
- BOILERPLATE="$BOILERPLATE:depend.mk"
- fi
-fi
-
-trap '' 1 2 15
-cat > confcache <<\EOF
-# This file is a shell script that caches the results of configure
-# tests run on this system so they can be shared between configure
-# scripts and configure runs. It is not useful on other systems.
-# If it contains results you don't want to keep, you may remove or edit it.
-#
-# By default, configure uses ./config.cache as the cache file,
-# creating it if it does not exist already. You can give configure
-# the --cache-file=FILE option to use a different cache file; that is
-# what configure does when it calls configure scripts in
-# subdirectories, so they share the cache.
-# Giving --cache-file=/dev/null disables caching, for debugging configure.
-# config.status only pays attention to the cache file if you give it the
-# --recheck option to rerun configure.
-#
-EOF
-# The following way of writing the cache mishandles newlines in values,
-# but we know of no workaround that is simple, portable, and efficient.
-# So, don't put newlines in cache variables' values.
-# Ultrix sh set writes to stderr and can't be redirected directly,
-# and sets the high bit in the cache file unless we assign to the vars.
-(set) 2>&1 |
- case `(ac_space=' '; set | grep ac_space) 2>&1` in
- *ac_space=\ *)
- # `set' does not quote correctly, so add quotes (double-quote substitution
- # turns \\\\ into \\, and sed turns \\ into \).
- sed -n \
- -e "s/'/'\\\\''/g" \
- -e "s/^\\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\\)=\\(.*\\)/\\1=\${\\1='\\2'}/p"
- ;;
- *)
- # `set' quotes correctly as required by POSIX, so do not add quotes.
- sed -n -e 's/^\([a-zA-Z0-9_]*_cv_[a-zA-Z0-9_]*\)=\(.*\)/\1=${\1=\2}/p'
- ;;
- esac >> confcache
-if cmp -s $cache_file confcache; then
- :
-else
- if test -w $cache_file; then
- echo "updating cache $cache_file"
- cat confcache > $cache_file
- else
- echo "not updating unwritable cache $cache_file"
- fi
-fi
-rm -f confcache
-
-trap 'rm -fr conftest* confdefs* core core.* *.core $ac_clean_files; exit 1' 1 2 15
-
-test "x$prefix" = xNONE && prefix=$ac_default_prefix
-# Let make expand exec_prefix.
-test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
-
-# Any assignment to VPATH causes Sun make to only execute
-# the first set of double-colon rules, so remove it if not needed.
-# If there is a colon in the path, we need to keep it.
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[^:]*$/d'
-fi
-
-trap 'rm -f $CONFIG_STATUS conftest*; exit 1' 1 2 15
-
-# Transform confdefs.h into DEFS.
-# Protect against shell expansion while executing Makefile rules.
-# Protect against Makefile macro expansion.
-cat > conftest.defs <<\EOF
-s%#define \([A-Za-z_][A-Za-z0-9_]*\) *\(.*\)%-D\1=\2%g
-s%[ `~#$^&*(){}\\|;'"<>?]%\\&%g
-s%\[%\\&%g
-s%\]%\\&%g
-s%\$%$$%g
-EOF
-DEFS=`sed -f conftest.defs confdefs.h | tr '\012' ' '`
-rm -f conftest.defs
-
-
-# Without the "./", some shells look in PATH for config.status.
-: ${CONFIG_STATUS=./config.status}
-
-echo creating $CONFIG_STATUS
-rm -f $CONFIG_STATUS
-cat > $CONFIG_STATUS </dev/null | sed 1q`:
-#
-# $0 $ac_configure_args
-#
-# Compiler output produced by configure, useful for debugging
-# configure, is in ./config.log if it exists.
-
-ac_cs_usage="Usage: $CONFIG_STATUS [--recheck] [--version] [--help]"
-for ac_option
-do
- case "\$ac_option" in
- -recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
- echo "running \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion"
- exec \${CONFIG_SHELL-/bin/sh} $0 $ac_configure_args --no-create --no-recursion ;;
- -version | --version | --versio | --versi | --vers | --ver | --ve | --v)
- echo "$CONFIG_STATUS generated by autoconf version 2.13"
- exit 0 ;;
- -help | --help | --hel | --he | --h)
- echo "\$ac_cs_usage"; exit 0 ;;
- *) echo "\$ac_cs_usage"; exit 1 ;;
- esac
-done
-
-ac_given_srcdir=$srcdir
-
-trap 'rm -fr `echo "Makefile:Makefile.in:$BOILERPLATE \
- rdr/Makefile:rdr/Makefile.in:$BOILERPLATE \
- network/Makefile:network/Makefile.in:$BOILERPLATE \
- Xregion/Makefile:Xregion/Makefile.in:$BOILERPLATE \
- rfb/Makefile:rfb/Makefile.in:$BOILERPLATE \
-" | sed "s/:[^ ]*//g"` conftest*; exit 1' 1 2 15
-EOF
-cat >> $CONFIG_STATUS < conftest.subs <<\\CEOF
-$ac_vpsub
-$extrasub
-s%@SHELL@%$SHELL%g
-s%@CFLAGS@%$CFLAGS%g
-s%@CPPFLAGS@%$CPPFLAGS%g
-s%@CXXFLAGS@%$CXXFLAGS%g
-s%@FFLAGS@%$FFLAGS%g
-s%@DEFS@%$DEFS%g
-s%@LDFLAGS@%$LDFLAGS%g
-s%@LIBS@%$LIBS%g
-s%@exec_prefix@%$exec_prefix%g
-s%@prefix@%$prefix%g
-s%@program_transform_name@%$program_transform_name%g
-s%@bindir@%$bindir%g
-s%@sbindir@%$sbindir%g
-s%@libexecdir@%$libexecdir%g
-s%@datadir@%$datadir%g
-s%@sysconfdir@%$sysconfdir%g
-s%@sharedstatedir@%$sharedstatedir%g
-s%@localstatedir@%$localstatedir%g
-s%@libdir@%$libdir%g
-s%@includedir@%$includedir%g
-s%@oldincludedir@%$oldincludedir%g
-s%@infodir@%$infodir%g
-s%@mandir@%$mandir%g
-s%@CC@%$CC%g
-s%@CXX@%$CXX%g
-s%@RANLIB@%$RANLIB%g
-s%@SET_MAKE@%$SET_MAKE%g
-s%@MITSHM_CPPFLAGS@%$MITSHM_CPPFLAGS%g
-s%@CXXCPP@%$CXXCPP%g
-s%@X_CFLAGS@%$X_CFLAGS%g
-s%@X_PRE_LIBS@%$X_PRE_LIBS%g
-s%@X_LIBS@%$X_LIBS%g
-s%@X_EXTRA_LIBS@%$X_EXTRA_LIBS%g
-s%@ZLIB_DIR@%$ZLIB_DIR%g
-s%@ZLIB_INCLUDE@%$ZLIB_INCLUDE%g
-s%@ZLIB_LIB@%$ZLIB_LIB%g
-s%@VSNPRINTF_DEFINE@%$VSNPRINTF_DEFINE%g
-s%@SOCKLEN_T_DEFINE@%$SOCKLEN_T_DEFINE%g
-
-CEOF
-EOF
-
-cat >> $CONFIG_STATUS <<\EOF
-
-# Split the substitutions into bite-sized pieces for seds with
-# small command number limits, like on Digital OSF/1 and HP-UX.
-ac_max_sed_cmds=90 # Maximum number of lines to put in a sed script.
-ac_file=1 # Number of current file.
-ac_beg=1 # First line for current file.
-ac_end=$ac_max_sed_cmds # Line after last line for current file.
-ac_more_lines=:
-ac_sed_cmds=""
-while $ac_more_lines; do
- if test $ac_beg -gt 1; then
- sed "1,${ac_beg}d; ${ac_end}q" conftest.subs > conftest.s$ac_file
- else
- sed "${ac_end}q" conftest.subs > conftest.s$ac_file
- fi
- if test ! -s conftest.s$ac_file; then
- ac_more_lines=false
- rm -f conftest.s$ac_file
- else
- if test -z "$ac_sed_cmds"; then
- ac_sed_cmds="sed -f conftest.s$ac_file"
- else
- ac_sed_cmds="$ac_sed_cmds | sed -f conftest.s$ac_file"
- fi
- ac_file=`expr $ac_file + 1`
- ac_beg=$ac_end
- ac_end=`expr $ac_end + $ac_max_sed_cmds`
- fi
-done
-if test -z "$ac_sed_cmds"; then
- ac_sed_cmds=cat
-fi
-EOF
-
-cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF
-for ac_file in .. $CONFIG_FILES; do if test "x$ac_file" != x..; then
- # Support "outfile[:infile[:infile...]]", defaulting infile="outfile.in".
- case "$ac_file" in
- *:*) ac_file_in=`echo "$ac_file"|sed 's%[^:]*:%%'`
- ac_file=`echo "$ac_file"|sed 's%:.*%%'` ;;
- *) ac_file_in="${ac_file}.in" ;;
- esac
-
- # Adjust a relative srcdir, top_srcdir, and INSTALL for subdirectories.
-
- # Remove last slash and all that follows it. Not all systems have dirname.
- ac_dir=`echo $ac_file|sed 's%/[^/][^/]*$%%'`
- if test "$ac_dir" != "$ac_file" && test "$ac_dir" != .; then
- # The file is in a subdirectory.
- test ! -d "$ac_dir" && mkdir "$ac_dir"
- ac_dir_suffix="/`echo $ac_dir|sed 's%^\./%%'`"
- # A "../" for each directory in $ac_dir_suffix.
- ac_dots=`echo $ac_dir_suffix|sed 's%/[^/]*%../%g'`
- else
- ac_dir_suffix= ac_dots=
- fi
-
- case "$ac_given_srcdir" in
- .) srcdir=.
- if test -z "$ac_dots"; then top_srcdir=.
- else top_srcdir=`echo $ac_dots|sed 's%/$%%'`; fi ;;
- /*) srcdir="$ac_given_srcdir$ac_dir_suffix"; top_srcdir="$ac_given_srcdir" ;;
- *) # Relative path.
- srcdir="$ac_dots$ac_given_srcdir$ac_dir_suffix"
- top_srcdir="$ac_dots$ac_given_srcdir" ;;
- esac
-
-
- echo creating "$ac_file"
- rm -f "$ac_file"
- configure_input="Generated automatically from `echo $ac_file_in|sed 's%.*/%%'` by configure."
- case "$ac_file" in
- *Makefile*) ac_comsub="1i\\
-# $configure_input" ;;
- *) ac_comsub= ;;
- esac
-
- ac_file_inputs=`echo $ac_file_in|sed -e "s%^%$ac_given_srcdir/%" -e "s%:% $ac_given_srcdir/%g"`
- sed -e "$ac_comsub
-s%@configure_input@%$configure_input%g
-s%@srcdir@%$srcdir%g
-s%@top_srcdir@%$top_srcdir%g
-" $ac_file_inputs | (eval "$ac_sed_cmds") > $ac_file
-fi; done
-rm -f conftest.s*
-
-EOF
-cat >> $CONFIG_STATUS <> $CONFIG_STATUS <<\EOF
-
-exit 0
-EOF
-chmod +x $CONFIG_STATUS
-rm -fr confdefs* $ac_clean_files
-test "$no_create" = yes || ${CONFIG_SHELL-/bin/sh} $CONFIG_STATUS || exit 1
-
diff --git a/src/vnc/common/configure.in b/src/vnc/common/configure.in
deleted file mode 100644
index cc1897a3..00000000
--- a/src/vnc/common/configure.in
+++ /dev/null
@@ -1,99 +0,0 @@
-dnl Process this file with autoconf to produce a configure script.
-AC_INIT(rdr/InStream.h)
-
-dnl dirty hack to prevent use of -g in CFLAGS and CXXFLAGS
-ac_cv_prog_cc_g=no
-ac_cv_prog_cxx_g=no
-
-dnl Checks for programs.
-AC_PROG_CC
-AC_PROG_CXX
-AC_PROG_RANLIB
-AC_PROG_MAKE_SET
-AC_LANG_CPLUSPLUS
-
-case "`(uname -sr) 2>/dev/null`" in
-"SunOS 5"*)
- SOLARIS=yes
- USE_MITSHM=yes
- ;;
-"Linux"*)
- LINUX=yes
- USE_MITSHM=yes
- ;;
-esac
-
-if test "$USE_MITSHM" = yes; then
- MITSHM_CPPFLAGS="-DMITSHM"
-fi
-AC_SUBST(MITSHM_CPPFLAGS)
-
-if test "$GCC" = yes; then
- CFLAGS="$CFLAGS -Wall"
- if test "$SOLARIS" = yes; then
- CFLAGS="$CFLAGS -Wno-unknown-pragmas -Wno-implicit-int"
- fi
-fi
-if test "$GXX" = yes; then
- CXXFLAGS="$CXXFLAGS -Wall"
- if test "$SOLARIS" = yes; then
- CXXFLAGS="$CXXFLAGS -Wno-unknown-pragmas -Wno-implicit-int -fpermissive"
- fi
-fi
-
-AC_PATH_XTRA
-
-AC_ARG_WITH(installed-zlib,
-[ --with-installed-zlib use the version of zlib which is installed on the
- system instead of the one distributed with VNC])
-
-if test "$with_installed_zlib" = yes; then
- echo "using installed zlib"
- ZLIB_LIB=-lz
-else
- ZLIB_DIR=zlib
- ZLIB_INCLUDE='-I$(top_srcdir)/zlib'
- ZLIB_LIB='$(top_srcdir)/zlib/libz.a'
- echo "configuring zlib..."
- (cd zlib; ./configure)
- echo "...done configuring zlib"
-fi
-
-AC_SUBST(ZLIB_DIR)
-AC_SUBST(ZLIB_INCLUDE)
-AC_SUBST(ZLIB_LIB)
-
-if test "$SOLARIS" = yes; then
- dnl Solaris 2.5 lacks vsnprintf, so use our own version & support 2.5
- VSNPRINTF_DEFINE=
-else
- AC_CHECK_FUNC(vsnprintf,VSNPRINTF_DEFINE='-DHAVE_VSNPRINTF',VSNPRINTF_DEFINE=)
-fi
-AC_SUBST(VSNPRINTF_DEFINE)
-
-AC_MSG_CHECKING(for socklen_t)
-AC_TRY_COMPILE(
-[#include
- #include ],
-[socklen_t x;
-accept(0, 0, &x);],
-AC_MSG_RESULT(yes)
-SOCKLEN_T_DEFINE='-DVNC_SOCKLEN_T=socklen_t',
-AC_MSG_RESULT(using int)
-SOCKLEN_T_DEFINE='-DVNC_SOCKLEN_T=int')
-AC_SUBST(SOCKLEN_T_DEFINE)
-
-BOILERPLATE=boilerplate.mk
-
-if (sh -c "make --version" 2>/dev/null | grep GNU 2>&1 >/dev/null); then
- if sh -c "vncmkdepend" >/dev/null 2>&1; then
- BOILERPLATE="$BOILERPLATE:depend.mk"
- fi
-fi
-
-AC_OUTPUT(Makefile:Makefile.in:$BOILERPLATE \
- rdr/Makefile:rdr/Makefile.in:$BOILERPLATE \
- network/Makefile:network/Makefile.in:$BOILERPLATE \
- Xregion/Makefile:Xregion/Makefile.in:$BOILERPLATE \
- rfb/Makefile:rfb/Makefile.in:$BOILERPLATE \
-)
diff --git a/src/vnc/common/depend.mk b/src/vnc/common/depend.mk
deleted file mode 100644
index 51d4cd63..00000000
--- a/src/vnc/common/depend.mk
+++ /dev/null
@@ -1,76 +0,0 @@
-#
-# C / C++ header dependency stuff
-#
-# Needs GNU make and vncmkdepend, a hacked version of makedepend
-
-.SUFFIXES: .d
-
-CMAKEDEPEND = vncmkdepend
-CXXMAKEDEPEND = vncmkdepend
-
-#
-# The recommended method of doing dependency analysis in the GNU make manual
-# turns out to be painfully slow. This method is similar but it's
-# substantially faster and retains the desirable property that the user doesn't
-# need to manually invoke a "make depend" step.
-#
-# As with the method described in the manual, we generate a separate dependency
-# (.d) file for each source file. The .d file records the header files that
-# each C or C++ source file includes. Any source file recorded in SRCS or
-# CXXSRCS will cause us to try and include the corresponding .d file and GNU
-# make then treats each .d file as a target to be remade.
-#
-# Unlike the manual's method, the rule we provide for making the .d file is
-# actually a fake. All it does is record in a temporary file that the .d file
-# needs to be remade. But as well as all the .d files, we also try to include
-# a file called "depend.phony". This file never exists, but it causes GNU make
-# to try and make the target "depend.phony". The rule for depend.phony then
-# looks at the temporary files generated by the .d rules and then invokes the
-# "omkdepend" program on all of the source files in one go.
-#
-
-#
-# We use simple assignment here to remove any of the depend.tmp files
-# at the time make parses this bit.
-#
-
-dummyvariable := $(shell $(RM) cdepend.tmp cxxdepend.tmp)
-
-#
-# Now the "fake" rules for generating .d files.
-#
-
-%.d: %.c
- @echo "$<" >> cdepend.tmp
-
-%.d: %.cxx
- @echo "$<" >> cxxdepend.tmp
-
-#
-# The depend.phony rule which actually runs omkdepend.
-#
-
-depend.phony:
- @if [ -f cdepend.tmp ]; then \
- echo $(CMAKEDEPEND) $(ALL_CPPFLAGS) `cat cdepend.tmp`; \
- $(CMAKEDEPEND) $(ALL_CPPFLAGS) `cat cdepend.tmp`; \
- rm -f cdepend.tmp; \
- fi; \
- if [ -f cxxdepend.tmp ]; then \
- echo $(CXXMAKEDEPEND) $(ALL_CPPFLAGS) `cat cxxdepend.tmp`; \
- $(CXXMAKEDEPEND) $(ALL_CPPFLAGS) `cat cxxdepend.tmp`; \
- rm -f cxxdepend.tmp; \
- fi
-
-#
-# Now include the .d files and the "depend.phony" file which never exists.
-# For some reason GNU make evaluates the targets in reverse order, so we need
-# to include depend.phony first. The "-" tells make not to complain that it
-# can't find the file.
-#
-
--include depend.phony
-
-ifdef SRCS
--include $(patsubst %.c,%.d,$(patsubst %.cxx,%.d,$(SRCS)))
-endif
diff --git a/src/vnc/common/javabin/index.vnc b/src/vnc/common/javabin/index.vnc
deleted file mode 100644
index aecb6131..00000000
--- a/src/vnc/common/javabin/index.vnc
+++ /dev/null
@@ -1,13 +0,0 @@
-
-
-
-VNC viewer for Java
-
-
-
-
-
-
diff --git a/src/vnc/common/javabin/logo150x150.gif b/src/vnc/common/javabin/logo150x150.gif
deleted file mode 100644
index f1699ba5..00000000
Binary files a/src/vnc/common/javabin/logo150x150.gif and /dev/null differ
diff --git a/src/vnc/common/javabin/vncviewer.jar b/src/vnc/common/javabin/vncviewer.jar
deleted file mode 100644
index 9916d398..00000000
Binary files a/src/vnc/common/javabin/vncviewer.jar and /dev/null differ
diff --git a/src/vnc/common/network/CMakeLists.txt b/src/vnc/common/network/CMakeLists.txt
deleted file mode 100644
index e5496986..00000000
--- a/src/vnc/common/network/CMakeLists.txt
+++ /dev/null
@@ -1,35 +0,0 @@
-# synergy -- mouse and keyboard sharing utility
-# Copyright (C) 2012 Nick Bolton
-#
-# This package is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# found in the file COPYING that should have accompanied this file.
-#
-# This package is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-set(inc
- Socket.h
- TcpSocket.h
-)
-
-set(src
- ${inc}
- TcpSocket.cxx
-)
-
-if (WIN32)
- list(APPEND src ${inc})
-endif()
-
-set(inc
- ..
-)
-
-include_directories(${inc})
-add_library(vnc_network STATIC ${src})
diff --git a/src/vnc/common/network/Makefile.in b/src/vnc/common/network/Makefile.in
deleted file mode 100644
index 8aed303a..00000000
--- a/src/vnc/common/network/Makefile.in
+++ /dev/null
@@ -1,17 +0,0 @@
-
-SRCS = TcpSocket.cxx
-
-OBJS = $(SRCS:.cxx=.o)
-
-DIR_CPPFLAGS = -I$(top_srcdir) @SOCKLEN_T_DEFINE@
-
-library = libnetwork.a
-
-all:: $(library)
-
-$(library): $(OBJS)
- rm -f $(library)
- $(AR) $(library) $(OBJS)
- $(RANLIB) $(library)
-
-# followed by boilerplate.mk
diff --git a/src/vnc/common/network/Socket.h b/src/vnc/common/network/Socket.h
deleted file mode 100644
index 7713d2cd..00000000
--- a/src/vnc/common/network/Socket.h
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-// -=- Socket.h - abstract base-class for any kind of network stream/socket
-
-#ifndef __NETWORK_SOCKET_H__
-#define __NETWORK_SOCKET_H__
-
-#include
-#include
-#include
-#include
-
-namespace network {
-
- class Socket {
- public:
- Socket(int fd)
- : instream(new rdr::FdInStream(fd)),
- outstream(new rdr::FdOutStream(fd)),
- ownStreams(true), isShutdown_(false),
- queryConnection(false) {}
- virtual ~Socket() {
- if (ownStreams) {
- delete instream;
- delete outstream;
- }
- }
- rdr::FdInStream &inStream() {return *instream;}
- rdr::FdOutStream &outStream() {return *outstream;}
- int getFd() {return outstream->getFd();}
-
- // if shutdown() is overridden then the override MUST call on to here
- virtual void shutdown() {isShutdown_ = true;}
- bool isShutdown() const {return isShutdown_;}
-
- // information about this end of the socket
- virtual char* getMyAddress() = 0; // a string e.g. "192.168.0.1"
- virtual int getMyPort() = 0;
- virtual char* getMyEndpoint() = 0; // ::
-
- // information about the remote end of the socket
- virtual char* getPeerAddress() = 0; // a string e.g. "192.168.0.1"
- virtual int getPeerPort() = 0;
- virtual char* getPeerEndpoint() = 0; // ::
-
- // Is the remote end on the same machine?
- virtual bool sameMachine() = 0;
-
- // Was there a "?" in the ConnectionFilter used to accept this Socket?
- void setRequiresQuery() {queryConnection = true;}
- bool requiresQuery() const {return queryConnection;}
-
- protected:
- Socket() : instream(0), outstream(0), ownStreams(false),
- isShutdown_(false), queryConnection(false) {}
- Socket(rdr::FdInStream* i, rdr::FdOutStream* o, bool own)
- : instream(i), outstream(o), ownStreams(own),
- isShutdown_(false), queryConnection(false) {}
- rdr::FdInStream* instream;
- rdr::FdOutStream* outstream;
- bool ownStreams;
- bool isShutdown_;
- bool queryConnection;
- };
-
- class ConnectionFilter {
- public:
- virtual bool verifyConnection(Socket* s) = 0;
- };
-
- class SocketListener {
- public:
- SocketListener() : fd(0), filter(0) {}
- virtual ~SocketListener() {}
-
- // shutdown() stops the socket from accepting further connections
- virtual void shutdown() = 0;
-
- // accept() returns a new Socket object if there is a connection
- // attempt in progress AND if the connection passes the filter
- // if one is installed. Otherwise, returns 0.
- virtual Socket* accept() = 0;
-
- // setFilter() applies the specified filter to all new connections
- void setFilter(ConnectionFilter* f) {filter = f;}
- int getFd() {return fd;}
- protected:
- int fd;
- ConnectionFilter* filter;
- };
-
- struct SocketException : public rdr::SystemException {
- SocketException(const char* text, int err_) : rdr::SystemException(text, err_) {}
- };
-
- class SocketServer {
- public:
- virtual ~SocketServer() {}
-
- // addSocket() tells the server to serve the Socket. The caller
- // retains ownership of the Socket - the only way for the server
- // to discard a Socket is by calling shutdown() on it.
- // outgoing is set to true if the socket was created by connecting out
- // to another host, or false if the socket was created by accept()ing
- // an incoming connection.
- virtual void addSocket(network::Socket* sock, bool outgoing=false) = 0;
-
- // removeSocket() tells the server to stop serving the Socket. The
- // caller retains ownership of the Socket - the server must NOT
- // delete the Socket! This call is used mainly to cause per-Socket
- // resources to be freed.
- virtual void removeSocket(network::Socket* sock) = 0;
-
- // processSocketEvent() tells the server there is a Socket read event.
- // The implementation can indicate that the Socket is no longer active
- // by calling shutdown() on it. The caller will then call removeSocket()
- // soon after processSocketEvent returns, to allow any pre-Socket
- // resources to be tidied up.
- virtual void processSocketEvent(network::Socket* sock) = 0;
-
- // checkTimeouts() allows the server to check socket timeouts, etc. The
- // return value is the number of milliseconds to wait before
- // checkTimeouts() should be called again. If this number is zero then
- // there is no timeout and checkTimeouts() should be called the next time
- // an event occurs.
- virtual int checkTimeouts() = 0;
- };
-
-}
-
-#endif // __NETWORK_SOCKET_H__
diff --git a/src/vnc/common/network/TcpSocket.cxx b/src/vnc/common/network/TcpSocket.cxx
deleted file mode 100644
index 058621b1..00000000
--- a/src/vnc/common/network/TcpSocket.cxx
+++ /dev/null
@@ -1,467 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#ifdef WIN32
-//#include
-#include
-#define errorNumber WSAGetLastError()
-#define snprintf _snprintf
-#else
-#define errorNumber errno
-#define closesocket close
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#include
-#endif
-
-#include
-#include
-#include
-
-#ifndef VNC_SOCKLEN_T
-#define VNC_SOCKLEN_T int
-#endif
-
-#ifndef INADDR_NONE
-#define INADDR_NONE ((unsigned long)-1)
-#endif
-
-using namespace network;
-using namespace rdr;
-
-static rfb::LogWriter vlog("TcpSocket");
-
-
-// -=- Socket initialisation
-static bool socketsInitialised = false;
-static void initSockets() {
- if (socketsInitialised)
- return;
-#ifdef WIN32
- WORD requiredVersion = MAKEWORD(2,0);
- WSADATA initResult;
-
- if (WSAStartup(requiredVersion, &initResult) != 0)
- throw SocketException("unable to initialise Winsock2", errorNumber);
-#else
- signal(SIGPIPE, SIG_IGN);
-#endif
- socketsInitialised = true;
-}
-
-
-// -=- TcpSocket
-
-TcpSocket::TcpSocket(int sock, bool close)
- : Socket(new FdInStream(sock), new FdOutStream(sock), true), closeFd(close)
-{
-}
-
-TcpSocket::TcpSocket(const char *host, int port)
- : closeFd(true)
-{
- int sock;
-
- // - Create a socket
- initSockets();
- if ((sock = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- throw SocketException("unable to create socket", errorNumber);
-
-#ifndef WIN32
- // - By default, close the socket on exec()
- fcntl(sock, F_SETFD, FD_CLOEXEC);
-#endif
-
- // - Connect it to something
-
- // Try processing the host as an IP address
- struct sockaddr_in addr;
- memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_addr.s_addr = inet_addr(host);
- addr.sin_port = htons(port);
- if ((int)addr.sin_addr.s_addr == -1) {
- // Host was not an IP address - try resolving as DNS name
- struct hostent *hostinfo;
- hostinfo = gethostbyname(host);
- if (hostinfo && hostinfo->h_addr) {
- addr.sin_addr.s_addr = ((struct in_addr *)hostinfo->h_addr)->s_addr;
- } else {
- int e = errorNumber;
- closesocket(sock);
- throw SocketException("unable to resolve host by name", e);
- }
- }
-
- // Attempt to connect to the remote host
- if (connect(sock, (struct sockaddr *)&addr, sizeof(addr)) != 0) {
- int e = errorNumber;
- closesocket(sock);
- throw SocketException("unable to connect to host", e);
- }
-
- // Disable Nagle's algorithm, to reduce latency
- enableNagles(sock, false);
-
- // Create the input and output streams
- instream = new FdInStream(sock);
- outstream = new FdOutStream(sock);
- ownStreams = true;
-}
-
-TcpSocket::~TcpSocket() {
- if (closeFd)
- closesocket(getFd());
-}
-
-char* TcpSocket::getMyAddress() {
- struct sockaddr_in info;
- struct in_addr addr;
- VNC_SOCKLEN_T info_size = sizeof(info);
-
- getsockname(getFd(), (struct sockaddr *)&info, &info_size);
- memcpy(&addr, &info.sin_addr, sizeof(addr));
-
- char* name = inet_ntoa(addr);
- if (name) {
- return rfb::strDup(name);
- } else {
- return rfb::strDup("");
- }
-}
-
-int TcpSocket::getMyPort() {
- return getSockPort(getFd());
-}
-
-char* TcpSocket::getMyEndpoint() {
- rfb::CharArray address; address.buf = getMyAddress();
- int port = getMyPort();
-
- int buflen = strlen(address.buf) + 32;
- char* buffer = new char[buflen];
- sprintf(buffer, "%s::%d", address.buf, port);
- return buffer;
-}
-
-char* TcpSocket::getPeerAddress() {
- struct sockaddr_in info;
- struct in_addr addr;
- VNC_SOCKLEN_T info_size = sizeof(info);
-
- getpeername(getFd(), (struct sockaddr *)&info, &info_size);
- memcpy(&addr, &info.sin_addr, sizeof(addr));
-
- char* name = inet_ntoa(addr);
- if (name) {
- return rfb::strDup(name);
- } else {
- return rfb::strDup("");
- }
-}
-
-int TcpSocket::getPeerPort() {
- struct sockaddr_in info;
- VNC_SOCKLEN_T info_size = sizeof(info);
-
- getpeername(getFd(), (struct sockaddr *)&info, &info_size);
- return ntohs(info.sin_port);
-}
-
-char* TcpSocket::getPeerEndpoint() {
- rfb::CharArray address; address.buf = getPeerAddress();
- int port = getPeerPort();
-
- int buflen = strlen(address.buf) + 32;
- char* buffer = new char[buflen];
- sprintf(buffer, "%s::%d", address.buf, port);
- return buffer;
-}
-
-bool TcpSocket::sameMachine() {
- struct sockaddr_in peeraddr, myaddr;
- VNC_SOCKLEN_T addrlen = sizeof(struct sockaddr_in);
-
- getpeername(getFd(), (struct sockaddr *)&peeraddr, &addrlen);
- getsockname(getFd(), (struct sockaddr *)&myaddr, &addrlen);
-
- return (peeraddr.sin_addr.s_addr == myaddr.sin_addr.s_addr);
-}
-
-void TcpSocket::shutdown()
-{
- Socket::shutdown();
- ::shutdown(getFd(), 2);
-}
-
-bool TcpSocket::enableNagles(int sock, bool enable) {
- int one = enable ? 0 : 1;
- if (setsockopt(sock, IPPROTO_TCP, TCP_NODELAY,
- (char *)&one, sizeof(one)) < 0) {
- int e = errorNumber;
- vlog.error("unable to setsockopt TCP_NODELAY: %d", e);
- return false;
- }
- return true;
-}
-
-bool TcpSocket::isSocket(int sock)
-{
- struct sockaddr_in info;
- VNC_SOCKLEN_T info_size = sizeof(info);
- return getsockname(sock, (struct sockaddr *)&info, &info_size) >= 0;
-}
-
-bool TcpSocket::isConnected(int sock)
-{
- struct sockaddr_in info;
- VNC_SOCKLEN_T info_size = sizeof(info);
- return getpeername(sock, (struct sockaddr *)&info, &info_size) >= 0;
-}
-
-int TcpSocket::getSockPort(int sock)
-{
- struct sockaddr_in info;
- VNC_SOCKLEN_T info_size = sizeof(info);
- if (getsockname(sock, (struct sockaddr *)&info, &info_size) < 0)
- return 0;
- return ntohs(info.sin_port);
-}
-
-
-TcpListener::TcpListener(int port, bool localhostOnly, int sock, bool close_)
- : closeFd(close_)
-{
- if (sock != -1) {
- fd = sock;
- return;
- }
-
- initSockets();
- if ((fd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
- throw SocketException("unable to create listening socket", errorNumber);
-
-#ifndef WIN32
- // - By default, close the socket on exec()
- fcntl(fd, F_SETFD, FD_CLOEXEC);
-
- int one = 1;
- if (setsockopt(fd, SOL_SOCKET, SO_REUSEADDR,
- (const char *)&one, sizeof(one)) < 0) {
- int e = errorNumber;
- closesocket(fd);
- throw SocketException("unable to create listening socket", e);
- }
-#endif
-
- // - Bind it to the desired port
- struct sockaddr_in addr;
- memset(&addr, 0, sizeof(addr));
- addr.sin_family = AF_INET;
- addr.sin_port = htons(port);
- if (localhostOnly)
- addr.sin_addr.s_addr = htonl(INADDR_LOOPBACK);
- else
- addr.sin_addr.s_addr = htonl(INADDR_ANY);
- if (bind(fd, (struct sockaddr *)&addr, sizeof(addr)) < 0) {
- int e = errorNumber;
- closesocket(fd);
- throw SocketException("unable to bind listening socket", e);
- }
-
- // - Set it to be a listening socket
- if (listen(fd, 5) < 0) {
- int e = errorNumber;
- closesocket(fd);
- throw SocketException("unable to set socket to listening mode", e);
- }
-}
-
-TcpListener::~TcpListener() {
- if (closeFd) closesocket(fd);
-}
-
-void TcpListener::shutdown()
-{
-#ifdef WIN32
- closesocket(getFd());
-#else
- ::shutdown(getFd(), 2);
-#endif
-}
-
-
-Socket*
-TcpListener::accept() {
- int new_sock = -1;
-
- // Accept an incoming connection
- if ((new_sock = ::accept(fd, 0, 0)) < 0)
- throw SocketException("unable to accept new connection", errorNumber);
-
-#ifndef WIN32
- // - By default, close the socket on exec()
- fcntl(new_sock, F_SETFD, FD_CLOEXEC);
-#endif
-
- // Disable Nagle's algorithm, to reduce latency
- TcpSocket::enableNagles(new_sock, false);
-
- // Create the socket object & check connection is allowed
- TcpSocket* s = new TcpSocket(new_sock);
- if (filter && !filter->verifyConnection(s)) {
- delete s;
- return 0;
- }
- return s;
-}
-
-void TcpListener::getMyAddresses(std::list* result) {
- const hostent* addrs = gethostbyname(0);
- if (addrs == 0)
- throw rdr::SystemException("gethostbyname", errorNumber);
- if (addrs->h_addrtype != AF_INET)
- throw rdr::Exception("getMyAddresses: bad family");
- for (int i=0; addrs->h_addr_list[i] != 0; i++) {
- const char* addrC = inet_ntoa(*((struct in_addr*)addrs->h_addr_list[i]));
- char* addr = new char[strlen(addrC)+1];
- strcpy(addr, addrC);
- result->push_back(addr);
- }
-}
-
-int TcpListener::getMyPort() {
- return TcpSocket::getSockPort(getFd());
-}
-
-
-TcpFilter::TcpFilter(const char* spec) {
- rfb::CharArray tmp;
- tmp.buf = rfb::strDup(spec);
- while (tmp.buf) {
- rfb::CharArray first;
- rfb::strSplit(tmp.buf, ',', &first.buf, &tmp.buf);
- if (strlen(first.buf))
- filter.push_back(parsePattern(first.buf));
- }
-}
-
-TcpFilter::~TcpFilter() {
-}
-
-
-static bool
-patternMatchIP(const TcpFilter::Pattern& pattern, const char* value) {
- unsigned long address = inet_addr(value);
- if (address == INADDR_NONE) return false;
- return ((pattern.address & pattern.mask) == (address & pattern.mask));
-}
-
-bool
-TcpFilter::verifyConnection(Socket* s) {
- rfb::CharArray name;
-
- name.buf = s->getPeerAddress();
- std::list::iterator i;
- for (i=filter.begin(); i!=filter.end(); i++) {
- if (patternMatchIP(*i, name.buf)) {
- switch ((*i).action) {
- case Accept:
- vlog.debug("ACCEPT %s", name.buf);
- return true;
- case Query:
- vlog.debug("QUERY %s", name.buf);
- s->setRequiresQuery();
- return true;
- case Reject:
- vlog.debug("REJECT %s", name.buf);
- return false;
- }
- }
- }
-
- vlog.debug("[REJECT] %s", name.buf);
- return false;
-}
-
-
-TcpFilter::Pattern TcpFilter::parsePattern(const char* p) {
- TcpFilter::Pattern pattern;
-
- bool expandMask = false;
- rfb::CharArray addr, mask;
-
- if (rfb::strSplit(&p[1], '/', &addr.buf, &mask.buf)) {
- if (rfb::strContains(mask.buf, '.')) {
- pattern.mask = inet_addr(mask.buf);
- } else {
- pattern.mask = atoi(mask.buf);
- expandMask = true;
- }
- } else {
- pattern.mask = 32;
- expandMask = true;
- }
- if (expandMask) {
- unsigned long expanded = 0;
- // *** check endianness!
- for (int i=0; i<(int)pattern.mask; i++)
- expanded |= 1<<(31-i);
- pattern.mask = htonl(expanded);
- }
-
- pattern.address = inet_addr(addr.buf) & pattern.mask;
- if ((pattern.address == INADDR_NONE) ||
- (pattern.address == 0)) pattern.mask = 0;
-
- switch(p[0]) {
- case '+': pattern.action = TcpFilter::Accept; break;
- case '-': pattern.action = TcpFilter::Reject; break;
- case '?': pattern.action = TcpFilter::Query; break;
- };
-
- return pattern;
-}
-
-char* TcpFilter::patternToStr(const TcpFilter::Pattern& p) {
- in_addr tmp;
- rfb::CharArray addr, mask;
- tmp.s_addr = p.address;
- addr.buf = rfb::strDup(inet_ntoa(tmp));
- tmp.s_addr = p.mask;
- mask.buf = rfb::strDup(inet_ntoa(tmp));
- char* result = new char[strlen(addr.buf)+1+strlen(mask.buf)+1+1];
- switch (p.action) {
- case Accept: result[0] = '+'; break;
- case Reject: result[0] = '-'; break;
- case Query: result[0] = '?'; break;
- };
- result[1] = 0;
- strcat(result, addr.buf);
- strcat(result, "/");
- strcat(result, mask.buf);
- return result;
-}
diff --git a/src/vnc/common/network/TcpSocket.h b/src/vnc/common/network/TcpSocket.h
deleted file mode 100644
index 8b19c7ef..00000000
--- a/src/vnc/common/network/TcpSocket.h
+++ /dev/null
@@ -1,99 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-// -=- TcpSocket.h - base-class for TCP stream sockets.
-// This header also defines the TcpListener class, used
-// to listen for incoming socket connections over TCP
-//
-// NB: Any file descriptors created by the TcpSocket or
-// TcpListener classes are close-on-exec if the OS supports
-// it. TcpSockets initialised with a caller-supplied fd
-// are NOT set to close-on-exec.
-
-#ifndef __NETWORK_TCP_SOCKET_H__
-#define __NETWORK_TCP_SOCKET_H__
-
-#include
-
-#include
-
-namespace network {
-
- class TcpSocket : public Socket {
- public:
- TcpSocket(int sock, bool close=true);
- TcpSocket(const char *name, int port);
- virtual ~TcpSocket();
-
- virtual char* getMyAddress();
- virtual int getMyPort();
- virtual char* getMyEndpoint();
-
- virtual char* getPeerAddress();
- virtual int getPeerPort();
- virtual char* getPeerEndpoint();
- virtual bool sameMachine();
-
- virtual void shutdown();
-
- static bool enableNagles(int sock, bool enable);
- static bool isSocket(int sock);
- static bool isConnected(int sock);
- static int getSockPort(int sock);
- private:
- bool closeFd;
- };
-
- class TcpListener : public SocketListener {
- public:
- TcpListener(int port, bool localhostOnly=false, int sock=-1,
- bool close=true);
- virtual ~TcpListener();
-
- virtual void shutdown();
- virtual Socket* accept();
-
- void getMyAddresses(std::list* addrs);
- int getMyPort();
-
- private:
- bool closeFd;
- };
-
- class TcpFilter : public ConnectionFilter {
- public:
- TcpFilter(const char* filter);
- virtual ~TcpFilter();
-
- virtual bool verifyConnection(Socket* s);
-
- typedef enum {Accept, Reject, Query} Action;
- struct Pattern {
- Action action;
- unsigned long address;
- unsigned long mask;
- };
- static Pattern parsePattern(const char* s);
- static char* patternToStr(const Pattern& p);
- protected:
- std::list filter;
- };
-
-}
-
-#endif // __NETWORK_TCP_SOCKET_H__
diff --git a/src/vnc/common/rdr/CMakeLists.txt b/src/vnc/common/rdr/CMakeLists.txt
deleted file mode 100644
index 5bd1f7ad..00000000
--- a/src/vnc/common/rdr/CMakeLists.txt
+++ /dev/null
@@ -1,58 +0,0 @@
-# synergy -- mouse and keyboard sharing utility
-# Copyright (C) 2012 Nick Bolton
-#
-# This package is free software; you can redistribute it and/or
-# modify it under the terms of the GNU General Public License
-# found in the file COPYING that should have accompanied this file.
-#
-# This package is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see .
-
-set(inc
- Exception.h
- FdInStream.h
- FdOutStream.h
- FixedMemOutStream.h
- HexInStream.h
- HexOutStream.h
- InStream.h
- MemInStream.h
- MemOutStream.h
- OutStream.h
- RandomStream.h
- SubstitutingInStream.h
- types.h
- ZlibInStream.h
- ZlibOutStream.h
-)
-
-set(src
- Exception.cxx
- FdInStream.cxx
- FdOutStream.cxx
- HexInStream.cxx
- HexOutStream.cxx
- InStream.cxx
- RandomStream.cxx
- ZlibInStream.cxx
- ZlibOutStream.cxx
-)
-
-if (WIN32)
- list(APPEND src ${inc})
-endif()
-
-set(inc
- ..
- ../zlib
-)
-
-include_directories(${inc})
-add_library(vnc_rdr STATIC ${src})
-target_link_libraries(vnc_rdr
- vnc_zlib)
diff --git a/src/vnc/common/rdr/Exception.cxx b/src/vnc/common/rdr/Exception.cxx
deleted file mode 100644
index 1f1ce66c..00000000
--- a/src/vnc/common/rdr/Exception.cxx
+++ /dev/null
@@ -1,73 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-#include
-#ifdef _WIN32
-#include
-#include
-//#include
-#endif
-
-using namespace rdr;
-
-SystemException::SystemException(const char* s, int err_)
- : Exception(s), err(err_)
-{
- strncat(str_, ": ", len-1-strlen(str_));
-#ifdef _WIN32
- // Windows error messages are crap, so use unix ones for common errors.
- const char* msg = 0;
- switch (err) {
- case WSAECONNREFUSED: msg = "Connection refused"; break;
- case WSAETIMEDOUT: msg = "Connection timed out"; break;
- case WSAECONNRESET: msg = "Connection reset by peer"; break;
- case WSAECONNABORTED: msg = "Connection aborted"; break;
- }
- if (msg) {
- strncat(str_, msg, len-1-strlen(str_));
- } else {
-#ifdef UNICODE
- WCHAR* tmsg = new WCHAR[len-strlen(str_)];
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- 0, err, 0, tmsg, len-1-strlen(str_), 0);
- WideCharToMultiByte(CP_ACP, 0, tmsg, wcslen(tmsg)+1,
- str_+strlen(str_), len-strlen(str_), 0, 0);
- delete [] tmsg;
-#else
- char* currStr = str_+strlen(str_);
- FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_IGNORE_INSERTS,
- 0, err, 0, currStr, len-1-strlen(str_), 0);
-#endif
- int l = strlen(str_);
- if ((l >= 2) && (str_[l-2] == '\r') && (str_[l-1] == '\n'))
- str_[l-2] = 0;
- }
-
-#else
- strncat(str_, strerror(err), len-1-strlen(str_));
-#endif
- strncat(str_, " (", len-1-strlen(str_));
- char buf[20];
-#ifdef WIN32
- if (err < 0)
- sprintf(buf, "%x", err);
- else
-#endif
- sprintf(buf,"%d",err);
- strncat(str_, buf, len-1-strlen(str_));
- strncat(str_, ")", len-1-strlen(str_));
-}
diff --git a/src/vnc/common/rdr/Exception.h b/src/vnc/common/rdr/Exception.h
deleted file mode 100644
index 1b92f777..00000000
--- a/src/vnc/common/rdr/Exception.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#ifndef __RDR_EXCEPTION_H__
-#define __RDR_EXCEPTION_H__
-
-#include
-#include
-
-namespace rdr {
-
- struct Exception {
- enum { len = 256 };
- char str_[len];
- Exception(const char* s=0) {
- str_[0] = 0;
- if (s)
- strncat(str_, s, len-1);
- else
- strcat(str_, "Exception");
- }
- virtual const char* str() const { return str_; }
- };
-
- struct SystemException : public Exception {
- int err;
- SystemException(const char* s, int err_);
- };
-
- struct TimedOut : public Exception {
- TimedOut(const char* s="Timed out") : Exception(s) {}
- };
-
- struct EndOfStream : public Exception {
- EndOfStream(const char* s="End of stream") : Exception(s) {}
- };
-
- struct FrameException : public Exception {
- FrameException(const char* s="Frame exception") : Exception(s) {}
- };
-}
-
-#endif
diff --git a/src/vnc/common/rdr/FdInStream.cxx b/src/vnc/common/rdr/FdInStream.cxx
deleted file mode 100644
index 6496ed5b..00000000
--- a/src/vnc/common/rdr/FdInStream.cxx
+++ /dev/null
@@ -1,283 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#include
-#include
-#ifdef _WIN32
-#include
-#ifndef _WIN32_WCE
-#include
-#endif
-#define read(s,b,l) recv(s,(char*)b,l,0)
-#define close closesocket
-#undef errno
-#define errno WSAGetLastError()
-#undef EINTR
-#define EINTR WSAEINTR
-#else
-#include
-#include
-#include
-#include
-#endif
-
-// XXX should use autoconf HAVE_SYS_SELECT_H
-#ifdef _AIX
-#include
-#endif
-
-#include
-#include
-
-#pragma warning(disable: 4244)
-
-using namespace rdr;
-
-enum { DEFAULT_BUF_SIZE = 8192,
- MIN_BULK_SIZE = 1024 };
-
-FdInStream::FdInStream(int fd_, int timeoutms_, int bufSize_,
- bool closeWhenDone_)
- : fd(fd_), closeWhenDone(closeWhenDone_),
- timeoutms(timeoutms_), blockCallback(0),
- timing(false), timeWaitedIn100us(5), timedKbits(0),
- bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
-{
- ptr = end = start = new U8[bufSize];
-}
-
-FdInStream::FdInStream(int fd_, FdInStreamBlockCallback* blockCallback_,
- int bufSize_)
- : fd(fd_), timeoutms(0), blockCallback(blockCallback_),
- timing(false), timeWaitedIn100us(5), timedKbits(0),
- bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
-{
- ptr = end = start = new U8[bufSize];
-}
-
-FdInStream::~FdInStream()
-{
- delete [] start;
- if (closeWhenDone) close(fd);
-}
-
-
-void FdInStream::setTimeout(int timeoutms_) {
- timeoutms = timeoutms_;
-}
-
-void FdInStream::setBlockCallback(FdInStreamBlockCallback* blockCallback_)
-{
- blockCallback = blockCallback_;
- timeoutms = 0;
-}
-
-int FdInStream::pos()
-{
- return offset + ptr - start;
-}
-
-void FdInStream::readBytes(void* data, int length)
-{
- if (length < MIN_BULK_SIZE) {
- InStream::readBytes(data, length);
- return;
- }
-
- U8* dataPtr = (U8*)data;
-
- int n = end - ptr;
- if (n > length) n = length;
-
- memcpy(dataPtr, ptr, n);
- dataPtr += n;
- length -= n;
- ptr += n;
-
- while (length > 0) {
- n = readWithTimeoutOrCallback(dataPtr, length);
- dataPtr += n;
- length -= n;
- offset += n;
- }
-}
-
-
-int FdInStream::overrun(int itemSize, int nItems, bool wait)
-{
- if (itemSize > bufSize)
- throw Exception("FdInStream overrun: max itemSize exceeded");
-
- if (end - ptr != 0)
- memmove(start, ptr, end - ptr);
-
- offset += ptr - start;
- end -= ptr - start;
- ptr = start;
-
- while (end < start + itemSize) {
- int n = readWithTimeoutOrCallback((U8*)end, start + bufSize - end, wait);
- if (n == 0) return 0;
- end += n;
- }
-
- if (itemSize * nItems > end - ptr)
- nItems = (end - ptr) / itemSize;
-
- return nItems;
-}
-
-#ifdef _WIN32
-static void gettimeofday(struct timeval* tv, void*)
-{
- LARGE_INTEGER counts, countsPerSec;
- static double usecPerCount = 0.0;
-
- if (QueryPerformanceCounter(&counts)) {
- if (usecPerCount == 0.0) {
- QueryPerformanceFrequency(&countsPerSec);
- usecPerCount = 1000000.0 / countsPerSec.QuadPart;
- }
-
- LONGLONG usecs = (LONGLONG)(counts.QuadPart * usecPerCount);
- tv->tv_usec = (long)(usecs % 1000000);
- tv->tv_sec = (long)(usecs / 1000000);
-
- } else {
-#ifndef _WIN32_WCE
- struct timeb tb;
- ftime(&tb);
- tv->tv_sec = tb.time;
- tv->tv_usec = tb.millitm * 1000;
-#else
- throw SystemException("QueryPerformanceCounter", GetLastError());
-#endif
- }
-}
-#endif
-
-//
-// readWithTimeoutOrCallback() reads up to the given length in bytes from the
-// file descriptor into a buffer. If the wait argument is false, then zero is
-// returned if no bytes can be read without blocking. Otherwise if a
-// blockCallback is set, it will be called (repeatedly) instead of blocking.
-// If alternatively there is a timeout set and that timeout expires, it throws
-// a TimedOut exception. Otherwise it returns the number of bytes read. It
-// never attempts to read() unless select() indicates that the fd is readable -
-// this means it can be used on an fd which has been set non-blocking. It also
-// has to cope with the annoying possibility of both select() and read()
-// returning EINTR.
-//
-
-int FdInStream::readWithTimeoutOrCallback(void* buf, int len, bool wait)
-{
- struct timeval before, after;
- if (timing)
- gettimeofday(&before, 0);
-
- int n;
- while (true) {
- do {
- fd_set fds;
- struct timeval tv;
- struct timeval* tvp = &tv;
-
- if (!wait) {
- tv.tv_sec = tv.tv_usec = 0;
- } else if (timeoutms != -1) {
- tv.tv_sec = timeoutms / 1000;
- tv.tv_usec = (timeoutms % 1000) * 1000;
- } else {
- tvp = 0;
- }
-
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
- n = select(fd+1, &fds, 0, 0, tvp);
- } while (n < 0 && errno == EINTR);
-
- if (n > 0) break;
- if (n < 0) throw SystemException("select",errno);
- if (!wait) return 0;
- if (!blockCallback) throw TimedOut();
-
- blockCallback->blockCallback();
- }
-
- do {
- n = ::read(fd, buf, len);
- } while (n < 0 && errno == EINTR);
-
- if (n < 0) throw SystemException("read",errno);
- if (n == 0) throw EndOfStream();
-
- if (timing) {
- gettimeofday(&after, 0);
-// fprintf(stderr,"%d.%06d\n",(after.tv_sec - before.tv_sec),
-// (after.tv_usec - before.tv_usec));
- int newTimeWaited = ((after.tv_sec - before.tv_sec) * 10000 +
- (after.tv_usec - before.tv_usec) / 100);
- int newKbits = n * 8 / 1000;
-
-// if (newTimeWaited == 0) {
-// fprintf(stderr,"new kbps infinite t %d k %d\n",
-// newTimeWaited, newKbits);
-// } else {
-// fprintf(stderr,"new kbps %d t %d k %d\n",
-// newKbits * 10000 / newTimeWaited, newTimeWaited, newKbits);
-// }
-
- // limit rate to between 10kbit/s and 40Mbit/s
-
- if (newTimeWaited > newKbits*1000) newTimeWaited = newKbits*1000;
- if (newTimeWaited < newKbits/4) newTimeWaited = newKbits/4;
-
- timeWaitedIn100us += newTimeWaited;
- timedKbits += newKbits;
- }
-
- return n;
-}
-
-void FdInStream::startTiming()
-{
- timing = true;
-
- // Carry over up to 1s worth of previous rate for smoothing.
-
- if (timeWaitedIn100us > 10000) {
- timedKbits = timedKbits * 10000 / timeWaitedIn100us;
- timeWaitedIn100us = 10000;
- }
-}
-
-void FdInStream::stopTiming()
-{
- timing = false;
- if (timeWaitedIn100us < timedKbits/2)
- timeWaitedIn100us = timedKbits/2; // upper limit 20Mbit/s
-}
-
-unsigned int FdInStream::kbitsPerSecond()
-{
- // The following calculation will overflow 32-bit arithmetic if we have
- // received more than about 50Mbytes (400Mbits) since we started timing, so
- // it should be OK for a single RFB update.
-
- return timedKbits * 10000 / timeWaitedIn100us;
-}
diff --git a/src/vnc/common/rdr/FdInStream.h b/src/vnc/common/rdr/FdInStream.h
deleted file mode 100644
index 5d9598c8..00000000
--- a/src/vnc/common/rdr/FdInStream.h
+++ /dev/null
@@ -1,77 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-//
-// FdInStream streams from a file descriptor.
-//
-
-#ifndef __RDR_FDINSTREAM_H__
-#define __RDR_FDINSTREAM_H__
-
-#include
-
-namespace rdr {
-
- class FdInStreamBlockCallback {
- public:
- virtual void blockCallback() = 0;
- };
-
- class FdInStream : public InStream {
-
- public:
-
- FdInStream(int fd, int timeoutms=-1, int bufSize=0,
- bool closeWhenDone_=false);
- FdInStream(int fd, FdInStreamBlockCallback* blockCallback, int bufSize=0);
- virtual ~FdInStream();
-
- void setTimeout(int timeoutms);
- void setBlockCallback(FdInStreamBlockCallback* blockCallback);
- int getFd() { return fd; }
- int pos();
- void readBytes(void* data, int length);
-
- void startTiming();
- void stopTiming();
- unsigned int kbitsPerSecond();
- unsigned int timeWaited() { return timeWaitedIn100us; }
-
- protected:
- int overrun(int itemSize, int nItems, bool wait);
-
- private:
- int readWithTimeoutOrCallback(void* buf, int len, bool wait=true);
-
- int fd;
- bool closeWhenDone;
- int timeoutms;
- FdInStreamBlockCallback* blockCallback;
-
- bool timing;
- unsigned int timeWaitedIn100us;
- unsigned int timedKbits;
-
- int bufSize;
- int offset;
- U8* start;
- };
-
-} // end of namespace rdr
-
-#endif
diff --git a/src/vnc/common/rdr/FdOutStream.cxx b/src/vnc/common/rdr/FdOutStream.cxx
deleted file mode 100644
index bfe1d36a..00000000
--- a/src/vnc/common/rdr/FdOutStream.cxx
+++ /dev/null
@@ -1,174 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#include
-#include
-#ifdef _WIN32
-#include
-#define write(s,b,l) send(s,(const char*)b,l,0)
-#define EWOULDBLOCK WSAEWOULDBLOCK
-#undef errno
-#define errno WSAGetLastError()
-#undef EINTR
-#define EINTR WSAEINTR
-#else
-#include
-#include
-#include
-#include
-#endif
-
-#include
-#include
-
-
-using namespace rdr;
-
-enum { DEFAULT_BUF_SIZE = 16384,
- MIN_BULK_SIZE = 1024 };
-
-FdOutStream::FdOutStream(int fd_, int timeoutms_, int bufSize_)
- : fd(fd_), timeoutms(timeoutms_),
- bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
-{
- ptr = start = new U8[bufSize];
- end = start + bufSize;
-}
-
-FdOutStream::~FdOutStream()
-{
- try {
- flush();
- } catch (Exception&) {
- }
- delete [] start;
-}
-
-void FdOutStream::setTimeout(int timeoutms_) {
- timeoutms = timeoutms_;
-}
-
-void FdOutStream::writeBytes(const void* data, int length)
-{
- if (length < MIN_BULK_SIZE) {
- OutStream::writeBytes(data, length);
- return;
- }
-
- const U8* dataPtr = (const U8*)data;
-
- flush();
-
- while (length > 0) {
- int n = writeWithTimeout(dataPtr, length);
- length -= n;
- dataPtr += n;
- offset += n;
- }
-}
-
-int FdOutStream::length()
-{
- return offset + ptr - start;
-}
-
-void FdOutStream::flush()
-{
- U8* sentUpTo = start;
- while (sentUpTo < ptr) {
- int n = writeWithTimeout((const void*) sentUpTo, ptr - sentUpTo);
- sentUpTo += n;
- offset += n;
- }
-
- ptr = start;
-}
-
-
-int FdOutStream::overrun(int itemSize, int nItems)
-{
- if (itemSize > bufSize)
- throw Exception("FdOutStream overrun: max itemSize exceeded");
-
- flush();
-
- if (itemSize * nItems > end - ptr)
- nItems = (end - ptr) / itemSize;
-
- return nItems;
-}
-
-//
-// writeWithTimeout() writes up to the given length in bytes from the given
-// buffer to the file descriptor. If there is a timeout set and that timeout
-// expires, it throws a TimedOut exception. Otherwise it returns the number of
-// bytes written. It never attempts to write() unless select() indicates that
-// the fd is writable - this means it can be used on an fd which has been set
-// non-blocking. It also has to cope with the annoying possibility of both
-// select() and write() returning EINTR.
-//
-
-int FdOutStream::writeWithTimeout(const void* data, int length)
-{
- int n;
-
- do {
-
- do {
- fd_set fds;
- struct timeval tv;
- struct timeval* tvp = &tv;
-
- if (timeoutms != -1) {
- tv.tv_sec = timeoutms / 1000;
- tv.tv_usec = (timeoutms % 1000) * 1000;
- } else {
- tvp = 0;
- }
-
- FD_ZERO(&fds);
- FD_SET(fd, &fds);
-#ifdef _WIN32_WCE
- // NB: This fixes a broken Winsock2 select() behaviour. select()
- // never returns for non-blocking sockets, unless they're already
- // ready to be written to...
- u_long zero = 0; ioctlsocket(fd, FIONBIO, &zero);
-#endif
- n = select(fd+1, 0, &fds, 0, tvp);
-#ifdef _WIN32_WCE
- u_long one = 0; ioctlsocket(fd, FIONBIO, &one);
-#endif
- } while (n < 0 && errno == EINTR);
-
- if (n < 0) throw SystemException("select",errno);
-
- if (n == 0) throw TimedOut();
-
- do {
- n = ::write(fd, data, length);
- } while (n < 0 && (errno == EINTR));
-
- // NB: This outer loop simply fixes a broken Winsock2 EWOULDBLOCK
- // condition, found only under Win98 (first edition), with slow
- // network connections. Should in fact never ever happen...
- } while (n < 0 && (errno == EWOULDBLOCK));
-
- if (n < 0) throw SystemException("write",errno);
-
- return n;
-}
diff --git a/src/vnc/common/rdr/FdOutStream.h b/src/vnc/common/rdr/FdOutStream.h
deleted file mode 100644
index f75917cd..00000000
--- a/src/vnc/common/rdr/FdOutStream.h
+++ /dev/null
@@ -1,56 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-//
-// FdOutStream streams to a file descriptor.
-//
-
-#ifndef __RDR_FDOUTSTREAM_H__
-#define __RDR_FDOUTSTREAM_H__
-
-#include
-
-namespace rdr {
-
- class FdOutStream : public OutStream {
-
- public:
-
- FdOutStream(int fd, int timeoutms=-1, int bufSize=0);
- virtual ~FdOutStream();
-
- void setTimeout(int timeoutms);
- int getFd() { return fd; }
-
- void flush();
- int length();
- void writeBytes(const void* data, int length);
-
- private:
- int overrun(int itemSize, int nItems);
- int writeWithTimeout(const void* data, int length);
- int fd;
- int timeoutms;
- int bufSize;
- int offset;
- U8* start;
- };
-
-}
-
-#endif
diff --git a/src/vnc/common/rdr/FixedMemOutStream.h b/src/vnc/common/rdr/FixedMemOutStream.h
deleted file mode 100644
index e4ec52cb..00000000
--- a/src/vnc/common/rdr/FixedMemOutStream.h
+++ /dev/null
@@ -1,52 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-//
-// A FixedMemOutStream writes to a buffer of a fixed length.
-//
-
-#ifndef __RDR_FIXEDMEMOUTSTREAM_H__
-#define __RDR_FIXEDMEMOUTSTREAM_H__
-
-#include
-#include
-
-namespace rdr {
-
- class FixedMemOutStream : public OutStream {
-
- public:
-
- FixedMemOutStream(void* buf, int len) {
- ptr = start = (U8*)buf;
- end = start + len;
- }
-
- int length() { return ptr - start; }
- void reposition(int pos) { ptr = start + pos; }
- const void* data() { return (const void*)start; }
-
- private:
-
- int overrun(int itemSize, int nItems) { throw EndOfStream(); }
- U8* start;
- };
-
-}
-
-#endif
diff --git a/src/vnc/common/rdr/HexInStream.cxx b/src/vnc/common/rdr/HexInStream.cxx
deleted file mode 100644
index 80f8a796..00000000
--- a/src/vnc/common/rdr/HexInStream.cxx
+++ /dev/null
@@ -1,117 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#include
-#include
-
-#include
-#include
-
-using namespace rdr;
-
-const int DEFAULT_BUF_LEN = 16384;
-
-static inline int min(int a, int b) {return a= '0') && (c <= '9'))
- *v = (*v << 4) + (c - '0');
- else if ((c >= 'a') && (c <= 'f'))
- *v = (*v << 4) + (c - 'a' + 10);
- else
- return false;
- return true;
-}
-
-bool HexInStream::hexStrToBin(const char* s, char** data, int* length) {
- int l=strlen(s);
- if ((l % 2) == 0) {
- delete [] *data;
- *data = 0; *length = 0;
- if (l == 0)
- return true;
- *data = new char[l/2];
- *length = l/2;
- for(int i=0;i bufSize)
- throw Exception("HexInStream overrun: max itemSize exceeded");
-
- if (end - ptr != 0)
- memmove(start, ptr, end - ptr);
-
- end -= ptr - start;
- offset += ptr - start;
- ptr = start;
-
- while (end < ptr + itemSize) {
- int n = in_stream.check(2, 1, wait);
- if (n == 0) return 0;
- const U8* iptr = in_stream.getptr();
- const U8* eptr = in_stream.getend();
- int length = min((eptr - iptr)/2, start + bufSize - end);
-
- U8* optr = (U8*) end;
- for (int i=0; i end - ptr)
- nItems = (end - ptr) / itemSize;
-
- return nItems;
-}
diff --git a/src/vnc/common/rdr/HexInStream.h b/src/vnc/common/rdr/HexInStream.h
deleted file mode 100644
index 6bfb8433..00000000
--- a/src/vnc/common/rdr/HexInStream.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#ifndef __RDR_HEX_INSTREAM_H__
-#define __RDR_HEX_INSTREAM_H__
-
-#include
-
-namespace rdr {
-
- class HexInStream : public InStream {
- public:
-
- HexInStream(InStream& is, int bufSize=0);
- virtual ~HexInStream();
-
- int pos();
-
- static bool readHexAndShift(char c, int* v);
- static bool hexStrToBin(const char* s, char** data, int* length);
-
- protected:
- int overrun(int itemSize, int nItems, bool wait);
-
- private:
- int bufSize;
- U8* start;
- int offset;
-
- InStream& in_stream;
- };
-
-} // end of namespace rdr
-
-#endif
diff --git a/src/vnc/common/rdr/HexOutStream.cxx b/src/vnc/common/rdr/HexOutStream.cxx
deleted file mode 100644
index 9b0b6c4d..00000000
--- a/src/vnc/common/rdr/HexOutStream.cxx
+++ /dev/null
@@ -1,110 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#include
-#include
-
-using namespace rdr;
-
-const int DEFAULT_BUF_LEN = 16384;
-
-static inline int min(int a, int b) {return a=0) && (i<=9))
- return '0'+i;
- else if ((i>=10) && (i<=15))
- return 'a'+(i-10);
- else
- throw rdr::Exception("intToHex failed");
-}
-
-char* HexOutStream::binToHexStr(const char* data, int length) {
- char* buffer = new char[length*2+1];
- for (int i=0; i> 4) & 15);
- buffer[i*2+1] = intToHex((data[i] & 15));
- if (!buffer[i*2] || !buffer[i*2+1]) {
- delete [] buffer;
- return 0;
- }
- }
- buffer[length*2] = 0;
- return buffer;
-}
-
-
-void
-HexOutStream::writeBuffer() {
- U8* pos = start;
- while (pos != ptr) {
- out_stream.check(2);
- U8* optr = out_stream.getptr();
- U8* oend = out_stream.getend();
- int length = min(ptr-pos, (oend-optr)/2);
-
- for (int i=0; i> 4) & 0xf);
- optr[i*2+1] = intToHex(pos[i] & 0xf);
- }
-
- out_stream.setptr(optr + length*2);
- pos += length;
- }
- offset += ptr - start;
- ptr = start;
-}
-
-int HexOutStream::length()
-{
- return offset + ptr - start;
-}
-
-void
-HexOutStream::flush() {
- writeBuffer();
- out_stream.flush();
-}
-
-int
-HexOutStream::overrun(int itemSize, int nItems) {
- if (itemSize > bufSize)
- throw Exception("HexOutStream overrun: max itemSize exceeded");
-
- writeBuffer();
-
- if (itemSize * nItems > end - ptr)
- nItems = (end - ptr) / itemSize;
-
- return nItems;
-}
-
diff --git a/src/vnc/common/rdr/HexOutStream.h b/src/vnc/common/rdr/HexOutStream.h
deleted file mode 100644
index 10247e68..00000000
--- a/src/vnc/common/rdr/HexOutStream.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#ifndef __RDR_HEX_OUTSTREAM_H__
-#define __RDR_HEX_OUTSTREAM_H__
-
-#include
-
-namespace rdr {
-
- class HexOutStream : public OutStream {
- public:
-
- HexOutStream(OutStream& os, int buflen=0);
- virtual ~HexOutStream();
-
- void flush();
- int length();
-
- static char intToHex(int i);
- static char* binToHexStr(const char* data, int length);
-
- private:
- void writeBuffer();
- int overrun(int itemSize, int nItems);
-
- OutStream& out_stream;
-
- U8* start;
- int offset;
- int bufSize;
- };
-
-}
-
-#endif
diff --git a/src/vnc/common/rdr/InStream.cxx b/src/vnc/common/rdr/InStream.cxx
deleted file mode 100644
index a413b6c1..00000000
--- a/src/vnc/common/rdr/InStream.cxx
+++ /dev/null
@@ -1,35 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#include
-#include
-
-using namespace rdr;
-
-U32 InStream::maxStringLength = 65535;
-
-char* InStream::readString()
-{
- U32 len = readU32();
- if (len > maxStringLength)
- throw Exception("InStream max string length exceeded");
- char* str = new char[len+1];
- readBytes(str, len);
- str[len] = 0;
- return str;
-}
diff --git a/src/vnc/common/rdr/InStream.h b/src/vnc/common/rdr/InStream.h
deleted file mode 100644
index 97648fb4..00000000
--- a/src/vnc/common/rdr/InStream.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-//
-// rdr::InStream marshalls data from a buffer stored in RDR (RFB Data
-// Representation).
-//
-
-#ifndef __RDR_INSTREAM_H__
-#define __RDR_INSTREAM_H__
-
-#include
-#include // for memcpy
-
-namespace rdr {
-
- class InStream {
-
- public:
-
- virtual ~InStream() {}
-
- // check() ensures there is buffer data for at least one item of size
- // itemSize bytes. Returns the number of items in the buffer (up to a
- // maximum of nItems). If wait is false, then instead of blocking to wait
- // for the bytes, zero is returned if the bytes are not immediately
- // available.
-
- inline int check(int itemSize, int nItems=1, bool wait=true)
- {
- if (ptr + itemSize * nItems > end) {
- if (ptr + itemSize > end)
- return overrun(itemSize, nItems, wait);
-
- nItems = (end - ptr) / itemSize;
- }
- return nItems;
- }
-
- // checkNoWait() tries to make sure that the given number of bytes can
- // be read without blocking. It returns true if this is the case, false
- // otherwise. The length must be "small" (less than the buffer size).
-
- inline bool checkNoWait(int length) { return check(length, 1, false)!=0; }
-
- // readU/SN() methods read unsigned and signed N-bit integers.
-
- inline U8 readU8() { check(1); return *ptr++; }
- inline U16 readU16() { check(2); int b0 = *ptr++; int b1 = *ptr++;
- return b0 << 8 | b1; }
- inline U32 readU32() { check(4); int b0 = *ptr++; int b1 = *ptr++;
- int b2 = *ptr++; int b3 = *ptr++;
- return b0 << 24 | b1 << 16 | b2 << 8 | b3; }
-
- inline S8 readS8() { return (S8) readU8(); }
- inline S16 readS16() { return (S16)readU16(); }
- inline S32 readS32() { return (S32)readU32(); }
-
- // readString() reads a string - a U32 length followed by the data.
- // Returns a null-terminated string - the caller should delete[] it
- // afterwards.
-
- char* readString();
-
- // maxStringLength protects against allocating a huge buffer. Set it
- // higher if you need longer strings.
-
- static U32 maxStringLength;
-
- inline void skip(int bytes) {
- while (bytes > 0) {
- int n = check(1, bytes);
- ptr += n;
- bytes -= n;
- }
- }
-
- // readBytes() reads an exact number of bytes.
-
- virtual void readBytes(void* data, int length) {
- U8* dataPtr = (U8*)data;
- U8* dataEnd = dataPtr + length;
- while (dataPtr < dataEnd) {
- int n = check(1, dataEnd - dataPtr);
- memcpy(dataPtr, ptr, n);
- ptr += n;
- dataPtr += n;
- }
- }
-
- // readOpaqueN() reads a quantity without byte-swapping.
-
- inline U8 readOpaque8() { return readU8(); }
- inline U16 readOpaque16() { check(2); U16 r; ((U8*)&r)[0] = *ptr++;
- ((U8*)&r)[1] = *ptr++; return r; }
- inline U32 readOpaque32() { check(4); U32 r; ((U8*)&r)[0] = *ptr++;
- ((U8*)&r)[1] = *ptr++; ((U8*)&r)[2] = *ptr++;
- ((U8*)&r)[3] = *ptr++; return r; }
- inline U32 readOpaque24A() { check(3); U32 r=0; ((U8*)&r)[0] = *ptr++;
- ((U8*)&r)[1] = *ptr++; ((U8*)&r)[2] = *ptr++;
- return r; }
- inline U32 readOpaque24B() { check(3); U32 r=0; ((U8*)&r)[1] = *ptr++;
- ((U8*)&r)[2] = *ptr++; ((U8*)&r)[3] = *ptr++;
- return r; }
-
- // pos() returns the position in the stream.
-
- virtual int pos() = 0;
-
- // getptr(), getend() and setptr() are "dirty" methods which allow you to
- // manipulate the buffer directly. This is useful for a stream which is a
- // wrapper around an underlying stream.
-
- inline const U8* getptr() const { return ptr; }
- inline const U8* getend() const { return end; }
- inline void setptr(const U8* p) { ptr = p; }
-
- private:
-
- // overrun() is implemented by a derived class to cope with buffer overrun.
- // It ensures there are at least itemSize bytes of buffer data. Returns
- // the number of items in the buffer (up to a maximum of nItems). itemSize
- // is supposed to be "small" (a few bytes). If wait is false, then
- // instead of blocking to wait for the bytes, zero is returned if the bytes
- // are not immediately available.
-
- virtual int overrun(int itemSize, int nItems, bool wait=true) = 0;
-
- protected:
-
- InStream() {}
- const U8* ptr;
- const U8* end;
- };
-
-}
-
-#endif
diff --git a/src/vnc/common/rdr/Makefile.in b/src/vnc/common/rdr/Makefile.in
deleted file mode 100644
index 09fa5544..00000000
--- a/src/vnc/common/rdr/Makefile.in
+++ /dev/null
@@ -1,19 +0,0 @@
-
-SRCS = Exception.cxx FdInStream.cxx FdOutStream.cxx InStream.cxx \
- RandomStream.cxx ZlibInStream.cxx ZlibOutStream.cxx \
- HexInStream.cxx HexOutStream.cxx
-
-OBJS = $(SRCS:.cxx=.o)
-
-DIR_CPPFLAGS = -I$(top_srcdir) @ZLIB_INCLUDE@
-
-library = librdr.a
-
-all:: $(library)
-
-$(library): $(OBJS)
- rm -f $(library)
- $(AR) $(library) $(OBJS)
- $(RANLIB) $(library)
-
-# followed by boilerplate.mk
diff --git a/src/vnc/common/rdr/MemInStream.h b/src/vnc/common/rdr/MemInStream.h
deleted file mode 100644
index 77ca3f3a..00000000
--- a/src/vnc/common/rdr/MemInStream.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-//
-// rdr::MemInStream is an InStream which streams from a given memory buffer.
-// If the deleteWhenDone parameter is true then the buffer will be delete[]d in
-// the destructor. Note that it is delete[]d as a U8* - strictly speaking this
-// means it ought to be new[]ed as a U8* as well, but on most platforms this
-// doesn't matter.
-//
-
-#ifndef __RDR_MEMINSTREAM_H__
-#define __RDR_MEMINSTREAM_H__
-
-#include
-#include
-
-namespace rdr {
-
- class MemInStream : public InStream {
-
- public:
-
- MemInStream(const void* data, int len, bool deleteWhenDone_=false)
- : start((const U8*)data), deleteWhenDone(deleteWhenDone_)
- {
- ptr = start;
- end = start + len;
- }
-
- virtual ~MemInStream() {
- if (deleteWhenDone)
- delete [] (U8*)start;
- }
-
- int pos() { return ptr - start; }
- void reposition(int pos) { ptr = start + pos; }
-
- private:
-
- int overrun(int itemSize, int nItems, bool wait) { throw EndOfStream(); }
- const U8* start;
- bool deleteWhenDone;
- };
-
-}
-
-#endif
diff --git a/src/vnc/common/rdr/MemOutStream.h b/src/vnc/common/rdr/MemOutStream.h
deleted file mode 100644
index ee3e9500..00000000
--- a/src/vnc/common/rdr/MemOutStream.h
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-//
-// A MemOutStream grows as needed when data is written to it.
-//
-
-#ifndef __RDR_MEMOUTSTREAM_H__
-#define __RDR_MEMOUTSTREAM_H__
-
-#include
-
-namespace rdr {
-
- class MemOutStream : public OutStream {
-
- public:
-
- MemOutStream(int len=1024) {
- start = ptr = new U8[len];
- end = start + len;
- }
-
- virtual ~MemOutStream() {
- delete [] start;
- }
-
- void writeBytes(const void* data, int length) {
- check(length);
- memcpy(ptr, data, length);
- ptr += length;
- }
-
- int length() { return ptr - start; }
- void clear() { ptr = start; };
- void clearAndZero() { memset(start, 0, ptr-start); clear(); }
- void reposition(int pos) { ptr = start + pos; }
-
- // data() returns a pointer to the buffer.
-
- const void* data() { return (const void*)start; }
-
- private:
-
- // overrun() either doubles the buffer or adds enough space for nItems of
- // size itemSize bytes.
-
- int overrun(int itemSize, int nItems) {
- int len = ptr - start + itemSize * nItems;
- if (len < (end - start) * 2)
- len = (end - start) * 2;
-
- U8* newStart = new U8[len];
- memcpy(newStart, start, ptr - start);
- ptr = newStart + (ptr - start);
- delete [] start;
- start = newStart;
- end = newStart + len;
-
- return nItems;
- }
-
- U8* start;
- };
-
-}
-
-#endif
diff --git a/src/vnc/common/rdr/OutStream.h b/src/vnc/common/rdr/OutStream.h
deleted file mode 100644
index 35c699dc..00000000
--- a/src/vnc/common/rdr/OutStream.h
+++ /dev/null
@@ -1,152 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-//
-// rdr::OutStream marshalls data into a buffer stored in RDR (RFB Data
-// Representation).
-//
-
-#ifndef __RDR_OUTSTREAM_H__
-#define __RDR_OUTSTREAM_H__
-
-#include
-#include // for memcpy
-
-namespace rdr {
-
- class OutStream {
-
- protected:
-
- OutStream() {}
-
- public:
-
- virtual ~OutStream() {}
-
- // check() ensures there is buffer space for at least one item of size
- // itemSize bytes. Returns the number of items which fit (up to a maximum
- // of nItems).
-
- inline int check(int itemSize, int nItems=1)
- {
- if (ptr + itemSize * nItems > end) {
- if (ptr + itemSize > end)
- return overrun(itemSize, nItems);
-
- nItems = (end - ptr) / itemSize;
- }
- return nItems;
- }
-
- // writeU/SN() methods write unsigned and signed N-bit integers.
-
- inline void writeU8( U8 u) { check(1); *ptr++ = u; }
- inline void writeU16(U16 u) { check(2); *ptr++ = u >> 8; *ptr++ = (U8)u; }
- inline void writeU32(U32 u) { check(4); *ptr++ = u >> 24; *ptr++ = u >> 16;
- *ptr++ = u >> 8; *ptr++ = u; }
-
- inline void writeS8( S8 s) { writeU8((U8)s); }
- inline void writeS16(S16 s) { writeU16((U16)s); }
- inline void writeS32(S32 s) { writeU32((U32)s); }
-
- // writeString() writes a string - a U32 length followed by the data. The
- // given string should be null-terminated (but the terminating null is not
- // written to the stream).
-
- inline void writeString(const char* str) {
- U32 len = strlen(str);
- writeU32(len);
- writeBytes(str, len);
- }
-
- inline void pad(int bytes) {
- while (bytes-- > 0) writeU8(0);
- }
-
- inline void skip(int bytes) {
- while (bytes > 0) {
- int n = check(1, bytes);
- ptr += n;
- bytes -= n;
- }
- }
-
- // writeBytes() writes an exact number of bytes.
-
- virtual void writeBytes(const void* data, int length) {
- const U8* dataPtr = (const U8*)data;
- const U8* dataEnd = dataPtr + length;
- while (dataPtr < dataEnd) {
- int n = check(1, dataEnd - dataPtr);
- memcpy(ptr, dataPtr, n);
- ptr += n;
- dataPtr += n;
- }
- }
-
- // writeOpaqueN() writes a quantity without byte-swapping.
-
- inline void writeOpaque8( U8 u) { writeU8(u); }
- inline void writeOpaque16(U16 u) { check(2); *ptr++ = ((U8*)&u)[0];
- *ptr++ = ((U8*)&u)[1]; }
- inline void writeOpaque32(U32 u) { check(4); *ptr++ = ((U8*)&u)[0];
- *ptr++ = ((U8*)&u)[1];
- *ptr++ = ((U8*)&u)[2];
- *ptr++ = ((U8*)&u)[3]; }
- inline void writeOpaque24A(U32 u) { check(3); *ptr++ = ((U8*)&u)[0];
- *ptr++ = ((U8*)&u)[1];
- *ptr++ = ((U8*)&u)[2]; }
- inline void writeOpaque24B(U32 u) { check(3); *ptr++ = ((U8*)&u)[1];
- *ptr++ = ((U8*)&u)[2];
- *ptr++ = ((U8*)&u)[3]; }
-
- // length() returns the length of the stream.
-
- virtual int length() = 0;
-
- // flush() requests that the stream be flushed.
-
- virtual void flush() {}
-
- // getptr(), getend() and setptr() are "dirty" methods which allow you to
- // manipulate the buffer directly. This is useful for a stream which is a
- // wrapper around an underlying stream.
-
- inline U8* getptr() { return ptr; }
- inline U8* getend() { return end; }
- inline void setptr(U8* p) { ptr = p; }
-
- private:
-
- // overrun() is implemented by a derived class to cope with buffer overrun.
- // It ensures there are at least itemSize bytes of buffer space. Returns
- // the number of items which fit (up to a maximum of nItems). itemSize is
- // supposed to be "small" (a few bytes).
-
- virtual int overrun(int itemSize, int nItems) = 0;
-
- protected:
-
- U8* ptr;
- U8* end;
- };
-
-}
-
-#endif
diff --git a/src/vnc/common/rdr/RandomStream.cxx b/src/vnc/common/rdr/RandomStream.cxx
deleted file mode 100644
index 7056c2cc..00000000
--- a/src/vnc/common/rdr/RandomStream.cxx
+++ /dev/null
@@ -1,130 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#include
-#include
-#include
-#include
-#ifndef WIN32
-#include
-#include
-#else
-#define getpid() GetCurrentProcessId()
-#ifndef RFB_HAVE_WINCRYPT
-#pragma message(" NOTE: Not building WinCrypt-based RandomStream")
-#endif
-#endif
-
-using namespace rdr;
-
-const int DEFAULT_BUF_LEN = 256;
-
-unsigned int RandomStream::seed;
-
-RandomStream::RandomStream()
- : offset(0)
-{
- ptr = end = start = new U8[DEFAULT_BUF_LEN];
-
-#ifdef RFB_HAVE_WINCRYPT
- provider = 0;
- if (!CryptAcquireContext(&provider, 0, 0, PROV_RSA_FULL, 0)) {
- if (GetLastError() == NTE_BAD_KEYSET) {
- if (!CryptAcquireContext(&provider, 0, 0, PROV_RSA_FULL, CRYPT_NEWKEYSET)) {
- fprintf(stderr, "RandomStream: unable to create keyset\n");
- provider = 0;
- }
- } else {
- fprintf(stderr, "RandomStream: unable to acquire context\n");
- provider = 0;
- }
- }
- if (!provider) {
-#else
-#ifndef WIN32
- fp = fopen("/dev/urandom", "r");
- if (!fp)
- fp = fopen("/dev/random", "r");
- if (!fp) {
-#else
- {
-#endif
-#endif
- fprintf(stderr,"RandomStream: warning: no OS supplied random source - using rand()\n");
- seed += (unsigned int) time(0) + getpid() + getpid() * 987654 + rand();
- srand(seed);
- }
-}
-
-RandomStream::~RandomStream() {
- delete [] start;
-
-#ifdef RFB_HAVE_WINCRYPT
- if (provider)
- CryptReleaseContext(provider, 0);
-#endif
-#ifndef WIN32
- if (fp) fclose(fp);
-#endif
-}
-
-int RandomStream::pos() {
- return offset + ptr - start;
-}
-
-int RandomStream::overrun(int itemSize, int nItems, bool wait) {
- if (itemSize > DEFAULT_BUF_LEN)
- throw Exception("RandomStream overrun: max itemSize exceeded");
-
- if (end - ptr != 0)
- memmove(start, ptr, end - ptr);
-
- end -= ptr - start;
- offset += ptr - start;
- ptr = start;
-
- int length = start + DEFAULT_BUF_LEN - end;
-
-#ifdef RFB_HAVE_WINCRYPT
- if (provider) {
- if (!CryptGenRandom(provider, length, (U8*)end))
- throw rdr::SystemException("unable to CryptGenRandom", GetLastError());
- end += length;
- } else {
-#else
-#ifndef WIN32
- if (fp) {
- int n = fread((U8*)end, length, 1, fp);
- if (n != 1)
- throw rdr::SystemException("reading /dev/urandom or /dev/random failed",
- errno);
- end += length;
- } else {
-#else
- {
-#endif
-#endif
- for (int i=0; i end - ptr)
- nItems = (end - ptr) / itemSize;
-
- return nItems;
-}
diff --git a/src/vnc/common/rdr/RandomStream.h b/src/vnc/common/rdr/RandomStream.h
deleted file mode 100644
index c33360d7..00000000
--- a/src/vnc/common/rdr/RandomStream.h
+++ /dev/null
@@ -1,63 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#ifndef __RDR_RANDOMSTREAM_H__
-#define __RDR_RANDOMSTREAM_H__
-
-#include
-#include
-
-#ifdef WIN32
-#include
-#include
-#ifdef WINCRYPT32API
-#define RFB_HAVE_WINCRYPT
-#endif
-#endif
-
-namespace rdr {
-
- class RandomStream : public InStream {
-
- public:
-
- RandomStream();
- virtual ~RandomStream();
-
- int pos();
-
- protected:
- int overrun(int itemSize, int nItems, bool wait);
-
- private:
- U8* start;
- int offset;
-
- static unsigned int seed;
-#ifdef RFB_HAVE_WINCRYPT
- HCRYPTPROV provider;
-#endif
-#ifndef WIN32
- FILE* fp;
-#endif
-
- };
-
-} // end of namespace rdr
-
-#endif
diff --git a/src/vnc/common/rdr/SubstitutingInStream.h b/src/vnc/common/rdr/SubstitutingInStream.h
deleted file mode 100644
index 325b01c5..00000000
--- a/src/vnc/common/rdr/SubstitutingInStream.h
+++ /dev/null
@@ -1,102 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#ifndef __RDR_SUBSTITUTINGINSTREAM_H__
-#define __RDR_SUBSTITUTINGINSTREAM_H__
-
-#include
-#include
-
-namespace rdr {
-
- class Substitutor {
- public:
- virtual char* substitute(const char* varName) = 0;
- };
-
- class SubstitutingInStream : public InStream {
- public:
- SubstitutingInStream(InStream* underlying_, Substitutor* s,
- int maxVarNameLen_)
- : underlying(underlying_), dollar(0), substitutor(s), subst(0),
- maxVarNameLen(maxVarNameLen_)
- {
- ptr = end = underlying->getptr();
- varName = new char[maxVarNameLen+1];
- }
- ~SubstitutingInStream() {
- delete underlying;
- delete [] varName;
- delete [] subst;
- }
-
- int pos() { return underlying->pos(); }
-
- virtual int overrun(int itemSize, int nItems, bool wait=true) {
- if (itemSize != 1)
- throw new rdr::Exception("SubstitutingInStream: itemSize must be 1");
-
- if (subst) {
- delete [] subst;
- subst = 0;
- } else {
- underlying->setptr(ptr);
- }
-
- underlying->check(1);
- ptr = underlying->getptr();
- end = underlying->getend();
- dollar = (const U8*)memchr(ptr, '$', end-ptr);
- if (dollar) {
- if (dollar == ptr) {
- try {
- int i = 0;
- while (i < maxVarNameLen) {
- varName[i++] = underlying->readS8();
- varName[i] = 0;
- subst = substitutor->substitute(varName);
- if (subst) {
- ptr = (U8*)subst;
- end = (U8*)subst + strlen(subst);
- break;
- }
- }
- } catch (EndOfStream&) {
- }
-
- if (!subst)
- dollar = (const U8*)memchr(ptr+1, '$', end-ptr-1);
- }
- if (!subst && dollar) end = dollar;
- }
-
- if (itemSize * nItems > end - ptr)
- nItems = (end - ptr) / itemSize;
-
- return nItems;
- }
-
- InStream* underlying;
- const U8* dollar;
- Substitutor* substitutor;
- char* varName;
- char* subst;
- int maxVarNameLen;
- };
-}
-#endif
diff --git a/src/vnc/common/rdr/ZlibInStream.cxx b/src/vnc/common/rdr/ZlibInStream.cxx
deleted file mode 100644
index 6f3a7d02..00000000
--- a/src/vnc/common/rdr/ZlibInStream.cxx
+++ /dev/null
@@ -1,125 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#include
-#include
-#include
-
-using namespace rdr;
-
-enum { DEFAULT_BUF_SIZE = 16384 };
-
-ZlibInStream::ZlibInStream(int bufSize_)
- : underlying(0), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0),
- bytesIn(0)
-{
- zs = new z_stream;
- zs->zalloc = Z_NULL;
- zs->zfree = Z_NULL;
- zs->opaque = Z_NULL;
- zs->next_in = Z_NULL;
- zs->avail_in = 0;
- if (inflateInit(zs) != Z_OK) {
- delete zs;
- throw Exception("ZlibInStream: inflateInit failed");
- }
- ptr = end = start = new U8[bufSize];
-}
-
-ZlibInStream::~ZlibInStream()
-{
- delete [] start;
- inflateEnd(zs);
- delete zs;
-}
-
-void ZlibInStream::setUnderlying(InStream* is, int bytesIn_)
-{
- underlying = is;
- bytesIn = bytesIn_;
- ptr = end = start;
-}
-
-int ZlibInStream::pos()
-{
- return offset + ptr - start;
-}
-
-void ZlibInStream::reset()
-{
- ptr = end = start;
- if (!underlying) return;
-
- while (bytesIn > 0) {
- decompress(true);
- end = start; // throw away any data
- }
- underlying = 0;
-}
-
-int ZlibInStream::overrun(int itemSize, int nItems, bool wait)
-{
- if (itemSize > bufSize)
- throw Exception("ZlibInStream overrun: max itemSize exceeded");
- if (!underlying)
- throw Exception("ZlibInStream overrun: no underlying stream");
-
- if (end - ptr != 0)
- memmove(start, ptr, end - ptr);
-
- offset += ptr - start;
- end -= ptr - start;
- ptr = start;
-
- while (end - ptr < itemSize) {
- if (!decompress(wait))
- return 0;
- }
-
- if (itemSize * nItems > end - ptr)
- nItems = (end - ptr) / itemSize;
-
- return nItems;
-}
-
-// decompress() calls the decompressor once. Note that this won't necessarily
-// generate any output data - it may just consume some input data. Returns
-// false if wait is false and we would block on the underlying stream.
-
-bool ZlibInStream::decompress(bool wait)
-{
- zs->next_out = (U8*)end;
- zs->avail_out = start + bufSize - end;
-
- int n = underlying->check(1, 1, wait);
- if (n == 0) return false;
- zs->next_in = (U8*)underlying->getptr();
- zs->avail_in = underlying->getend() - underlying->getptr();
- if ((int)zs->avail_in > bytesIn)
- zs->avail_in = bytesIn;
-
- int rc = inflate(zs, Z_SYNC_FLUSH);
- if (rc != Z_OK) {
- throw Exception("ZlibInStream: inflate failed");
- }
-
- bytesIn -= zs->next_in - underlying->getptr();
- end = zs->next_out;
- underlying->setptr(zs->next_in);
- return true;
-}
diff --git a/src/vnc/common/rdr/ZlibInStream.h b/src/vnc/common/rdr/ZlibInStream.h
deleted file mode 100644
index c26b6d63..00000000
--- a/src/vnc/common/rdr/ZlibInStream.h
+++ /dev/null
@@ -1,59 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-//
-// ZlibInStream streams from a compressed data stream ("underlying"),
-// decompressing with zlib on the fly.
-//
-
-#ifndef __RDR_ZLIBINSTREAM_H__
-#define __RDR_ZLIBINSTREAM_H__
-
-#include
-
-struct z_stream_s;
-
-namespace rdr {
-
- class ZlibInStream : public InStream {
-
- public:
-
- ZlibInStream(int bufSize=0);
- virtual ~ZlibInStream();
-
- void setUnderlying(InStream* is, int bytesIn);
- void reset();
- int pos();
-
- private:
-
- int overrun(int itemSize, int nItems, bool wait);
- bool decompress(bool wait);
-
- InStream* underlying;
- int bufSize;
- int offset;
- z_stream_s* zs;
- int bytesIn;
- U8* start;
- };
-
-} // end of namespace rdr
-
-#endif
diff --git a/src/vnc/common/rdr/ZlibOutStream.cxx b/src/vnc/common/rdr/ZlibOutStream.cxx
deleted file mode 100644
index 181e3567..00000000
--- a/src/vnc/common/rdr/ZlibOutStream.cxx
+++ /dev/null
@@ -1,140 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#include
-#include
-#include
-
-using namespace rdr;
-
-enum { DEFAULT_BUF_SIZE = 16384 };
-
-ZlibOutStream::ZlibOutStream(OutStream* os, int bufSize_, int compressLevel)
- : underlying(os), bufSize(bufSize_ ? bufSize_ : DEFAULT_BUF_SIZE), offset(0)
-{
- zs = new z_stream;
- zs->zalloc = Z_NULL;
- zs->zfree = Z_NULL;
- zs->opaque = Z_NULL;
- if (deflateInit(zs, compressLevel) != Z_OK) {
- delete zs;
- throw Exception("ZlibOutStream: deflateInit failed");
- }
- ptr = start = new U8[bufSize];
- end = start + bufSize;
-}
-
-ZlibOutStream::~ZlibOutStream()
-{
- try {
- flush();
- } catch (Exception&) {
- }
- delete [] start;
- deflateEnd(zs);
- delete zs;
-}
-
-void ZlibOutStream::setUnderlying(OutStream* os)
-{
- underlying = os;
-}
-
-int ZlibOutStream::length()
-{
- return offset + ptr - start;
-}
-
-void ZlibOutStream::flush()
-{
- zs->next_in = start;
- zs->avail_in = ptr - start;
-
-// fprintf(stderr,"zos flush: avail_in %d\n",zs->avail_in);
-
- while (zs->avail_in != 0) {
-
- do {
- underlying->check(1);
- zs->next_out = underlying->getptr();
- zs->avail_out = underlying->getend() - underlying->getptr();
-
-// fprintf(stderr,"zos flush: calling deflate, avail_in %d, avail_out %d\n",
-// zs->avail_in,zs->avail_out);
- int rc = deflate(zs, Z_SYNC_FLUSH);
- if (rc != Z_OK) throw Exception("ZlibOutStream: deflate failed");
-
-// fprintf(stderr,"zos flush: after deflate: %d bytes\n",
-// zs->next_out-underlying->getptr());
-
- underlying->setptr(zs->next_out);
- } while (zs->avail_out == 0);
- }
-
- offset += ptr - start;
- ptr = start;
-}
-
-int ZlibOutStream::overrun(int itemSize, int nItems)
-{
-// fprintf(stderr,"ZlibOutStream overrun\n");
-
- if (itemSize > bufSize)
- throw Exception("ZlibOutStream overrun: max itemSize exceeded");
-
- while (end - ptr < itemSize) {
- zs->next_in = start;
- zs->avail_in = ptr - start;
-
- do {
- underlying->check(1);
- zs->next_out = underlying->getptr();
- zs->avail_out = underlying->getend() - underlying->getptr();
-
-// fprintf(stderr,"zos overrun: calling deflate, avail_in %d, avail_out %d\n",
-// zs->avail_in,zs->avail_out);
-
- int rc = deflate(zs, 0);
- if (rc != Z_OK) throw Exception("ZlibOutStream: deflate failed");
-
-// fprintf(stderr,"zos overrun: after deflate: %d bytes\n",
-// zs->next_out-underlying->getptr());
-
- underlying->setptr(zs->next_out);
- } while (zs->avail_out == 0);
-
- // output buffer not full
-
- if (zs->avail_in == 0) {
- offset += ptr - start;
- ptr = start;
- } else {
- // but didn't consume all the data? try shifting what's left to the
- // start of the buffer.
- fprintf(stderr,"z out buf not full, but in data not consumed\n");
- memmove(start, zs->next_in, ptr - zs->next_in);
- offset += zs->next_in - start;
- ptr -= zs->next_in - start;
- }
- }
-
- if (itemSize * nItems > end - ptr)
- nItems = (end - ptr) / itemSize;
-
- return nItems;
-}
diff --git a/src/vnc/common/rdr/ZlibOutStream.h b/src/vnc/common/rdr/ZlibOutStream.h
deleted file mode 100644
index 7d737c14..00000000
--- a/src/vnc/common/rdr/ZlibOutStream.h
+++ /dev/null
@@ -1,57 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-//
-// ZlibOutStream streams to a compressed data stream (underlying), compressing
-// with zlib on the fly.
-//
-
-#ifndef __RDR_ZLIBOUTSTREAM_H__
-#define __RDR_ZLIBOUTSTREAM_H__
-
-#include
-
-struct z_stream_s;
-
-namespace rdr {
-
- class ZlibOutStream : public OutStream {
-
- public:
-
- ZlibOutStream(OutStream* os=0, int bufSize=0, int compressionLevel=-1);
- virtual ~ZlibOutStream();
-
- void setUnderlying(OutStream* os);
- void flush();
- int length();
-
- private:
-
- int overrun(int itemSize, int nItems);
-
- OutStream* underlying;
- int bufSize;
- int offset;
- z_stream_s* zs;
- U8* start;
- };
-
-} // end of namespace rdr
-
-#endif
diff --git a/src/vnc/common/rdr/types.h b/src/vnc/common/rdr/types.h
deleted file mode 100644
index 6421b137..00000000
--- a/src/vnc/common/rdr/types.h
+++ /dev/null
@@ -1,66 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-#ifndef __RDR_TYPES_H__
-#define __RDR_TYPES_H__
-
-namespace rdr {
-
- typedef unsigned char U8;
- typedef unsigned short U16;
- typedef unsigned int U32;
- typedef signed char S8;
- typedef signed short S16;
- typedef signed int S32;
-
- class U8Array {
- public:
- U8Array() : buf(0) {}
- U8Array(U8* a) : buf(a) {} // note: assumes ownership
- U8Array(int len) : buf(new U8[len]) {}
- ~U8Array() { delete [] buf; }
-
- // Get the buffer pointer & clear it (i.e. caller takes ownership)
- U8* takeBuf() { U8* tmp = buf; buf = 0; return tmp; }
-
- U8* buf;
- };
-
- class U16Array {
- public:
- U16Array() : buf(0) {}
- U16Array(U16* a) : buf(a) {} // note: assumes ownership
- U16Array(int len) : buf(new U16[len]) {}
- ~U16Array() { delete [] buf; }
- U16* takeBuf() { U16* tmp = buf; buf = 0; return tmp; }
- U16* buf;
- };
-
- class U32Array {
- public:
- U32Array() : buf(0) {}
- U32Array(U32* a) : buf(a) {} // note: assumes ownership
- U32Array(int len) : buf(new U32[len]) {}
- ~U32Array() { delete [] buf; }
- U32* takeBuf() { U32* tmp = buf; buf = 0; return tmp; }
- U32* buf;
- };
-
-} // end of namespace rdr
-
-#endif
diff --git a/src/vnc/common/rfb/Blacklist.cxx b/src/vnc/common/rfb/Blacklist.cxx
deleted file mode 100644
index 4590befe..00000000
--- a/src/vnc/common/rfb/Blacklist.cxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-#include
-#include
-
-using namespace rfb;
-
-IntParameter Blacklist::threshold("BlacklistThreshold",
- "The number of unauthenticated connection attempts allowed from any "
- "individual host before that host is black-listed",
- 5);
-IntParameter Blacklist::initialTimeout("BlacklistTimeout",
- "The initial timeout applied when a host is first black-listed. "
- "The host cannot re-attempt a connection until the timeout expires.",
- 10);
-
-
-Blacklist::Blacklist() {
-}
-
-Blacklist::~Blacklist() {
- // Free the map keys
- BlacklistMap::iterator i;
- for (i=blm.begin(); i!=blm.end(); i++) {
- strFree((char*)(*i).first);
- }
-}
-
-bool Blacklist::isBlackmarked(const char* name) {
- BlacklistMap::iterator i = blm.find(name);
- if (i == blm.end()) {
- // Entry is not already black-marked.
- // Create the entry unmarked, unblocked,
- // with suitable defaults set.
- BlacklistInfo bi;
- bi.marks = 1;
- bi.blockUntil = 0;
- bi.blockTimeout = initialTimeout;
- blm[strDup(name)] = bi;
- i = blm.find(name);
- }
-
- // Entry exists - has it reached the threshold yet?
- if ((*i).second.marks >= threshold) {
- // Yes - entry is blocked - has the timeout expired?
- time_t now = time(0);
- if (now >= (*i).second.blockUntil) {
- // Timeout has expired. Reset timeout and allow
- // a re-try.
- (*i).second.blockUntil = now + (*i).second.blockTimeout;
- (*i).second.blockTimeout = (*i).second.blockTimeout * 2;
- return false;
- }
- // Blocked and timeout still in effect - reject!
- return true;
- }
-
- // We haven't reached the threshold yet.
- // Increment the black-mark counter but allow
- // the entry to pass.
- (*i).second.marks++;
- return false;
-}
-
-void Blacklist::clearBlackmark(const char* name) {
- BlacklistMap::iterator i = blm.find(name);
- if (i != blm.end()) {
- strFree((char*)(*i).first);
- blm.erase(i);
- }
-}
diff --git a/src/vnc/common/rfb/Blacklist.h b/src/vnc/common/rfb/Blacklist.h
deleted file mode 100644
index 0eb38460..00000000
--- a/src/vnc/common/rfb/Blacklist.h
+++ /dev/null
@@ -1,91 +0,0 @@
-/* Copyright (C) 2002-2005 RealVNC Ltd. All Rights Reserved.
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
- * USA.
- */
-
-//
-// Blacklist.h - Handling of black-listed entities.
-// Just keeps a table mapping strings to timing information, including
-// how many times the entry has been black-listed and when to next
-// put it on probation (e.g. allow a connection in from the host, and
-// re-blacklist it if that fails).
-//
-
-#ifndef __RFB_BLACKLIST_H__
-#define __RFB_BLACKLIST_H__
-
-#include
-#include
-#include