update STPCardValidator documentation

update STPCardValidator documentation

--- Stripe/PublicHeaders/STPCardValidator.h
+++ Stripe/PublicHeaders/STPCardValidator.h
@@ -85,7 +85,7 @@
  *  @param cvc   the CVC to validate
  *  @param brand the card brand (can be determined from the card's number using +brandForNumber)
  *
- *  @return Whether the CVC represents a valid CVC for that card brand. For example, would return STPCardValidationStateValid for @"123" and STPCardBrandVisa, STPCardValidationStateValid for @"1234" and STPCardBrandAmericanExpress, STPCardValidationStateIncomplete for @"123" and STPCardBrandAmericanExpress, and STPCardValidationStateInvalid for @"12345" and any brand.
+ *  @return Whether the CVC represents a valid CVC for that card brand. For example, would return STPCardValidationStateValid for @"123" and STPCardBrandVisa, STPCardValidationStateValid for @"1234" and STPCardBrandAmericanExpress, STPCardValidationStateIncomplete for @"12" and STPCardBrandVisa, and STPCardValidationStateInvalid for @"12345" and any brand.
  */
 + (STPCardValidationState)validationStateForCVC:(nonnull NSString *)cvc cardBrand:(STPCardBrand)brand;


Extensions: Fix wrong group test and prevent crash

--- src/App/GeoFeatureGroupExtension.h
+++ src/App/GeoFeatureGroupExtension.h
@@ -73,7 +73,8 @@

     /// Returns true if the given DocumentObject is DocumentObjectGroup but not GeoFeatureGroup
     static bool isNonGeoGroup(const DocumentObject* obj) {
-        return obj->hasExtension(GroupExtension::getExtensionClassTypeId());
+        return obj->hasExtension(GroupExtension::getExtensionClassTypeId()) &
+               !obj->hasExtension(GeoFeatureGroupExtension::getExtensionClassTypeId());
     }
 };


util/comm-dev.c: Fix passing wrong parameter to ioctl

The method ec_command_dev_v2 re-calls ioctl again if the first attempt
fails and the errno is EAGAIN. There is a typo that the pointer of
pointer of data block is passed to ioctl. This may lead to segmentation
fault or, if the driver writes malicious data, arbitrary code execution.

BUG=b:243507497
BRANCH=None
TEST=None

Change-Id: Iece1ff89f9253d976e396d46c0e98f0332016bf6
Signed-off-by: Wen-Ting Tseng <9acb13c74a2c19d08f734ed33a3032b1501b0038@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3850562
Reviewed-by: Jack Rosenthal <d3f605bef1867f59845d4ce6e4f83b8dc9e4e0ae@chromium.org>

--- util/comm-dev.c
+++ util/comm-dev.c
@@ -153,7 +153,7 @@
 			strresult(s_cmd->result));
 		if (errno == EAGAIN && s_cmd->result == EC_RES_IN_PROGRESS) {
 			s_cmd->command = EC_CMD_RESEND_RESPONSE;
-			r = ioctl(fd, CROS_EC_DEV_IOCXCMD_V2, &s_cmd);
+			r = ioctl(fd, CROS_EC_DEV_IOCXCMD_V2, s_cmd);
 			if (r < 0) {
 				fprintf(stderr,
 					"ioctl %d, errno %d (%s), EC result %d (%s)\n",


Remove unused define.

Remove unused define.

--- cloudfsapi.c
+++ cloudfsapi.c
@@ -596,7 +596,6 @@
 int cloudfs_connect()
 {
   #define HUBIC_TOKEN_URL     "https://api.hubic.com/oauth/token"
-  #define HUBIC_AUTH_URL      "https://api.hubic.com/oauth/auth"
   #define HUBIC_CRED_URL      "https://api.hubic.com/1.0/account/credentials"
   #define HUBIC_CLIENT_ID     (reconnect_args.client_id)
   #define HUBIC_CLIENT_SECRET (reconnect_args.client_secret)


Debug info

Debug info

--- cloudfsapi.c
+++ cloudfsapi.c
@@ -246,6 +246,57 @@
   }
 }

+int split_file_and_put(char* path, FILE* fp, FILE* temp) {
+  char* file;
+  long size;
+  int blocks, i;
+  int result = 1;
+
+  fseek(fp, 0L, SEEK_END);
+  size = ftell(fp);
+  fseek(fp, 0L, SEEK_SET);
+
+  blocks = ceil((float)size/BLOCK_SIZE);
+
+  fprintf(temp, "%d", blocks);
+
+  file = (char*)calloc(size, sizeof(char));
+  fread(file, sizeof(char), size, fp);
+
+  for (i = 0; i < blocks; i++) {
+    char num[blocks];
+    char *buf = (char*)calloc(BLOCK_SIZE+1,sizeof(char));
+    FILE *tmp = tmpfile();
+    sprintf(num, ".%d.", i);
+
+    char * complete ;
+    if((complete = malloc(strlen(path)+strlen(num)+1)) != NULL){
+      complete[0] = '\0';   // ensures the memory is an empty string
+      strcat(complete,path);
+      strcat(complete,num);
+    } else {
+      return 0;
+    }
+
+    long begin = i*BLOCK_SIZE;
+    long end = (i*BLOCK_SIZE+BLOCK_SIZE-1 > size ? size : i*BLOCK_SIZE+BLOCK_SIZE);
+
+    fwrite(&file[i*BLOCK_SIZE], sizeof(char), end-begin, tmp);
+    //memcpy(buf, &file[i*BLOCK_SIZE], end-begin);
+    //fprintf(tmp, "%s", buf);
+
+    char *encoded = curl_escape(complete, 0);
+    int response = send_request("PUT", encoded, tmp, NULL, NULL);
+    result = (response >= 200 && response < 300) && result;
+    curl_free(encoded);
+    fclose(tmp);
+    free(buf);
+  }
+
+  free(file);
+  return result;
+}
+
 int cloudfs_object_read_fp(const char *path, FILE *fp)
 {
   fflush(fp);
@@ -269,56 +320,6 @@
   int response = send_request("PUT", encoded, tmp, NULL, NULL);
   curl_free(encoded);
   return (response >= 200 && response < 300);
-}
-
-int split_file_and_put(char* path, FILE* fp, FILE* temp) {
-  char* file;
-  long size;
-  int blocks, i;
-  int result = 1;
-
-  fseek(fp, 0L, SEEK_END);
-  size = ftell(fp);
-  fseek(fp, 0L, SEEK_SET);
-
-  blocks = ceil((float)size/BLOCK_SIZE);
-
-  fprintf(temp, "%d", blocks);
-
-  file = (char*)calloc(size, sizeof(char));
-  fread(file, sizeof(char), size, fp);
-
-  for (i = 0; i < blocks; i++) {
-    char num[blocks];
-    char *buf = (char*)calloc(BLOCK_SIZE+1,sizeof(char));
-    FILE *tmp = tmpfile();
-    sprintf(num, ".%d.", i);
-
-    char * complete ;
-    if((complete = malloc(strlen(path)+strlen(num)+1)) != NULL){
-      complete[0] = '\0';   // ensures the memory is an empty string
-      strcat(complete,path);
-      strcat(complete,num);
-    } else {
-      return 0;
-    }
-
-    long begin = i*BLOCK_SIZE;
-    long end = (i*BLOCK_SIZE+BLOCK_SIZE-1 > size ? size : i*BLOCK_SIZE+BLOCK_SIZE-1);
-
-    memcpy(buf, &file[i*BLOCK_SIZE], end-begin);
-    fprintf(tmp, "%s", buf);
-
-    char *encoded = curl_escape(complete, 0);
-    int response = send_request("PUT", encoded, tmp, NULL, NULL);
-    result = (response >= 200 && response < 300) && result;
-    curl_free(encoded);
-    fclose(tmp);
-    free(buf);
-  }
-
-  free(file);
-  return result;
 }

 int rebuild_file(char* path, FILE *fp, int blocks) {


xbps-repo: [clean] do not fail if cachedir does not exist, update for new API.

--- bin/xbps-repo/clean.c
+++ bin/xbps-repo/clean.c
@@ -43,12 +43,8 @@
 	char *binpkg;
 	int rv = 0;

-	dirp = opendir(xhp->cachedir);
-	if (dirp == NULL) {
-		xbps_error_printf("cannot access to cachedir %s: %s\n",
-		    xhp->cachedir, strerror(errno));
-		return errno;
-	}
+	if ((dirp = opendir(xhp->cachedir)) == NULL)
+		return 0;

 	while ((dp = readdir(dirp)) != NULL) {
 		if ((strcmp(dp->d_name, ".") == 0) ||
@@ -86,7 +82,6 @@
 				    dp->d_name);
 				unlink(binpkg);
 			}
-			prop_object_release(repo_pkgd);
 			free(binpkg);
 			continue;
 		}


add io

add io

--- hardware/platform.h
+++ hardware/platform.h
@@ -49,6 +49,10 @@
 #define STEP_MOTOR_2        QSYS_ADDRESS_TO_LINUX_ADDRESS(0x100002a0)
 #define STEP_MOTOR_3        QSYS_ADDRESS_TO_LINUX_ADDRESS(0x100002c0)
 #define STEP_MOTOR_4        QSYS_ADDRESS_TO_LINUX_ADDRESS(0x100002e0)
+#define STEP_MOTOR_5        QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000900)
+#define STEP_MOTOR_6        QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000920)
+#define STEP_MOTOR_7        QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000940)
+#define STEP_MOTOR_8        QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000960)

 #define POSITITON_SENSNOR_0 QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000300)
 #define POSITITON_SENSNOR_1 QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000320)
@@ -67,14 +71,14 @@
 #define BRUSH_MOTOR_4       QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000400)
 #define BRUSH_MOTOR_5       QSYS_ADDRESS_TO_LINUX_ADDRESS(0x100003a0)

-#define FAN_MOTOR_0         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000420)
-#define FAN_MOTOR_1         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000440)
-#define FAN_MOTOR_2         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000440)
-#define FAN_MOTOR_3         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000440)
-#define FAN_MOTOR_4         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000440)
-#define FAN_MOTOR_5         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000440)
-#define FAN_MOTOR_6         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000440)
-#define FAN_MOTOR_7         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000440)
+#define FAN_MOTOR_0         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000800)
+#define FAN_MOTOR_1         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000820)
+#define FAN_MOTOR_2         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000840)
+#define FAN_MOTOR_3         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000860)
+#define FAN_MOTOR_4         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000880)
+#define FAN_MOTOR_5         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x100008a0)
+#define FAN_MOTOR_6         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x100008c0)
+#define FAN_MOTOR_7         QSYS_ADDRESS_TO_LINUX_ADDRESS(0x100008e0)

 #define SUBDIVISION_STEP_MOTOR_0  QSYS_ADDRESS_TO_LINUX_ADDRESS(0x10000440)


Read WTP Desc.

Read WTP Desc.

FossilOrigin-Name: 2a2806ef2d1fc790e2869d23e89b8bf8c26621559c0bd285851a9169e9df2ab9

error: pathspec 'src/capwap/cw_read_wtp_descriptor.c' did not match any file(s) known to git

--- src/capwap/cw_read_wtp_descriptor.c
+++ src/capwap/cw_read_wtp_descriptor.c
@@ -0,0 +1,148 @@
+/*
+    This file is part of libcapwap.
+
+    libcapwap is free software: you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation, either version 3 of the License, or
+    (at your option) any later version.
+
+    libcapwap is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with Foobar.  If not, see <http://www.gnu.org/licenses/>.
+
+*/
+
+
+#include "capwap.h"
+#include "capwap_items.h"
+
+#include "wtpinfo.h"
+
+#include "cw_util.h"
+#include "dbg.h"
+
+
+
+
+static int readelem_wtp_descriptor(struct conn *conn, struct cw_action_in *a,
+				   uint8_t * data, int len, int cq)
+{
+
+	if (len < 6) {
+		return 0;
+	}
+
+	cw_itemstore_t itemstore = conn->incomming;
+
+	cw_itemstore_set_byte(itemstore, CW_ITEM_WTP_MAX_RADIOS, cw_get_byte(data));
+	cw_itemstore_set_byte(itemstore, CW_ITEM_WTP_RADIOS_IN_USE,
+			      cw_get_byte(data + 1));
+
+	int ncrypt = cw_get_byte(data + 2);
+	int i;
+	if (ncrypt == 0) {
+		/* non-conform */
+		cw_dbg(DBG_RFC,
+		       "Non-standard-conform WTP descriptor detected (See RFC 5415)");
+		if (!cq)
+			i = 3;
+		else
+			i = 4;
+	} else {
+		i = ncrypt * 3 + 3;
+	}
+
+	do {
+		if (i + 8 > len) {
+			cw_dbg(DBG_ELEM_ERR,
+			       "WTP descriptor subelement to long, length=%d>%d", i + 8,
+			       len);
+			return 0;
+		}
+
+		uint32_t vendor_id = cw_get_dword(data + i);	//ntohl(*((uint32_t*)(msgelem+i)));
+
+		uint32_t val = cw_get_dword(data + i + 4);
+		int subtype = (val >> 16) & 0xffff;
+		int sublen = val & 0xffff;
+		i += 8;
+
+		if (sublen + i > len) {
+			cw_dbg(DBG_ELEM_ERR,
+			       "WTP Descriptor subelement too long, length = %d", sublen);
+			return 0;
+		}
+
+		cw_dbg(DBG_SUBELEM, "WTP Descriptor subtype=%d,len=%d", subtype, sublen);
+
+		switch (subtype) {
+			case CW_SUBELEM_WTP_HARDWARE_VERSION:
+				cw_itemstore_set_dword(itemstore,
+						       CW_ITEM_WTP_HARDWARE_VENDOR,
+						       vendor_id);
+				cw_itemstore_set_bstrn(itemstore,
+						       CW_ITEM_WTP_HARDWARE_VERSION,
+						       data + i, sublen);
+				break;
+			case CW_SUBELEM_WTP_SOFTWARE_VERSION:
+				cw_itemstore_set_dword(itemstore,
+						       CW_ITEM_WTP_SOFTWARE_VENDOR,
+						       vendor_id);
+				cw_itemstore_set_bstrn(itemstore,
+						       CW_ITEM_WTP_SOFTWARE_VERSION,
+						       data + i, sublen);
+				break;
+			case CW_SUBELEM_WTP_BOOTLOADER_VERSION:
+				cw_itemstore_set_dword(itemstore,
+						       CW_ITEM_WTP_BOOTLOADER_VENDOR,
+						       vendor_id);
+				cw_itemstore_set_bstrn(itemstore,
+						       CW_ITEM_WTP_BOOTLOADER_VERSION,
+						       data + i, sublen);
+				break;
+			default:
+				cw_dbg(DBG_ELEM_ERR,
+				       "Unknown WTP descriptor subelement, type = %d",
+				       subtype);
+				break;
+		}
+		i += sublen;
+
+	} while (i < len);
+
+	return 1;
+}
+
+int cw_in_wtp_descriptor(struct conn *conn, struct cw_action_in *a, uint8_t * data,
+			 int len)
+{
+	switch (conn->capwap_mode) {
+		case CW_MODE_STD:
+			{
+				int rc =
+				    readelem_wtp_descriptor(conn, a, data, len,
+							    CW_MODE_STD);
+				if (!rc) {
+					cw_dbg(DBG_ELEM_ERR, "Bad WTP descriptor from %s",
+					       sock_addr2str(&conn->addr));
+					return 0;
+				}
+				return 1;
+			}
+
+
+
+	}
+
+	int rc = readelem_wtp_descriptor(conn, a, data, len, 0);
+	if (rc == -1) {
+		cw_dbg(DBG_RFC, "Bad WTP descriptor, trying cisco hack");
+		rc = readelem_wtp_descriptor(conn, a, data, len, 1);
+	}
+
+	return rc;
+}


Changed warn to be static to fix compile errors; src/textadept.h


SampleApp builds skia on Linux with BGRA pixel order, but Ganesh's SampleApp
assumes GL_RGBA texture format on all platforms except Windows (where it uses
GL_BGRA), so texture colours come out wrong.  As a temporary fix, do on Linux
what we do on Windows, and assume GL_BGRA.  (This should be made more general
later, and the assumption of matching formats between Skia and Ganesh removed.)

Review URL:  http://codereview.appspot.com/4474046/

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@1247 2bbb7eff-a529-9590-31e7-b0007b416f81

--- gpu/include/GrGLConfig.h
+++ gpu/include/GrGLConfig.h
@@ -133,7 +133,7 @@
 // Pick a pixel config for 32bit bitmaps. Our default is GL_RGBA (except on
 // Windows where we match GDI's order).
 #ifndef GR_GL_32BPP_COLOR_FORMAT
-    #if GR_WIN32_BUILD
+    #if GR_WIN32_BUILD || GR_LINUX_BUILD
         #define GR_GL_32BPP_COLOR_FORMAT    GR_GL_BGRA
     #else
         #define GR_GL_32BPP_COLOR_FORMAT    GR_GL_RGBA


i don't know how i missed this bug for so long. maybe it only triggered on t430?


- Added variable initialization to avoid compiler warning.

--- src/cell_interface/cell_interface.c
+++ src/cell_interface/cell_interface.c
@@ -251,7 +251,8 @@
     void *window_number_as_void)
 {
   int window_number = *((int*)window_number_as_void);
-  z_ucs buf, input, event_type;
+  z_ucs input, event_type;
+  z_ucs buf = 0; // init to 0 to calm compiler.
   z_ucs *linebreak;
   int space_on_line, i;

@@ -336,9 +337,8 @@
       TRACE_LOG("linebreak found.\n");
       buf = *linebreak;
       *linebreak = 0;
-    }
-
-    TRACE_LOG("buf: %d\n", buf);
+      TRACE_LOG("buf: %d\n", buf);
+    }

     TRACE_LOG("Output at %d/%d:\"",
         z_windows[window_number]->xcursorpos,


CRED: Missing put_cred() in prepare_kernel_cred()

Missing put_cred() in the error handling path of prepare_kernel_cred().

Signed-off-by: David Howells <ebac1d06c1688626821bb0e574a037a7a5354e49@redhat.com>
Acked-by: Steve Dickson <305cc9d5027c0f4e08c2697d4cabde07a8221669@redhat.com>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- kernel/cred.c
+++ kernel/cred.c
@@ -529,6 +529,7 @@

 error:
 	put_cred(new);
+	put_cred(old);
 	return NULL;
 }
 EXPORT_SYMBOL(prepare_kernel_cred);


kernel/fork.c: fix coding style issues

kernel/fork.c: fix coding style issues

Fix errors reported by checkpatch.pl.  One error is parentheses, the other
is a whitespace issue.

Signed-off-by: Daeseok Youn <9396ba0d387050db72435da746b84d5b8364732d@gmail.com>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>

--- kernel/fork.c
+++ kernel/fork.c
@@ -1654,7 +1654,7 @@
 	return do_fork(SIGCHLD, 0, 0, NULL, NULL);
 #else
 	/* can not support in nommu mode */
-	return(-EINVAL);
+	return -EINVAL;
 #endif
 }
 #endif
@@ -1662,7 +1662,7 @@
 #ifdef __ARCH_WANT_SYS_VFORK
 SYSCALL_DEFINE0(vfork)
 {
-	return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0,
+	return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, 0,
 			0, NULL, NULL);
 }
 #endif


kernel: main: remove useless comment

kernel: main: remove useless comment

--- kernel/main.c
+++ kernel/main.c
@@ -209,179 +209,6 @@
 {
 	int timeout = 1000000;

-//	pio_set_value(GPIOD_BASE, 12);
-//	timeout = 1000000;
-//	while (timeout--)
-//		;
-//
-//	pio_clear_value(GPIOD_BASE, 12);
-//	timeout = 1000000;
-//	while (timeout--)
-//		;
-//	pio_set_value(GPIOD_BASE, 12);
-//	timeout = 1000000;
-//	while (timeout--)
-//		;
-//
-//	ili9341_send_command(ILI9341_RESET);
-//	timeout = 1000000;
-//	while (timeout--)
-//		;
-//	ili9341_send_command(0xCFu);  // Power control B
-//	ili9341_send_data(0x00u);
-//	ili9341_send_data(0xc1u);
-//	ili9341_send_data(0X30u);
-//
-//	ili9341_send_command(0xEDu); // Power on sequence control
-//	ili9341_send_data(0x64u);
-//	ili9341_send_data(0x03u);
-//	ili9341_send_data(0X12u);
-//	ili9341_send_data(0X81u);
-//
-//	ili9341_send_command(0xE8u);  // Driver timing control A
-//	ili9341_send_data(0x85u);
-//	ili9341_send_data(0x00u);
-//	ili9341_send_data(0x7Au);
-//
-//	ili9341_send_command(0xCBu);   // Power control A
-//	ili9341_send_data(0x39u);
-//	ili9341_send_data(0x2Cu);
-//	ili9341_send_data(0x00u);
-//	ili9341_send_data(0x34u);
-//	ili9341_send_data(0x02u);
-//
-//	ili9341_send_command(0xF7u);  // Pump ratio control
-//	ili9341_send_data(0x20u);
-//
-//	ili9341_send_command(0xEAu);  // Driver timing control B
-//	ili9341_send_data(0x00u);
-//	ili9341_send_data(0x00u);
-//
-//	ili9341_send_command(0xC0u); //Power Control 1
-//	ili9341_send_data(0x1Bu); //VRH[5:0]
-//
-//	ili9341_send_command(0xC1u); //Power Control 2
-//	ili9341_send_data(0x10u); //SAP[2:0];BT[3:0]
-//
-//	ili9341_send_command(0xC5u); //VCOM Control 1
-//	ili9341_send_data(0x34u);
-//	ili9341_send_data(0x3Fu);
-//
-//	ili9341_send_command(0xC7u); //VCOM Control 2
-//	ili9341_send_data(0xC0u);
-//
-//	ili9341_send_command(0x3Au); // Pixel Format Set => 18 bits
-//	ili9341_send_data(0x66u);
-//
-//	ili9341_send_command(0x36u); // Memory Access Control
-//	ili9341_send_data(0x08u);
-//
-//	ili9341_send_command(0xB1u); // Frame Rate Control (In Normal Mode/Full Colors) (
-//	ili9341_send_data(0x00u);
-//	ili9341_send_data(0x1Du);
-//
-//	ili9341_send_command(0xB5u);     // Blanking porch control
-//	ili9341_send_data(0x02u);
-//	ili9341_send_data(0x02u);
-//	ili9341_send_data(10u);
-//	ili9341_send_data(30u);
-//
-//	ili9341_send_command(0xB6u); // Display Function Control
-//	ili9341_send_data(0x0Au);
-//	ili9341_send_data(0x02u);//a2
-//
-//	ili9341_send_command(0xF2u); // 3Gamma Function Disable
-//	ili9341_send_data(0x00u);
-//
-//	ili9341_send_command(0x26u); //Gamma curve selected
-//	ili9341_send_data(0x01u);
-//
-//	ili9341_send_command(0xE0u); //Positive Gamma Correction
-//	ili9341_send_data(0x0Fu);
-//	ili9341_send_data(0x39u);
-//	ili9341_send_data(0x36u);
-//	ili9341_send_data(0x0Bu);
-//	ili9341_send_data(0x0Eu);
-//	ili9341_send_data(0x09u);
-//	ili9341_send_data(0x52u);
-//	ili9341_send_data(0xA1u);
-//	ili9341_send_data(0x38u);
-//	ili9341_send_data(0x07u);
-//	ili9341_send_data(0x0Fu);
-//	ili9341_send_data(0x02u);
-//	ili9341_send_data(0x10u);
-//	ili9341_send_data(0x0Du);
-//	ili9341_send_data(0x00u);
-//
-//	ili9341_send_command(0XE1u); //Negative Gamma Correction
-//	ili9341_send_data(0x00u);
-//	ili9341_send_data(0x06u);
-//	ili9341_send_data(0x0Au);
-//	ili9341_send_data(0x05u);
-//	ili9341_send_data(0x11u);
-//	ili9341_send_data(0x06u);
-//	ili9341_send_data(0x2Du);
-//	ili9341_send_data(0x52u);
-//	ili9341_send_data(0x48u);
-//	ili9341_send_data(0x08u);
-//	ili9341_send_data(0x10u);
-//	ili9341_send_data(0x0Cu);
-//	ili9341_send_data(0x2Fu);
-//	ili9341_send_data(0x32u);
-//	ili9341_send_data(0x0Fu);
-//
-//	ili9341_send_command(0x11u); //Exit Sleep
-//	timeout = 1000000;
-//	while (timeout--)
-//		;
-//
-//	ili9341_send_command(0x29u); //Display on
-//
-//
-//	// Write the display data into GRAM here
-//	ili9341_send_command(0x2Au); // Column Address Set
-//	ili9341_send_data(0x00u);
-//	ili9341_send_data(0x00u);
-//	ili9341_send_data(0x00u);
-//	ili9341_send_data(0xEFu);
-//
-//	ili9341_send_command(0x2Bu); // Page Address Set (
-//	ili9341_send_data(0x00u);
-//	ili9341_send_data(0x00u);
-//	ili9341_send_data(0x01u);
-//	ili9341_send_data(0x3Fu);
-//
-//	// ****RGB******
-//	ili9341_send_command(0xb0u);  // RGB Interface Signal Control
-//	ili9341_send_data(0xC0u); //40 42 60 62
-//
-//	ili9341_send_command(0x3au);  //Pixel Format Set -> 18 bits
-//	ili9341_send_data(0x55u);   // 16 bits/pixel
-//
-//	ili9341_send_command(0xf6u);  // Interface Control
-//	ili9341_send_data(0x00u); //
-//	ili9341_send_data(0x03u); //
-//	ili9341_send_data(0x06u); //06 08
-//
-//	pio_set_value(GPIOD_BASE, 12);
-//	timeout = 1000000;
-//	while (timeout--)
-//		;
-//
-//	pio_clear_value(GPIOD_BASE, 12);
-//	timeout = 1000000;
-//	while (timeout--)
-//		;
-//	pio_set_value(GPIOD_BASE, 12);
-//	timeout = 1000000;
-//	while (timeout--)
-//		;
-//
-//	ili9341_send_command(ILI9341_RESET);
-//	timeout = 1000000;
-//	while (timeout--)
-//		;
-
 	ili9341_send_data(0xC3);
 	ili9341_send_data(0x08);
 	ili9341_send_data(0x50);
@@ -507,29 +334,6 @@
 #define GPIO_AF_LTDC	((unsigned char)0x0E)
 #define GPIO_AF_LCD	((unsigned char)0x09)

-
-//	ltdc.hsync = 10;
-//	ltdc.vsync = 2;
-//	ltdc.hbp = 20;
-//	ltdc.hfp = 10;
-//	ltdc.vbp = 2;
-//	ltdc.vfp = 4;
-//	ltdc.width = 240;
-//	ltdc.height = 320;
-//	ltdc.bpp = 2;
-//	ltdc.fb_addr = 0x20000000;
-
-//	ltdc.hsync = 20;
-//	ltdc.vsync = 2;
-//	ltdc.hbp = 20;
-//	ltdc.hfp = 10;
-//	ltdc.vbp = 2;
-//	ltdc.vfp = 4;
-//	ltdc.width = 240;
-//	ltdc.height = 320;
-//	ltdc.bpp = 2;
-//	ltdc.fb_addr = 0x20000000;
-
 	ltdc.hsync = 16;
 	ltdc.vsync = 2;
 	ltdc.hbp = 40;


patched fe_field_funciton.templates.h

patched fe_field_funciton.templates.h

--- include/deal.II/numerics/fe_field_function.templates.h
+++ include/deal.II/numerics/fe_field_function.templates.h
@@ -87,7 +87,8 @@
     FEValues<dim> fe_v(mapping, cell->get_fe(), quad,
                        update_values);
     fe_v.reinit(cell);
-    std::vector< Vector<double> > vvalues (1, values);
+    std::vector< Vector<typename VECTOR::value_type> > vvalues (1);
+    vvalues[0].reinit(values.size());
     fe_v.get_function_values(data_vector, vvalues);
     values = vvalues[0];
   }
@@ -138,10 +139,13 @@
     FEValues<dim> fe_v(mapping, cell->get_fe(), quad,
                        update_gradients);
     fe_v.reinit(cell);
-    std::vector< std::vector<Tensor<1,dim> > > vgrads
-    (1,  std::vector<Tensor<1,dim> >(n_components) );
+    std::vector< std::vector<Tensor<1,dim,typename VECTOR::value_type> > > vgrads
+    (1,  std::vector<Tensor<1,dim,typename VECTOR::value_type> >(n_components) );
     fe_v.get_function_gradients(data_vector, vgrads);
-    gradients = vgrads[0];
+    const unsigned int s = vgrads[0].size();
+    gradients.resize(s);
+    for (unsigned int i = 0; i < s; i++)
+      gradients[i] = vgrads[0][i];
   }

@@ -191,7 +195,8 @@
     FEValues<dim> fe_v(mapping, cell->get_fe(), quad,
                        update_hessians);
     fe_v.reinit(cell);
-    std::vector< Vector<double> > vvalues (1, values);
+    std::vector< Vector<typename VECTOR::value_type> > vvalues (1);
+    vvalues[0].reinit(values.size());
     fe_v.get_function_laplacians(data_vector, vvalues);
     values = vvalues[0];
   }
@@ -246,7 +251,7 @@
       {
         fe_v.reinit(cells[i], i, 0);
         const unsigned int nq = qpoints[i].size();
-        std::vector< Vector<double> > vvalues (nq, Vector<double>(n_components));
+        std::vector< Vector<typename VECTOR::value_type> > vvalues (nq, Vector<typename VECTOR::value_type>(n_components));
         fe_v.get_present_fe_values ().get_function_values(data_vector, vvalues);
         for (unsigned int q=0; q<nq; ++q)
           values[maps[i][q]] = vvalues[q];
@@ -308,11 +313,17 @@
       {
         fe_v.reinit(cells[i], i, 0);
         const unsigned int nq = qpoints[i].size();
-        std::vector< std::vector<Tensor<1,dim> > >
-        vgrads (nq, std::vector<Tensor<1,dim> >(n_components));
+        std::vector< std::vector<Tensor<1,dim,typename VECTOR::value_type> > >
+        vgrads (nq, std::vector<Tensor<1,dim,typename VECTOR::value_type> >(n_components));
         fe_v.get_present_fe_values ().get_function_gradients(data_vector, vgrads);
         for (unsigned int q=0; q<nq; ++q)
-          values[maps[i][q]] = vgrads[q];
+          {
+            std::vector< Tensor<1,dim> > &viq = values[maps[i][q]];
+            const unsigned int s = vgrads[q].size();
+            viq.resize(s);
+            for (unsigned int l=0;l<s;l++)
+              viq[l] = vgrads[q][l];
+          }
       }
   }

@@ -368,7 +379,7 @@
       {
         fe_v.reinit(cells[i], i, 0);
         const unsigned int nq = qpoints[i].size();
-        std::vector< Vector<double> > vvalues (nq, Vector<double>(n_components));
+        std::vector< Vector<typename VECTOR::value_type> > vvalues (nq, Vector<typename VECTOR::value_type>(n_components));
         fe_v.get_present_fe_values ().get_function_laplacians(data_vector, vvalues);
         for (unsigned int q=0; q<nq; ++q)
           values[maps[i][q]] = vvalues[q];


Minor fix for slab.c

Minor fix for slab.c

--- kernel/slab.c
+++ kernel/slab.c
@@ -25,7 +25,8 @@
     slab_buf->free_blocks_remaining = slab_buf->capacity;

     // Create a pointer chain to link all free blocks
-    slab_buf->next_free = buf + sizeof(slab_buf_t);
+    size_t offset = *((unsigned long*)slab_buf->buf) == SLAB_MAGIC ? sizeof(slab_buf_t) : 0;
+    slab_buf->next_free = buf + offset;
     void *next = slab_buf->next_free;
     for (unsigned int i = 0; i < (slab_buf->capacity-1); i++) {
         void *next_block = (void*)((uintptr_t)next + block_size);


Do not take wild guesses at how if_enc's internal works, include net/if_enc.h instead. ok todd@ and probably claudio who's in the train.

--- net/route.c
+++ net/route.c
@@ -1,4 +1,4 @@
-/*	$OpenBSD: route.c,v 1.85 2007/09/15 16:43:51 henning Exp $	*/
+/*	$OpenBSD: route.c,v 1.86 2007/09/17 05:06:20 pyr Exp $	*/
 /*	$NetBSD: route.c,v 1.14 1996/02/13 22:00:46 christos Exp $	*/

 /*
@@ -123,8 +123,8 @@

 #ifdef IPSEC
 #include <netinet/ip_ipsp.h>
-
-extern struct ifnet encif;
+#include <net/if_enc.h>
+
 struct ifaddr	*encap_findgwifa(struct sockaddr *);
 #endif

@@ -164,7 +164,7 @@
 struct ifaddr *
 encap_findgwifa(struct sockaddr *gw)
 {
-	return (TAILQ_FIRST(&encif.if_addrlist));
+	return (TAILQ_FIRST(&encif[0].sc_if.if_addrlist));
 }
 #endif


Subzero: Fix a potential null-pointer dereference.

BUG= none
R=jpp@chromium.org, manasijm@google.com

Review URL: https://codereview.chromium.org/2103613002 .

--- src/IceTargetLoweringX86BaseImpl.h
+++ src/IceTargetLoweringX86BaseImpl.h
@@ -5327,14 +5327,17 @@
         }
       } else if (VarDef->getOp() == InstArithmetic::Mul) {
         SizeT PowerOfTwo = 0;
-        ConstantInteger32 *MultConst =
-            llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(0));
-        if (llvm::isPowerOf2_32(MultConst->getValue())) {
-          PowerOfTwo += MultConst->getValue();
+        if (auto *MultConst =
+                llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(0))) {
+          if (llvm::isPowerOf2_32(MultConst->getValue())) {
+            PowerOfTwo += MultConst->getValue();
+          }
         }
-        MultConst = llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(1));
-        if (llvm::isPowerOf2_32(MultConst->getValue())) {
-          PowerOfTwo += MultConst->getValue();
+        if (auto *MultConst =
+                llvm::dyn_cast<ConstantInteger32>(VarDef->getSrc(1))) {
+          if (llvm::isPowerOf2_32(MultConst->getValue())) {
+            PowerOfTwo += MultConst->getValue();
+          }
         }
         ZeroesAvailable = llvm::Log2_32(PowerOfTwo) + 1;
       }


ACL: If a subscribed mailbox doesn't have list right, show it as non-existing.

--- src/plugins/acl/acl-mailbox-list.c
+++ src/plugins/acl/acl-mailbox-list.c
@@ -177,9 +177,9 @@
 }

 static int
-acl_mailbox_list_info_is_visible(struct acl_mailbox_list_iterate_context *ctx,
-				 const struct mailbox_info *info)
-{
+acl_mailbox_list_info_is_visible(struct acl_mailbox_list_iterate_context *ctx)
+{
+	struct mailbox_info *info = &ctx->info;
 	const char *acl_name;
 	int ret;

@@ -196,14 +196,9 @@
 		return ret;

 	/* no permission to see this mailbox */
-	if ((ctx->info.flags & MAILBOX_SUBSCRIBED) != 0) {
+	if ((info->flags & MAILBOX_SUBSCRIBED) != 0) {
 		/* it's subscribed, show it as non-existent */
-		if (info != &ctx->info) {
-			ctx->info = *info;
-			info = &ctx->info;
-		}
-		ctx->info.flags = MAILBOX_NONEXISTENT |
-			MAILBOX_SUBSCRIBED;
+		info->flags = MAILBOX_NONEXISTENT | MAILBOX_SUBSCRIBED;
 		return 1;
 	}
 	return 0;
@@ -218,8 +213,9 @@
 	int ret;

 	while ((info = acl_mailbox_list_iter_next_info(ctx)) != NULL) {
+		ctx->info = *info;
 		T_BEGIN {
-			ret = acl_mailbox_list_info_is_visible(ctx, info);
+			ret = acl_mailbox_list_info_is_visible(ctx);
 		} T_END;
 		if (ret > 0)
 			break;
@@ -229,7 +225,7 @@
 		}
 		/* skip to next one */
 	}
-	return info;
+	return &ctx->info;
 }

 static int


Fix semicolon.

Fix semicolon.

--- Pod/Classes/ViewControllers/VGContentTableViewController/VGContentTableViewController.h
+++ Pod/Classes/ViewControllers/VGContentTableViewController/VGContentTableViewController.h
@@ -17,6 +17,6 @@
 @property (nonatomic, strong) VGURLContent *content;

 @property (nonatomic, strong) IBInspectable NSString *contentName;
-@property (nonatomic, strong) IBInspectable NSString *cellIdentifier
+@property (nonatomic, strong) IBInspectable NSString *cellIdentifier;

 @end


Update 3rdparty/postgresql/pg_lzcompress.c

--- 3rdparty/postgresql/pg_lzcompress.c
+++ 3rdparty/postgresql/pg_lzcompress.c
@@ -737,7 +737,7 @@
 				 * must check this, else we risk an infinite loop below in the
 				 * face of corrupt data.)
 				 */
-				if (unlikely(sp > srcend || off == 0))
+				if (sp > srcend || off == 0)
 					return -1;

 				/*


acl: Don't use dovecot-acl-list with public namespaces.
All mailboxes in a public namespace are typically in dovecot-acl-list anyway.

--HG--
branch : HEAD

--- src/plugins/acl/acl-mailbox-list.c
+++ src/plugins/acl/acl-mailbox-list.c
@@ -98,6 +98,12 @@
 	if ((ctx->ctx.flags & (MAILBOX_LIST_ITER_RAW_LIST |
 			       MAILBOX_LIST_ITER_SELECT_SUBSCRIBED)) != 0)
 		return;
+
+	if (ns->type == NAMESPACE_PUBLIC) {
+		/* mailboxes in public namespace should all be listable to
+		   someone. we don't benefit from fast listing. */
+		return;
+	}

 	/* if this namespace's default rights contain LOOKUP, we'll need to
 	   go through all mailboxes in any case. */


Forgot to add.

Forgot to add.

error: pathspec 'src/plugins/acl/acl-mailbox-list.c' did not match any file(s) known to git

--- src/plugins/acl/acl-mailbox-list.c
+++ src/plugins/acl/acl-mailbox-list.c
@@ -0,0 +1,129 @@
+/* Copyright (C) 2006 Timo Sirainen */
+
+#include "lib.h"
+#include "array.h"
+#include "mailbox-list-private.h"
+#include "acl-api-private.h"
+#include "acl-plugin.h"
+
+struct acl_mailbox_list {
+	struct mailbox_list_vfuncs super;
+
+	/* FIXME: this is wrong. multiple storages can use the same
+	   mailbox_list, so the whole ACL plugin probably needs redesigning.
+	   for now this is just kludged to work this way. */
+	struct mail_storage *storage;
+};
+
+unsigned int acl_mailbox_list_module_id = 0;
+
+static bool acl_mailbox_list_module_id_set = FALSE;
+
+static struct mailbox_info *
+acl_mailbox_list_iter_next(struct mailbox_list_iterate_context *ctx)
+{
+	struct acl_mailbox_list *alist = ACL_CONTEXT(ctx->list);
+	struct mailbox_info *info;
+	int ret;
+
+	for (;;) {
+		info = alist->super.iter_next(ctx);
+		if (info == NULL)
+			return NULL;
+
+		ret = acl_storage_have_right(alist->storage, info->name,
+					     ACL_STORAGE_RIGHT_LOOKUP, NULL);
+		if (ret > 0)
+			return info;
+		if (ret < 0) {
+			ctx->failed = TRUE;
+			return NULL;
+		}
+
+		/* no permission to see this mailbox */
+		if ((ctx->flags & MAILBOX_LIST_ITER_SUBSCRIBED) != 0) {
+			/* it's subscribed, show it as non-existent */
+			if ((ctx->flags & MAILBOX_LIST_ITER_FAST_FLAGS) == 0)
+				info->flags = MAILBOX_NONEXISTENT;
+			return info;
+		}
+
+		/* skip to next one */
+	}
+}
+
+static int acl_get_mailbox_name_status(struct mailbox_list *list,
+				       const char *name,
+				       enum mailbox_name_status *status)
+{
+	struct acl_mailbox_list *alist = ACL_CONTEXT(list);
+	const char *parent;
+	int ret;
+
+	ret = acl_storage_have_right(alist->storage, name,
+				     ACL_STORAGE_RIGHT_LOOKUP, NULL);
+	if (ret < 0)
+		return -1;
+
+	if (alist->super.get_mailbox_name_status(list, name, status) < 0)
+		return -1;
+	if (ret > 0)
+		return 0;
+
+	/* we shouldn't reveal this mailbox's existance */
+	switch (*status) {
+	case MAILBOX_NAME_EXISTS:
+		*status = MAILBOX_NAME_VALID;
+		break;
+	case MAILBOX_NAME_VALID:
+	case MAILBOX_NAME_INVALID:
+		break;
+	case MAILBOX_NAME_NOINFERIORS:
+		/* have to check if we are allowed to see the parent */
+		t_push();
+		parent = acl_storage_get_parent_mailbox_name(alist->storage,
+							     name);
+		ret = acl_storage_have_right(alist->storage, parent,
+					     ACL_STORAGE_RIGHT_LOOKUP, NULL);
+		t_pop();
+
+		if (ret < 0)
+			return -1;
+		if (ret == 0) {
+			/* no permission to see the parent */
+			*status = MAILBOX_NAME_VALID;
+		}
+		break;
+	}
+	return 0;
+}
+
+void acl_mailbox_list_created(struct mailbox_list *list)
+{
+	struct acl_mailbox_list *alist;
+
+	if (acl_next_hook_mailbox_list_created != NULL)
+		acl_next_hook_mailbox_list_created(list);
+
+	alist = p_new(list->pool, struct acl_mailbox_list, 1);
+	alist->super = list->v;
+	list->v.iter_next = acl_mailbox_list_iter_next;
+	list->v.get_mailbox_name_status = acl_get_mailbox_name_status;
+
+	if (!acl_mailbox_list_module_id_set) {
+		acl_mailbox_list_module_id = mailbox_list_module_id++;
+		acl_mailbox_list_module_id_set = TRUE;
+	}
+
+	array_idx_set(&list->module_contexts,
+		      acl_mailbox_list_module_id, &alist);
+}
+
+void acl_mailbox_list_set_storage(struct mail_storage *storage)
+{
+	struct acl_mailbox_list *alist = ACL_CONTEXT(storage->list);
+
+	i_assert(alist->storage == NULL);
+
+	alist->storage = storage;
+}


Fixed build on Windows.

Fixed build on Windows.

--- src/zorbamisc/config/compatib_defs.h
+++ src/zorbamisc/config/compatib_defs.h
@@ -28,6 +28,7 @@
 #endif

 typedef unsigned long ulong;
+typedef unsigned int uint;
 // typedef __int64		int64_t;
 // typedef unsigned __int64	uint64_t;
 typedef unsigned short		uint16_t;


Fixed.

Fixed.

--- utility/ilog2.h
+++ utility/ilog2.h
@@ -4,7 +4,7 @@
 #define HL_ILOG2_H

 #if defined(_WIN32)
-#include <intrn.h>
+#include <windows.h>
 #endif

 namespace HL {
@@ -13,10 +13,13 @@
 #if defined(_WIN32)
   static inline int ilog2 (size_t sz)
   {
-    int retval;
-    sz = (sz << 1) - 1;
-    _BitScanForward (&retval, sz);
-    return retval;
+    DWORD index;
+    _BitScanReverse (&index, sz);
+    if (!(sz & (sz-1))) {
+      return index;
+    } else {
+      return index+1;
+    }
   }
 #elif defined(__GNUC__) && defined(__i386__)
   static inline int ilog2 (size_t sz)


*** empty log message ***

*** empty log message ***

--- cmd/smyrna/gui/frmobjectui.c
+++ cmd/smyrna/gui/frmobjectui.c
@@ -26,6 +26,7 @@
 #include "viewport.h"
 #include "memory.h"
 #include "frmobjectui.h"
+#include <assert.h>

 #ifdef WIN32
 #define STRCASECMP stricmp
@@ -34,134 +35,134 @@
 #define STRCASECMP strcasecmp
 #endif

-static attr_t *binarySearch(attr_list * l, char *searchKey);
+static attr_t* binarySearch( attr_list* l, char* searchKey);
 static int sel_node;
 static int sel_edge;
 static int sel_graph;

-static char *safestrdup(char *src)
-{
-    if (!src)
-	return NULL;
-    else
-	return strdup(src);
+static char* safestrdup(char* src)
+{
+	if (!src)
+		return NULL;
+	else
+		return strdup(src);
 }
 static int get_object_type()
 {
-    if (gtk_toggle_button_get_active
-	((GtkToggleButton *) glade_xml_get_widget(xml, "attrRB0")))
-	return AGRAPH;
-    if (gtk_toggle_button_get_active
-	((GtkToggleButton *) glade_xml_get_widget(xml, "attrRB1")))
-	return AGNODE;
-    if (gtk_toggle_button_get_active
-	((GtkToggleButton *) glade_xml_get_widget(xml, "attrRB2")))
-	return AGEDGE;
-    return -1;
-}
-
-void free_attr(attr_t * at)
-{
-    free(at->defValG);
-    free(at->defValN);
-    free(at->defValE);
-
-    free(at->name);
-    free(at);
-}
-
-
-attr_t *new_attr()
-{
-    attr_t *attr = malloc(sizeof(attr_t));
-    attr->defValG = (char *) 0;
-    attr->defValN = (char *) 0;
-    attr->defValE = (char *) 0;
-    attr->name = (char *) 0;
-    attr->value = (char *) 0;
-    attr->propagate = 0;
-    attr->objType[0] = 0;
-    attr->objType[1] = 0;
-    attr->objType[2] = 0;
-    return attr;
-}
-
-
-attr_t *new_attr_with_ref(Agsym_t * sym)
-{
-    attr_t *attr = new_attr();
-    attr->name = safestrdup(sym->name);
-    switch (sym->kind) {
-    case AGRAPH:
-	attr->objType[0] = 1;
-	if (sym->defval)
-	    attr->defValG = safestrdup(sym->defval);
-	break;
-    case AGNODE:
-	attr->objType[1] = 1;
-	if (sym->defval)
-	    attr->defValN = safestrdup(sym->defval);
-	break;
-    case AGEDGE:
-	attr->objType[2] = 1;
-	if (sym->defval)
-	    attr->defValE = safestrdup(sym->defval);
-	break;
-    }
-    return attr;
-}
-
-attr_t *new_attr_ref(attr_t * refAttr)
-{
-    attr_t *attr = malloc(sizeof(attr_t));
-    *attr = *refAttr;
-    attr->defValG = safestrdup(refAttr->defValG);
-    attr->defValN = safestrdup(refAttr->defValN);
-    attr->defValE = safestrdup(refAttr->defValE);
-    attr->name = safestrdup(refAttr->name);
-    if (refAttr->value)
-	attr->value = safestrdup(refAttr->value);
-    return attr;
-}
-
-static void reset_attr_list_widgets(attr_list * l)
-{
-    int id = 0;
-    for (id; id < MAX_FILTERED_ATTR_COUNT; id++) {
-	gtk_label_set_text(l->fLabels[id], "");
-    }
-}
-
-
-
-static void free_attr_list_widgets(attr_list * l)
-{
-    int id = 0;
-    for (id; id < MAX_FILTERED_ATTR_COUNT; id++) {
-	gtk_object_destroy((GtkObject *) l->fLabels[id]);
-    }
-}
-
-
-void free_attr_list(attr_list * l)
-{
-    int id = 0;
-    for (id; id < l->attr_count; id++) {
-	free_attr(l->attributes[id]);
-    }
-    if (l->with_widgets)
-	free_attr_list_widgets(l);
-    free(l);
-}
-attr_list *attr_list_new(Agraph_t * g, int with_widgets)
-{
-    int id = 0;
-    attr_list *l = malloc(sizeof(attr_list));
-    l->attr_count = 0;
-    l->capacity = DEFAULT_ATTR_LIST_CAPACITY;
-    l->attributes = malloc(DEFAULT_ATTR_LIST_CAPACITY * sizeof(attr_t *));
-    l->with_widgets = with_widgets;
-    /*create filter widgets */
+	if(gtk_toggle_button_get_active((GtkToggleButton*)glade_xml_get_widget(xml, "attrRB0")))
+		return AGRAPH;
+	if(gtk_toggle_button_get_active((GtkToggleButton*)glade_xml_get_widget(xml, "attrRB1")))
+		return AGNODE;
+	if(gtk_toggle_button_get_active((GtkToggleButton*)glade_xml_get_widget(xml, "attrRB2")))
+		return AGEDGE;
+	return -1;
+}
+void free_attr(attr_t* at)
+{
+	free(at->defValG);
+	free(at->defValN);
+	free(at->defValE);
+
+	free(at->name);
+	free(at);
+}
+
+
+attr_t* new_attr()
+{
+	attr_t* attr=malloc(sizeof(attr_t));
+	attr->defValG=(char*)0;
+	attr->defValN=(char*)0;
+	attr->defValE=(char*)0;
+	attr->name=(char*)0;
+	attr->value=(char*)0;
+	attr->propagate=0;
+	attr->objType[0]=0;
+	attr->objType[1]=0;
+	attr->objType[2]=0;
+	return attr;
+}
+
+
+attr_t* new_attr_with_ref(Agsym_t * sym)
+{
+	attr_t* attr=new_attr();
+	attr->name=safestrdup(sym->name);
+	switch (sym->kind)
+	{
+	case AGRAPH:
+		attr->objType[0]=1;
+		if(sym->defval)
+			attr->defValG=safestrdup(sym->defval);
+		break;
+	case AGNODE:
+		attr->objType[1]=1;
+		if(sym->defval)
+			attr->defValN=safestrdup(sym->defval);
+		break;
+	case AGEDGE:
+		attr->objType[2]=1;
+		if(sym->defval)
+			attr->defValE=safestrdup(sym->defval);
+		break;
+	}
+	return attr;
+}
+
+attr_t* new_attr_ref(attr_t* refAttr)
+{
+	attr_t* attr=malloc(sizeof(attr_t));
+	*attr=*refAttr;
+	attr->defValG=safestrdup(refAttr->defValG);
+	attr->defValN=safestrdup(refAttr->defValN);
+	attr->defValE=safestrdup(refAttr->defValE);
+	attr->name=safestrdup(refAttr->name);
+	if (refAttr->value)
+		attr->value=safestrdup(refAttr->value);
+	return attr;
+}
+
+static void reset_attr_list_widgets(attr_list* l)
+{
+	int id=0;
+	for (id;id < MAX_FILTERED_ATTR_COUNT ;id ++)
+	{
+		gtk_label_set_text(l->fLabels[id],"");
+	}
+}
+
+
+
+static void free_attr_list_widgets(attr_list* l)
+{
+	int id=0;
+	for (id;id < MAX_FILTERED_ATTR_COUNT ;id ++)
+	{
+		gtk_object_destroy((GtkObject*)l->fLabels[id]);
+	}
+}
+
+
+void free_attr_list(attr_list* l)
+{
+	int id=0;
+	for (id;id < l->attr_count; id ++)
+	{
+		free_attr(l->attributes[id]);
+	}
+	if (l->with_widgets)
+		free_attr_list_widgets(l);
+	free(l);
+}
+attr_list* attr_list_new(Agraph_t * g,int with_widgets )
+{
+	int id=0;
+	attr_list* l=malloc(sizeof(attr_list));
+	l->attr_count=0;
+	l->capacity=DEFAULT_ATTR_LIST_CAPACITY;
+	l->attributes=malloc(DEFAULT_ATTR_LIST_CAPACITY * sizeof(attr_t*));
+	l->with_widgets=with_widgets;
+	/*create filter widgets*/

 /*			gtk_widget_add_events(glade_xml_get_widget(xml, "frmObject"),
 			//  GDK_BUTTON_MOTION_MASK      = 1 << 4,
@@ -172,69 +173,67 @@
 			  GDK_SCROLL | GDK_VISIBILITY_NOTIFY_MASK);

     g_signal_connect((gpointer)glade_xml_get_widget(xml, "frmObject"), "motion_notify_event",  G_CALLBACK(attr_label_motion), NULL);*/
-    if (with_widgets) {
-	for (id; id < MAX_FILTERED_ATTR_COUNT; id++) {
-	    l->fLabels[id] = (GtkLabel *) gtk_label_new("");
-
-	    gtk_widget_add_events((GtkWidget *) l->fLabels[id],
-				  //  GDK_BUTTON_MOTION_MASK      = 1 << 4,
-				  GDK_BUTTON_MOTION_MASK |
-				  GDK_POINTER_MOTION_MASK |
-				  GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS |
-				  GDK_BUTTON_RELEASE_MASK |
-				  GDK_SCROLL | GDK_VISIBILITY_NOTIFY_MASK);
-
-	    gtk_widget_show((GtkWidget *) l->fLabels[id]);
-	    gtk_fixed_put((GtkFixed *) glade_xml_get_widget(xml, "fixed6"),
-			  (GtkWidget *) l->fLabels[id], 10, 110 + id * 13);
-	}
-    }
-    return l;
-}
-
-void print_attr_list(attr_list * l)
-{
-    int id = 0;
-    for (id; id < l->attr_count; id++) {
-	printf("%d  %s (%d %d %d) \n", l->attributes[id]->index,
-	       l->attributes[id]->name, l->attributes[id]->objType[0],
-	       l->attributes[id]->objType[1],
-	       l->attributes[id]->objType[2]);
-	printf("defG:%s defN:%s defE:%s\n", l->attributes[id]->defValG,
-	       l->attributes[id]->defValN, l->attributes[id]->defValE);
-    }
-}
-
-int attr_compare(const void *a, const void *b)
-{
-    attr_t *a1 = *(attr_t **) a;
-    attr_t *a2 = *(attr_t **) b;
-    return STRCASECMP(a1->name, a2->name);
-}
-
-static void attr_list_sort(attr_list * l)
-{
-    qsort(l->attributes, l->attr_count, sizeof(attr_t *), attr_compare);
-
-}
-
-void attr_list_add(attr_list * l, attr_t * a)
-{
-    int id = 0;
-    if ((!l) || (!a))
-	return;
-    l->attr_count++;
-    if (l->attr_count == l->capacity) {
-	l->capacity = l->capacity + EXPAND_CAPACITY_VALUE;
-	l->attributes =
-	    realloc(l->attributes, l->capacity * sizeof(attr_t *));
-    }
-    l->attributes[l->attr_count - 1] = a;
-    if (l->attr_count > 1)
-	attr_list_sort(l);
-    /*update indices */
-    for (id; id < l->attr_count; id++)
-	l->attributes[id]->index = id;
+	if(with_widgets)
+	{
+		for (id ; id < MAX_FILTERED_ATTR_COUNT ; id ++)
+		{
+			l->fLabels[id]=(GtkLabel*)gtk_label_new("");
+
+			gtk_widget_add_events((GtkWidget*)l->fLabels[id],
+			//  GDK_BUTTON_MOTION_MASK      = 1 << 4,
+			  GDK_BUTTON_MOTION_MASK |
+			  GDK_POINTER_MOTION_MASK |
+			  GDK_BUTTON_PRESS_MASK | GDK_KEY_PRESS |
+			  GDK_BUTTON_RELEASE_MASK |
+			  GDK_SCROLL | GDK_VISIBILITY_NOTIFY_MASK);
+
+			gtk_widget_show((GtkWidget*)l->fLabels[id]);
+			Color_Widget("blue",(GtkWidget*)l->fLabels[id]);
+			gtk_fixed_put((GtkFixed*)glade_xml_get_widget(xml, "fixed6"),(GtkWidget*)l->fLabels[id],10,110+id * 13);
+		}
+	}
+	return l;
+}
+void print_attr_list(attr_list* l)
+{
+	int id=0;
+	for (id;id < l->attr_count; id ++)
+	{
+		printf ("%d  %s (%d %d %d) \n",l->attributes[id]->index,l->attributes[id]->name,l->attributes[id]->objType[0],l->attributes[id]->objType[1],l->attributes[id]->objType[2]);
+		printf ("defG:%s defN:%s defE:%s\n",l->attributes[id]->defValG,l->attributes[id]->defValN,l->attributes[id]->defValE);
+	}
+}
+
+int attr_compare (const void * a, const void * b)
+{
+	attr_t* a1=*(attr_t**)a;
+	attr_t* a2=*(attr_t**)b;
+	return STRCASECMP(a1->name,a2->name);
+}
+
+static void attr_list_sort(attr_list* l)
+{
+  qsort (l->attributes, l->attr_count,sizeof(attr_t*), attr_compare);
+
+}
+
+void attr_list_add(attr_list* l,attr_t* a)
+{
+	int id=0;
+	if ( (!l) || (!a))
+		return;
+	l->attr_count ++ ;
+	if (l->attr_count == l->capacity)
+	{
+		l->capacity = l->capacity + EXPAND_CAPACITY_VALUE;
+		l->attributes=realloc (l->attributes,l->capacity * sizeof(attr_t*));
+	}
+	l->attributes[l->attr_count-1]=a;
+	if (l->attr_count > 1)
+		attr_list_sort(l);
+	/*update indices*/
+	for (id;id < l->attr_count; id ++)
+		l->attributes[id]->index=id;

@@ -242,517 +241,536 @@
 static attr_data_type get_attr_data_type(char c)
 {
 //typedef enum {attr_alpha,attr_float,attr_int,attr_bool,attr_drowdown,attr_color} attr_data_type;
-    switch (c) {
-    case 'A':
+	switch (c)
+	{
+		case 'A':
+			return attr_alpha;break;
+		case 'F':
+			return attr_float;break;
+		case 'B':
+			return attr_bool;break;
+		case 'I':
+			return attr_int;break;
+	}
 	return attr_alpha;
-	break;
-    case 'F':
-	return attr_float;
-	break;
-    case 'B':
-	return attr_bool;
-	break;
-    case 'I':
-	return attr_int;
-	break;
-    }
-    return attr_alpha;
-
-}
-static void object_type_helper(char *a, int *t)
-{
-    if (strcmp(a, "GRAPH") == 0)
-	t[0] = 1;
-    if (strcmp(a, "CLUSTER") == 0)
-	t[0] = 1;
-    if (strcmp(a, "NODE") == 0)
-	t[1] = 1;
-    if (strcmp(a, "EDGE") == 0)
-	t[2] = 1;
-    if (strcmp(a, "ANY_ELEMENT") == 0) {
-	t[0] = 1;
-	t[1] = 1;
-	t[2] = 1;
-    }
-}
-
-static void set_attr_object_type(char *str, int *t)
-{
-
-    char *a;
-    a = strtok(str, " ");
-    object_type_helper(a, t);
-    while (a = strtok(NULL, " or "))
-	object_type_helper(a, t);
-
-}
-
-static attr_t *binarySearch(attr_list * l, char *searchKey)
-{
-    int middle, low, high, res;
-    low = 0;
-    high = l->attr_count - 1;
-
-    while (low <= high) {
-	middle = (low + high) / 2;
-	res = STRCASECMP(searchKey, l->attributes[middle]->name);
-	if (res == 0) {
-	    return l->attributes[middle];
-	} else if (res < 0) {
-	    high = middle - 1;
-	} else {
-	    low = middle + 1;
-	}
-    }
-    return NULL;
-}
-
-
-
-
-
-
-static attr_t *pBinarySearch(attr_list * l, char *searchKey)
-{
-    char buf[512];
-    int middle, low, high, res;
-    low = 0;
-    high = l->attr_count - 1;
-
-    while (low <= high) {
-	middle = (low + high) / 2;
-	strncpy(buf, l->attributes[middle]->name, strlen(searchKey));
-	buf[strlen(searchKey)] = '\0';
-	res = STRCASECMP(searchKey, buf);
-	if (res == 0) {
-	    return l->attributes[middle];
-	}
-//        else if               ( searchKey < b[ middle ] ) {
-	else if (res < 0) {
-	    high = middle - 1;
-	} else {
-	    low = middle + 1;
-	}
-    }
-    return NULL;
-
-}
-
-
-
-
-void create_filtered_list(char *prefix, attr_list * sl, attr_list * tl)
-{
-    int res;
-    char buf[512];
-    attr_t *at;
-    int objKind = get_object_type();
-
-    if (strlen(prefix) == 0)
-	return;
-    /*locate first occurance */
-    at = pBinarySearch(sl, prefix);
-    if (!at)
-	return;
-
-    res = 0;
-    /*go backward to get the first */
-    while ((at->index > 0) && (res == 0)) {
-	at = sl->attributes[at->index - 1];
-	strncpy(buf, at->name, strlen(prefix));
-	buf[strlen(prefix)] = '\0';;
-	res = STRCASECMP(prefix, buf);
-    }
-    res = 0;
-    while ((at->index < sl->attr_count) && (res == 0)) {
-	at = sl->attributes[at->index + 1];
-	strncpy(buf, at->name, strlen(prefix));
-	buf[strlen(prefix)] = '\0';
-	res = STRCASECMP(prefix, buf);
-	if ((res == 0) && (at->objType[objKind] == 1))
-	    attr_list_add(tl, new_attr_ref(at));
-    }
-}
-void filter_attributes(char *prefix, topview * t)
+
+}
+static void object_type_helper(char* a,int* t)
+{
+	if (strcmp(a,"GRAPH")==0)
+		t[0]=1;
+	if (strcmp(a,"CLUSTER")==0)
+		t[0]=1;
+	if (strcmp(a,"NODE")==0)
+		t[1]=1;
+	if (strcmp(a,"EDGE")==0)
+		t[2]=1;
+	if (strcmp(a,"ANY_ELEMENT")==0)
+	{
+		t[0]=1;
+		t[1]=1;
+		t[2]=1;
+	}
+}
+
+static void set_attr_object_type(char* str,int* t)
+{
+
+	char* a;
+	a=strtok(str," ");
+	object_type_helper(a,t);
+	while (a=strtok(NULL," or "))
+		object_type_helper(a,t);
+
+}
+
+static attr_t* binarySearch( attr_list* l, char* searchKey)
+{
+	int middle,low,high,res;
+   low=0;
+   high=l->attr_count-1;
+
+   while ( low <= high ) {
+      middle = ( low + high ) / 2;
+	  res=STRCASECMP(searchKey,l->attributes[middle]->name);
+	  if ( res==0) {
+         return l->attributes[middle];
+      }
+	  else if 		( res < 0  ) {
+         high = middle - 1;
+      } else {
+         low = middle + 1;
+      }
+   }
+   return  NULL;
+}
+
+
+
+
+
+
+static attr_t* pBinarySearch( attr_list* l, char* searchKey)
+{
+	char buf[512];
+	int middle,low,high,res;
+   low=0;
+   high=l->attr_count-1;
+
+   while ( low <= high ) {
+      middle = ( low + high ) / 2;
+	   strncpy ( buf, l->attributes[middle]->name, strlen(searchKey));
+		buf[strlen(searchKey)]='\0';
+	  res=STRCASECMP(searchKey,buf);
+	  if ( res==0) {
+         return l->attributes[middle];
+      }
+//	  else if 		( searchKey < b[ middle ] ) {
+	  else if 		( res < 0  ) {
+         high = middle - 1;
+      } else {
+         low = middle + 1;
+      }
+   }
+   return  NULL;
+
+}
+
+
+
+
+
+
+void create_filtered_list(char* prefix,attr_list* sl,attr_list* tl)
+{
+	int res;
+	char buf[512];
+	attr_t* at;
+	int objKind=get_object_type();
+
+	if (strlen(prefix)==0)
+		return;
+	/*locate first occurance*/
+	at= pBinarySearch( sl, prefix);
+	if (!at)
+		return;
+
+	res=0;
+	/*go backward to get the first*/
+	while((at->index > 0) && (res == 0))
+	{
+		at=sl->attributes[at->index - 1];
+		strncpy ( buf, at->name, strlen(prefix));
+		buf[strlen(prefix)]='\0';;
+		res=STRCASECMP(prefix,buf);
+	}
+	res=0;
+	while((at->index <sl->attr_count) && (res == 0))
+	{
+		at=sl->attributes[at->index + 1];
+		strncpy ( buf, at->name, strlen(prefix));
+		buf[strlen(prefix)]='\0';
+		res=STRCASECMP(prefix,buf);
+		if((res == 0) && (at->objType[objKind]==1))
+			attr_list_add(tl,new_attr_ref(at));
+	}
+}
+void filter_attributes(char* prefix,topview* t)
 //void filter_attributes(char* prefix, attr_list* l)
 {

-    int ind = 0;
-    int tmp;
-
-    attr_list *l = t->attributes;
-    attr_list *fl = t->filtered_attr_list;
-    int objKind = get_object_type();
-
-    if (fl)
-	free_attr_list(fl);
-    fl = attr_list_new(NULL, 0);
-    reset_attr_list_widgets(l);
-    create_filtered_list(prefix, l, fl);
-    for (ind; ind < fl->attr_count; ind++) {
-	gtk_label_set_text(l->fLabels[ind], fl->attributes[ind]->name);
-    }
-
-    /*a new attribute can be entered */
-
-    gtk_widget_show(glade_xml_get_widget(xml, "txtValue"));
-    gtk_widget_show(glade_xml_get_widget(xml, "txtDefValue"));
-
-    gtk_entry_set_text((GtkEntry *)
-		       glade_xml_get_widget(xml, "txtDefValue"), "");
-    gtk_entry_set_text((GtkEntry *) glade_xml_get_widget(xml, "txtValue"),
-		       "");
-    gtk_widget_set_sensitive(glade_xml_get_widget(xml, "txtDefValue"), 1);
-    gtk_widget_show(glade_xml_get_widget(xml, "attrAddBtn"));
-    gtk_widget_hide(glade_xml_get_widget(xml, "attrApplyBtn"));
-
-
-    if (strlen(prefix) == 0) {
-	gtk_widget_hide(glade_xml_get_widget(xml, "attrAddBtn"));
+	int ind=0;
+	int tmp;
+
+	attr_list* l=t->attributes;
+	attr_list* fl=t->filtered_attr_list;
+	int objKind=get_object_type();
+
+	if (fl)
+		free_attr_list(fl);
+	fl=attr_list_new(NULL,0);
+	reset_attr_list_widgets(l);
+	create_filtered_list(prefix,l,fl);
+	for (ind;ind < fl->attr_count; ind ++)
+	{
+		gtk_label_set_text(l->fLabels[ind],fl->attributes[ind]->name);
+	}
+
+	Color_Widget_bg("white",glade_xml_get_widget(xml, "txtAttr"));
+	if (fl->attr_count==0)
+		Color_Widget_bg("red",glade_xml_get_widget(xml, "txtAttr"));
+	/*a new attribute can be entered*/
+
+	gtk_widget_show(glade_xml_get_widget(xml, "txtValue"));
+	gtk_widget_show(glade_xml_get_widget(xml, "txtDefValue"));
+
+	gtk_entry_set_text((GtkEntry*)glade_xml_get_widget(xml, "txtDefValue"),"");
+	gtk_entry_set_text((GtkEntry*)glade_xml_get_widget(xml, "txtValue"),"");
+	gtk_widget_set_sensitive(glade_xml_get_widget(xml, "txtDefValue"),1);
+	gtk_widget_show(glade_xml_get_widget(xml, "attrAddBtn"));
 	gtk_widget_hide(glade_xml_get_widget(xml, "attrApplyBtn"));
-	gtk_widget_hide(glade_xml_get_widget(xml, "attrAddBtn"));
-	gtk_widget_hide(glade_xml_get_widget(xml, "txtValue"));
-	gtk_widget_hide(glade_xml_get_widget(xml, "txtDefValue"));
-    }
-
-
-    for (ind = 0; ind < fl->attr_count; ind++) {
-	if (STRCASECMP(prefix, fl->attributes[ind]->name) == 0) {	/*an existing attribute */
-
-	    if (get_object_type() == AGRAPH)
-		gtk_entry_set_text((GtkEntry *)
-				   glade_xml_get_widget(xml,
-							"txtDefValue"),
-				   fl->attributes[0]->defValG);
-	    if (get_object_type() == AGNODE)
-		gtk_entry_set_text((GtkEntry *)
-				   glade_xml_get_widget(xml,
-							"txtDefValue"),
-				   fl->attributes[0]->defValN);
-	    if (get_object_type() == AGEDGE)
-		gtk_entry_set_text((GtkEntry *)
-				   glade_xml_get_widget(xml,
-							"txtDefValue"),
-				   fl->attributes[0]->defValE);
-	    gtk_entry_set_text((GtkEntry *)
-			       glade_xml_get_widget(xml, "txtValue"),
-			       agget(view->g[view->activeGraph], prefix));
-	    gtk_widget_set_sensitive(glade_xml_get_widget
-				     (xml, "txtDefValue"), 0);
-	    gtk_widget_hide(glade_xml_get_widget(xml, "attrAddBtn"));
-	    gtk_widget_show(glade_xml_get_widget(xml, "attrApplyBtn"));
-
-	    break;
-
-	}
-    }
-
-    tmp = (((objKind == AGNODE) && (sel_node))
-	   || ((objKind == AGEDGE) && (sel_edge)) || ((objKind == AGRAPH)
-						      && (sel_graph)));
-    gtk_widget_set_sensitive(glade_xml_get_widget(xml, "txtValue"), tmp);
-}
-
+	gtk_toggle_button_set_active ((GtkToggleButton*)glade_xml_get_widget(xml, "attrProg"),0);
+
+
+
+	if(strlen(prefix)==0)
+	{
+		gtk_widget_hide(glade_xml_get_widget(xml, "attrAddBtn"));
+		gtk_widget_hide(glade_xml_get_widget(xml, "attrApplyBtn"));
+		gtk_widget_hide(glade_xml_get_widget(xml, "attrAddBtn"));
+		gtk_widget_hide(glade_xml_get_widget(xml, "txtValue"));
+		gtk_widget_hide(glade_xml_get_widget(xml, "txtDefValue"));
+		Color_Widget_bg("white",glade_xml_get_widget(xml, "txtAttr"));
+	}
+
+
+	for (ind=0;ind < fl->attr_count;ind++)
+	{
+		if( STRCASECMP(prefix,fl->attributes[ind]->name)==0)/*an existing attribute*/
+		{
+
+			Color_Widget_bg("green",glade_xml_get_widget(xml, "txtAttr"));
+
+			if(get_object_type()==AGRAPH)
+				gtk_entry_set_text((GtkEntry*)glade_xml_get_widget(xml, "txtDefValue"),fl->attributes[0]->defValG);
+			if(get_object_type()==AGNODE)
+				gtk_entry_set_text((GtkEntry*)glade_xml_get_widget(xml, "txtDefValue"),fl->attributes[0]->defValN);
+			if(get_object_type()==AGEDGE)
+				gtk_entry_set_text((GtkEntry*)glade_xml_get_widget(xml, "txtDefValue"),fl->attributes[0]->defValE);
+//			gtk_entry_set_text((GtkEntry*)glade_xml_get_widget(xml, "txtValue"),agget(view->g[view->activeGraph],prefix));
+			gtk_widget_set_sensitive(glade_xml_get_widget(xml, "txtDefValue"),0);
+			gtk_widget_hide(glade_xml_get_widget(xml, "attrAddBtn"));
+			gtk_widget_show(glade_xml_get_widget(xml, "attrApplyBtn"));
+			gtk_toggle_button_set_active ((GtkToggleButton*)glade_xml_get_widget(xml, "attrProg"),fl->attributes[0]->propagate);
+			break;
+
+		}
+	}
+
+	tmp=(((objKind==AGNODE) &&(sel_node))		  ||			((objKind==AGEDGE) &&(sel_edge))			||			((objKind==AGRAPH) &&(sel_graph)));
+		gtk_widget_set_sensitive(glade_xml_get_widget(xml, "txtValue"),tmp);
+}
 /*asttribute text changed call back*/

 _BB void on_txtAttr_changed(GtkWidget * widget, gpointer user_data)
 {
-//      printf ("attr text has been changed to %s \n",gtk_entry_get_text((GtkEntry*)widget));
-    filter_attributes((char *) gtk_entry_get_text((GtkEntry *) widget),
-		      view->Topview);
-}
-
-_BB void on_attrApplyBtn_clicked(GtkWidget * widget, gpointer user_data)
-{
-    int ind = 0;
-    int cnt = 0;
-    char *attr_name;
-    char *value;
-    int prog;
-    topview *t;
-    topview_node *n;
-    topview_edge *e;
-    Agraph_t *g;
-    /*values to be applied to selected objects */
-    attr_name =
-	(char *) gtk_entry_get_text((GtkEntry *)
-				    glade_xml_get_widget(xml, "txtAttr"));
-    value =
-	(char *) gtk_entry_get_text((GtkEntry *)
-				    glade_xml_get_widget(xml, "txtValue"));
-    prog =
-	gtk_toggle_button_get_active((GtkToggleButton *)
-				     glade_xml_get_widget(xml,
-							  "attrProg"));
-    g = view->g[view->activeGraph];
-    t = view->Topview;
-    /*nodes */
-    for (ind; ind < view->Topview->Nodecount; ind++) {
-	n = &t->Nodes[ind];
-	if (n->data.Selected) {
-	    cnt++;
-	    if (cnt == 1)
-		agattr(g, AGNODE, attr_name, "");
-	    agset(n->Node, attr_name, value);
-	}
-    }
-    /*edges */
-    for (ind; ind < view->Topview->Edgecount; ind++) {
-	e = &t->Edges[ind];
-	if (e->data.Selected) {
-	    cnt++;
-	    if (cnt == 1)
-		agattr(g, AGEDGE, attr_name, "");
-	    agset(e->Edge, attr_name, value);
-	}
-    }
-}
-_BB on_attrRB0_clicked(GtkWidget * widget, gpointer user_data)
-{
-    filter_attributes((char *)
-		      gtk_entry_get_text((GtkEntry *)
-					 glade_xml_get_widget(xml,
-							      "txtAttr")),
-		      view->Topview);
-
-}
-_BB void on_attrProg_toggled(GtkWidget * widget, gpointer user_data)
-{
-    printf("%s \n", agget(view->Topview->Nodes[5].Node, "testattr"));
-
-}
-
-_BB void attr_label_motion(GtkWidget * widget, GdkEventMotion * event,
-			   gpointer data)
+//	printf ("attr text has been changed to %s \n",gtk_entry_get_text((GtkEntry*)widget));
+	filter_attributes((char*)gtk_entry_get_text((GtkEntry*)widget),view->Topview);
+}
+
+_BB void on_attrApplyBtn_clicked (GtkWidget * widget, gpointer user_data)
+{
+	int ind=0;
+	int cnt=0;
+	char* attr_name;
+	char* value;
+	char* def_val;
+	int prog;
+	topview* t;
+	topview_node* n;
+	topview_edge* e;
+	Agraph_t* g;
+	int objKind;
+	Agsym_t* sym;
+	attr_t* attr;
+
+
+
+	/*values to be applied to selected objects*/
+	attr_name=(char*)gtk_entry_get_text((GtkEntry*)glade_xml_get_widget(xml, "txtAttr"));
+	def_val=(char*)gtk_entry_get_text((GtkEntry*)glade_xml_get_widget(xml, "txtDefValue"));
+	value=(char*)gtk_entry_get_text((GtkEntry*)glade_xml_get_widget(xml, "txtValue"));
+	prog=gtk_toggle_button_get_active((GtkToggleButton*)glade_xml_get_widget(xml, "attrProg"));
+	g=view->g[view->activeGraph];
+	t=view->Topview;
+	objKind=get_object_type();
+	attr=binarySearch(view->Topview->attributes,attr_name);
+	assert(attr);
+	attr->propagate=prog;
+	sym=agattr(g,objKind,attr_name,(char*)0);
+	if (!sym)	/*it shouldnt be null, just in case it is null*/
+		agattr(g,objKind,attr_name,def_val);
+	/*graph*/
+	if(objKind==AGRAPH)
+			agset(g,attr_name,value);
+	/*nodes*/
+	if(objKind==AGNODE)
+	{
+		for (ind;ind < view->Topview->Nodecount; ind ++)
+		{
+			n=&t->Nodes[ind];
+			if (n->data.Selected)
+			{
+					agset(n->Node,attr_name,value);
+			}
+		}
+	}
+	/*edges*/
+	if(objKind==AGEDGE)
+	{
+
+		for (ind;ind < view->Topview->Edgecount; ind ++)
+		{
+			e=&t->Edges[ind];
+			if (e->data.Selected)
+				agset(e->Edge,attr_name,value);
+		}
+	}
+}
+_BB on_attrRB0_clicked (GtkWidget * widget, gpointer user_data)
+{
+	filter_attributes((char*)
+		gtk_entry_get_text((GtkEntry*)glade_xml_get_widget(xml, "txtAttr")),view->Topview);
+
+}
+_BB void on_attrProg_toggled (GtkWidget * widget, gpointer user_data)
+{
+	printf ("%s \n",agget (view->Topview->Nodes[5].Node,"testattr"));
+
+}
+
+_BB void attr_label_motion(GtkWidget * widget,GdkEventMotion * event, gpointer data)
 {
     float x = (float) event->x;
     float y = (float) event->y;
-//      printf ("%f %f \n",x,y);
-}
-_BB void on_attrAddBtn_clicked(GtkWidget * widget, gpointer user_data)
-{
-    int ind = 0;
-    int cnt = 0;
-    char *attr_name;
-    char *value;
-    char *defValue;
-    static int objKind;
-
-
-    int prog;
-    topview *t;
-    topview_node *n;
-    topview_edge *e;
-    Agraph_t *g;
-    attr_t *attr;
-    objKind = get_object_type();
-
-
-    /*values to be applied to selected objects */
-    attr_name =
-	(char *) gtk_entry_get_text((GtkEntry *)
-				    glade_xml_get_widget(xml, "txtAttr"));
-    value =
-	(char *) gtk_entry_get_text((GtkEntry *)
-				    glade_xml_get_widget(xml, "txtValue"));
-    defValue =
-	(char *) gtk_entry_get_text((GtkEntry *)
-				    glade_xml_get_widget(xml,
-							 "txtDefValue"));
-    prog =
-	gtk_toggle_button_get_active((GtkToggleButton *)
-				     glade_xml_get_widget(xml,
-							  "attrProg"));
-    g = view->g[view->activeGraph];
-    t = view->Topview;
-    attr =
-	/*try to find first */
-	attr = binarySearch(t->attributes, attr_name);
-    if (!attr) {
-	attr = new_attr();
-	attr->index = 0;
-	attr->name = safestrdup(attr_name);
-	attr->type = attr_alpha;
-	attr->value = safestrdup("");
-	attr->widget = NULL;
-	attr_list_add(t->attributes, attr);
-    }
-    attr->propagate = 0;
-
-    if (objKind == AGRAPH) {
-	agattr(g, AGRAPH, attr_name, defValue);
-	attr->defValG = safestrdup(defValue);
-	attr->objType[0] = 1;
-    }
-
-    /*nodes */
-    if (objKind == AGNODE) {
-	for (ind; ind < view->Topview->Nodecount; ind++) {
-	    n = &t->Nodes[ind];
-	    if (n->data.Selected) {
-		cnt++;
-		if (cnt == 1) {
-		    agattr(g, AGNODE, attr_name, defValue);
-		    break;
-		}
-
-	    }
-	}
-	attr->defValN = safestrdup(defValue);
-	attr->objType[1] = 1;
-
-
-
-    }
-    if (objKind == AGEDGE) {
-
-	cnt = 0;
-	/*edges */
-	for (ind; ind < view->Topview->Edgecount; ind++) {
-	    e = &t->Edges[ind];
-	    if (e->data.Selected) {
-		cnt++;
-		if (cnt == 1) {
-		    agattr(g, AGEDGE, attr_name, defValue);
-		    break;
-		}
-	    }
-	}
-	attr->defValE = safestrdup(defValue);
-	attr->objType[2] = 1;
-
-    }
-    filter_attributes(attr_name, view->Topview);
-
-
-}
-
-attr_list *load_attr_list(Agraph_t * g)
-{
-    attr_t *attr;
-    attr_list *l;
-    FILE *file;
-    Agsym_t *sym;		/*cgraph atttribute */
+//	printf ("%f %f \n",x,y);
+}
+_BB void on_attrAddBtn_clicked (GtkWidget * widget, gpointer user_data)
+{
+	int ind=0;
+	int cnt=0;
+	char* attr_name;
+	char* value;
+	char* defValue;
+	static int objKind;
+
+
+	int prog;
+	topview* t;
+	topview_node* n;
+	topview_edge* e;
+	Agraph_t* g;
+	attr_t* attr;
+	objKind=get_object_type();
+
+
+	/*values to be applied to selected objects*/
+	attr_name=(char*)gtk_entry_get_text((GtkEntry*)glade_xml_get_widget(xml, "txtAttr"));
+	value=(char*)gtk_entry_get_text((GtkEntry*)glade_xml_get_widget(xml, "txtValue"));
+	defValue=(char*)gtk_entry_get_text((GtkEntry*)glade_xml_get_widget(xml, "txtDefValue"));
+	prog=gtk_toggle_button_get_active((GtkToggleButton*)glade_xml_get_widget(xml, "attrProg"));
+	g=view->g[view->activeGraph];
+	t=view->Topview;
+	/*try to find first*/
+	attr=binarySearch(t->attributes,attr_name);
+	if(!attr)
+	{
+		attr=new_attr();
+		attr->index=0;
+		attr->name=safestrdup(attr_name);
+		attr->type=attr_alpha;
+		attr->value=safestrdup("");
+		attr->widget=NULL;
+		attr_list_add(t->attributes,attr);
+	}
+	attr->propagate=0;
+
+	if (objKind==AGRAPH)
+	{
+		agattr(g, AGRAPH, attr_name,defValue);
+		attr->defValG=safestrdup(defValue);
+		attr->objType[0]=1;
+	}
+
+	/*nodes*/
+	if (objKind==AGNODE)
+	{
+		for (ind;ind < view->Topview->Nodecount; ind ++)
+		{
+			n=&t->Nodes[ind];
+			if (n->data.Selected)
+			{
+				cnt++;
+				if (cnt==1)
+				{
+					agattr(g, AGNODE, attr_name,defValue);
+					break;
+				}
+
+			}
+		}
+		attr->defValN=safestrdup(defValue);
+		attr->objType[1]=1;
+
+
+
+	}
+	if (objKind==AGEDGE)
+	{
+
+		cnt=0;
+		/*edges*/
+		for (ind;ind < view->Topview->Edgecount; ind ++)
+		{
+			e=&t->Edges[ind];
+			if (e->data.Selected)
+			{
+				cnt++;
+				if (cnt==1)
+				{
+					agattr(g, AGEDGE, attr_name,defValue);
+					break;
+				}
+			}
+		}
+		attr->defValE=safestrdup(defValue);
+		attr->objType[2]=1;
+
+	}
+	filter_attributes(attr_name,view->Topview);
+
+
+}
+
+attr_list* load_attr_list(Agraph_t* g)
+{
+	attr_t* attr;
+	attr_list* l;
+	FILE *file;
+	Agsym_t* sym;	/*cgraph atttribute*/
     char line[BUFSIZ];
-    char *smyrna_attrs = smyrnaPath("attrs.txt");
-    char *a;
-
-    g = view->g[view->activeGraph];
-    file = fopen(smyrna_attrs, "r");
-
-    l = attr_list_new(NULL, 1);
-
-    if (file != NULL) {
-	int i = 0;
-	while (fgets(line, BUFSIZ, file) != NULL) {
-	    int idx = 0;
-	    attr = new_attr();
-	    a = strtok(line, ",");
-	    attr->index = i;
-	    attr->type = get_attr_data_type(a[0]);
-	    while (a = strtok(NULL, ",")) {
-		/*C,(0)color, (1)black, (2)EDGE Or NODE Or CLUSTER, (3)ALL_ENGINES */
-
-		switch (idx) {
-		case 0:
-		    /**/ attr->name = safestrdup(a);
-		    break;
-		case 1:
-		    /**/ attr->defValG = safestrdup(a);
-		    attr->defValN = safestrdup(a);
-		    attr->defValE = safestrdup(a);
-		    break;
-		case 2:
-		    /**/ set_attr_object_type(a, attr->objType);
-		    break;
-		}
-		idx++;
-	    }
-	    i++;
-	    attr_list_add(l, attr);
-
-	}
-    }
-    sym = NULL;
-    while ((sym = agnxtattr(g, AGRAPH, sym))) {
-	if (!binarySearch(l, sym->name)) {
-	    attr = new_attr_with_ref(sym);
-	    attr_list_add(l, attr);
-
-	}
-    }
-    sym = NULL;
-    while ((sym = agnxtattr(g, AGNODE, sym))) {
-	if (!binarySearch(l, sym->name)) {
-	    attr = new_attr_with_ref(sym);
-	    attr_list_add(l, attr);
-
-	}
-    }
-    sym = NULL;
-    while ((sym = agnxtattr(g, AGEDGE, sym))) {
-	if (!binarySearch(l, sym->name)) {
-	    attr = new_attr_with_ref(sym);
-	    attr_list_add(l, attr);
-	}
-    }
-
-    print_attr_list(l);
-    return l;
-}
-
- /**/ static void set_header_text()
-{
-    int nodeCnt;
-    int edgeCnt;
-    static char buf[512];
-    int ind = 0;
-
-    topview *t;
-    topview_node *n;
-    topview_edge *e;
-
-
-
-    nodeCnt = 0;
-    edgeCnt = 0;
-    t = view->Topview;
-
-
-    for (ind; ind < view->Topview->Nodecount; ind++) {
-	n = &t->Nodes[ind];
-	if (n->data.Selected) {
-	    nodeCnt++;
-	}
-    }
-    for (ind; ind < view->Topview->Edgecount; ind++) {
-	e = &t->Edges[ind];
-	if (e->data.Selected) {
-	    edgeCnt++;
-	}
-    }
-    sel_node = nodeCnt;
-    sel_edge = edgeCnt;
-    sel_graph = 1;
-
-    sprintf(buf, "%d Nodes and %d edges selected", nodeCnt, edgeCnt);
-    gtk_label_set_text((GtkLabel *) glade_xml_get_widget(xml, "label124"),
-		       buf);
-    gtk_entry_set_text((GtkEntry *) glade_xml_get_widget(xml, "txtAttr"),
-		       "");
-
-
-}
-
-void showAttrsWidget(topview * t)
+	char* smyrna_attrs = smyrnaPath ("attrs.txt");
+	char* a;
+
+	g=view->g[view->activeGraph];
+	file = fopen(smyrna_attrs, "r");
+
+	l=attr_list_new(NULL,1);
+
+    if (file != NULL)
+	{
+		int i=0;
+		while (fgets(line, BUFSIZ, file) != NULL)
+		{
+			int idx=0;
+			attr=new_attr();
+			a=strtok(line,",");
+			attr->index=i;
+			attr->type=get_attr_data_type(a[0]);
+			while (a=strtok(NULL,","))
+			{
+					/*C,(0)color, (1)black, (2)EDGE Or NODE Or CLUSTER, (3)ALL_ENGINES*/
+
+				switch (idx)
+				{
+					case 0: /**/
+						attr->name=safestrdup(a);
+						break;
+					case 1: /**/
+						attr->defValG=safestrdup(a);
+						attr->defValN=safestrdup(a);
+						attr->defValE=safestrdup(a);
+						break;
+					case 2: /**/
+						set_attr_object_type(a,attr->objType);
+						break;
+				}
+				idx ++;
+			}
+			i++;
+			attr_list_add(l,attr);
+
+		}
+	}
+	sym=NULL;
+    while ((sym = agnxtattr(g,AGRAPH, sym)))
+	{
+		if(!binarySearch( l, sym->name))
+		{
+			attr=new_attr_with_ref(sym);
+			attr_list_add(l,attr);
+
+		}
+	}
+	sym=NULL;
+	while ((sym = agnxtattr(g,AGNODE, sym)))
+	{
+		if(!binarySearch(l, sym->name))
+		{
+			attr=new_attr_with_ref(sym);
+			attr_list_add(l,attr);
+
+		}
+	}
+	sym=NULL;
+	while ((sym = agnxtattr(g,AGEDGE, sym)))
+	{
+		if(!binarySearch(l, sym->name))
+		{
+			attr=new_attr_with_ref(sym);
+			attr_list_add(l,attr);
+		}
+	}
+
+	return l;
+}
+
+/**/
+static void set_header_text()
+{
+	int nodeCnt;
+	int edgeCnt;
+	static char buf[512];
+	int ind=0;
+
+	topview* t;
+	topview_node* n;
+	topview_edge* e;
+
+
+
+	nodeCnt=0;
+	edgeCnt=0;
+	t=view->Topview;
+
+
+	for (ind;ind < view->Topview->Nodecount; ind ++)
+	{
+		n=&t->Nodes[ind];
+		if (n->data.Selected)
+		{
+			nodeCnt++;
+		}
+	}
+	for (ind;ind < view->Topview->Edgecount; ind ++)
+	{
+		e=&t->Edges[ind];
+		if (e->data.Selected)
+		{
+			edgeCnt++;
+		}
+	}
+		sel_node=nodeCnt;
+		sel_edge=edgeCnt;
+		sel_graph=1;
+
+	sprintf(buf,"%d Nodes and %d edges selected",nodeCnt,edgeCnt);
+	gtk_label_set_text((GtkLabel*)glade_xml_get_widget(xml, "label124"),buf);
+	gtk_entry_set_text((GtkEntry*)glade_xml_get_widget(xml, "txtAttr"),"");
+	Color_Widget_bg("white",glade_xml_get_widget(xml, "fixed6"));
+
+
+
+}
+
+void showAttrsWidget(topview* t)
 {
     gtk_widget_hide(glade_xml_get_widget(xml, "dlgSettings"));
     gtk_widget_show(glade_xml_get_widget(xml, "dlgSettings"));
-    gtk_notebook_set_current_page((GtkNotebook *)
-				  glade_xml_get_widget(xml, "notebook3"),
-				  ATTR_NOTEBOOK_IDX);
-    set_header_text();
-    filter_attributes("", view->Topview);
+	gtk_notebook_set_current_page (
+		(GtkNotebook*)glade_xml_get_widget(xml, "notebook3"),ATTR_NOTEBOOK_IDX);
+	set_header_text();
+	filter_attributes("",view->Topview);

 }
@@ -924,7 +942,7 @@
 		       GD_GraphFileName(graph));
     gtk_combo_box_set_active((GtkComboBox *)
 			     glade_xml_get_widget(xml, "cbLayout"),
-			     GD_Engine(graph));
+			    GD_Engine(graph));
     gtk_toggle_button_set_active((GtkToggleButton *)
 				 glade_xml_get_widget(xml, "chkVisible"),
 				 GD_AlwaysShow(graph));
@@ -942,19 +960,18 @@
     int respond = 0;
     int id = 0;
     //check the graph name  should not be duplicated graph names
-    for (id = 0; id < view->graphCount; id++) {
-	if (graph != view->g[id]) {
-	    if (STRCASECMP
-		(gtk_entry_get_text
-		 ((GtkEntry *)
-		  glade_xml_get_widget(xml, "entryGraphName")),
-		 GD_GraphName(view->g[id])) == 0) {
-		Dlg =
-		    (GtkMessageDialog *) gtk_message_dialog_new(NULL,
-								GTK_DIALOG_MODAL,
-								GTK_MESSAGE_WARNING,
-								GTK_BUTTONS_OK,
-								"There is another graph with this name!");
+    for (id = 0; id < view->graphCount; id++)
+	{
+		if (graph != view->g[id])
+		{
+			if (STRCASECMP(gtk_entry_get_text ((GtkEntry *)glade_xml_get_widget(xml, "entryGraphName")),
+		 GD_GraphName(view->g[id])) ==
+				0) {
+					Dlg = (GtkMessageDialog *) gtk_message_dialog_new(NULL,
+							  GTK_DIALOG_MODAL,
+								  GTK_MESSAGE_WARNING,
+								  GTK_BUTTONS_OK,
+								  "There is another graph with this name!");
 		respond = gtk_dialog_run((GtkDialog *) Dlg);
 		gtk_object_destroy((GtkObject *) Dlg);
 		return 0;
@@ -971,10 +988,11 @@
 	 GD_GraphFileName(graph)) != 0) {

-	if ((file = fopen(gtk_entry_get_text((GtkEntry *)
-					     glade_xml_get_widget(xml,
-								  "entryGraphFileName")),
-			  "r"))) {
+	if ((file =
+	     fopen(gtk_entry_get_text
+		   ((GtkEntry *)
+		    glade_xml_get_widget(xml, "entryGraphFileName")),
+		   "r"))) {
 	    fclose(file);
 	    Dlg = (GtkMessageDialog *) gtk_message_dialog_new(NULL,
 							      GTK_DIALOG_MODAL,
@@ -988,10 +1006,11 @@
 		return 0;
 	}
 	//now check if filename is legal, try to open it to write
-	if ((file = fopen(gtk_entry_get_text((GtkEntry *)
-					     glade_xml_get_widget(xml,
-								  "entryGraphFileName")),
-			  "w")))
+	if ((file =
+	     fopen(gtk_entry_get_text
+		   ((GtkEntry *)
+		    glade_xml_get_widget(xml, "entryGraphFileName")),
+		   "w")))
 	    fclose(file);
 	else {
 	    Dlg = (GtkMessageDialog *) gtk_message_dialog_new(NULL,
@@ -1009,33 +1028,35 @@

     }

+
     //if it comes so far graph deserves new values

-    GD_GraphName(graph) = (char *) gtk_entry_get_text((GtkEntry *)
-						      glade_xml_get_widget
-						      (xml,
-						       "entryGraphName"));
-    GD_GraphFileName(graph) = (char *) gtk_entry_get_text((GtkEntry *)
-							  glade_xml_get_widget
-							  (xml,
-							   "entryGraphFileName"));
-
-    GD_AlwaysShow(graph) = gtk_toggle_button_get_active((GtkToggleButton *)
-							glade_xml_get_widget
-							(xml,
-							 "chkVisible"));
-    GD_Locked(graph) = gtk_toggle_button_get_active((GtkToggleButton *)
-						    glade_xml_get_widget
-						    (xml, "chkLocked"));
-    GD_TopView(graph) = gtk_toggle_button_get_active((GtkToggleButton *)
-						     glade_xml_get_widget
-						     (xml, "chkTopView"));
+    GD_GraphName(graph) =
+	(char *) gtk_entry_get_text((GtkEntry *)
+				    glade_xml_get_widget(xml,
+							 "entryGraphName"));
+    GD_GraphFileName(graph) =
+	(char *) gtk_entry_get_text((GtkEntry *)
+				    glade_xml_get_widget(xml,
+							 "entryGraphFileName"));
+
+    GD_AlwaysShow(graph) =
+	gtk_toggle_button_get_active((GtkToggleButton *)
+				     glade_xml_get_widget(xml,
+							  "chkVisible"));
+    GD_Locked(graph) =
+	gtk_toggle_button_get_active((GtkToggleButton *)
+				     glade_xml_get_widget(xml,
+							  "chkLocked"));
+    GD_TopView(graph) =
+	gtk_toggle_button_get_active((GtkToggleButton *)
+				     glade_xml_get_widget(xml,
+							  "chkTopView"));

     //check if the engine has been changed, if so do new layout
     if (GD_Engine(graph) != gtk_combo_box_get_active((GtkComboBox *)
-						     glade_xml_get_widget
-						     (xml, "cbLayout"))) {
+				 glade_xml_get_widget(xml, "cbLayout"))) {
 	Dlg =
 	    (GtkMessageDialog *) gtk_message_dialog_new(NULL,
 							GTK_DIALOG_MODAL,
@@ -1044,10 +1065,10 @@
 							"You have changed the layout of the graph,this will change the graph layout\n all your position changes will be lost\n Are you sure?");
 	respond = gtk_dialog_run((GtkDialog *) Dlg);
 	if (respond == GTK_RESPONSE_YES)
-	    do_graph_layout(graph, gtk_combo_box_get_active((GtkComboBox *)
-							    glade_xml_get_widget
-							    (xml,
-							     "cbLayout")),
+	    do_graph_layout(graph,
+			    gtk_combo_box_get_active((GtkComboBox *)
+						     glade_xml_get_widget
+						     (xml, "cbLayout")),
 			    0);
 	gtk_object_destroy((GtkObject *) Dlg);
     }
@@ -1081,245 +1102,194 @@
     //according to object type (typeIndex) set the reference object
     switch (typeIndex)		//typeindex 0 means new object
     {
-    case GVE_CLUSTER:		//graph  sub graph (cluster)
-	obj = GD_selectedGraphs(g)[0];
-	break;
-    case GVE_NODE:		//Node
-	obj = GD_selectedNodes(g)[0];
-	break;
-    case GVE_EDGE:		//Edge
-	obj = GD_selectedEdges(g)[0];
-	break;
-    default:
-	break;
+		case GVE_CLUSTER:			//graph  sub graph (cluster)
+			obj = GD_selectedGraphs(g)[0];
+		break;
+		case GVE_NODE:			//Node
+			obj = GD_selectedNodes(g)[0];
+		break;
+		case GVE_EDGE:			//Edge
+			obj = GD_selectedEdges(g)[0];
+		break;
+		default :
+		break;
     }
     for (widgetcounter = 0; widgetcounter < MAXIMUM_WIDGET_COUNT;
-	 widgetcounter++) {
+	 widgetcounter++)
+	{
 	//create the labels and widget here
-	attr[widgetcounter].ComboValuesCount = 0;
-	attr[widgetcounter].ComboValues = '\0';
-
-	if (!AttrWidgets[widgetcounter]) {
-	    AttrLabels[widgetcounter] =
-		gtk_label_new(attr[widgetcounter].Name);
-	    switch (attr[widgetcounter].Type) {
-	    case 'F':		//float
-		AttrWidgets[widgetcounter] =
-		    gtk_spin_button_new_with_range(0, 100, 0.001);
-		g_signal_connect((gpointer) AttrWidgets[widgetcounter],
-				 "value-changed",
-				 G_CALLBACK(attr_widgets_modifiedSlot),
-				 (gpointer) widgetcounter);
-
-		break;
-	    case 'C':		//color box
-		AttrWidgets[widgetcounter] = gtk_color_button_new();
-		gtk_widget_set_size_request(AttrWidgets[widgetcounter], 50,
-					    23);
-		g_signal_connect((gpointer) AttrWidgets[widgetcounter],
-				 "color-set",
-				 G_CALLBACK(attr_widgets_modifiedSlot),
-				 (gpointer) widgetcounter);
-
-		break;
-	    default:		//alphanumreric         GTK Entry
-		AttrWidgets[widgetcounter] = gtk_entry_new();
-		gtk_widget_set_size_request(AttrWidgets[widgetcounter],
-					    130, 23);
-		g_signal_connect((gpointer) AttrWidgets[widgetcounter],
-				 "changed",
-				 G_CALLBACK(attr_widgets_modifiedSlot),
-				 (gpointer) widgetcounter);
-		break;
-	    }
-	    attr[widgetcounter].attrWidget = AttrWidgets[widgetcounter];
-	}
-	//locate widget on the GtkLayout* layout
-	if (attr[widgetcounter].ApplyTo[typeIndex] == 1) {
-	    gtk_layout_put(layout, AttrWidgets[widgetcounter], X, Y);
-	    gtk_layout_put(layout, AttrLabels[widgetcounter], X - 80, Y);
-	    gtk_widget_show(AttrWidgets[widgetcounter]);
-	    gtk_widget_show(AttrLabels[widgetcounter]);
-	    Y = Y + Yinc;
-	    switch (attr[widgetcounter].Type) {
-	    case 'F':
-		if (agget(obj, attr[widgetcounter].Name))
-		    gtk_spin_button_set_value((GtkSpinButton *)
-					      AttrWidgets[widgetcounter],
-					      atof(agget
-						   (obj,
-						    attr[widgetcounter].
-						    Name)));
-		else
-		    gtk_spin_button_set_value((GtkSpinButton *)
-					      AttrWidgets[widgetcounter],
-					      atof(attr[widgetcounter].
-						   Default));
-		break;
-	    case 'C':
-		if (agget(obj, attr[widgetcounter].Name))
-		    setGdkColor(&color,
-				agget(obj, attr[widgetcounter].Name));
-		else
-		    setGdkColor(&color, attr[widgetcounter].Default);
-
-		gtk_color_button_set_color((GtkColorButton *)
-					   AttrWidgets[widgetcounter],
-					   &color);
-		break;
-	    default:
-		if (agget(obj, attr[widgetcounter].Name))
-		    gtk_entry_set_text((GtkEntry *)
-				       AttrWidgets[widgetcounter],
-				       agget(obj,
-					     attr[widgetcounter].Name));
-		else
-		    gtk_entry_set_text((GtkEntry *)
-				       AttrWidgets[widgetcounter],
-				       attr[widgetcounter].Default);
-	    }
-	    gtk_widget_show(AttrWidgets[widgetcounter]);
-	    gtk_widget_show(AttrLabels[widgetcounter]);
-	} else {
-	    gtk_widget_hide(AttrWidgets[widgetcounter]);
-	    gtk_widget_hide(AttrLabels[widgetcounter]);
-	}
-	if (Y > widget_per_page * Yinc) {
-	    X = 320;
-	    Y = OriginalY;
-	}
-	attr_widgets_modified[widgetcounter] = 0;	//set to unmodified
-    }
+		attr[widgetcounter].ComboValuesCount = 0;
+		attr[widgetcounter].ComboValues = '\0';
+
+		if (!AttrWidgets[widgetcounter])
+		{
+			AttrLabels[widgetcounter] =
+			gtk_label_new(attr[widgetcounter].Name);
+			switch (attr[widgetcounter].Type)
+			{
+				case 'F':		//float
+					AttrWidgets[widgetcounter] =
+					gtk_spin_button_new_with_range(0, 100, 0.001);
+					g_signal_connect((gpointer) AttrWidgets[widgetcounter],"value-changed", G_CALLBACK(attr_widgets_modifiedSlot),(gpointer) widgetcounter);
+
+				break;
+				case 'C':		//color box
+					AttrWidgets[widgetcounter] = gtk_color_button_new();
+					gtk_widget_set_size_request(AttrWidgets[widgetcounter], 50, 23);
+					g_signal_connect((gpointer) AttrWidgets[widgetcounter],"color-set",G_CALLBACK(attr_widgets_modifiedSlot),(gpointer) widgetcounter);
+
+				break;
+				default:		//alphanumreric         GTK Entry
+					AttrWidgets[widgetcounter] = gtk_entry_new();
+					gtk_widget_set_size_request(AttrWidgets[widgetcounter],130, 23);
+					g_signal_connect((gpointer) AttrWidgets[widgetcounter], "changed", G_CALLBACK(attr_widgets_modifiedSlot),(gpointer) widgetcounter);
+				break;
+		    }
+		    attr[widgetcounter].attrWidget = AttrWidgets[widgetcounter];
+		}
+		//locate widget on the GtkLayout* layout
+		if (attr[widgetcounter].ApplyTo[typeIndex] == 1)
+		{
+			gtk_layout_put(layout, AttrWidgets[widgetcounter], X, Y);
+			gtk_layout_put(layout, AttrLabels[widgetcounter], X - 80, Y);
+			gtk_widget_show(AttrWidgets[widgetcounter]);
+			gtk_widget_show(AttrLabels[widgetcounter]);
+			Y = Y + Yinc;
+			switch (attr[widgetcounter].Type)
+			{
+				case 'F':
+					if (agget(obj, attr[widgetcounter].Name))
+						gtk_spin_button_set_value((GtkSpinButton *)	AttrWidgets[widgetcounter],atof(agget(obj,attr[widgetcounter].Name)));
+					else
+					    gtk_spin_button_set_value((GtkSpinButton *)AttrWidgets[widgetcounter],atof(attr[widgetcounter].Default));
+				break;
+				case 'C':
+					if (agget(obj, attr[widgetcounter].Name))
+						setGdkColor(&color,	agget(obj, attr[widgetcounter].Name));
+					else
+						setGdkColor(&color, attr[widgetcounter].Default);
+
+					gtk_color_button_set_color((GtkColorButton *)AttrWidgets[widgetcounter],&color);
+				break;
+				default:
+					if (agget(obj, attr[widgetcounter].Name))
+						gtk_entry_set_text((GtkEntry *)AttrWidgets[widgetcounter],agget(obj,attr[widgetcounter].Name));
+					else
+						gtk_entry_set_text((GtkEntry *)AttrWidgets[widgetcounter],attr[widgetcounter].Default);
+			}
+			gtk_widget_show(AttrWidgets[widgetcounter]);
+			gtk_widget_show(AttrLabels[widgetcounter]);
+		}
+		else
+		{
+			gtk_widget_hide(AttrWidgets[widgetcounter]);
+			gtk_widget_hide(AttrLabels[widgetcounter]);
+		}
+		if (Y > widget_per_page * Yinc)
+		{
+			X = 320;
+			Y = OriginalY;
+		}
+		attr_widgets_modified[widgetcounter] = 0;	//set to unmodified
+	}

     //first part, common attributes
     sprintf(buf, "%i", OD_ID(obj));
-    gtk_entry_set_text((GtkEntry *)
-		       glade_xml_get_widget(xml, "objEntryName"),
-		       OD_ObjName(obj));
-    gtk_entry_set_text((GtkEntry *)
-		       glade_xml_get_widget(xml, "objEntryLabel"),
-		       agnameof(obj));
-    gtk_toggle_button_set_active((GtkToggleButton *)
-				 glade_xml_get_widget(xml,
-						      "frmObjectchkVisible"),
-				 OD_Visible(obj));
-    gtk_toggle_button_set_active((GtkToggleButton *)
-				 glade_xml_get_widget(xml,
-						      "frmObjectchkLocked"),
-				 OD_Locked(obj));
-    gtk_toggle_button_set_active((GtkToggleButton *)
-				 glade_xml_get_widget(xml,
-						      "frmObjectchkHighlighted"),
-				 OD_Highlighted(obj));
+    gtk_entry_set_text((GtkEntry *)glade_xml_get_widget(xml, "objEntryName"),OD_ObjName(obj));
+	gtk_entry_set_text((GtkEntry *)glade_xml_get_widget(xml, "objEntryLabel"),agnameof(obj));
+    gtk_toggle_button_set_active((GtkToggleButton *)glade_xml_get_widget(xml,"frmObjectchkVisible"),OD_Visible(obj));
+    gtk_toggle_button_set_active((GtkToggleButton *)glade_xml_get_widget(xml,"frmObjectchkLocked"),OD_Locked(obj));
+	gtk_toggle_button_set_active((GtkToggleButton *)glade_xml_get_widget(xml,"frmObjectchkHighlighted"),OD_Highlighted(obj));
     //get the position info // show only one item is selected
     if (((GD_selectedNodesCount(g) == 1) && (typeIndex == GVE_NODE))
 	|| ((GD_selectedEdgesCount(g) == 1) && (typeIndex == GVE_EDGE))
-	|| ((GD_selectedGraphsCount(g) == 1) && (typeIndex == GVE_EDGE))) {
-	sprintf(line, "%s", agget(obj, "pos"));
-	a = (float) atof(strtok(line, ","));
-	b = (float) atof(strtok(NULL, ","));
-	gtk_spin_button_set_value((GtkSpinButton *)
-				  glade_xml_get_widget(xml,
-						       "frmObjectPosX"),
-				  a);
-	gtk_spin_button_set_value((GtkSpinButton *)
-				  glade_xml_get_widget(xml,
-						       "frmObjectPosY"),
-				  b);
-	gtk_spin_button_set_value((GtkSpinButton *)
-				  glade_xml_get_widget(xml,
-						       "frmObjectPosZ"),
-				  0);
-	gtk_widget_show(glade_xml_get_widget(xml, "frmObjectPosX"));
-	gtk_widget_show(glade_xml_get_widget(xml, "frmObjectPosY"));
-	gtk_widget_show(glade_xml_get_widget(xml, "frmObjectPosZ"));
-	gtk_widget_show(glade_xml_get_widget(xml, "frmObjectlabel3"));
-	gtk_label_set_text((GtkLabel *)
-			   glade_xml_get_widget(xml, "frmObjectPosLabelX"),
-			   "X:");
-    } else {
-	gtk_widget_hide(glade_xml_get_widget(xml, "frmObjectPosX"));
-	gtk_widget_hide(glade_xml_get_widget(xml, "frmObjectPosY"));
-	gtk_widget_hide(glade_xml_get_widget(xml, "frmObjectPosZ"));
-	gtk_widget_hide(glade_xml_get_widget(xml, "frmObjectlabel3"));
-	gtk_widget_hide(glade_xml_get_widget(xml, "frmObjectPosLabelY"));
-	gtk_widget_hide(glade_xml_get_widget(xml, "frmObjectPosLabelZ"));
-	switch (typeIndex)	//typeindex 0 means new object
-	{
-	case GVE_CLUSTER:	//graph  sub graph (cluster)
-	    gtk_label_set_text((GtkLabel *)
-			       glade_xml_get_widget(xml,
-						    "frmObjectPosLabelX"),
-			       "Changes that you make will be applied to all selected clusters");
-	    break;
-	case GVE_NODE:		//Node
-	    gtk_label_set_text((GtkLabel *)
-			       glade_xml_get_widget(xml,
-						    "frmObjectPosLabelX"),
-			       "Changes that you make will be applied to all selected nodes!");
-	    break;
-	case GVE_EDGE:		//Edge
-	    gtk_label_set_text((GtkLabel *)
-			       glade_xml_get_widget(xml,
-						    "frmObjectPosLabelX"),
-			       "Changes that you make will be applied to all selected edges!");
-	    break;
-	default:
-	    break;
-	}
+	|| ((GD_selectedGraphsCount(g) == 1) && (typeIndex == GVE_EDGE)))
+	{
+		sprintf(line, "%s", agget(obj, "pos"));
+		a = (float) atof(strtok(line, ","));
+		b = (float) atof(strtok(NULL, ","));
+		gtk_spin_button_set_value((GtkSpinButton *)glade_xml_get_widget(xml,"frmObjectPosX"),a);
+		gtk_spin_button_set_value((GtkSpinButton *)glade_xml_get_widget(xml,"frmObjectPosY"),b);
+		gtk_spin_button_set_value((GtkSpinButton *)glade_xml_get_widget(xml,"frmObjectPosZ"),0);
+		gtk_widget_show(glade_xml_get_widget(xml, "frmObjectPosX"));
+		gtk_widget_show(glade_xml_get_widget(xml, "frmObjectPosY"));
+		gtk_widget_show(glade_xml_get_widget(xml, "frmObjectPosZ"));
+		gtk_widget_show(glade_xml_get_widget(xml, "frmObjectlabel3"));
+		gtk_label_set_text((GtkLabel *)glade_xml_get_widget(xml, "frmObjectPosLabelX"),"X:");
     }
+	else
+	{
+		gtk_widget_hide(glade_xml_get_widget(xml, "frmObjectPosX"));
+		gtk_widget_hide(glade_xml_get_widget(xml, "frmObjectPosY"));
+		gtk_widget_hide(glade_xml_get_widget(xml, "frmObjectPosZ"));
+		gtk_widget_hide(glade_xml_get_widget(xml, "frmObjectlabel3"));
+		gtk_widget_hide(glade_xml_get_widget(xml, "frmObjectPosLabelY"));
+		gtk_widget_hide(glade_xml_get_widget(xml, "frmObjectPosLabelZ"));
+		switch (typeIndex)	//typeindex 0 means new object
+		{
+			case GVE_CLUSTER:		//graph  sub graph (cluster)
+				gtk_label_set_text((GtkLabel *)glade_xml_get_widget(xml,"frmObjectPosLabelX"),"Changes that you make will be applied to all selected clusters");
+			break;
+			case GVE_NODE:		//Node
+				gtk_label_set_text((GtkLabel *)glade_xml_get_widget(xml,"frmObjectPosLabelX"),"Changes that you make will be applied to all selected nodes!");
+		    break;
+			case GVE_EDGE:		//Edge
+				gtk_label_set_text((GtkLabel *)glade_xml_get_widget(xml,"frmObjectPosLabelX"),"Changes that you make will be applied to all selected edges!");
+		    break;
+			default :
+				break;
+		}
+	}
     return 1;
 }
 void update_object_properties(int typeIndex, Agraph_t * g)	//updates objects from gui(node ,edge, cluster)
 {
     int ind = 0;
-    for (ind = 0; ind < widgetcounter; ind++) {
-	//if widget has been changed
-	if (attr_widgets_modified[ind] == 1) {
-	    switch (typeIndex)	//typeindex 0 means new object
-	    {
-	    case GVE_CLUSTER:	//graph  sub graph (cluster)
-		change_selected_graph_attributes(g, attr[ind].Name,
-						 get_attribute_string_value_from_widget
-						 (&attr[ind]));
+    for (ind = 0; ind < widgetcounter; ind++)
+	{
+		//if widget has been changed
+		if (attr_widgets_modified[ind] == 1)
+		{
+			switch (typeIndex)	//typeindex 0 means new object
+			{
+				case GVE_CLUSTER:		//graph  sub graph (cluster)
+					change_selected_graph_attributes(g, attr[ind].Name,
+							 get_attribute_string_value_from_widget
+							 (&attr[ind]));
+				break;
+				case GVE_NODE:		//Node
+					change_selected_node_attributes(g, attr[ind].Name,
+							get_attribute_string_value_from_widget
+							(&attr[ind]));
+				break;
+				case GVE_EDGE:		//Edge
+					change_selected_edge_attributes(g, attr[ind].Name,
+								get_attribute_string_value_from_widget
+								(&attr[ind]));
+				break;
+			}
+		}
+
+	}
+}
+char *get_attribute_string_value_from_widget(attribute * att)
+{
+    GdkColor color;
+    switch (att->Type)
+	{
+	    case 'F':
+			sprintf(guibuffer, "%f",gtk_spin_button_get_value((GtkSpinButton *) att->attrWidget));
+			return guibuffer;
 		break;
-	    case GVE_NODE:	//Node
-		change_selected_node_attributes(g, attr[ind].Name,
-						get_attribute_string_value_from_widget
-						(&attr[ind]));
-		break;
-	    case GVE_EDGE:	//Edge
-		change_selected_edge_attributes(g, attr[ind].Name,
-						get_attribute_string_value_from_widget
-						(&attr[ind]));
-		break;
-	    }
-	}
-
-    }
-}
-char *get_attribute_string_value_from_widget(attribute * att)
-{
-    GdkColor color;
-    switch (att->Type) {
-    case 'F':
-	sprintf(guibuffer, "%f",
-		gtk_spin_button_get_value((GtkSpinButton *) att->
-					  attrWidget));
-	return guibuffer;
-	break;
-    case 'C':
-	gtk_color_button_get_color((GtkColorButton *) att->attrWidget,
-				   &color);
-	sprintf(guibuffer, "#%x%x%x", color.red / 255, color.green / 255,
-		color.blue / 255);
-	return guibuffer;
-	break;
-    default:
-	strcpy(guibuffer,
-	       gtk_entry_get_text((GtkEntry *) att->attrWidget));
-	return guibuffer;
+		case 'C':
+			gtk_color_button_get_color((GtkColorButton *) att->attrWidget,&color);
+			sprintf(guibuffer, "#%x%x%x", color.red / 255, color.green / 255,color.blue / 255);
+			return guibuffer;
+			break;
+		default:
+			strcpy(guibuffer,gtk_entry_get_text((GtkEntry *) att->attrWidget));
+			return guibuffer;
     }
 }
 void change_selected_graph_attributes(Agraph_t * g, char *attrname,
@@ -1328,8 +1298,9 @@
     int ind = 0;
     agattr(g, AGRAPH, attrname, "");

-    for (ind = 0; ind < GD_selectedGraphsCount(g); ind++) {
-	agset(GD_selectedGraphs(g)[ind], attrname, attrvalue);
+    for (ind = 0; ind < GD_selectedGraphsCount(g); ind++)
+	{
+		agset(GD_selectedGraphs(g)[ind], attrname, attrvalue);
     }

@@ -1340,8 +1311,9 @@
     int ind = 0;
     agattr(g, AGNODE, attrname, "");

-    for (ind = 0; ind < GD_selectedNodesCount(g); ind++) {
-	agset(GD_selectedNodes(g)[ind], attrname, attrvalue);
+    for (ind = 0; ind < GD_selectedNodesCount(g); ind++)
+	{
+		agset(GD_selectedNodes(g)[ind], attrname, attrvalue);
     }
 }
 void change_selected_edge_attributes(Agraph_t * g, char *attrname,
@@ -1350,8 +1322,9 @@
     int ind = 0;
     agattr(g, AGEDGE, attrname, "");

-    for (ind = 0; ind < GD_selectedEdgesCount(g); ind++) {
-	agset(GD_selectedEdges(g)[ind], attrname, attrvalue);
+    for (ind = 0; ind < GD_selectedEdgesCount(g); ind++)
+	{
+		agset(GD_selectedEdges(g)[ind], attrname, attrvalue);

     }
 }
@@ -1368,15 +1341,16 @@
     char *pch;
     int ind = 0;
     int attrcount = 0;
-    static char *smyrna_attrs;
+    static char* smyrna_attrs;

     if (!smyrna_attrs) {
 #if WIN32
 	smyrna_attrs = SMYRNA_ATTRS;
 #else
-	smyrna_attrs = smyrnaPath("attrs.txt");
+	smyrna_attrs = smyrnaPath ("attrs.txt");
 #endif
     }
+
     //loads attributes from a text file
     file = fopen(smyrna_attrs, "r");
     if (file != NULL) {
@@ -1437,8 +1411,8 @@
 		    break;
 		default:
 		    attr[attrcount].ComboValues =
-			RALLOC(attr[attrcount].ComboValuesCount,
-			       attr[attrcount].ComboValues, char *);
+			RALLOC(attr[attrcount].ComboValuesCount,
+				attr[attrcount].ComboValues, char*);
 		    attr[attrcount].ComboValues[attr[attrcount].
 						ComboValuesCount] =
 			safestrdup(ss);
@@ -1452,4 +1426,4 @@
     }
 }

-#endif
+#endif


virtual: Fixed initial mailbox synchronization for the last virtual mailbox.

--- src/plugins/virtual/virtual-sync.c
+++ src/plugins/virtual/virtual-sync.c
@@ -988,6 +988,12 @@
 	}
 	i_free(vmails);

+	/* finish adding messages to the last mailbox */
+	for (; j < uidmap_count; j++) {
+		add_rec.rec.real_uid = uidmap[j].real_uid;
+		array_append(&ctx->all_adds, &add_rec, 1);
+	}
+
 	/* if there are any mailboxes we didn't yet sync, add new messages in
 	   them */
 	bboxes = array_get(&ctx->mbox->backend_boxes, &count);


Added block source

Added block source

error: pathspec 'cml/src/block/source/block.c' did not match any file(s) known to git

--- cml/src/block/source/block.c
+++ cml/src/block/source/block.c
@@ -0,0 +1,11 @@
+size_t
+FUNCTION(cml_block,size)(const TYPE(cml_block) *b)
+{
+        return b->size;
+}
+
+ATOMIC *
+FUNCTION(cml_block,data)(const TYPE(cml_block) *b)
+{
+        return b->data;
+}


Remove path from vector on directory watcher item removed event

--- src/MediaServer/DirectoryWatcher.h
+++ src/MediaServer/DirectoryWatcher.h
@@ -59,7 +59,14 @@
       const ofx::IO::DirectoryWatcherManager::DirectoryEvent& evt) {
     string path = evt.item.path();

-    // TODO Remove items from Vector
+    // Remove path from vector
+    int i;
+    for (i = 0; i < filePaths.size(); i++) {
+      if (path == filePaths[i]) {
+        filePaths.erase(filePaths.begin() + i);
+        break;
+      }
+    }

     ofNotifyEvent(onItemRemoved, path, this);
   }


zbuf: use load_be32 macro

zbuf: use load_be32 macro

--- nmsg/zbuf.c
+++ nmsg/zbuf.c
@@ -17,8 +17,8 @@
 /* Import. */

 #include "nmsg_port.h"
+#include "nmsg_port_net.h"

-#include <netinet/in.h>
 #include <assert.h>
 #include <stdlib.h>

@@ -132,8 +132,8 @@
 {
 	int zret;

-	*ulen = ntohl(*((uint32_t *) zbuf));
-	zbuf += sizeof(uint32_t);
+	load_be32(zbuf, ulen);
+	zbuf += 4;

 	*ubuf = malloc(*ulen);
 	if (*ubuf == NULL)


cleanup: format help text to ease reading

BRANCH=none
BUG=none
TEST=verify help text on command line

Change-Id: Iec19641eb0a61f1f0de1afe4b59b587b8f0d7410
Signed-off-by: Jett Rink <9d4aef0593e6843318d99df31597fb6153b89787@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1945820
Reviewed-by: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>


util/comm-i2c: Fix memory leak

util/comm-i2c: Fix memory leak

Found by Coverity #58167

BUG=none
BRANCH=none
TEST=none

Change-Id: I434d4b140683b4c3440c30b232fab34d781da9d4
Signed-off-by: Patrick Georgi <bc411205f21846a74924ee7b489c75617ec76078@google.com>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/1781466
Reviewed-by: Daisuke Nojiri <fd5f93af191bf7e8f73ea71cc3c0f66b41b1dd49@chromium.org>
Tested-by: Patrick Georgi <bc411205f21846a74924ee7b489c75617ec76078@chromium.org>
Commit-Queue: Patrick Georgi <bc411205f21846a74924ee7b489c75617ec76078@chromium.org>


Fix uninitialized read of size 1 in little2_updatePosition

Reported by Pascal Cuoq

Valgrind's view:
==4416== Conditional jump or move depends on uninitialised value(s)
==4416==    at 0x41F187: little2_updatePosition (xmltok_impl.c:1748)
==4416==    by 0x405F85: XML_GetCurrentColumnNumber (xmlparse.c:1931)
==4416==    by 0x402F7B: reportError (xmlfile.c:67)
==4416==    by 0x403041: processFile (xmlfile.c:84)
==4416==    by 0x403752: filemap (unixfilemap.c:61)
==4416==    by 0x403523: XML_ProcessFile (xmlfile.c:239)
==4416==    by 0x402EBC: main (xmlwf.c:847)

--- expat/lib/xmltok_impl.c
+++ expat/lib/xmltok_impl.c
@@ -1744,7 +1744,7 @@
                        const char *end,
                        POSITION *pos)
 {
-  while (ptr < end) {
+  while (end - ptr >= MINBPC(enc)) {
     switch (BYTE_TYPE(enc, ptr)) {
 #define LEAD_CASE(n) \
     case BT_LEAD ## n: \


 - Implemented "disable_command_history" and "return_on_escape" for
   read-line input.

--- src/cell_interface/cell_interface.c
+++ src/cell_interface/cell_interface.c
@@ -1981,7 +1981,7 @@
 static int16_t read_line(zscii *dest, uint16_t maximum_length,
     uint16_t tenth_seconds, uint32_t verification_routine,
     uint8_t preloaded_input, int *tenth_seconds_elapsed,
-    bool UNUSED(disable_command_history), bool UNUSED(return_on_escape))
+    bool disable_command_history, bool return_on_escape)
 {
   z_ucs input, buf;
   int timeout_millis = -1, event_type, i;
@@ -2469,18 +2469,22 @@
         }
       }
       else if (
+          (disable_command_history == false)
+          &&
           (
-           (event_type == EVENT_WAS_CODE_CURSOR_UP)
-           &&
-           (cmd_history_index < command_history_nof_entries)
+           (
+            (event_type == EVENT_WAS_CODE_CURSOR_UP)
+            &&
+            (cmd_history_index < command_history_nof_entries)
+           )
+           ||
+           (
+            (event_type == EVENT_WAS_CODE_CURSOR_DOWN)
+            &&
+            (cmd_history_index != 0)
+           )
           )
-          ||
-          (
-           (event_type == EVENT_WAS_CODE_CURSOR_DOWN)
-           &&
-           (cmd_history_index != 0)
-          )
-          )
+         )
       {
         TRACE_LOG("old history index: %d.\n", cmd_history_index);

@@ -2597,6 +2601,14 @@
         input_index = input_size;
         refresh_cursor(active_z_window_id);
         screen_cell_interface->update_screen();
+      }
+      else if (event_type == EVENT_WAS_CODE_ESC)
+      {
+        if (return_on_escape == true)
+        {
+          input_in_progress = false;
+          input_size = -2;
+        }
       }
     }