[sanitizers] Make sure that all complex macros uses parenthesis

Summary:
Without them expressions like this may have different values.
(SANITIZER_INTERCEPT_MEMRCHR && SANITIZER_INTERCEPT_PREADV)

Reviewers: alekseyshl

Subscribers: srhines, kubamracek, llvm-commits

Differential Revision: https://reviews.llvm.org/D35512

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@308228 91177308-0d34-0410-b5e6-96231b3b80d8

--- lib/sanitizer_common/sanitizer_platform_interceptors.h
+++ lib/sanitizer_common/sanitizer_platform_interceptors.h
@@ -115,9 +115,9 @@
 // memmem on Darwin doesn't exist on 10.6
 // FIXME: enable memmem on Windows.
 #define SANITIZER_INTERCEPT_MEMMEM \
-  SI_NOT_WINDOWS && !SI_MAC_DEPLOYMENT_BELOW_10_7
+  (SI_NOT_WINDOWS && !SI_MAC_DEPLOYMENT_BELOW_10_7)
 #define SANITIZER_INTERCEPT_MEMCHR 1
-#define SANITIZER_INTERCEPT_MEMRCHR SI_FREEBSD || SI_LINUX || SI_NETBSD
+#define SANITIZER_INTERCEPT_MEMRCHR (SI_FREEBSD || SI_LINUX || SI_NETBSD)

 #define SANITIZER_INTERCEPT_READ   SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_PREAD  SI_NOT_WINDOWS
@@ -134,7 +134,7 @@
 #define SANITIZER_INTERCEPT_WRITEV SI_NOT_WINDOWS

 #define SANITIZER_INTERCEPT_PREADV \
-  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_PWRITEV SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_PREADV64 SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_PWRITEV64 SI_LINUX_NOT_ANDROID
@@ -149,7 +149,7 @@

 #ifndef SANITIZER_INTERCEPT_PRINTF
 # define SANITIZER_INTERCEPT_PRINTF SI_NOT_WINDOWS
-# define SANITIZER_INTERCEPT_PRINTF_L SI_FREEBSD || SI_NETBSD
+# define SANITIZER_INTERCEPT_PRINTF_L (SI_FREEBSD || SI_NETBSD)
 # define SANITIZER_INTERCEPT_ISOC99_PRINTF SI_LINUX_NOT_ANDROID
 #endif

@@ -158,14 +158,14 @@

 #define SANITIZER_INTERCEPT_GETPWNAM_AND_FRIENDS SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_GETPWNAM_R_AND_FRIENDS \
-  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_GETPWENT \
-  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_FGETPWENT SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_GETPWENT_R \
-  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_SETPWENT SI_MAC || SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_CLOCK_GETTIME SI_FREEBSD || SI_NETBSD || SI_LINUX
+  (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
+#define SANITIZER_INTERCEPT_SETPWENT (SI_MAC || SI_LINUX_NOT_ANDROID)
+#define SANITIZER_INTERCEPT_CLOCK_GETTIME (SI_FREEBSD || SI_NETBSD || SI_LINUX)
 #define SANITIZER_INTERCEPT_GETITIMER SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_TIME SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_GLOB SI_LINUX_NOT_ANDROID
@@ -176,10 +176,11 @@
 #define SANITIZER_INTERCEPT_GETNAMEINFO SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_GETSOCKNAME SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_GETHOSTBYNAME SI_NOT_WINDOWS
-#define SANITIZER_INTERCEPT_GETHOSTBYNAME_R SI_FREEBSD || SI_LINUX
-#define SANITIZER_INTERCEPT_GETHOSTBYNAME2_R SI_FREEBSD || SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_GETHOSTBYADDR_R SI_FREEBSD || SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_GETHOSTENT_R SI_FREEBSD || SI_LINUX_NOT_ANDROID
+#define SANITIZER_INTERCEPT_GETHOSTBYNAME_R (SI_FREEBSD || SI_LINUX)
+#define SANITIZER_INTERCEPT_GETHOSTBYNAME2_R \
+  (SI_FREEBSD || SI_LINUX_NOT_ANDROID)
+#define SANITIZER_INTERCEPT_GETHOSTBYADDR_R (SI_FREEBSD || SI_LINUX_NOT_ANDROID)
+#define SANITIZER_INTERCEPT_GETHOSTENT_R (SI_FREEBSD || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_GETSOCKOPT SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_ACCEPT SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_ACCEPT4 SI_LINUX_NOT_ANDROID
@@ -205,66 +206,67 @@
 #define SANITIZER_INTERCEPT_GET_CURRENT_DIR_NAME SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_STRTOIMAX SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_MBSTOWCS SI_NOT_WINDOWS
-#define SANITIZER_INTERCEPT_MBSNRTOWCS SI_MAC || SI_LINUX_NOT_ANDROID
+#define SANITIZER_INTERCEPT_MBSNRTOWCS (SI_MAC || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_WCSTOMBS SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_WCSNRTOMBS \
-  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_WCRTOMB \
-  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_TCGETATTR SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_REALPATH SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_CANONICALIZE_FILE_NAME SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_CONFSTR \
-  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_SCHED_GETAFFINITY SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_SCHED_GETPARAM SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_STRERROR SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_STRERROR_R SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_XPG_STRERROR_R SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_SCANDIR \
-  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_SCANDIR64 SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_GETGROUPS SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_POLL SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_PPOLL SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_WORDEXP \
-  SI_FREEBSD || SI_NETBSD || (SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || (SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_SIGWAIT SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_SIGWAITINFO SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_SIGTIMEDWAIT SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_SIGSETOPS \
-  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_SIGPENDING SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_SIGPROCMASK SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_BACKTRACE \
-  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_GETMNTENT SI_LINUX
 #define SANITIZER_INTERCEPT_GETMNTENT_R SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_STATFS SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID
+#define SANITIZER_INTERCEPT_STATFS \
+  (SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_STATFS64 \
-  (SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID
+  ((SI_MAC && !SI_IOS) || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_STATVFS \
-  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_STATVFS64 SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_INITGROUPS SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_ETHER_NTOA_ATON SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_ETHER_HOST \
-  SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_ETHER_R SI_FREEBSD || SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_SHMCTL \
-  SI_NETBSD ||                     \
-      ((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && SANITIZER_WORDSIZE == 64)
+  (SI_FREEBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
+#define SANITIZER_INTERCEPT_ETHER_R (SI_FREEBSD || SI_LINUX_NOT_ANDROID)
+#define SANITIZER_INTERCEPT_SHMCTL                       \
+  (SI_NETBSD || ((SI_FREEBSD || SI_LINUX_NOT_ANDROID) && \
+                 SANITIZER_WORDSIZE == 64))  // NOLINT
 #define SANITIZER_INTERCEPT_RANDOM_R SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GET SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETINHERITSCHED \
-  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_PTHREAD_ATTR_GETAFFINITY_NP SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPSHARED SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETTYPE SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPROTOCOL \
-  SI_MAC || SI_NETBSD || SI_LINUX_NOT_ANDROID
+  (SI_MAC || SI_NETBSD || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETPRIOCEILING \
-  SI_MAC || SI_NETBSD || SI_LINUX_NOT_ANDROID
+  (SI_MAC || SI_NETBSD || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETROBUST SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_PTHREAD_MUTEXATTR_GETROBUST_NP SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_PTHREAD_RWLOCKATTR_GETPSHARED SI_NOT_WINDOWS
@@ -279,35 +281,36 @@
 #define SANITIZER_INTERCEPT_SINCOS SI_LINUX
 #define SANITIZER_INTERCEPT_REMQUO SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_LGAMMA SI_NOT_WINDOWS
-#define SANITIZER_INTERCEPT_LGAMMA_R SI_FREEBSD || SI_LINUX
+#define SANITIZER_INTERCEPT_LGAMMA_R (SI_FREEBSD || SI_LINUX)
 #define SANITIZER_INTERCEPT_LGAMMAL_R SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_DRAND48_R SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_RAND_R \
-  SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_MAC || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_ICONV \
-  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
 #define SANITIZER_INTERCEPT_TIMES SI_NOT_WINDOWS

 // FIXME: getline seems to be available on OSX 10.7
 #define SANITIZER_INTERCEPT_GETLINE \
-  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
-
-#define SANITIZER_INTERCEPT__EXIT SI_LINUX || SI_FREEBSD || SI_NETBSD || SI_MAC
+  (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)
+
+#define SANITIZER_INTERCEPT__EXIT \
+  (SI_LINUX || SI_FREEBSD || SI_NETBSD || SI_MAC)

 #define SANITIZER_INTERCEPT_PHTREAD_MUTEX SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_PTHREAD_SETNAME_NP \
-  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)

 #define SANITIZER_INTERCEPT_TLS_GET_ADDR \
-  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID
+  (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID)

 #define SANITIZER_INTERCEPT_LISTXATTR SI_LINUX
 #define SANITIZER_INTERCEPT_GETXATTR SI_LINUX
 #define SANITIZER_INTERCEPT_GETRESID SI_LINUX
 #define SANITIZER_INTERCEPT_GETIFADDRS \
-  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_MAC
+  (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_MAC)
 #define SANITIZER_INTERCEPT_IF_INDEXTONAME \
-  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_MAC
+  (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_MAC)
 #define SANITIZER_INTERCEPT_CAPGET SI_LINUX_NOT_ANDROID
 #if SI_LINUX && defined(__arm__)
 #define SANITIZER_INTERCEPT_AEABI_MEM 1
@@ -315,52 +318,55 @@
 #define SANITIZER_INTERCEPT_AEABI_MEM 0
 #endif
 #define SANITIZER_INTERCEPT___BZERO SI_MAC
-#define SANITIZER_INTERCEPT_FTIME !SI_FREEBSD && !SI_NETBSD && SI_NOT_WINDOWS
+#define SANITIZER_INTERCEPT_FTIME (!SI_FREEBSD && !SI_NETBSD && SI_NOT_WINDOWS)
 #define SANITIZER_INTERCEPT_XDR SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_TSEARCH SI_LINUX_NOT_ANDROID || SI_MAC || SI_NETBSD
+#define SANITIZER_INTERCEPT_TSEARCH \
+  (SI_LINUX_NOT_ANDROID || SI_MAC || SI_NETBSD)
 #define SANITIZER_INTERCEPT_LIBIO_INTERNALS SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_FOPEN SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_FOPEN64 SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_OPEN_MEMSTREAM SI_LINUX_NOT_ANDROID || SI_NETBSD
+#define SANITIZER_INTERCEPT_OPEN_MEMSTREAM (SI_LINUX_NOT_ANDROID || SI_NETBSD)
 #define SANITIZER_INTERCEPT_OBSTACK SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT_FFLUSH SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_FCLOSE SI_NOT_WINDOWS

 #ifndef SANITIZER_INTERCEPT_DLOPEN_DLCLOSE
 #define SANITIZER_INTERCEPT_DLOPEN_DLCLOSE \
-  SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_MAC
-#endif
-
-#define SANITIZER_INTERCEPT_GETPASS SI_LINUX_NOT_ANDROID || SI_MAC || SI_NETBSD
+  (SI_FREEBSD || SI_NETBSD || SI_LINUX_NOT_ANDROID || SI_MAC)
+#endif
+
+#define SANITIZER_INTERCEPT_GETPASS \
+  (SI_LINUX_NOT_ANDROID || SI_MAC || SI_NETBSD)
 #define SANITIZER_INTERCEPT_TIMERFD SI_LINUX_NOT_ANDROID

 #define SANITIZER_INTERCEPT_MLOCKX SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_FOPENCOOKIE SI_LINUX_NOT_ANDROID
-#define SANITIZER_INTERCEPT_SEM SI_LINUX || SI_FREEBSD || SI_NETBSD
+#define SANITIZER_INTERCEPT_SEM (SI_LINUX || SI_FREEBSD || SI_NETBSD)
 #define SANITIZER_INTERCEPT_PTHREAD_SETCANCEL SI_NOT_WINDOWS
-#define SANITIZER_INTERCEPT_MINCORE SI_LINUX || SI_NETBSD
+#define SANITIZER_INTERCEPT_MINCORE (SI_LINUX || SI_NETBSD)
 #define SANITIZER_INTERCEPT_PROCESS_VM_READV SI_LINUX
 #define SANITIZER_INTERCEPT_CTERMID \
-  SI_LINUX || SI_MAC || SI_FREEBSD || SI_NETBSD
-#define SANITIZER_INTERCEPT_CTERMID_R SI_MAC || SI_FREEBSD
-
-#define SANITIZER_INTERCEPTOR_HOOKS SI_LINUX || SI_MAC || SI_WINDOWS
+  (SI_LINUX || SI_MAC || SI_FREEBSD || SI_NETBSD)
+#define SANITIZER_INTERCEPT_CTERMID_R (SI_MAC || SI_FREEBSD)
+
+#define SANITIZER_INTERCEPTOR_HOOKS (SI_LINUX || SI_MAC || SI_WINDOWS)
 #define SANITIZER_INTERCEPT_RECV_RECVFROM SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_SEND_SENDTO SI_NOT_WINDOWS
 #define SANITIZER_INTERCEPT_EVENTFD_READ_WRITE SI_LINUX

 #define SANITIZER_INTERCEPT_STAT \
   (SI_FREEBSD || SI_MAC || SI_ANDROID || SI_NETBSD)
-#define SANITIZER_INTERCEPT___XSTAT !SANITIZER_INTERCEPT_STAT && SI_NOT_WINDOWS
+#define SANITIZER_INTERCEPT___XSTAT \
+  (!SANITIZER_INTERCEPT_STAT && SI_NOT_WINDOWS)
 #define SANITIZER_INTERCEPT___XSTAT64 SI_LINUX_NOT_ANDROID
 #define SANITIZER_INTERCEPT___LXSTAT SANITIZER_INTERCEPT___XSTAT
 #define SANITIZER_INTERCEPT___LXSTAT64 SI_LINUX_NOT_ANDROID

-#define SANITIZER_INTERCEPT_UTMP SI_NOT_WINDOWS && !SI_MAC && !SI_FREEBSD
-#define SANITIZER_INTERCEPT_UTMPX SI_LINUX_NOT_ANDROID || SI_MAC || SI_FREEBSD
+#define SANITIZER_INTERCEPT_UTMP (SI_NOT_WINDOWS && !SI_MAC && !SI_FREEBSD)
+#define SANITIZER_INTERCEPT_UTMPX (SI_LINUX_NOT_ANDROID || SI_MAC || SI_FREEBSD)

 #define SANITIZER_INTERCEPT_GETLOADAVG \
-  SI_LINUX_NOT_ANDROID || SI_MAC || SI_FREEBSD || SI_NETBSD
+  (SI_LINUX_NOT_ANDROID || SI_MAC || SI_FREEBSD || SI_NETBSD)

 #define SANITIZER_INTERCEPT_MALLOPT_AND_MALLINFO \
   (!SI_FREEBSD && !SI_MAC && !SI_NETBSD)


Fix missing slash

Fix missing slash


testing explore code

testing explore code

--- user/robot/jessk/umain.c
+++ user/robot/jessk/umain.c
@@ -127,7 +127,7 @@
 	}
 }
 void claim_territory() {
-
+
 }
 bool can_gather_resources(uint8_t territory) {


Remove bogus '-' from getopt(3) string hit when porting daemon(8) to
GNU/Linux *duck*.

MFC after:	1 week


acpi: osglue: improve and simplify AcpiOsMapMemory and AcpiOsUnmapMemory

Signed-off-by: Simon Gerber <13ba2e9de9ead0ea0b5f47504fb3a80bb9b1ee3b@inf.ethz.ch>

--- usr/acpi/acpica_osglue.c
+++ usr/acpi/acpica_osglue.c
@@ -548,7 +548,7 @@
     int npages = DIVIDE_ROUND_UP(length, BASE_PAGE_SIZE);
     lpaddr_t pend  = pbase + length;

-    //printf("AcpiOsMapMemory: 0x%"PRIxLPADDR", %d\n", pbase, npages);
+    ACPI_DEBUG("AcpiOsMapMemory: aligned request: 0x%"PRIxLPADDR", %d\n", pbase, npages);

     struct capref am_pages[npages];
     memset(&am_pages, 0, npages*sizeof(struct capref));
@@ -617,47 +617,62 @@
         DEBUG_ERR(err, "vregion_map failed");
         return NULL;
     }
+    ACPI_DEBUG("%s: Mapping %#"PRIxLPADDR" at %#"PRIxGENVADDR"\n",
+            __FUNCTION__, pbase, vregion_get_base_addr(vregion));

     struct AcpiMapping *new = malloc(sizeof(struct AcpiMapping));
     new->num_caps = npages;
     new->caps = calloc(npages, sizeof(struct capref));
     for (int page = 0; page < npages; page++) {
-        struct capref frame_cap;
+
         if (capref_is_null(am_pages[page])) {
             lpaddr_t paddr = pbase + page * BASE_PAGE_SIZE;

+            ACPI_DEBUG("%s: allocating page for %#"PRIxLPADDR"\n",
+                    __FUNCTION__, paddr);
+
             err = mm_realloc_range(&pci_mm_physaddr, BASE_PAGE_BITS, paddr,
-                                   &frame_cap);
+                    &new->caps[page]);
             if (err_is_fail(err)) {
                 free(new->caps);
                 free(new);
                 DEBUG_ERR(err, "AcpiOsMapMemory: allocating RAM at %lx failed\n",
-                          paddr);
+                        paddr);
                 return NULL;
             }
             /* result of mm_realloc_range is already DevFrame */
         }
         else {
-            frame_cap = am_pages[page];
+            ACPI_DEBUG("%s: already have page for %#"PRIxLPADDR"\n",
+                    __FUNCTION__, pbase + page * BASE_PAGE_SIZE);
+
+            // Create a copy of the cap so we don't accidentally kill more
+            // than one mapping in AcpiOsUnmapMemory()
+            err = slot_alloc(&new->caps[page]);
+            if (err_is_fail(err)) {
+                DEBUG_ERR(err, "slot_alloc for copy of page");
+                // XXX: TODO: cleanup previous pages
+                free(new->caps);
+                free(new);
+                return NULL;
+            }
+            err = cap_copy(new->caps[page], am_pages[page]);
+            if (err_is_fail(err)) {
+                DEBUG_ERR(err, "slot_alloc for copy of page");
+                // XXX: TODO: cleanup previous pages
+                slot_free(new->caps[page]);
+                free(new->caps);
+                free(new);
+                return NULL;
+            }
         }

-        err = slot_alloc(&new->caps[page]);
-        if (err_is_fail(err)) {
-            DEBUG_ERR(err, "AcpiOsMapMemory: could not allocate slot for capability: %s.",
-                    err_getstring(err_no(err)));
-            return NULL;
-        }
-        err = cap_copy(new->caps[page], frame_cap);
-        if (err_is_fail(err)) {
-            DEBUG_ERR(err, "AcpiOsMapMemory: cap_copy failed: %s.",
-                    err_getstring(err_no(err)));
-            return NULL;
-        }
         err = memobj->m.f.fill(&memobj->m, page * BASE_PAGE_SIZE, new->caps[page],
-                           BASE_PAGE_SIZE);
+                BASE_PAGE_SIZE);
         if (err_is_fail(err)) {
             DEBUG_ERR(err, "AcpiOsMapMemory: memobj fill failed: %s.",
                     err_getstring(err_no(err)));
+            // XXX: TODO: cleanup
             return NULL;
         }
         assert(err == 0);
@@ -665,6 +680,7 @@
         if (err_is_fail(err)) {
             DEBUG_ERR(err, "AcpiOsMapMemory: memobj pagefault failed: %s.",
                     err_getstring(err_no(err)));
+            // XXX: TODO: cleanup
             return NULL;
         }
         assert(err == 0);
@@ -702,11 +718,14 @@
     void                    *where,
     ACPI_SIZE               length)
 {
-    // printf("unmap %p %zd\n", where, (size_t)length);
+    ACPI_DEBUG("%s: %p %zd\n", __FUNCTION__, where, (size_t)length);

     uintptr_t vbase = (uintptr_t)where & (~BASE_PAGE_MASK);
     length = ROUND_UP(length, BASE_PAGE_SIZE);

+    ACPI_DEBUG("%s: aligned request: %#"PRIxPTR", %zu pages\n",
+            __FUNCTION__, vbase, length / BASE_PAGE_SIZE);
+
     // printf("AcpiOsUnmapMemory: 0x%lx, %ld\n", vbase, length / BASE_PAGE_SIZE);

     // printf("unmap 0x%lx %zd\n", vbase, length);
@@ -715,28 +734,54 @@
     assert(head); // there should be a mapped region if Unmap is called

     struct AcpiMapping *prev = NULL;
+    errval_t err;
     for (struct AcpiMapping *walk = head; walk; prev = walk, walk = walk->next) {
         genvaddr_t walk_vaddr = vregion_get_base_addr(walk->vregion);
         genvaddr_t walk_end   = walk_vaddr + walk->length;
         // printf("0x%"PRIxGENVADDR", 0x%"PRIxGENVADDR"\n", walk_vaddr, walk_end);
         if (walk_vaddr <= vbase && walk_end >= vbase + length) {
+            ACPI_DEBUG("region: %#"PRIxGENVADDR", %zu pages\n",
+                    walk_vaddr, walk->length / BASE_PAGE_SIZE);
             // printf("match\n");
             walk->refcount--;
             if (!walk->refcount) {
-                vregion_destroy(walk->vregion);
-                memobj_destroy_anon((struct memobj *)walk->memobj);
+                ACPI_DEBUG("%s: last reference to region, cleaning up\n", __FUNCTION__);
+
+                // Remove from list
                 if (prev) {
                     prev->next = walk->next;
                 }
                 else { // we were head
                     head = walk->next;
                 }
-                for (int i = 0; i < walk->num_caps; i++) {
-                    // XXX: ensure that this never deletes a last copy?
-                    cap_destroy(walk->caps[i]);
+
+                // Delete vregion; do this first because vnode_unmap complains
+                // about missing caps if we mm_free() the backing caps first
+                err = vregion_destroy(walk->vregion);
+                if (err_is_fail(err)) {
+                    DEBUG_ERR(err, "%s: vregion_destroy", __FUNCTION__);
                 }
+
+                // return backing caps to MM
+                for (int page = 0; page < walk->num_caps; page++) {
+                    lpaddr_t pagebase = walk->pbase + page * BASE_PAGE_SIZE;
+                    err = mm_free(&pci_mm_physaddr, walk->caps[page],
+                            pagebase, BASE_PAGE_BITS);
+                    if (err_is_fail(err)) {
+                        DEBUG_ERR(err, "mm_free()");
+                    }
+                }
+
+                // memobj destroy will fail as backing caps are already
+                // deleted, so we don't check errors.
+                memobj_destroy_anon((struct memobj *)walk->memobj);
+
+                // Free malloc'd memory for element
+                free(walk->vregion);
+                free(walk->memobj);
                 free(walk->caps);
                 free(walk);
+
                 return;
             }
         }


chore(Unit): definitions of the unit framework

--- cplusplus/tyr/test/unit/tyr_unit.h
+++ cplusplus/tyr/test/unit/tyr_unit.h
@@ -32,9 +32,37 @@

 namespace tyr {

+template <typename Function>
 struct UnitCase {
+  typedef std::function<void (void)> CaseType;
+
+  std::string unit_name;
+  CaseType    unit_case;
+
+  UnitCase(const std::string& name, const CaseType& unit)
+    : unit_name(name)
+    , unit_case(unit) {
+  }
 };
+
+class UnitFramework : public Singleton<UnitFramework> {
+  std::vector<UnitCase> unit_list_;
+public:
+  int Run(void);
+  bool RegisterUnit(const char* name, const UnitCase::CaseType& unit);
+};
+
+int UnitPrint(const char* format, ...);

 }

+#define UNIT_RUN_ALL()  tyr::UnitFramework::Instance().Run()
+#define UNIT_IMPL(__name__)\
+static void tyr_Unit##__name__(void);\
+static bool tyr_boolean_##__name__ = tyr::UnitFramework::RegisterUnit(#__name__, tyr_Unit##__name__);\
+static void tyr_Unit##__name__(void)
+
+#define UNIT_PRINT(fmt, ...)  tyr::UnitPrint((fmt), ##__VA_ARGS__)
+#define CLASS_NAME(__class__) typeid(__class__).name()
+
 #endif  // __TYR_UNIT_HEADER_H__


cpu cortex-m3_common: cleanup thread_arch.c

--- cpu/cortex-m3_common/thread_arch.c
+++ cpu/cortex-m3_common/thread_arch.c
@@ -20,13 +20,14 @@
  */

 #include <stdint.h>
+#include <stdio.h>

 #include "arch/thread_arch.h"
+#include "thread.h"
 #include "sched.h"
 #include "irq.h"
 #include "cpu.h"
 #include "kernel_internal.h"
-

 /**
  * @name noticeable marker marking the beginning of a stack segment
@@ -41,10 +42,8 @@
  */
 #define EXCEPT_RET_TASK_MODE        (0xfffffffd)

-
 static void context_save(void);
 static void context_restore(void) NORETURN;
-static void enter_thread_mode(void) NORETURN;

 /**
  * Cortex-M3 knows stacks and handles register backups, so use different stack frame layout
@@ -92,103 +91,89 @@
         *stk = i;
     }

-    /* lr means exception return code  */
+    /* put LR to trigger return to thread stack pointer */
     stk--;
-    *stk = (uint32_t)EXCEPT_RET_TASK_MODE; /* return to task-mode main stack pointer */
+    *stk = (uint32_t)EXCEPT_RET_TASK_MODE;

     return (char*) stk;
 }

 void thread_arch_stack_print(void)
 {
-    /* TODO */
+    int count = 0;
+    uint32_t *sp = (uint32_t *)sched_active_thread->sp;
+
+    printf("printing the current stack of thread %u\n", thread_getpid());
+    printf("  address:      data:\n");
+
+    do {
+        printf("  0x%08x:   0x%08x\n", (unsigned int)sp, (unsigned int)*sp);
+        sp++;
+        count++;
+    } while (*sp != STACK_MARKER);
+
+    printf("current stack size: %u byte\n", count);
 }

-void thread_arch_start_threading(void)
+__attribute__((naked)) void thread_arch_start_threading(void)
 {
-    sched_run();
+    /* enable IRQs to make sure the SVC interrupt is reachable */
     enableIRQ();
-    enter_thread_mode();
+    /* trigger the SVC interrupt which will get and execute the next thread */
+    asm("svc    0x01");
 }

-/**
- * @brief Set the MCU into Thread-Mode and load the initial task from the stack and run it
- */
-void NORETURN enter_thread_mode(void)
+void thread_arch_yield(void)
 {
-    /* switch to user mode use PSP instead of MSP in ISR Mode*/
-    CONTROL_Type mode;
-    mode.w = __get_CONTROL();
-    mode.b.SPSEL = 1; /* select PSP */
-    mode.b.nPRIV = 0; /* privilege */
-    __set_CONTROL(mode.w);
+    /* trigger the PENDSV interrupt to run scheduler and schedule new thread if applicable */
+    SCB->ICSR |= SCB_ICSR_PENDSVSET_Msk;
+}

-    /* load pdc->stackpointer in r0 */
-    asm("ldr    r0, =sched_active_thread" );      /* r0 = &sched_active_thread */
-    asm("ldr    r0, [r0]"           );      /* r0 = *r0 = sched_active_thread */
-    asm("ldr    sp, [r0]"           );      /* sp = r0  restore stack pointer*/
-    asm("pop    {r4}"               );      /* skip exception return */
-    asm("pop    {r4-r11}"           );
-    asm("pop    {r0-r3,r12,lr}"     );      /* get registers from stack */
-    asm("pop    {r4}"               );      /* get PC */
-    asm("pop    {r5}"               );      /* discard the xPSR entry */
-    asm("mov    pc, r4"             );      /* load PC */
+__attribute__((always_inline)) static __INLINE void context_save(void)
+{
+    /* {r0-r3,r12,LR,PC,xPSR} are saved automatically on exception entry */
+
+    /* save unsaved registers onto the stack */
+    asm("mrs    r0, psp"                    );  /* get stack pointer from user mode */
+    asm("stmdb  r0!,{r4-r11}"               );  /* save regs */
+    asm("stmdb  r0!,{lr}"                   );  /* exception return value */
+    asm("ldr    r1, =sched_active_thread"   );  /* load address of current TCB */
+    asm("ldr    r1, [r1]"                   );  /* dereference TCB */
+    asm("str    r0, [r1]"                   );  /* write r0 to tcb->sp */
+}
+
+__attribute__((always_inline)) static __INLINE void context_restore(void)
+{
+    /* restore registers from stack */
+    asm("ldr    r0, =sched_active_thread"   );  /* load address of current TCB */
+    asm("ldr    r0, [r0]"                   );  /* dereference TCB */
+    asm("ldr    r1, [r0]"                   );  /* load tcb->sp to register 1 */
+    asm("ldmia  r1!, {r0}"                  );  /* restore exception return value from stack */
+    asm("ldmia  r1!, {r4-r11}"              );  /* restore other registers */
+    asm("msr    psp, r1"                    );  /* restore PSP register (user mode SP) */
+    asm("bx     r0"                         );  /* load exception return value to PC */
+
+    /* {r0-r3,r12,LR,PC,xPSR} are restored automatically on exception return */

     UNREACHABLE();
 }

-void thread_arch_yield(void)
+/**
+ * @brief The svc is used for running the scheduler and scheduling a new task during start-up or
+ *        after a thread has exited
+ */
+__attribute__((naked)) void isr_svc(void)
 {
-    if (irq_arch_in()) {
-        SCB->ICSR |= SCB_ICSR_PENDSVSET_Msk;    /* set PendSV Bit */
-    }
-    else {
-        asm("svc 0x01\n");                      /* trigger SVC interrupt, which will trigger the pendSV (needed?) */
-    }
+    sched_run();
+    context_restore();
 }

 /**
- * @brief SVC interrupt handler (to be discussed if this is really needed)
+ * @brief All task switching activity is carried out int the pendSV interrupt
  */
-__attribute__((naked)) void isr_svc(void)
-{
-    SCB->ICSR |= SCB_ICSR_PENDSVSET_Msk;    /* trigger the pendsv interrupt */
-    asm("bx     LR"                 );      /* load exception return value to PC causes end of exception*/
-}
-
 __attribute__((naked)) void isr_pendsv(void)
 {
     context_save();
     sched_run();
     context_restore();
 }
-
-__attribute__((always_inline)) static __INLINE void context_save(void)
-{
-    /* {r0-r3,r12,LR,PC,xPSR} are saved automatically on exception entry */
-
-    /* save unsaved registers */
-    asm("mrs    r0, psp"            );      /* get stack pointer from user mode */
-    asm("stmdb  r0!,{r4-r11}"       );      /* save regs */
-    asm("stmdb  r0!,{lr}"           );      /* exception return value */
-/*  asm("vstmdb sp!, {s16-s31}"     ); */   /* TODO save FPU registers if needed */
-    asm("ldr    r1, =sched_active_thread" );      /* load address of current tcb */
-    asm("ldr    r1, [r1]"           );      /* dereference pdc */
-    asm("str    r0, [r1]"           );      /* write r0 to pdc->sp means current threads stack pointer */
-}
-
-__attribute__((always_inline)) static __INLINE void context_restore(void)
-{
-    asm("ldr    r0, =sched_active_thread" );      /* load address of current TCB */
-    asm("ldr    r0, [r0]"           );      /* dereference TCB */
-    asm("ldr    r1, [r0]"           );      /* load tcb->sp to register 1 */
-    asm("ldmia  r1!, {r0}"          );      /* restore exception return value from stack */
-/*  asm("pop    {s16-s31}"          ); */   /* TODO load FPU register if needed depends on r0 exret */
-    asm("ldmia  r1!, {r4-r11}"      );      /* restore other registers */
-    asm("msr    psp, r1"            );      /* restore PSP register (user mode SP)*/
-    asm("bx     r0"                 );      /* load exception return value to PC causes end of exception*/
-
-    /* {r0-r3,r12,LR,PC,xPSR} are restored automatically on exception return */
-
-    UNREACHABLE();
-}


CrankShape3Polyhedron: Added VInfo, EInfo, FInfo structures.

--- crankshape/crankshape3polyhedron.h
+++ crankshape/crankshape3polyhedron.h
@@ -45,6 +45,40 @@
                           CrankShape3Finite)

 /**
+ * CrankShape3PolyhedronVInfo:
+ * @nedges: Number of edges.
+ * @edges: (array length=nedges): Edge ids.
+ * @faces: (array length=nedges): Face ids.
+ */
+typedef struct _CrankShape3PolyhedronVInfo {
+  guint nedges;
+  guint *edges;
+  guint *faces;
+} CrankShape3PolyhedronVInfo;
+
+/**
+ * CrankShape3PolyhedronEInfo:
+ * @verts: Vertices ids.
+ * @faces: Face ids.
+ */
+typedef struct _CrankShape3PolyhedronEInfo {
+  guint verts[2];
+  guint faces[2];
+} CrankShape3PolyhedronEInfo;
+
+/**
+ * CrankShape3PolyhedronFInfo:
+ * @nverts: Number of edges.
+ * @verts: (array length=nverts): Vertices ids.
+ * @edges: (array length=nverts): Face ids.
+ */
+typedef struct _CrankShape3PolyhedronFInfo {
+  guint nverts;
+  guint *verts;
+  guint *edges;
+} CrankShape3PolyhedronFInfo;
+
+/**
  * CrankShape3PolyhedronClass:
  * @get_nvertices: Slot for crank_shape3_polyhedron_get_nvertices()
  * @get_nedges: Slot for crank_shape3_polyhedron_get_nedges()


v2 [patch 2/6] wrapper.c: correct the return types

Steve Grubb was kind enough to do a review at
http://article.gmane.org/gmane.comp.lib.libcg.devel/2485
and pointed out that we were checking for unsigned values to be
negative. That is of course wrong, and we need to actually be
checking integers. Correct the return type so that the check
is valid once more.

Reported-by: Steve Grubb <17a7c7c605e476cc91b20e110a29a35a2402f1f4@redhat.com>
Signed-off-by: Dhaval Giani <f48451d72a1ad74c777093928b661ad7099a85df@gmail.com>
Acked-By: Jan Safranek <a7f4b96ffdd515ecef00f117294da18555749b0b@redhat.com>

--- src/wrapper.c
+++ src/wrapper.c
@@ -436,7 +436,7 @@
 					const char *name, int64_t value)
 {
 	int i;
-	unsigned ret;
+	int ret;

 	if (!controller)
 		return ECGINVAL;
@@ -484,7 +484,7 @@
 					const char *name, u_int64_t value)
 {
 	int i;
-	unsigned ret;
+	int ret;

 	if (!controller)
 		return ECGINVAL;
@@ -538,7 +538,7 @@
 						const char *name, bool value)
 {
 	int i;
-	unsigned ret;
+	int ret;

 	if (!controller)
 		return ECGINVAL;


Somewhat better message from failed checkData()

--- src/pl-pro.c
+++ src/pl-pro.c
@@ -623,23 +623,24 @@
   }

   { Functor f = valueTerm(*p);
-    mark(p);

     if ( !onGlobal(f) )
       printk("Term at %p not on global stack", f);

     if ( tag(f->definition) != TAG_ATOM ||
          storage(f->definition) != STG_GLOBAL )
-      printk("Illegal term: 0x%x", *p);
+      printk("Illegal functor: 0x%x", *p);
     if ( f->definition & MARK_MASK )
-      printk("Term with mark: 0x%x", *p);
+      printk("functor with mark: 0x%x", *p);
     if ( f->definition & FIRST_MASK )
-      printk("Term with first: 0x%x", *p);
+      printk("functor with first: 0x%x", *p);
     arity = arityFunctor(f->definition);
     if ( arity < 0 )
       printk("Illegal arity (%d)", arity);
     else if ( arity > 256 && !is_ht_capacity(arity) )
       printk("Dubious arity (%d)", arity);
+
+    mark(p);
     for(n=0; n<arity-1; n++)
       key += check_data(&f->arguments[n], recursive PASS_LD);


FIXED: Failing autoload-predicate calls when in debug-mode.

--- src/pl-vmi.c
+++ src/pl-vmi.c
@@ -1602,7 +1602,14 @@
       SAVE_REGISTERS(qid);
       DEF = getProcDefinedDefinition(DEF PASS_LD);
       LOAD_REGISTERS(qid);
-      FR->predicate = DEF;
+      if ( FR->predicate != DEF )		/* auto imported/loaded */
+      { FR->predicate = DEF;
+#ifdef O_PROFILE
+        if ( FR->prof_node )
+	  profSetHandle(FR->prof_node, DEF);
+#endif
+        goto retry_continue;
+      }
       set(FR, FR_INBOX);

       SAVE_REGISTERS(qid);


Added compile comment to solve_direct

Added compile comment to solve_direct

--- utilities/solve_direct.c
+++ utilities/solve_direct.c
@@ -1,3 +1,8 @@
+/*
+module load intel-para/2015-07
+g++ solve_direct.c -o solve_direct -lmkl_intel_lp64 -lmkl_sequential -lmkl_core -liomp5 -lpthread -std=c++11
+*/
+
 #include <iostream>
 #include <vector>
 #include <complex.h>


Small optimization

Small optimization

--- src/pl-vmi.c
+++ src/pl-vmi.c
@@ -2460,7 +2460,7 @@
   if ( bfr == ch )
   { BFR = bfr->parent;
   } else
-  { for(; bfr; bfr=bfr->parent)
+  { for(; bfr >= ch; bfr=bfr->parent)
     { if ( bfr->parent == ch )
       { bfr->parent = ch->parent;
 	break;


Add documentation

Add documentation

--- GRRMOD/GRRMOD_core.c
+++ GRRMOD/GRRMOD_core.c
@@ -244,6 +244,7 @@
 /**
  * Set a buffer to update. This routine is called inside a thread.
  * @param arg Not used.
+ * @return Always returns NULL.
  */
 static void* player(void *arg) {
 #ifdef _GRRMOD_DEBUG
@@ -273,11 +274,13 @@
     }
     thr_running = false;

-    return 0;
+    return NULL;
 }

 /**
  * Callback function for AESND_AllocateVoice.
+ * @param pb Pointer to buffer.
+ * @param state Voice state.
  */
 static void __aesndvoicecallback(AESNDPB *pb, u32 state) {
     switch(state) {


fix atapi_initialize()

fix atapi_initialize()

--- cbus/atapicmd.c
+++ cbus/atapicmd.c
@@ -1175,5 +1175,35 @@
 	sendabort(drv);
 }

+void atapi_initialize(void) {
+#if defined(_WINDOWS)
+	UINT32 dwID = 0;
+	//if(!pic_cs_initialized){
+	//	memset(&pic_cs, 0, sizeof(pic_cs));
+	//	InitializeCriticalSection(&pic_cs);
+	//	pic_cs_initialized = 1;
+	//}
+	if(!atapi_thread_initialized){
+		atapi_thread_initialized = 1;
+		atapi_thread = (HANDLE)_beginthreadex(NULL, 0, atapi_dataread_threadfunc, NULL, CREATE_SUSPENDED, &dwID);
+	}
+#else
+	// TODO: WindowspR[h
+#endif
+}
+
+void atapi_deinitialize(void) {
+#if defined(_WINDOWS)
+	if(atapi_thread_initialized){
+		atapi_thread_initialized = 0;
+		while(((int)ResumeThread(atapi_thread)) > 0);
+		WaitForSingleObject(atapi_thread,  INFINITE);
+		CloseHandle(atapi_thread);
+		atapi_thread = NULL;
+	}
+#else
+	// TODO: WindowspR[h
+#endif
+}
 #endif	/* SUPPORT_IDEIO */


Turn $qlf_close into no-op if no qlf is opened.

--- src/pl-wic.c
+++ src/pl-wic.c
@@ -2617,7 +2617,11 @@
 word
 pl_qlf_close()
 { GET_LD
-  return qlfClose(PASS_LD1);
+
+  if ( wicFd )
+    return qlfClose(PASS_LD1);
+
+  succeed;
 }


fix missing timeout on stream death

fix missing timeout on stream death

--- src/player.c
+++ src/player.c
@@ -779,10 +779,8 @@
 		 * this may happen when a stream is played and the network connection
 		 * changes - most likely due to a DSL reconnect.
 		 */
-		if( (i == 0) &&
-				(control->mpmode & PM_STREAM) &&
-				((control->status == mpc_start) ||
-				 (control->mpmode & PM_SWITCH))) {
+		if( (i == 0) && (control->mpmode & PM_STREAM) &&
+				(control->status != mpc_idle) ) {
 			control->watchdog++;
 			if ( control->watchdog > STREAM_TIMEOUT ) {
 				addMessage(-1, "Player froze!");


Copy editing for grammar and cohesion.

Copy editing for grammar and cohesion.

--- src/player.c
+++ src/player.c
@@ -31,10 +31,10 @@
 				inv_rm(PLYRT.inv, i);
 				memo("You pick up the %s", PLYR.inv->itms[j]->f->name);
 			} else {
-				memo("You cannot pick up the %s.", PLYRT.inv->itms[i]->f->name);
+				memo("The %s is to heavy to pick up.", PLYRT.inv->itms[i]->f->name);
 			}
 		} else {
-			memo("There is no such item.");
+			memo("You try to pick it up, but then you realize it does not exist.");
 		}

 		redraw();
@@ -51,7 +51,7 @@
 		if((j=inv_add(PLYRT.inv,PLYR.inv->itms[i]))!=INVALID){
 			PLYR.inv->itms[i]->i=j;
 			inv_rm(PLYR.inv,i);
-			memo("You Dropped %s",PLYRT.inv->itms[j]->f->name);
+			memo("You dropped the %s",PLYRT.inv->itms[j]->f->name);
 		}else{
 			memo("You cannot drop the %s.",PLYR.inv->itms[i]->f->name);
 		}
@@ -64,7 +64,7 @@

 void plyr_act_inv(void)
 {
-	inv_prompt("Your inventory:", PLYR.inv, &PLYR);
+	inv_prompt("You examine the contents of your inventory:", PLYR.inv, &PLYR);
 	redraw();
 }

@@ -80,7 +80,7 @@
 		if (t != NULL && t->crtr != NULL) {
 			switch (dam = crtr_attack(&PLYR, t->crtr)) {
 			case DEAD:
-				memo("You kill the %s", t->crtr->f->name);
+				memo("You slay the %s.", t->crtr->f->name);
 				crtr_free(t->crtr);
 				t->crtr = NULL;

@@ -88,10 +88,10 @@
 				wrefresh(dispscr);
 				break;
 			case 0:
-				memo("You miss");
+				memo("You miss.");
 				break;
 			default:
-				memo("You hit for %d damage", dam);
+				memo("You hit for %d damage.", dam);
 				break;
 			}
 		}
@@ -103,7 +103,7 @@
 	int i;
 	item * it;

-	i = inv_prompt("What dost thy consume?", PLYR.inv, &PLYR);
+	i = inv_prompt("What dost thou consume?", PLYR.inv, &PLYR);

 	if(PLYR.inv->size > i && PLYR.inv->itms[i]!=NULL){
 		it = PLYR.inv->itms[i];
@@ -115,7 +115,7 @@
 		if (PLYR.health  > PLYR.f->max_health ) PLYR.health  = PLYR.f->max_health;
 		if (PLYR.stamina > PLYR.f->max_stamina) PLYR.stamina = PLYR.f->max_stamina;

-		memo("Thy dost consume the %s.", it->f->name);
+		memo("Thou dost consume the %s.", it->f->name);
 		item_free(it);
 	}else{
 		memo("Such an item existeth not.");
@@ -129,13 +129,13 @@
 	int i;
 	item * it;

-	i = inv_prompt("What dost thy equip?", PLYR.inv, &PLYR);
+	i = inv_prompt("What dost thou equip?", PLYR.inv, &PLYR);

 	if (PLYR.inv->size > i && PLYR.inv->itms[i] != NULL && PLYR.inv->itms[i]->f->type == EQUIPABLE){
 		it = PLYR.inv->itms[i];
 		crtr_equip(&PLYR, it, it->f->u.eq.slot);

-		memo("Thy dost equip the %s.", it->f->name);
+		memo("Thou dost equip the %s.", it->f->name);
 	}else{
 		memo("Such an item existeth not.");
 	}


Mark all drivers as resident, not just qt driver, since we have had issues in the past with other drivers (e.g. cairo driver) which would likely have been solved by this patch.

svn path=/trunk/; revision=11914

--- src/plcore.c
+++ src/plcore.c
@@ -3272,10 +3272,11 @@
             driver->drvnam, drvspec );

         driver->dlhand = lt_dlopenext( drvspec );
-
-        if (strcmp(driver->drvnam,"qt") == 0) {
-          lt_dlmakeresident(driver->dlhand);
-        }
+
+        // Mark all drivers resident to prevent problems
+        // with atexit handlers / library reinitialisation such
+        // as those seen with qt and cairo drivers.
+        lt_dlmakeresident(driver->dlhand);
     }

 // If it still isn't loaded, then we're doomed.


Change plP_image() to support pldifilt() rotation/translation/clipping.

svn path=/trunk/; revision=3421

--- src/plcore.c
+++ src/plcore.c
@@ -2544,20 +2544,29 @@

   npts = nx*ny;
   if (plsc->difilt) {
+    PLINT clpxmi, clpxma, clpymi, clpyma;
+
     xscl = (PLINT *) malloc(nx*ny*sizeof(PLINT));
     yscl = (PLINT *) malloc(nx*ny*sizeof(PLINT));
     for (i = 0; i < npts; i++) {
       xscl[i] = x[i];
       yscl[i] = y[i];
     }
-    printf("plcore.c: plP_image(), FIXME\n");
-    exit(0); /* *** FIXME *** */
-
-    /* difiltShort(xscl, yscl, npts, &clpxmi, &clpxma, &clpymi, &clpyma); */
+    difilt(xscl, yscl, npts, &clpxmi, &clpxma, &clpymi, &clpyma);
+    plsc->imclxmin = clpxmi;
+    plsc->imclymin = clpymi;
+    plsc->imclxmax = clpxma;
+    plsc->imclymax = clpyma;
+
     grimage(xscl, yscl, z, nx, ny);
+
     free(xscl);
     free(yscl);
   } else {
+    plsc->imclxmin = plsc->phyxmi;
+    plsc->imclymin = plsc->phyymi;
+    plsc->imclxmax = plsc->phyxma;
+    plsc->imclymax = plsc->phyyma;
     grimage(x, y, z, nx, ny );
   }
 }


Bug fix: changed declarations of xclp[] and yclp[] from static to local
variables in plP_pllclp() and plP_plfclp(). plP_pllclp can call itself
consequently it needs local variables. Fixed problem with dash line and
orientation=1.  (Submitted by Wesley Ebisuzaki)

svn path=/trunk/; revision=664

--- src/plline.c
+++ src/plline.c
@@ -1,8 +1,14 @@
 /* $Id$
    $Log$
-   Revision 1.9  1993/07/31 08:18:34  mjl
-   Clipping routine for polygons added (preliminary).
-
+   Revision 1.10  1994/01/17 19:27:15  mjl
+   Bug fix: changed declarations of xclp[] and yclp[] from static to local
+   variables in plP_pllclp() and plP_plfclp(). plP_pllclp can call itself
+   consequently it needs local variables. Fixed problem with dash line and
+   orientation=1.  (Submitted by Wesley Ebisuzaki)
+
+ * Revision 1.9  1993/07/31  08:18:34  mjl
+ * Clipping routine for polygons added (preliminary).
+ *
  * Revision 1.8  1993/07/01  22:18:13  mjl
  * Changed all plplot source files to include plplotP.h (private) rather than
  * plplot.h.  Rationalized namespace -- all externally-visible internal
@@ -23,7 +29,6 @@
 #define INSIDE(ix,iy) (BETW(ix,xmin,xmax) && BETW(iy,ymin,ymax))

 static PLINT xline[PL_MAXPOLYLINE], yline[PL_MAXPOLYLINE];
-static short xclp[PL_MAXPOLYLINE], yclp[PL_MAXPOLYLINE];

 static PLINT lastx = UNDEFINED, lasty = UNDEFINED;

@@ -243,6 +248,7 @@
 {
     PLINT x1, x2, y1, y2;
     PLINT i, iclp = 0;
+    short xclp[PL_MAXPOLYLINE], yclp[PL_MAXPOLYLINE];
     int drawable;

     for (i = 0; i < npts - 1; i++) {
@@ -312,6 +318,7 @@
 {
     PLINT x1, x2, y1, y2;
     PLINT i, iclp = 0;
+    short xclp[PL_MAXPOLYLINE], yclp[PL_MAXPOLYLINE];
     int drawable;

     iclp = 0;


Correct typo; PLP_pointinpolygon ==> plP_pointinpolygon.

svn path=/trunk/; revision=10634

--- src/plline.c
+++ src/plline.c
@@ -1450,13 +1450,13 @@
         xflt[i] = (PLFLT) x[i];
         yflt[i] = (PLFLT) y[i];
     }
-    return_value = PLP_pointinpolygon( n, xflt, yflt, (PLFLT) xp, (PLFLT) yp );
+    return_value = plP_pointinpolygon( n, xflt, yflt, (PLFLT) xp, (PLFLT) yp );
     free( xflt );
     free( yflt );
     return return_value;
 }
 /*----------------------------------------------------------------------*\
- * int PLP_pointinpolygon()
+ * int plP_pointinpolygon()
  *
  * Returns 1 if the point is inside the polygon, 0 otherwise
  * Notes:
@@ -1468,7 +1468,7 @@
  \*----------------------------------------------------------------------*/

 int
-PLP_pointinpolygon( PLINT n, PLFLT *x, PLFLT *y, PLFLT xp, PLFLT yp )
+plP_pointinpolygon( PLINT n, PLFLT *x, PLFLT *y, PLFLT xp, PLFLT yp )
 {
     int   i;
     int   count_crossings;


plugin.h: Update docs

plugin.h: Update docs

--- src/plugin.h
+++ src/plugin.h
@@ -1,5 +1,5 @@
-#ifndef INC_PLUGIN_H
-#define INC_PLUGIN_H
+#ifndef CG_PLUGIN_H
+#define CG_PLUGIN_H

 #include "utils.h"

@@ -9,17 +9,47 @@

   class Plugin;

+  /**
+   * @brief Base class for all plugin factories.
+   *
+   * Each plugin factory implements the type() method which is used to match
+   * the correct plugin with the type field in the General section of the
+   * *.ini files. A plugin factory also implements the instance() method to
+   * return a newly created instance of the correct plugin.
+   *
+   * Inside a plugin implementation file, it is succicient to use the
+   * PLUGIN_FACTORY macro with the correct parameters.
+   */
   class PluginFactory
   {
     public:
       /**
-       * Get the plugin type. This is the 'type' in field in the 'General'
-       * section of the ini file.
+       * @brief Get the plugin type.
+       *
+       * This is the 'type' in field in the 'General' section of the ini file.
+       *
+       * @return The plugin type.
        */
       virtual std::string type() const = 0;
+
+      /**
+       * @brief Get a new instance of the plugin.
+       *
+       * The instance that is returned is a newly created object and should be
+       * deleted when it is not needed anymore.
+       *
+       * @return A pointer to a new instance of the plugin.
+       */
       virtual Plugin* instance() const = 0;
   };

+  /**
+   * @brief Macro used to generate code for a plugin factory.
+   *
+   * @param type_str The plugin type as defined in the General section of the
+   *        *.ini files.
+   * @param klass The class name of the plugin class.
+   */
 #define PLUGIN_FACTORY(type_str, klass) \
   class klass##Factory : public PluginFactory \
   { \
@@ -30,20 +60,41 @@
   }; \
   klass##Factory the##klass##Factory;

+  /**
+   * @brief Base class for all plugins to generate images.
+   *
+   * Each derived plugin class implements the image() method to generate the
+   * image for a certain type that is found in the General section of the
+   * *.ini configuration files.
+   */
   class Plugin
   {
     public:
+      /**
+       * @brief Destructor.
+       */
       virtual ~Plugin()
       {
       }

       /**
-       * Get the generated image.
+       * @brief Get the generated image.
+       *
+       * Subclasses implement this method to generate the required image for
+       * their type.
+       *
+       * @param conf The ini configuration.
+       *
+       * @return The generated image.
        */
       virtual img::EasyImage image(const ini::Configuration &conf) = 0;

       /**
-       * Get a list of all plugins.
+       * @brief Get a list of all plugin factories.
+       *
+       * This method can be used to enumerate all available plugin types.
+       *
+       * @return List of plugin factories.
        */
       static std::list<PluginFactory*>& pluginFactories()
       {
@@ -58,6 +109,16 @@
         pluginFactories().push_back(factory);
       }

+      /**
+       * @brief Find the plugin for the specified type and create an instance
+       * of it.
+       *
+       * @param type The plugin type as defined in the General section of the
+       *        *.ini files.
+       *
+       * @return An instance of the plugin type or 0 if there is no plugin for
+       * the specified type.
+       */
       static Plugin* findPlugin(const std::string &type)
       {
         std::list<PluginFactory*> &list = pluginFactories();


Check for nil.

Check for nil.

--- sql/backends/monet5/sql.c
+++ sql/backends/monet5/sql.c
@@ -1634,7 +1634,7 @@
 		}
 		return MAL_SUCCEED;
 	}
-	if (*sname)
+	if (*sname && strcmp(*sname, str_nil) != 0)
 		throw(SQL, "sql.bind", "unable to find %s.%s(%s)", *sname, *tname, *cname);
 	throw(SQL, "sql.bind", "unable to find %s(%s)", *tname, *cname);
 }


Fix r8-as-r9 and SIMD format widths when printing x86 signal fpstate (#3811)

Fixes a bug where r8's value is printed for r9 in signal fpstate.
Changes incorrect 2-byte output formatting to 4-byte for ymmh and
32-bit xmm.

--- core/unix/signal_linux_x86.c
+++ core/unix/signal_linux_x86.c
@@ -417,7 +417,7 @@
     for (i = 0; i < 8; i++) {
         LOG(THREAD, LOG_ASYNCH, 1, "\txmm%d = ", i);
         for (j = 0; j < 4; j++)
-            LOG(THREAD, LOG_ASYNCH, 1, "%04x ", fp->_xmm[i].element[j]);
+            LOG(THREAD, LOG_ASYNCH, 1, "%08x ", fp->_xmm[i].element[j]);
         LOG(THREAD, LOG_ASYNCH, 1, "\n");
     }
 #    endif
@@ -435,7 +435,7 @@
             for (i = 0; i < proc_num_simd_sse_avx_registers(); i++) {
                 LOG(THREAD, LOG_ASYNCH, 1, "\tymmh%d = ", i);
                 for (j = 0; j < 4; j++) {
-                    LOG(THREAD, LOG_ASYNCH, 1, "%04x ",
+                    LOG(THREAD, LOG_ASYNCH, 1, "%08x",
                         xstate->ymmh.ymmh_space[i * 4 + j]);
                 }
                 LOG(THREAD, LOG_ASYNCH, 1, "\n");
@@ -466,7 +466,7 @@
     LOG(THREAD, LOG_ASYNCH, 1, "\txax=" PFX "\n", sc->SC_XAX);
 #    ifdef X64
     LOG(THREAD, LOG_ASYNCH, 1, "\t r8=" PFX "\n", sc->r8);
-    LOG(THREAD, LOG_ASYNCH, 1, "\t r9=" PFX "\n", sc->r8);
+    LOG(THREAD, LOG_ASYNCH, 1, "\t r9=" PFX "\n", sc->r9);
     LOG(THREAD, LOG_ASYNCH, 1, "\tr10=" PFX "\n", sc->r10);
     LOG(THREAD, LOG_ASYNCH, 1, "\tr11=" PFX "\n", sc->r11);
     LOG(THREAD, LOG_ASYNCH, 1, "\tr12=" PFX "\n", sc->r12);


ifdef instead of if on CONFIG_APPLET_CPU_STATUS

--- src/wmtaskbar.h
+++ src/wmtaskbar.h
@@ -9,7 +9,7 @@
 #include "yxtray.h"

 class ObjectBar;
-#if CONFIG_APPLET_CPU_STATUS
+#ifdef CONFIG_APPLET_CPU_STATUS
 class CPUStatus;
 #endif
 #ifdef CONFIG_APPLET_NET_STATUS


rpmdb.c: minor changes

rpmdb.c: minor changes

--- rpmdb/rpmdb.c
+++ rpmdb/rpmdb.c
@@ -2333,15 +2333,14 @@
     return rc;
 }

-
 Header rpmdbNextIterator(rpmdbMatchIterator mi)
 {
     dbiIndex dbi;
-    void * uh;
-    size_t uhlen;
     DBT k = DBT_INIT;
     DBT v = DBT_INIT;
     union _dbswap mi_offset;
+    void * uh;
+    size_t uhlen;
     int rc;
     int xx;

@@ -3262,8 +3261,8 @@
 /*@=compmempass@*/
 		    xx = dbiSync(dbi, 0);
 		}
-v.data = _free(v.data);
-v.size = 0;
+		v.data = _free(v.data); /* headerUnload */
+		v.size = 0;
 		xx = dbiCclose(dbi, dbcursor, DB_WRITECURSOR);
 		if (!dbi->dbi_no_dbsync)
 		    xx = dbiSync(dbi, 0);


Include evas asynchronous feature.

Include evas asynchronous feature.

SVN revision: 36019


Graphics: Add some debug to dfb_gfxcard_batchblit2() software path, still unimplemented.

--- src/core/gfxcard.c
+++ src/core/gfxcard.c
@@ -2546,28 +2546,30 @@
      }

      if (i < num) {
-          if (state->render_options & DSRO_MATRIX) {
-               D_UNIMPLEMENTED();
-          }
-          else {
-               D_UNIMPLEMENTED();
-/*
-               if (gAcquire( state, DFXL_BLIT2 )) {
-                    for (; i<num; i++) {
-                         if (dfb_clip_blit_precheck( &state->clip,
-                                                     rects[i].w, rects[i].h,
-                                                     points[i].x, points[i].y ))
-                         {
-                              dfb_clip_blit( &state->clip, &rects[i],
-                                             &points[i].x, &points[i].y );
-
-                              gBlit( state, &rects[i], points[i].x, points[i].y );
-                         }
-                    }
-
-                    gRelease( state );
-               }
-*/
+          D_UNIMPLEMENTED();
+
+          for (; i<num; i++) {
+               D_DEBUG_AT( Core_GraphicsOps, "  -> rects[%d]   " DFB_RECT_FORMAT "\n", i, DFB_RECTANGLE_VALS( &rects[i] ) );
+               D_DEBUG_AT( Core_GraphicsOps, "  -> points[%d]   %4d,%4d\n", i, points[i].x, points[i].y );
+               D_DEBUG_AT( Core_GraphicsOps, "  -> points2[%d]  %4d,%4d\n", i, points2[i].x, points2[i].y );
+
+               if ((state->render_options & DSRO_MATRIX) ||
+                   dfb_clip_blit_precheck( &state->clip,
+                                           rects[i].w, rects[i].h,
+                                           points[i].x, points[i].y ))
+               {
+                    int dx = points[i].x;
+                    int dy = points[i].y;
+
+                    dfb_clip_blit( &state->clip, &rects[i], &dx, &dy );
+
+                    points2[i].x += dx - points[i].x;
+                    points2[i].y += dy - points[i].y;
+
+                    D_DEBUG_AT( Core_GraphicsOps, "  => rects[%d]   " DFB_RECT_FORMAT "\n", i, DFB_RECTANGLE_VALS( &rects[i] ) );
+                    D_DEBUG_AT( Core_GraphicsOps, "  => points[%d]   %4d,%4d\n", i, dx, dy );
+                    D_DEBUG_AT( Core_GraphicsOps, "  => points2[%d]  %4d,%4d\n", i, points2[i].x, points2[i].y );
+               }
           }
      }


Properly implement the Unicode line break rules for contracted braille windows. (dm)

git-svn-id: 30a5f035a20f1bc647618dbad7eea2a951b61b7c@3583 91a5dbb7-01b9-0310-9b5f-b28072856b6e

--- Programs/ctb_translate.c
+++ Programs/ctb_translate.c
@@ -404,38 +404,310 @@
   return putBytes(sequence+1, *sequence);
 }

-static int
-canBreakLine (wchar_t c1, wchar_t c2) {
+static void
+findLineBreakOpportunities (unsigned char *opportunities, const wchar_t *characters, size_t length) {
 #ifdef HAVE_LIBICUUC
-  ULineBreak lb1 = u_getIntPropertyValue(c1, UCHAR_LINE_BREAK);
-  ULineBreak lb2 = u_getIntPropertyValue(c2, UCHAR_LINE_BREAK);
-  if (lb1 == U_LB_MANDATORY_BREAK) return 1;
-  if (lb1 == U_LB_CARRIAGE_RETURN) return (c1 != WC_C('\r')) || (c2 != WC_C('\n'));
-  if (lb1 == U_LB_LINE_FEED) return 1;
-  if (lb2 == U_LB_COMBINING_MARK) return 0;
-  if (lb1 == U_LB_NEXT_LINE) return 1;
-  if ((lb1 == U_LB_SURROGATE) || (lb2 == U_LB_SURROGATE)) return 0;
-  if ((lb1 == U_LB_WORD_JOINER) || (lb2 == U_LB_WORD_JOINER)) return 0;
-  if (lb1 == U_LB_ZWSPACE) return 1;
-  if ((lb1 == U_LB_GLUE) || (lb2 == U_LB_GLUE)) return 0;
-  if (lb1 == U_LB_SPACE) return 1;
-  if ((lb1 == U_LB_BREAK_BOTH) || (lb2 == U_LB_BREAK_BOTH)) return 1;
-  if (lb1 == U_LB_BREAK_AFTER) return 1;
-  if (lb2 == U_LB_BREAK_BEFORE) return 1;
-  if (lb2 == U_LB_CLOSE_PUNCTUATION) return 0;
-  if (lb2 == U_LB_EXCLAMATION) return 0;
-  if (lb1 == U_LB_OPEN_PUNCTUATION) return 0;
-  if (lb2 == U_LB_INFIX_NUMERIC) return 0;
-  if ((lb1 == U_LB_INFIX_NUMERIC) && (lb2 == U_LB_NUMERIC)) return 0;
-  if ((lb1 == U_LB_NUMERIC) && (lb2 == U_LB_NUMERIC)) return 0;
-  if ((lb1 == U_LB_NUMERIC) && (lb2 == U_LB_POSTFIX_NUMERIC)) return 0;
-  if ((lb1 == U_LB_PREFIX_NUMERIC) && (lb2 == U_LB_NUMERIC)) return 0;
-  if (lb1 == U_LB_BREAK_SYMBOLS) return 1;
-  if (lb1 == U_LB_IDEOGRAPHIC) return 1;
+  if (length > 0) {
+    ULineBreak lineBreakTypes[length];
+
+    {
+      int i;
+      for (i=0; i<length; i+=1) {
+        lineBreakTypes[i] = u_getIntPropertyValue(characters[i], UCHAR_LINE_BREAK);
+      }
+    }
+    if (lineBreakTypes[0] == U_LB_COMBINING_MARK) lineBreakTypes[0] = U_LB_ALPHABETIC;
+
+    opportunities[0] = 0;
+    {
+      ULineBreak indirect = U_LB_SPACE;
+      int limit = length - 1;
+      int index = 0;
+
+      while (index < limit) {
+        ULineBreak before = lineBreakTypes[index];
+        ULineBreak after = lineBreakTypes[++index];
+        unsigned char *opportunity = &opportunities[index];
+
+        if (before != U_LB_SPACE) indirect = before;
+
+        if ((before == U_LB_CARRIAGE_RETURN) && (after == U_LB_LINE_FEED)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_MANDATORY_BREAK) ||
+            (before == U_LB_CARRIAGE_RETURN) ||
+            (before == U_LB_LINE_FEED) ||
+            (before == U_LB_NEXT_LINE)) {
+          *opportunity = 1;
+          continue;
+        }
+
+        if ((after == U_LB_MANDATORY_BREAK) ||
+            (after == U_LB_CARRIAGE_RETURN) ||
+            (after == U_LB_LINE_FEED) ||
+            (after == U_LB_NEXT_LINE)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((after == U_LB_SPACE) || (after == U_LB_ZWSPACE)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if (before == U_LB_ZWSPACE) {
+          *opportunity = 1;
+          continue;
+        }
+
+        if (after == U_LB_COMBINING_MARK) {
+          if ((before == U_LB_MANDATORY_BREAK) ||
+              (before == U_LB_CARRIAGE_RETURN) ||
+              (before == U_LB_LINE_FEED) ||
+              (before == U_LB_NEXT_LINE) ||
+              (before == U_LB_SPACE) ||
+              (before == U_LB_ZWSPACE)) {
+            before = U_LB_ALPHABETIC;
+          }
+
+          lineBreakTypes[index] = before;
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_WORD_JOINER) || (after == U_LB_WORD_JOINER)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_GLUE) ||
+            ((before != U_LB_SPACE) && (after == U_LB_GLUE))) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((after == U_LB_CLOSE_PUNCTUATION) ||
+            (after == U_LB_EXCLAMATION) ||
+            (after == U_LB_INFIX_NUMERIC) ||
+            (after == U_LB_BREAK_SYMBOLS)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if (indirect == U_LB_OPEN_PUNCTUATION) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((indirect == U_LB_QUOTATION) && (after == U_LB_OPEN_PUNCTUATION)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((indirect == U_LB_CLOSE_PUNCTUATION) && (after == U_LB_NONSTARTER)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((indirect == U_LB_BREAK_BOTH) && (after == U_LB_BREAK_BOTH)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if (before == U_LB_SPACE) {
+          *opportunity = 1;
+          continue;
+        }
+
+        if ((before == U_LB_QUOTATION) || (after == U_LB_QUOTATION)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((after == U_LB_CONTINGENT_BREAK) || (before == U_LB_CONTINGENT_BREAK)) {
+          *opportunity = 1;
+          continue;
+        }
+
+        if ((after == U_LB_BREAK_AFTER) ||
+            (after == U_LB_HYPHEN) ||
+            (after == U_LB_NONSTARTER) ||
+            (before == U_LB_BREAK_BEFORE)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((after == U_LB_INSEPARABLE) &&
+            ((before == U_LB_ALPHABETIC) ||
+             (before == U_LB_IDEOGRAPHIC) ||
+             (before == U_LB_INSEPARABLE) ||
+             (before == U_LB_NUMERIC))) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_IDEOGRAPHIC) && (after == U_LB_POSTFIX_NUMERIC) &&
+            (before == U_LB_ALPHABETIC) && (after == U_LB_NUMERIC) &&
+            (before == U_LB_NUMERIC) && (after == U_LB_ALPHABETIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_PREFIX_NUMERIC) && (after == U_LB_IDEOGRAPHIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_PREFIX_NUMERIC) && (after == U_LB_ALPHABETIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_POSTFIX_NUMERIC) && (after == U_LB_ALPHABETIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_CLOSE_PUNCTUATION) && (after == U_LB_POSTFIX_NUMERIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_CLOSE_PUNCTUATION) && (after == U_LB_PREFIX_NUMERIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_NUMERIC) && (after == U_LB_POSTFIX_NUMERIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_NUMERIC) && (after == U_LB_PREFIX_NUMERIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_POSTFIX_NUMERIC) && (after == U_LB_OPEN_PUNCTUATION)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_POSTFIX_NUMERIC) && (after == U_LB_NUMERIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_PREFIX_NUMERIC) && (after == U_LB_OPEN_PUNCTUATION)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_PREFIX_NUMERIC) && (after == U_LB_NUMERIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_HYPHEN) && (after == U_LB_NUMERIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_INFIX_NUMERIC) && (after == U_LB_NUMERIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_NUMERIC) && (after == U_LB_NUMERIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_BREAK_SYMBOLS) && (after == U_LB_NUMERIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_JL) &&
+            ((after == U_LB_JL) ||
+             (after == U_LB_JV) ||
+             (after == U_LB_H2) ||
+             (after == U_LB_H3))) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if (((before == U_LB_JV) || (before == U_LB_H2)) &&
+            ((after == U_LB_JV) || (after == U_LB_JT))) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if (((before == U_LB_JT) || (before == U_LB_H3)) &&
+            (after == U_LB_JT)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if (((before == U_LB_JL) || (before == U_LB_JV) || (before == U_LB_JT) ||
+             (before == U_LB_H2) || (before == U_LB_H3)) &&
+            (after == U_LB_INSEPARABLE)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if (((before == U_LB_JL) || (before == U_LB_JV) || (before == U_LB_JT) ||
+             (before == U_LB_H2) || (before == U_LB_H3)) &&
+            (after == U_LB_POSTFIX_NUMERIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_PREFIX_NUMERIC) &&
+            ((after == U_LB_JL) || (after == U_LB_JV) || (after == U_LB_JT) ||
+             (after == U_LB_H2) || (after == U_LB_H3))) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_ALPHABETIC) && (after == U_LB_ALPHABETIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_INFIX_NUMERIC) && (after == U_LB_ALPHABETIC)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if (((before == U_LB_ALPHABETIC) || (before == U_LB_NUMERIC)) &&
+            (after == U_LB_OPEN_PUNCTUATION)) {
+          *opportunity = 0;
+          continue;
+        }
+
+        if ((before == U_LB_CLOSE_PUNCTUATION) &&
+            ((after == U_LB_ALPHABETIC) || (after == U_LB_NUMERIC))) {
+          *opportunity = 0;
+          continue;
+        }
+
+        *opportunity = 1;
+      }
+    }
+  }
 #else /* HAVE_LIBICUUC */
-  if (testCharacter(c1, CTC_Space)) return 1;
+  int wasSpace = 0;
+  int index;
+
+  for (index=0; index<length; index+=1) {
+    int isSpace = testCharacter(characters[index], CTC_Space);
+    opportunities[index] = wasSpace && !isSpace;
+    wasSpace = isSpace;
+  }
 #endif /* HAVE_LIBICUUC */
-  return 0;
 }

 int
@@ -447,7 +719,9 @@
 ) {
   const wchar_t *srcword = NULL;
   BYTE *destword = NULL; /* last word transla1ted */
+  BYTE *destlast = NULL;
   const wchar_t *literal = NULL;
+  unsigned char lineBreakOpportunities[*inputLength];

   if (!(table = (ContractionTableHeader *)contractionTable)) return 0;
   srcmax = (srcmin = src = inputBuffer) + *inputLength;
@@ -455,7 +729,10 @@
   offsets = offsetsMap;
   previousOpcode = CTO_None;

+  findLineBreakOpportunities(lineBreakOpportunities, inputBuffer, *inputLength);
+
   while (src < srcmax) { /*the main translation loop */
+    destlast = dest;
     setOffset();
     setBefore();

@@ -569,9 +846,7 @@
       src++;
     }

-    if ((src > srcmin) &&
-        (currentOpcode != CTO_JoinableWord) &&
-        canBreakLine(src[-1], *src)) {
+    if (lineBreakOpportunities[src-srcmin] && (currentOpcode != CTO_JoinableWord)) {
       srcword = src;
       destword = dest;
     }
@@ -580,11 +855,15 @@
       previousOpcode = currentOpcode;
     }
   }				/*end of translation loop */
+
 done:
+  if (destlast) dest = destlast;

   if ((src < srcmax) &&
+      !lineBreakOpportunities[src-srcmin] &&
       (destword != NULL) &&
-      ((destmax - destword) <= ((destmax - destmin) / 4)) &&
+      ((destmax - destword) < ((destmax - destmin) / 2)) &&
+      !testCharacter(src[-1], CTC_Space) &&
       !testCharacter(*src, CTC_Space)) {
     src = srcword;
     dest = destword;


Initialize buffer

Initialize buffer

--- src/kraknet.c
+++ src/kraknet.c
@@ -71,7 +71,7 @@
 }

 int main(int argc, char **argv){
-	char *home_dir, *buf, *s, *str;
+	char *home_dir, *buf = calloc(256, sizeof(char)), *s, *str;
 	FILE *r;

 	// If this is an "inline" rendering, HTTP headers are probably not wanted.


freedreno: limit non-user constant buffers to a4xx

Seems to mostly work on a3xx.  Except when it doesn't and kills gpu
quite badly.

Signed-off-by: Rob Clark <915c10c999604870200b6defbe633d857c856ca0@gmail.com>

--- src/gallium/drivers/freedreno/freedreno_screen.c
+++ src/gallium/drivers/freedreno/freedreno_screen.c
@@ -172,7 +172,7 @@
 		return 1;

 	case PIPE_CAP_USER_CONSTANT_BUFFERS:
-		return is_ir3(screen) ? 0 : 1;
+		return is_a4xx(screen) ? 0 : 1;

 	case PIPE_CAP_SHADER_STENCIL_EXPORT:
 	case PIPE_CAP_TGSI_TEXCOORD:


bug in mbedtls? won't build with just RSA

--- libs/crypto/mbedtls/include/mbedtls/ssl_ciphersuites.h
+++ libs/crypto/mbedtls/include/mbedtls/ssl_ciphersuites.h
@@ -246,7 +246,7 @@
     MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA,
 } mbedtls_key_exchange_type_t;

-#if defined(MBEDTLS_KEY_EXCHANGE_RSA_ENABLED)          || \
+#if \
     defined(MBEDTLS_KEY_EXCHANGE_DHE_RSA_ENABLED)      || \
     defined(MBEDTLS_KEY_EXCHANGE_ECDHE_RSA_ENABLED)    || \
     defined(MBEDTLS_KEY_EXCHANGE_ECDHE_ECDSA_ENABLED)  || \


More fixups to points_from_density.

More fixups to points_from_density.

--- src/points.c
+++ src/points.c
@@ -212,14 +212,7 @@
     heman_image* density, HEMAN_FLOAT minradius, HEMAN_FLOAT maxradius)
 {
     assert(density->nbands == 1);
-    float width, height;
-    if (density->height > density->width) {
-        width = 1;
-        height = (float) density->height / density->width;
-    } else {
-        width = (float) density->width / density->height;
-        height = 1;
-    }
+    float width = 1, height = 1;
     int maxattempts = 30;
     float rscale = 1.0f / UINT_MAX;
     unsigned int seed = 0;
@@ -321,7 +314,7 @@
             GRID_INSERT(pt, nsamples);
             samples[nsamples++] = pt;
         } else {
-            if (--nactives < 0) {
+            if (--nactives <= 0) {
                 break;
             }
             actives[aindex] = actives[nactives];


missing initializer

missing initializer

git-svn-id: ae92b08b608af1c8cefa3e10d2325ea527204e07@10784 3eda493b-6a19-0410-b2e0-ec8ea4dd8fda

--- mount_slash/bmap_flush.c
+++ mount_slash/bmap_flush.c
@@ -751,7 +751,7 @@
 	struct psc_waitq waitq = PSC_WAITQ_INIT;
 	struct srm_bmap_id *rel_bmaps;
 	size_t z;
-	int nbmaps, i;
+	int nbmaps = 0, i;

 	rel_bmaps = PSCALLOC(sizeof(struct srm_bmap_id) * MAX_BMAP_RELEASE);


Fixed zmq SIGTERM handling

Fixed zmq SIGTERM handling

--- lib/src/0mq.c
+++ lib/src/0mq.c
@@ -80,9 +80,10 @@

 static void mux_handler(int signal_value)
 {
-    mux_printf("ZSYS signal handler called");
     zctx_interrupted = 1;
     zsys_interrupted = 1;
+    zsys_handler_reset();
+    raise(signal_value);
 }

 /**
@@ -98,24 +99,19 @@
 __PUBLIC bool mux_connect(const char *path)
 {
     display->zmq.path = path;
-    display->zmq.socket = zsock_new_dealer(path);
+    display->zmq.socket = zsock_new_dealer(display->zmq.path);
     zsys_handler_set(mux_handler);
     if (display->zmq.socket == NULL) {
         mux_printf_error("0mq socket creation failed");
         return false;
     }

-    if (zsock_connect(display->zmq.socket, "%s", path) == -1) {
-        mux_printf_error("0mq connect failed");
-        return false;
-    }
-    mux_printf("Bound to %s", path);
-
     display->zmq.poller = zpoller_new(display->zmq.socket, NULL);
     if (display->zmq.poller == NULL) {
         mux_printf_error("Could not initialize socket poller");
         return false;
     }
+    mux_printf("Bound to %s", path);

     return true;
 }


[lib] Added bidi type definition in dedicated header...

--- Headers/SBBidiType.h
+++ Headers/SBBidiType.h
@@ -16,6 +16,8 @@

 #ifndef _SB_PUBLIC_BIDI_TYPE_H
 #define _SB_PUBLIC_BIDI_TYPE_H
+
+#include "SBBase.h"

 /**
  * Constants that specify the bidirectional types of a character.
@@ -51,4 +53,29 @@
     SBBidiTypePDF = 0x17    /**< Format: Pop Directional Formatting */
 };

+/**
+ * A type to represent the bidirectional type of a character.
+ */
+typedef SBUInt8 SBBidiType;
+
+/**
+ * Checks whether specified bidirectional type is strong.
+ */
+#define SBBidiTypeIsStrong(t)               SBUInt8InRange(t, SBBidiTypeL, SBBidiTypeAL)
+
+/**
+ * Checks whether specified bidirectional type is weak.
+ */
+#define SBBidiTypeIsWeak(t)                 SBUInt8InRange(t, SBBidiTypeBN, SBBidiTypeCS)
+
+/**
+ * Checks whether specified bidirectional type is neutral.
+ */
+#define SBBidiTypeIsNeutral(t)              SBUInt8InRange(t, SBBidiTypeWS, SBBidiTypeON)
+
+/**
+ * Checks whether specified bidirectional type is format.
+ */
+#define SBBidiTypeIsFormat(t)               SBUInt8InRange(t, SBBidiTypeLRI, SBBidiTypePDF)
+
 #endif


Removed broken X11 command.

Removed broken X11 command.

--- client/X11/xf_graphics.c
+++ client/X11/xf_graphics.c
@@ -43,7 +43,7 @@
 #define TAG CLIENT_TAG("x11")

 BOOL xf_decode_color(rdpGdi* gdi, const UINT32 srcColor,
-                     UINT32* color, UINT32* format)
+		     UINT32* color, UINT32* format)
 {
 	xfContext* xfc;
 	UINT32 DstFormat;
@@ -54,14 +54,14 @@

 	xfc = (xfContext*)gdi->context;
 	SrcFormat = gdi_get_pixel_format(gdi->context->settings->ColorDepth,
-	                                 FALSE);
+					 FALSE);

 	if (format)
 		*format = SrcFormat;

 	DstFormat = xf_get_local_color_format(xfc, FALSE);
 	*color = ConvertColor(srcColor, SrcFormat,
-	                      DstFormat, &gdi->palette);
+			      DstFormat, &gdi->palette);
 	return TRUE;
 }

@@ -80,7 +80,7 @@
 	data = bitmap->data;
 	depth = GetBitsPerPixel(bitmap->format);
 	pixmap = XCreatePixmap(xfc->display, xfc->drawable, bitmap->width,
-	                       bitmap->height, xfc->depth);
+			       bitmap->height, xfc->depth);

 	if (bitmap->data)
 	{
@@ -96,19 +96,19 @@

 			SrcFormat = bitmap->format;
 			freerdp_image_copy(data, gdi->dstFormat, 0, 0, 0,
-			                   bitmap->width, bitmap->height,
-			                   bitmap->data, SrcFormat,
-			                   0, 0, 0, &context->gdi->palette);
+					   bitmap->width, bitmap->height,
+					   bitmap->data, SrcFormat,
+					   0, 0, 0, &context->gdi->palette);
 			_aligned_free(bitmap->data);
 			bitmap->data = data;
 			bitmap->format = gdi->dstFormat;
 		}

 		image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
-		                     ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height,
-		                     xfc->scanline_pad, 0);
+				     ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height,
+				     xfc->scanline_pad, 0);
 		XPutImage(xfc->display, pixmap, xfc->gc, image, 0, 0, 0, 0, bitmap->width,
-		          bitmap->height);
+			  bitmap->height);
 		XFree(image);
 	}

@@ -139,10 +139,10 @@
 	xf_lock_x11(xfc, FALSE);
 	XSetFunction(xfc->display, xfc->gc, GXcopy);
 	image = XCreateImage(xfc->display, xfc->visual, xfc->depth,
-	                     ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height,
-	                     xfc->scanline_pad, 0);
+			     ZPixmap, 0, (char*) bitmap->data, bitmap->width, bitmap->height,
+			     xfc->scanline_pad, 0);
 	XPutImage(xfc->display, xfc->primary, xfc->gc,
-	          image, 0, 0, bitmap->left, bitmap->top, width, height);
+		  image, 0, 0, bitmap->left, bitmap->top, width, height);
 	XFree(image);
 	ret = gdi_InvalidateRegion(xfc->hdc, bitmap->left, bitmap->top, width, height);
 	xf_unlock_x11(xfc, FALSE);
@@ -150,7 +150,7 @@
 }

 static BOOL xf_Bitmap_SetSurface(rdpContext* context, rdpBitmap* bitmap,
-                                 BOOL primary)
+				 BOOL primary)
 {
 	xfContext* xfc = (xfContext*) context;
 	xf_lock_x11(xfc, FALSE);
@@ -186,18 +186,18 @@
 	ci.yhot = pointer->yPos;

 	if (!(ci.pixels = (XcursorPixel*) calloc(ci.height,
-	                  ci.width * GetBytesPerPixel(gdi->dstFormat))))
+			  ci.width * GetBytesPerPixel(gdi->dstFormat))))
 	{
 		xf_unlock_x11(xfc, FALSE);
 		return FALSE;
 	}

 	if (freerdp_image_copy_from_pointer_data(
-	        (BYTE*) ci.pixels, gdi->dstFormat,
-	        0, 0, 0, pointer->width, pointer->height,
-	        pointer->xorMaskData, pointer->lengthXorMask,
-	        pointer->andMaskData, pointer->lengthAndMask,
-	        pointer->xorBpp, &context->gdi->palette) < 0)
+		(BYTE*) ci.pixels, gdi->dstFormat,
+		0, 0, 0, pointer->width, pointer->height,
+		pointer->xorMaskData, pointer->lengthXorMask,
+		pointer->andMaskData, pointer->lengthAndMask,
+		pointer->xorBpp, &context->gdi->palette) < 0)
 	{
 		free(ci.pixels);
 		xf_unlock_x11(xfc, FALSE);
@@ -225,7 +225,7 @@
 }

 static BOOL xf_Pointer_Set(rdpContext* context,
-                           const rdpPointer* pointer)
+			   const rdpPointer* pointer)
 {
 #ifdef WITH_XCURSOR
 	xfContext* xfc = (xfContext*) context;
@@ -305,7 +305,7 @@
 	tmp.event_mask = (current.your_event_mask & ~(PointerMotionMask));

 	if (XChangeWindowAttributes(xfc->display, xfc->window->handle, CWEventMask,
-	                            &tmp) == 0)
+				    &tmp) == 0)
 		goto out;

 	XWarpPointer(xfc->display, None, xfc->window->handle, 0, 0, 0, 0, x, y);
@@ -328,14 +328,14 @@
 	xf_lock_x11(xfc, FALSE);
 	scanline = (glyph->cx + 7) / 8;
 	xf_glyph->pixmap = XCreatePixmap(xfc->display, xfc->drawing, glyph->cx,
-	                                 glyph->cy, 1);
+					 glyph->cy, 1);
 	image = XCreateImage(xfc->display, xfc->visual, 1,
-	                     ZPixmap, 0, (char*) glyph->aj, glyph->cx, glyph->cy, 8, scanline);
+			     ZPixmap, 0, (char*) glyph->aj, glyph->cx, glyph->cy, 8, scanline);
 	image->byte_order = MSBFirst;
 	image->bitmap_bit_order = MSBFirst;
 	XInitImage(image);
 	XPutImage(xfc->display, xf_glyph->pixmap, xfc->gc_mono, image, 0, 0, 0, 0,
-	          glyph->cx, glyph->cy);
+		  glyph->cx, glyph->cy);
 	XFree(image);
 	xf_unlock_x11(xfc, FALSE);
 	return TRUE;
@@ -355,8 +355,8 @@
 }

 static BOOL xf_Glyph_Draw(rdpContext* context, const rdpGlyph* glyph, UINT32 x,
-                          UINT32 y, UINT32 w, UINT32 h, UINT32 sx, UINT32 sy,
-                          BOOL fOpRedundant)
+			  UINT32 y, UINT32 w, UINT32 h, UINT32 sx, UINT32 sy,
+			  BOOL fOpRedundant)
 {
 	xfGlyph* xf_glyph;
 	xfContext* xfc = (xfContext*) context;
@@ -383,8 +383,8 @@
 }

 static BOOL xf_Glyph_BeginDraw(rdpContext* context, UINT32 x, UINT32 y,
-                               UINT32 width, UINT32 height, UINT32 bgcolor,
-                               UINT32 fgcolor, BOOL fOpRedundant)
+			       UINT32 width, UINT32 height, UINT32 bgcolor,
+			       UINT32 fgcolor, BOOL fOpRedundant)
 {
 	xfContext* xfc = (xfContext*) context;
 	XRectangle rect;
@@ -406,7 +406,6 @@
 		XSetForeground(xfc->display, xfc->gc, fgcolor);
 		XSetBackground(xfc->display, xfc->gc, fgcolor);
 		XSetFillStyle(xfc->display, xfc->gc, FillOpaqueStippled);
-		XClearArea(xfc->display, xfc->drawable, xfc->gc, x, y, width, height);
 		XFillRectangle(xfc->display, xfc->drawable, xfc->gc, x, y, width, height);
 	}

@@ -417,8 +416,8 @@
 }

 static BOOL xf_Glyph_EndDraw(rdpContext* context, UINT32 x, UINT32 y,
-                             UINT32 width, UINT32 height,
-                             UINT32 bgcolor, UINT32 fgcolor)
+			     UINT32 width, UINT32 height,
+			     UINT32 bgcolor, UINT32 fgcolor)
 {
 	xfContext* xfc = (xfContext*) context;
 	BOOL ret = TRUE;


Update orbitalElementConversions.h

Update orbitalElementConversions.h

Fixing bug in orbital element conversions, with thanks to Andreas Kleinschneider for pointing it out.

--- Tudat/Astrodynamics/BasicAstrodynamics/orbitalElementConversions.h
+++ Tudat/Astrodynamics/BasicAstrodynamics/orbitalElementConversions.h
@@ -392,13 +392,20 @@
     ScalarType dotProductPositionAndEccentricityVectors
             = position_.normalized( ).dot( eccentricityVector_.normalized( ) );

-    // Check if the dot-product is one of the limiting cases: 0.0 or 1.0
+    // Check if the dot-product is one of the limiting cases: 0.0, -1.0 or 1.0
     // (within prescribed tolerance).
     if ( std::fabs( mathematical_constants::getFloatingInteger< ScalarType >( 1 ) -
                     dotProductPositionAndEccentricityVectors ) < tolerance )
     {
         dotProductPositionAndEccentricityVectors =
                 mathematical_constants::getFloatingInteger< ScalarType >( 1 );
+    }
+
+    if ( std::fabs( mathematical_constants::getFloatingInteger< ScalarType >( 1 ) +
+                    dotProductPositionAndEccentricityVectors ) < tolerance )
+    {
+        dotProductPositionAndEccentricityVectors =
+                -mathematical_constants::getFloatingInteger< ScalarType >( 1 );
     }

     if ( std::fabs( dotProductPositionAndEccentricityVectors ) < tolerance )


Update pilha-codigo.c

Update pilha-codigo.c


WIP on C64 VICE Backend

WIP on C64 VICE Backend

Ref T13


attribute fExtDecayer, copy constructor and assignment operator added

--- TGeant4/TG4ModularPhysicsList.h
+++ TGeant4/TG4ModularPhysicsList.h
@@ -9,11 +9,13 @@
 // Only G4Decay is created directly in this modular
 // physics list.

-#ifndef TG4_PHYSICS_LIST_H
-#define TG4_PHYSICS_LIST_H
+#ifndef TG4_MODULAR_PHYSICS_LIST_H
+#define TG4_MODULAR_PHYSICS_LIST_H

 #include <G4VModularPhysicsList.hh>
 #include <globals.hh>
+
+class TG4ExtDecayer;

 class G4VProcess;

@@ -21,6 +23,8 @@
 {
   public:
     TG4ModularPhysicsList();
+    // --> protected
+    // TG4ModularPhysicsList(const TG4ModularPhysicsList& right);
     virtual ~TG4ModularPhysicsList();

     // methods
@@ -29,6 +33,11 @@
     void PrintAllProcesses() const;

   protected:
+    TG4ModularPhysicsList(const TG4ModularPhysicsList& right);
+
+    // operators
+    TG4ModularPhysicsList& operator=(const TG4ModularPhysicsList& right);
+
     // methods
     virtual void ConstructParticle();
     virtual void ConstructProcess();
@@ -43,6 +52,9 @@

         // construct general processes
     void ConstructGeneral();
+
+  private:
+    TG4ExtDecayer*  fExtDecayer;
 };

 #endif //TG4_MODULAR_PHYSICS_LIST_H


xdr_ioq_uv_fetch: uninitialized variable

Perhaps the uninitialized case "never happens," but we need to
handle it for optimized compiles.

Signed-off-by: Matt Benjamin <b5ea062884a8f3dc969ff57d1008615447c56296@redhat.com>
Acked-by: William Allen Simpson <a32028673838c960ebe556510eb0a9bdae75c728@redhat.com>

--- src/xdr_ioq.c
+++ src/xdr_ioq.c
@@ -95,7 +95,7 @@
 xdr_ioq_uv_fetch(struct xdr_ioq *xioq, struct poolq_head *ioqh,
 		 char *comment, u_int count, u_int ioq_flags)
 {
-	struct poolq_entry *have;
+	struct poolq_entry *have = NULL;

 	__warnx(TIRPC_DEBUG_FLAG_XDR,
 		"%s() %u %s",


fix return type and this way get rid of a last remaining compile-time warning

--- rpmdb/rpmtd.c
+++ rpmdb/rpmtd.c
@@ -227,12 +227,12 @@

 rpmuint8_t * rpmtdGetUint8(rpmtd td)
 {
-    char *res = NULL;
+    rpmuint8_t *res = NULL;

 assert(td != NULL);
     if (td->type == RPM_INT8_TYPE) {
 	int ix = (td->ix >= 0 ? td->ix : 0);
-	res = (char *) td->data + ix;
+	res = (rpmuint8_t *) td->data + ix;
     }
     return res;
 }


Updated module to use the dialog that raster designed. :) Some Cleanups

git-svn-id: 0f3f1c46c6da7ffd142db61e503a7ff63af3a195@19091 7cbeb6ba-43b4-40fd-8cce-4c39aea84d33


Graphics: Check for task manager in old functions that should not be called.

--- src/core/gfxcard.c
+++ src/core/gfxcard.c
@@ -328,7 +328,8 @@

      shared = data->shared;

-     dfb_gfxcard_lock( GDLF_SYNC );
+     if (!dfb_config->task_manager)
+          dfb_gfxcard_lock( GDLF_SYNC );

      if (data->driver_funcs) {
           const GraphicsDriverFuncs *funcs = data->driver_funcs;
@@ -418,6 +419,11 @@

      D_ASSERT( card != NULL );
      D_ASSERT( card->shared != NULL );
+
+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return DFB_BUG;

      shared = card->shared;
      funcs  = &card->funcs;
@@ -479,6 +485,11 @@

      D_ASSERT( card != NULL );
      D_ASSERT( card->shared != NULL );
+
+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return DFB_OK;

      shared = card->shared;
      funcs  = &card->funcs;
@@ -509,6 +520,11 @@
      D_ASSERT( device != NULL );
      D_MAGIC_ASSERT( state, CardState );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      if (device->funcs.StartDrawing)
           device->funcs.StartDrawing( device->driver_data, device->device_data, state );
 }
@@ -521,6 +537,11 @@
 {
      D_ASSERT( device != NULL );
      D_MAGIC_ASSERT( state, CardState );
+
+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;

      if (device->funcs.StopDrawing)
           device->funcs.StopDrawing( device->driver_data, device->device_data, state );
@@ -770,6 +791,11 @@
      D_MAGIC_ASSERT( state, CardState );
      D_MAGIC_ASSERT_IF( state->destination, CoreSurface );
      D_MAGIC_ASSERT_IF( state->source, CoreSurface );
+
+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return false;

      dst    = state->destination;
      src    = state->source;
@@ -992,6 +1018,11 @@
                       state, accel, state->destination );
      }

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return false;
+
      if (state->clip.x1 < 0) {
           state->clip.x1   = 0;
           state->modified |= SMF_CLIP;
@@ -1376,6 +1407,11 @@
      D_ASSERT( card->shared != NULL );
      D_MAGIC_ASSERT( state, CardState );
      D_ASSERT( state->destination != NULL );
+
+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;

      if (!dfb_config->software_only) {
           card->shared->pending_ops = true;
@@ -1488,6 +1524,11 @@
      D_ASSERT( rects != NULL );
      D_ASSERT( num > 0 );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      /* The state is locked during graphics operations. */
      dfb_state_lock( state );

@@ -1651,6 +1692,11 @@

      D_DEBUG_AT( Core_GraphicsOps, "%s( %d,%d - %dx%d, %p )\n", __FUNCTION__, DFB_RECTANGLE_VALS(rect), state );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      /* The state is locked during graphics operations. */
      dfb_state_lock( state );

@@ -1762,6 +1808,11 @@
      D_ASSERT( lines != NULL );
      D_ASSERT( num_lines > 0 );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      /* The state is locked during graphics operations. */
      dfb_state_lock( state );

@@ -1815,6 +1866,11 @@
      D_MAGIC_ASSERT( state, CardState );
      D_ASSERT( spans != NULL );
      D_ASSERT( num_spans > 0 );
+
+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;

      /* The state is locked during graphics operations. */
      dfb_state_lock( state );
@@ -2148,6 +2204,11 @@

      D_DEBUG_AT( Core_GraphicsOps, "%s( %p [%d], %p )\n", __FUNCTION__, tris, num, state );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      /* The state is locked during graphics operations. */
      dfb_state_lock( state );

@@ -2259,6 +2320,11 @@

      D_DEBUG_AT( Core_GraphicsOps, "%s( %p [%d], %p )\n", __FUNCTION__, traps, num, state );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      /* The state is locked during graphics operations. */
      dfb_state_lock( state );
      /* Signal beginning of sequence of operations if not already done. */
@@ -2416,6 +2482,11 @@
      D_MAGIC_ASSERT( state, DFBGraphicsState );
      D_ASSERT( points != NULL );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      /* The state is locked during graphics operations. */
      dfb_state_lock( state );

@@ -2489,6 +2560,11 @@
      D_ASSERT( card->shared != NULL );
      D_MAGIC_ASSERT( state, CardState );
      D_ASSERT( (glyph != NULL) && (attributes != NULL) && (points != NULL) );
+
+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;

      /* The state is locked during graphics operations. */
      dfb_state_lock( state );
@@ -2730,6 +2806,11 @@

 void dfb_gfxcard_blit( DFBRectangle *rect, int dx, int dy, CardState *state )
 {
+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      /* The state is locked during graphics operations. */
      dfb_state_lock( state );
      dfb_gfxcard_blit_locked( rect, dx, dy, state );
@@ -2783,8 +2864,7 @@
 {
      unsigned int i = 0;

-     DFBSurfaceBlittingFlags blittingflags = state->blittingflags;
-     dfb_simplify_blittingflags( &blittingflags );
+     DFBSurfaceBlittingFlags blittingflags;

      D_DEBUG_AT( Core_GraphicsOps, "%s( %p, %p [%d], %p )\n", __FUNCTION__, rects, points, num, state );

@@ -2794,6 +2874,14 @@
      D_ASSERT( rects != NULL );
      D_ASSERT( points != NULL );
      D_ASSERT( num > 0 );
+
+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
+     blittingflags = state->blittingflags;
+     dfb_simplify_blittingflags( &blittingflags );

      /* The state is locked during graphics operations. */
      dfb_state_lock( state );
@@ -2986,6 +3074,11 @@
      D_ASSERT( points2 != NULL );
      D_ASSERT( num > 0 );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      /* The state is locked during graphics operations. */
      dfb_state_lock( state );

@@ -3073,6 +3166,11 @@
      D_ASSERT( rect->w >= 1 );
      D_ASSERT( rect->h >= 1 );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      /* The state is locked during graphics operations. */
      dfb_state_lock( state );

@@ -3245,8 +3343,7 @@
      int i;
      bool need_clip, acquired = false;

-     DFBSurfaceBlittingFlags blittingflags = state->blittingflags;
-     dfb_simplify_blittingflags( &blittingflags );
+     DFBSurfaceBlittingFlags blittingflags;

      D_ASSERT( card != NULL );
      D_ASSERT( card->shared != NULL );
@@ -3261,6 +3358,14 @@
                       "  -> %d,%d - %dx%d -> %d,%d - %dx%d\n",
                       DFB_RECTANGLE_VALS(&srects[i]),
                       DFB_RECTANGLE_VALS(&drects[i]) );
+
+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
+     blittingflags = state->blittingflags;
+     dfb_simplify_blittingflags( &blittingflags );

      /* The state is locked during graphics operations. */
      dfb_state_lock( state );
@@ -3403,6 +3508,11 @@
      D_ASSERT( vertices != NULL );
      D_ASSERT( num >= 3 );
      D_MAGIC_ASSERT( state, CardState );
+
+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;

      /* The state is locked during graphics operations. */
      dfb_state_lock( state );
@@ -3745,6 +3855,11 @@

      D_ASSERT( card->shared != NULL );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return DFB_OK;
+
      ret = dfb_gfxcard_lock( GDLF_NONE );
      if (ret)
           return ret;
@@ -3777,6 +3892,11 @@
 {
      D_ASSUME( card != NULL );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      if (dfb_config->software_only)
           return;

@@ -3788,6 +3908,11 @@
 {
      D_ASSUME( card != NULL );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      if (dfb_config->software_only)
           return;

@@ -3799,6 +3924,11 @@
 {
      D_ASSUME( card != NULL );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      if (dfb_config->software_only)
           return;

@@ -3810,6 +3940,11 @@
 {
      D_ASSUME( card != NULL );

+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;
+
      if (dfb_config->software_only)
           return;

@@ -3820,6 +3955,11 @@
 void dfb_gfxcard_surface_leave( CoreSurfaceBuffer *buffer )
 {
      D_ASSUME( card != NULL );
+
+     D_ASSUME( !dfb_config->task_manager );
+
+     if (dfb_config->task_manager)
+          return;

      if (dfb_config->software_only)
           return;


LATENCY HISTORY returns empty array if no data is available.

Previously we returned an error.

--- src/latency.c
+++ src/latency.c
@@ -524,8 +524,11 @@
     if (!strcasecmp(c->argv[1]->ptr,"history") && c->argc == 3) {
         /* LATENCY HISTORY <event> */
         ts = dictFetchValue(server.latency_events,c->argv[2]->ptr);
-        if (ts == NULL) goto nodataerr;
-        latencyCommandReplyWithSamples(c,ts);
+        if (ts == NULL) {
+            addReplyMultiBulkLen(c,0);
+        } else {
+            latencyCommandReplyWithSamples(c,ts);
+        }
     } else if (!strcasecmp(c->argv[1]->ptr,"graph") && c->argc == 3) {
         /* LATENCY GRAPH <event> */
         sds graph;


svga: try to flag surfaces for sampling, in addition to rendering

This silences some warnings when we try to sample from surfaces that were
created for drawing, such as when blitting from one of the framebuffer
surfaces.  We were already doing the opposite situation (adding a bind
flag for rendering to surfaces declared as texture sources).

Reviewed-by: Charmaine Lee <67ce69700661ea856134ddb10419a330e5f037d7@vmware.com>

--- src/gallium/drivers/svga/svga_resource_texture.c
+++ src/gallium/drivers/svga/svga_resource_texture.c
@@ -839,6 +839,17 @@

    tex->key.cachable = 1;

+   if ((bindings & (PIPE_BIND_RENDER_TARGET | PIPE_BIND_DEPTH_STENCIL)) &&
+       !(bindings & PIPE_BIND_SAMPLER_VIEW)) {
+      /* Also check if the format can be sampled from */
+      if (screen->is_format_supported(screen, template->format,
+                                      template->target,
+                                      template->nr_samples,
+                                      PIPE_BIND_SAMPLER_VIEW)) {
+         bindings |= PIPE_BIND_SAMPLER_VIEW;
+      }
+   }
+
    if (bindings & PIPE_BIND_SAMPLER_VIEW) {
       tex->key.flags |= SVGA3D_SURFACE_HINT_TEXTURE;
       tex->key.flags |= SVGA3D_SURFACE_BIND_SHADER_RESOURCE;


ignore "current" when searching for named workspaces

--- src/workspace.c
+++ src/workspace.c
@@ -114,14 +114,15 @@
         /* We check if this is the workspace
          * next/prev/next_on_output/prev_on_output/back_and_forth/number command.
          * Beware: The workspace names "next", "prev", "next_on_output",
-         * "prev_on_output", "number" and "back_and_forth" are OK, so we check
-         * before stripping the double quotes */
+         * "prev_on_output", "number", "back_and_forth" and "current" are OK,
+         * so we check before stripping the double quotes */
         if (strncasecmp(target, "next", strlen("next")) == 0 ||
             strncasecmp(target, "prev", strlen("prev")) == 0 ||
             strncasecmp(target, "next_on_output", strlen("next_on_output")) == 0 ||
             strncasecmp(target, "prev_on_output", strlen("prev_on_output")) == 0 ||
             strncasecmp(target, "number", strlen("number")) == 0 ||
-            strncasecmp(target, "back_and_forth", strlen("back_and_forth")) == 0)
+            strncasecmp(target, "back_and_forth", strlen("back_and_forth")) == 0 ||
+            strncasecmp(target, "current", strlen("current")) == 0)
             continue;
         if (*target == '"')
             target++;


fix comment

fix comment

--- src/poolid.h
+++ src/poolid.h
@@ -22,7 +22,7 @@
 typedef struct _Reldep {
   Id name;		// "package"
   Id evr;		// "0:42-3"
-  int flags;		// operation/relation, see REL_x below
+  int flags;		// operation/relation, see REL_x in pool.h
 } Reldep;

 extern Id str2id(Pool *pool, const char *, int);


Track -25 changes to packet number decoding

--- lib/src/pkt.c
+++ lib/src/pkt.c
@@ -875,9 +875,10 @@
     const uint64_t pn_mask = pn_win - 1;

     m->hdr.nr |= (expected_pn & ~pn_mask);
-    if (m->hdr.nr + pn_hwin <= expected_pn)
+    if (m->hdr.nr + pn_hwin <= expected_pn &&
+        likely(m->hdr.nr + pn_hwin < (UINT64_C(1) << 62)))
         m->hdr.nr += pn_win;
-    else if (m->hdr.nr > expected_pn + pn_hwin && m->hdr.nr > pn_win)
+    else if (m->hdr.nr > expected_pn + pn_hwin && m->hdr.nr >= pn_win)
         m->hdr.nr -= pn_win;

     return true;


only build if bzip2 support is enabled

only build if bzip2 support is enabled

--- rpmio/rpmzq.c
+++ rpmio/rpmzq.c
@@ -37,6 +37,8 @@
  */

 #include "system.h"
+
+#if defined(HAVE_BZLIB_H)

 #include <rpmiotypes.h>
 #include <rpmlog.h>
@@ -847,3 +849,5 @@
 assert(zq->write_head == NULL);
     yarnTwist(zq->write_first, TO, -1);
 }
+
+#endif /* HAVE_BZLIB_H */


fix @version in each EFL header doxygen

fix @version in each EFL header doxygen

SVN revision: 71691

--- src/lib/Eet.h
+++ src/lib/Eet.h
@@ -5,7 +5,7 @@

    @mainpage Eet Library Documentation

-   @version 1.5.0
+   @version 1.6.0
    @date 2000-2012

    Please see the @ref authors page for contact details.


i915g: Use unchecked writes in sw winsys batchbuffer

--- src/gallium/winsys/i915/sw/i915_sw_batchbuffer.c
+++ src/gallium/winsys/i915/sw/i915_sw_batchbuffer.c
@@ -107,16 +107,16 @@

 #ifdef INTEL_ALWAYS_FLUSH
    /* MI_FLUSH | FLUSH_MAP_CACHE */
-   i915_winsys_batchbuffer_dword(ibatch, (0x4<<23)|(1<<0));
+   i915_winsys_batchbuffer_dword_unchecked(ibatch, (0x4<<23)|(1<<0));
    used += 4;
 #endif

    if ((used & 4) == 0) {
       /* MI_NOOP */
-      i915_winsys_batchbuffer_dword(ibatch, 0);
+      i915_winsys_batchbuffer_dword_unchecked(ibatch, 0);
    }
    /* MI_BATCH_BUFFER_END */
-   i915_winsys_batchbuffer_dword(ibatch, (0xA<<23));
+   i915_winsys_batchbuffer_dword_unchecked(ibatch, (0xA<<23));

    used = batch->base.ptr - batch->base.map;
    assert((used & 4) == 0);


No longer need retry cookies

No longer need retry cookies

--- lib/src/tls.c
+++ lib/src/tls.c
@@ -124,9 +124,6 @@
 static struct cipher_ctx dec_tckt;
 static struct cipher_ctx enc_tckt;

-#define COOKIE_LEN 64
-static uint8_t cookie[COOKIE_LEN];
-
 static FILE * tls_log_file;

@@ -932,10 +929,6 @@
         }

     } else {
-        hshk_prop->server.retry_uses_cookie = 1;
-        hshk_prop->server.cookie.key = cookie;
-        hshk_prop->server.cookie.additional_data.base = (uint8_t *)&c->peer;
-        hshk_prop->server.cookie.additional_data.len = sizeof(c->peer);
         // TODO: remove this interop hack eventually
         if (ntohs(c->sport) == 4434)
             c->tx_rtry = true;
@@ -1243,8 +1236,6 @@
     tls_ctx.get_time = &ptls_get_time;
     tls_ctx.omit_end_of_early_data = true;

-    ptls_openssl_random_bytes(cookie, COOKIE_LEN);
-
     init_ticket_prot();
 }


Add placeholders for YAML sequence

Add placeholders for YAML sequence

--- src/yaml_data.c
+++ src/yaml_data.c
@@ -83,6 +83,12 @@
             case YAML_MAPPING_END_EVENT:
                 // TODO
                 break;
+            case YAML_SEQUENCE_START_EVENT:
+                // TODO
+                break;
+            case YAML_SEQUENCE_END_EVENT:
+                // TODO
+                break;
             default:
                 /* Do nothing */
                 break;


Emulate prolog_predicates with prolog_rules for new rulesets.

--- src/prolog.c
+++ src/prolog.c
@@ -360,15 +360,27 @@
     fid_t        frame;
     term_t       pl_predlist = PL_new_term_ref();

-    prolog_predicate_t *predicates;
+    prolog_predicate_t *predicates, *undefined, *p;
     int                 npredicate;

     predicates = NULL;

     frame = PL_open_foreign_frame();

-    if (!PL_call_predicate(NULL, PL_Q_NORMAL, pr_exported, pl_predlist))
+    if (!PL_call_predicate(NULL, PL_Q_NORMAL, pr_exported, pl_predlist)) {
+        /* if we have a new ruleset emulate old interface if we can */
+        if (prolog_rules(&predicates, &undefined) != 0)
+            goto fail;
+
+        if (undefined == NULL)
+            goto success;
+
+        for (p = undefined; p->name != NULL; p++)
+            PROLOG_WARNING("undefined predicate %s:%s/%d",
+                           p->module, p->name, p->arity);
+        prolog_free_predicates(undefined);
         goto fail;
+    }

     if ((npredicate = prolog_list_length(pl_predlist)) <= 0)
         goto fail;
@@ -379,6 +391,7 @@
     if (prolog_walk_list(pl_predlist, collect_exported, predicates))
         goto fail;

+ success:
     PL_discard_foreign_frame(frame);

     return predicates;
@@ -410,7 +423,7 @@
     npredicate = 0;

     if ((predicates = ALLOC_ARRAY(prolog_predicate_t, CHUNK + 1)) == NULL)
-        goto fail;
+        return NULL;

     frame = PL_open_foreign_frame();
     pl_args = PL_new_term_refs(2);
@@ -501,8 +514,8 @@
         prolog_free_predicates(*rules);
     if (undef)
         prolog_free_predicates(*undef);
-
-    return NULL;
+    *rules = *undef = NULL;
+    return EINVAL;
 }


- quickfix hasha na BE.

- quickfix hasha na BE.

--- src/libgadu.c
+++ src/libgadu.c
@@ -1348,7 +1348,7 @@
 			};

 			l.uin = fix32(sess->uin);
-			l.hash = hash;
+			l.hash = fix32(hash);
 			l.status = fix32(sess->initial_status ? sess->initial_status : GG_STATUS_AVAIL);
 			l.version = fix32(GG_CLIENT_VERSION);
 			l.local_ip = sess->client_ip;