Regenerating build 64bits [ci skip]

Regenerating build 64bits [ci skip]

--- build/64bits/phalcon.c
+++ build/64bits/phalcon.c
@@ -1294,7 +1294,7 @@
 #define PHALCON_CALL_METHOD_PARAMS_5(return_value, object, method_name, param1, param2, param3, param4, param5) if(phalcon_call_method_five_params(return_value, object, method_name, sizeof(method_name)-1, param1, param2, param3, param4, param5, 1, 0, 1 TSRMLS_CC)==FAILURE) return;
 #define PHALCON_CALL_METHOD_PARAMS_5_NORETURN(object, method_name, param1, param2, param3, param4, param5) if(phalcon_call_method_five_params(NULL, object, method_name, sizeof(method_name)-1, param1, param2, param3, param4, param5, 0, 0, 1 TSRMLS_CC)==FAILURE) return;

-  /** Macros to call methods in the PHP userland (use these in development) */
+/** Macros to call methods in the PHP userland (use these in development) */
 #define phalcon_call_method(return_value, object, method_name) if (phalcon_call_method_ex(return_value, object, method_name, sizeof(method_name)-1, 1, 0, 1 TSRMLS_CC)==FAILURE) return;
 #define phalcon_call_method_noret(object, method_name) if (phalcon_call_method_ex(NULL, object, method_name, sizeof(method_name)-1, 0, 0, 1 TSRMLS_CC)==FAILURE) return;
 #define phalcon_call_method_pn(return_value, object, method_name, param_count, params) if(phalcon_call_method_params(return_value, object, method_name, sizeof(method_name)-1, param_count, params, 1, 0, 1 TSRMLS_CC)==FAILURE) return;
@@ -1309,6 +1309,12 @@
 #define phalcon_call_method_p4_noret(object, method_name, param1, param2, param3, param4) if(phalcon_call_method_four_params(NULL, object, method_name, sizeof(method_name)-1, param1, param2, param3, param4, 0, 0, 1 TSRMLS_CC)==FAILURE) return;
 #define phalcon_call_method_p5(return_value, object, method_name, param1, param2, param3, param4, param5) if(phalcon_call_method_five_params(return_value, object, method_name, sizeof(method_name)-1, param1, param2, param3, param4, param5, 1, 0, 1 TSRMLS_CC)==FAILURE) return;
 #define phalcon_call_method_p5_noret(object, method_name, param1, param2, param3, param4, param5) if(phalcon_call_method_five_params(NULL, object, method_name, sizeof(method_name)-1, param1, param2, param3, param4, param5, 0, 0, 1 TSRMLS_CC)==FAILURE) return;
+
+/** Macros to call methods with zvals as method names */
+#define phalcon_call_method_zval(return_value, object, method) if (phalcon_call_method_zval_ex(NULL, object, method, 1, 0, 1 TSRMLS_CC)==FAILURE) return;
+#define phalcon_call_method_zval_noret(object, method) if (phalcon_call_method_zval_ex(NULL, object, method, 0, 0, 1 TSRMLS_CC)==FAILURE) return;
+#define phalcon_call_method_zval_p1_noret(object, method, param1) if (phalcon_call_method_zval_one_param(NULL, object, method, param1, 0, 0, 1 TSRMLS_CC)==FAILURE) return;
+#define phalcon_call_method_zval_p3(return_value, object, method, param1, param2, param3) if(phalcon_call_method_zval_three_params(return_value, object, method, param1, param2, param3, 1, 0, 1 TSRMLS_CC)==FAILURE) return;

 /** Macros to call methods in the PHP userland with a precalculated hash key (not use these in development) (deprecated) */
 #define PHALCON_CALL_METHOD_KEY(return_value, object, method_name, key) if(phalcon_call_method_ex(return_value, object, method_name, sizeof(method_name)-1, 1, key, 1 TSRMLS_CC)==FAILURE) return;
@@ -1385,9 +1391,15 @@
 #define PHALCON_CALL_STATIC_NORETURN(class_name, method_name) if(phalcon_call_static_func(NULL, class_name, sizeof(class_name)-1, method_name, sizeof(method_name)-1, 0 TSRMLS_CC)==FAILURE) return;

 /** Use these functions to call static functions using a zval as callable */
-#define PHALCON_CALL_ZVAL_STATIC(return_value, class_zval, method_name) if(phalcon_call_static_zval_func(return_value, class_zval, method_name, sizeof(method_name)-1, 1 TSRMLS_CC)==FAILURE) return;
-#define PHALCON_CALL_STATIC_ZVAL_PARAMS(return_value, class_zval, method_name, param_count, params) if(phalcon_call_static_zval_func_params(return_value, class_zval, method_name, sizeof(method_name)-1, param_count, params, 1 TSRMLS_CC)==FAILURE) return;
-#define PHALCON_CALL_STATIC_ZVAL_PARAMS_1(return_value, class_zval, method_name, param1) if(phalcon_call_static_zval_func_one_param(return_value, class_zval, method_name, sizeof(method_name)-1, param1, 1 TSRMLS_CC)==FAILURE) return;
+#define PHALCON_CALL_ZVAL_STATIC(return_value, class_zval, method) if(phalcon_call_static_zval_func(return_value, class_zval, method, 1 TSRMLS_CC)==FAILURE) return;
+#define PHALCON_CALL_STATIC_ZVAL_PARAMS(return_value, class_zval, method, param_count, params) if(phalcon_call_static_zval_func_params(return_value, class_zval, method, param_count, params, 1 TSRMLS_CC)==FAILURE) return;
+#define PHALCON_CALL_STATIC_ZVAL_PARAMS_1(return_value, class_zval, method, param1) if(phalcon_call_static_zval_func_one_param(return_value, class_zval, method, param1, 1 TSRMLS_CC)==FAILURE) return;
+
+#define phalcon_call_zval_static(return_value, class_zval, method) if(phalcon_call_static_zval_func(return_value, class_zval, method, 1 TSRMLS_CC)==FAILURE) return;
+#define phalcon_call_zval_static_params(return_value, class_zval, method, param_count, params) if(phalcon_call_static_zval_func_params(return_value, class_zval, method, param_count, params, 1 TSRMLS_CC)==FAILURE) return;
+#define phalcon_call_zval_static_p1(return_value, class_zval, method, param1) if(phalcon_call_static_zval_func_one_param(return_value, class_zval, method, param1, 1 TSRMLS_CC)==FAILURE) return;
+
+#define phalcon_call_zval_str_static_p1(return_value, class_zval, method_name, param1) if(phalcon_call_static_zval_str_func_one_param(return_value, class_zval, method_name, sizeof(method_name)-1, param1, 1 TSRMLS_CC)==FAILURE) return;

 /** Use these functions to call functions in the PHP userland using an arbitrary zval as callable */
 #define PHALCON_CALL_USER_FUNC(return_value, handler) if(phalcon_call_user_func(return_value, handler TSRMLS_CC)==FAILURE) return;
@@ -1414,6 +1426,11 @@
 static int phalcon_call_method_four_params(zval *return_value, zval *object, char *method_name, int method_len, zval *param1, zval *param2, zval *param3, zval *param4, int noreturn, unsigned long method_key, int lower TSRMLS_DC);
 static int phalcon_call_method_five_params(zval *return_value, zval *object, char *method_name, int method_len, zval *param1, zval *param2, zval *param3, zval *param4, zval *param5, int noreturn, unsigned long method_key, int lower TSRMLS_DC);

+/** Call zval methods on object instances */
+static int phalcon_call_method_zval_ex(zval *return_value, zval *object, zval *method, int noreturn, unsigned long method_key, int lower TSRMLS_DC);
+static int phalcon_call_method_zval_one_param(zval *return_value, zval *object, zval *method, zval *param1, int noreturn, unsigned long method_key, int lower TSRMLS_DC);
+static int phalcon_call_method_zval_three_params(zval *return_value, zval *object, zval *method, zval *param1, zval *param2, zval *param3, int noreturn, unsigned long method_key, int lower TSRMLS_DC);
+
 /** Call methods on parent class */
 static int phalcon_call_parent_func(zval *return_value, zval *object, char *active_class, int active_class_len,char *method_name, int method_len, int noreturn TSRMLS_DC);
 static int phalcon_call_parent_func_params(zval *return_value, zval *object, char *active_class, int active_class_len, char *method_name, int method_len, zend_uint param_count, zval *params[], int noreturn TSRMLS_DC);
@@ -1439,9 +1456,11 @@
 static int phalcon_call_static_func_five_params(zval *return_value, char *class_name, int class_name_len, char *method_name, int method_len, zval *param1, zval *param2, zval *param3, zval *param4, zval *param5, int noreturn TSRMLS_DC);

 /** Call methods on static classes from a zval class name */
-static int phalcon_call_static_zval_func(zval *return_value, zval *mixed_name, char *method_name, int method_len, int noreturn TSRMLS_DC);
-static int phalcon_call_static_zval_func_params(zval *return_value, zval *mixed_name, char *method_name, int method_len, zend_uint param_count, zval *params[], int noreturn TSRMLS_DC);
-static int phalcon_call_static_zval_func_one_param(zval *return_value, zval *mixed_name, char *method_name, int method_len, zval *param1, int noreturn TSRMLS_DC);
+static int phalcon_call_static_zval_func(zval *return_value, zval *mixed_name, zval *method, int noreturn TSRMLS_DC);
+static int phalcon_call_static_zval_func_params(zval *return_value, zval *mixed_name, zval *method, zend_uint param_count, zval *params[], int noreturn TSRMLS_DC);
+static int phalcon_call_static_zval_func_one_param(zval *return_value, zval *mixed_name, zval *method, zval *param1, int noreturn TSRMLS_DC);
+
+static int phalcon_call_static_zval_str_func_one_param(zval *return_value, zval *mixed_name, char *method_name, int method_le, zval *param1, int noreturn TSRMLS_DC);

 /** Fast call_user_func_array/call_user_func */
 static int phalcon_call_user_func(zval *return_value, zval *handler TSRMLS_DC);
@@ -1964,6 +1983,11 @@

+/** Get the possible URI based on a script path */
+static void phalcon_get_uri(zval *return_value, zval *path TSRMLS_DC);
+
+
+
 #ifdef HAVE_CONFIG_H
 #endif

@@ -2902,6 +2926,10 @@
 	return phalcon_call_method_internal(return_value, object, method_name, method_len, noreturn, method_key, lower TSRMLS_CC);
 }

+static int phalcon_call_method_zval_ex(zval *return_value, zval *object, zval *method, int noreturn, unsigned long method_key, int lower TSRMLS_DC){
+	return phalcon_call_method_internal(return_value, object, Z_STRVAL_P(method), Z_STRLEN_P(method), noreturn, method_key, lower TSRMLS_CC);
+}
+
 static int phalcon_call_method_params(zval *return_value, zval *object, char *method_name, int method_len, zend_uint param_count, zval *params[], int noreturn, unsigned long method_key, int lower TSRMLS_DC){
 	return phalcon_call_method_params_internal(return_value, object, method_name, method_len, param_count, params, noreturn, method_key, lower TSRMLS_CC);
 }
@@ -2911,6 +2939,11 @@
 	return phalcon_call_method_params(return_value, object, method_name, method_len, 1, params, noreturn, method_key, lower TSRMLS_CC);
 }

+static int phalcon_call_method_zval_one_param(zval *return_value, zval *object, zval *method, zval *param1, int noreturn, unsigned long method_key, int lower TSRMLS_DC){
+	zval *params[] = { param1 };
+	return phalcon_call_method_params(return_value, object, Z_STRVAL_P(method), Z_STRLEN_P(method), 1, params, noreturn, method_key, lower TSRMLS_CC);
+}
+
 static int phalcon_call_method_two_params(zval *return_value, zval *object, char *method_name, int method_len, zval *param1, zval *param2, int noreturn, unsigned long method_key, int lower TSRMLS_DC){
 	zval *params[] = { param1, param2 };
 	return phalcon_call_method_params(return_value, object, method_name, method_len, 2, params, noreturn, method_key, lower TSRMLS_CC);
@@ -2919,6 +2952,11 @@
 static int phalcon_call_method_three_params(zval *return_value, zval *object, char *method_name, int method_len, zval *param1, zval *param2, zval *param3, int noreturn, unsigned long method_key, int lower TSRMLS_DC){
 	zval *params[] = { param1, param2, param3 };
 	return phalcon_call_method_params(return_value, object, method_name, method_len, 3, params, noreturn, method_key, lower TSRMLS_CC);
+}
+
+static int phalcon_call_method_zval_three_params(zval *return_value, zval *object, zval *method, zval *param1, zval *param2, zval *param3, int noreturn, unsigned long method_key, int lower TSRMLS_DC){
+	zval *params[] = { param1, param2, param3 };
+	return phalcon_call_method_params(return_value, object, Z_STRVAL_P(method), Z_STRLEN_P(method), 3, params, noreturn, method_key, lower TSRMLS_CC);
 }

 static int phalcon_call_method_four_params(zval *return_value, zval *object, char *method_name, int method_len, zval *param1, zval *param2, zval *param3, zval *param4, int noreturn, unsigned long method_key, int lower TSRMLS_DC){
@@ -3176,10 +3214,16 @@
 	return phalcon_call_static_func_params(return_value, class_name, class_length, method_name, method_len, 5, params, noreturn TSRMLS_CC);
 }

-static int phalcon_call_static_zval_func(zval *return_value, zval *mixed_name, char *method_name, int method_len, int noreturn TSRMLS_DC){
+static int phalcon_call_static_zval_func(zval *return_value, zval *mixed_name, zval *method, int noreturn TSRMLS_DC){

 	zval *fn;
 	int status = FAILURE;
+
+	if (unlikely(Z_TYPE_P(method) != IS_STRING)) {
+		php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function not-callable::not-callable()");
+		phalcon_memory_restore_stack(TSRMLS_C);
+		return FAILURE;
+	}

 	if (!noreturn) {
 		ALLOC_INIT_ZVAL(return_value);
@@ -3190,14 +3234,14 @@
 	ALLOC_INIT_ZVAL(fn);
 	array_init_size(fn, 2);
 	add_next_index_zval(fn, mixed_name);
-	add_next_index_stringl(fn, method_name, method_len, 1);
+	add_next_index_zval(fn, method);

 	status = phalcon_call_user_function(CG(function_table), NULL, fn, return_value, 0, NULL TSRMLS_CC);
 	if (unlikely(status == FAILURE)) {
 		if(Z_TYPE_P(mixed_name) == IS_STRING) {
-			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function %s::%s()", Z_STRVAL_P(mixed_name), method_name);
+			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function %s::%s()", Z_STRVAL_P(mixed_name), Z_STRVAL_P(method));
 		} else {
-			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function not-callable::%s()", method_name);
+			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function not-callable::%s()", Z_STRVAL_P(method));
 		}
 	}

@@ -3218,7 +3262,55 @@
 	return status;
 }

-inline int phalcon_call_static_zval_func_params(zval *return_value, zval *mixed_name, char *method_name, int method_len, zend_uint param_count, zval *params[], int noreturn TSRMLS_DC){
+inline int phalcon_call_static_zval_func_params(zval *return_value, zval *mixed_name, zval *method, zend_uint param_count, zval *params[], int noreturn TSRMLS_DC){
+
+	zval *fn;
+	int status = FAILURE;
+
+	if (unlikely(Z_TYPE_P(method) != IS_STRING)) {
+		php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function not-callable::not-callable()");
+		phalcon_memory_restore_stack(TSRMLS_C);
+		return FAILURE;
+	}
+
+	if (!noreturn) {
+		ALLOC_INIT_ZVAL(return_value);
+	}
+
+	Z_ADDREF_P(mixed_name);
+
+	ALLOC_INIT_ZVAL(fn);
+	array_init_size(fn, 2);
+	add_next_index_zval(fn, mixed_name);
+	add_next_index_zval(fn, method);
+
+	status = phalcon_call_user_function(CG(function_table), NULL, fn, return_value, param_count, params TSRMLS_CC);
+	if (unlikely(status == FAILURE)) {
+		if(Z_TYPE_P(mixed_name) == IS_STRING) {
+			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function %s::%s()", Z_STRVAL_P(mixed_name), Z_STRVAL_P(method));
+		} else {
+			php_error_docref(NULL TSRMLS_CC, E_ERROR, "Call to undefined function not-callable::%s()", Z_STRVAL_P(method));
+		}
+	}
+
+	zval_ptr_dtor(&fn);
+
+	if (!noreturn) {
+		zval_ptr_dtor(&return_value);
+	}
+
+	if (EG(exception)) {
+		status = FAILURE;
+	}
+
+	if (status == FAILURE) {
+		phalcon_memory_restore_stack(TSRMLS_C);
+	}
+
+	return status;
+}
+
+inline int phalcon_call_static_zval_str_func_params(zval *return_value, zval *mixed_name, char *method_name, int method_len, zend_uint param_count, zval *params[], int noreturn TSRMLS_DC){

 	zval *fn;
 	int status = FAILURE;
@@ -3260,19 +3352,24 @@
 	return status;
 }

-static int phalcon_call_static_zval_func_one_param(zval *return_value, zval *mixed_name, char *method_name, int method_len, zval *param1, int noreturn TSRMLS_DC){
+static int phalcon_call_static_zval_func_one_param(zval *return_value, zval *mixed_name, zval *method, zval *param1, int noreturn TSRMLS_DC){
 	zval *params[] = { param1 };
-	return phalcon_call_static_zval_func_params(return_value, mixed_name, method_name, method_len, 1, params, noreturn TSRMLS_CC);
-}
-
-static int phalcon_call_static_zval_func_two_params(zval *return_value, zval *mixed_name, char *method_name, int method_len, zval *param1, zval *param2, int noreturn TSRMLS_DC){
+	return phalcon_call_static_zval_func_params(return_value, mixed_name, method, 1, params, noreturn TSRMLS_CC);
+}
+
+static int phalcon_call_static_zval_str_func_one_param(zval *return_value, zval *mixed_name, char *method_name, int method_len, zval *param1, int noreturn TSRMLS_DC){
+	zval *params[] = { param1 };
+	return phalcon_call_static_zval_str_func_params(return_value, mixed_name, method_name, method_len, 1, params, noreturn TSRMLS_CC);
+}
+
+static int phalcon_call_static_zval_func_two_params(zval *return_value, zval *mixed_name, zval *method, int method_len, zval *param1, zval *param2, int noreturn TSRMLS_DC){
 	zval *params[] = { param1, param2 };
-	return phalcon_call_static_zval_func_params(return_value, mixed_name, method_name, method_len, 2, params, noreturn TSRMLS_CC);
-}
-
-static int phalcon_call_static_zval_func_three_params(zval *return_value, zval *mixed_name, char *method_name, int method_len, zval *param1, zval *param2, zval *param3, int noreturn TSRMLS_DC){
+	return phalcon_call_static_zval_func_params(return_value, mixed_name, method, 2, params, noreturn TSRMLS_CC);
+}
+
+static int phalcon_call_static_zval_func_three_params(zval *return_value, zval *mixed_name, zval *method, zval *param1, zval *param2, zval *param3, int noreturn TSRMLS_DC){
 	zval *params[] = { param1, param2, param3 };
-	return phalcon_call_static_zval_func_params(return_value, mixed_name, method_name, method_len, 3, params, noreturn TSRMLS_CC);
+	return phalcon_call_static_zval_func_params(return_value, mixed_name, method, 3, params, noreturn TSRMLS_CC);
 }

 static int phalcon_call_static_ce_func_params(zval *return_value, zend_class_entry *ce, char *method_name, int method_len, zend_uint param_count, zval *params[], int noreturn TSRMLS_DC){
@@ -11570,6 +11667,41 @@
 		RETURN_EMPTY_STRING();
 	}

+}
+
+
+
+
+static void phalcon_get_uri(zval *return_value, zval *path TSRMLS_DC) {
+
+	int i, found = 0, mark;
+	char *cursor, *str, ch;
+
+	if (Z_TYPE_P(path) != IS_STRING) {
+		RETURN_EMPTY_STRING();
+	}
+
+	if (Z_STRLEN_P(path) > 0) {
+		cursor = Z_STRVAL_P(path) + Z_STRLEN_P(path) - 1;
+		for (i = Z_STRLEN_P(path); i >= 0; i--) {
+			ch = *cursor;
+			if (ch == '/' || ch == '\\') {
+				found++;
+				if (found == 1) {
+					mark = i - 1;
+				} else {
+					str = emalloc(mark - i + 1);
+					memcpy(str, Z_STRVAL_P(path) + i, mark - i);
+					str[mark - i] = '\0';
+					ZVAL_STRINGL(return_value, str, mark - i, 0);
+					return;
+				}
+			}
+			cursor--;
+		}
+	}
+
+	RETURN_EMPTY_STRING();
 }

@@ -34265,7 +34397,7 @@
 					if (phalcon_method_exists(handler, event_name TSRMLS_CC) == SUCCESS) {

 						PHALCON_INIT_NVAR(status);
-						phalcon_call_method_p3(status, handler, Z_TYPE_P(event_name) == IS_STRING ? Z_STRVAL_P(event_name) : "", event, source, data);
+						phalcon_call_method_zval_p3(status, handler, event_name, event, source, data);

 						if (zend_is_true(collect)) {
 							phalcon_update_property_array_append(this_ptr, SL("_responses"), status TSRMLS_CC);
@@ -34326,7 +34458,7 @@
 					if (phalcon_method_exists(handler, event_name TSRMLS_CC) == SUCCESS) {

 						PHALCON_INIT_NVAR(status);
-						phalcon_call_method_p3(status, handler, Z_TYPE_P(event_name) == IS_STRING ? Z_STRVAL_P(event_name) : "", event, source, data);
+						phalcon_call_method_zval_p3(status, handler, event_name, event, source, data);

 						if (zend_is_true(collect)) {
 							phalcon_update_property_array_append(this_ptr, SL("_responses"), status TSRMLS_CC);
@@ -36662,7 +36794,7 @@
 		PHALCON_INIT_NVAR(method);
 		PHALCON_CONCAT_SV(method, "set", key);
 		if (phalcon_method_exists(entity, method TSRMLS_CC) == SUCCESS) {
-			phalcon_call_method_p1_noret(entity, Z_TYPE_P(method) == IS_STRING ? Z_STRVAL_P(method) : "", filtered_value);
+			phalcon_call_method_zval_p1_noret(entity, method, filtered_value);
 			zend_hash_move_forward_ex(ah0, &hp0);
 			continue;
 		}
@@ -37050,7 +37182,7 @@
 		PHALCON_CONCAT_SV(method, "get", name);
 		if (phalcon_method_exists(entity, method TSRMLS_CC) == SUCCESS) {
 			PHALCON_INIT_VAR(value);
-			phalcon_call_method(value, entity, Z_TYPE_P(method) == IS_STRING ? Z_STRVAL_P(method) : "");
+			phalcon_call_method_zval(value, entity, method);
 			RETURN_CCTOR(value);
 		}

@@ -44211,7 +44343,7 @@
 	phalcon_fetch_params(1, 1, 0, &event_name);

 	if (phalcon_method_exists(this_ptr, event_name TSRMLS_CC) == SUCCESS) {
-		phalcon_call_method_noret(this_ptr, Z_TYPE_P(event_name) == IS_STRING ? Z_STRVAL_P(event_name) : "");
+		phalcon_call_method_zval_noret(this_ptr, event_name);
 	}

 	PHALCON_OBS_VAR(models_manager);
@@ -44234,7 +44366,7 @@
 	if (phalcon_method_exists(this_ptr, event_name TSRMLS_CC) == SUCCESS) {

 		PHALCON_INIT_VAR(status);
-		phalcon_call_method(status, this_ptr, Z_TYPE_P(event_name) == IS_STRING ? Z_STRVAL_P(event_name) : "");
+		phalcon_call_method_zval(status, this_ptr, event_name);
 		if (PHALCON_IS_FALSE(status)) {
 			RETURN_MM_FALSE;
 		}
@@ -47836,7 +47968,7 @@
 	phalcon_call_method_key(params, this_ptr, "getparams", 8246354042190577929UL);

 	PHALCON_INIT_VAR(resultset);
-	PHALCON_CALL_STATIC_ZVAL_PARAMS_1(resultset, model, "find", params);
+	phalcon_call_zval_str_static_p1(resultset, model, "find", params);

 	RETURN_CCTOR(resultset);
 }
@@ -68644,7 +68776,7 @@
 	PHALCON_INIT_VAR(class_name);
 	phalcon_get_class(class_name, record, 0 TSRMLS_CC);

-	PHALCON_CALL_STATIC_ZVAL_PARAMS_1(number, class_name, "count", params);
+	phalcon_call_zval_str_static_p1(number, class_name, "count", params);
 	if (!PHALCON_IS_LONG(number, 0)) {

 		PHALCON_INIT_NVAR(option);
@@ -70103,7 +70235,7 @@
 	phalcon_fetch_params(1, 1, 0, &event_name);

 	if (phalcon_method_exists(this_ptr, event_name TSRMLS_CC) == SUCCESS) {
-		phalcon_call_method_noret(this_ptr, Z_TYPE_P(event_name) == IS_STRING ? Z_STRVAL_P(event_name) : "");
+		phalcon_call_method_zval_noret(this_ptr, event_name);
 	}

 	PHALCON_OBS_VAR(models_manager);
@@ -70126,7 +70258,7 @@
 	if (phalcon_method_exists(this_ptr, event_name TSRMLS_CC) == SUCCESS) {

 		PHALCON_INIT_VAR(status);
-		phalcon_call_method(status, this_ptr, Z_TYPE_P(event_name) == IS_STRING ? Z_STRVAL_P(event_name) : "");
+		phalcon_call_method_zval(status, this_ptr, event_name);
 		if (PHALCON_IS_FALSE(status)) {
 			RETURN_MM_FALSE;
 		}
@@ -71769,7 +71901,7 @@
 				PHALCON_INIT_NVAR(possible_setter);
 				PHALCON_CONCAT_SV(possible_setter, "set", attribute);
 				if (phalcon_method_exists(this_ptr, possible_setter TSRMLS_CC) == SUCCESS) {
-					phalcon_call_method_p1_noret(this_ptr, Z_TYPE_P(possible_setter) == IS_STRING ? Z_STRVAL_P(possible_setter) : "", value);
+					phalcon_call_method_zval_p1_noret(this_ptr, possible_setter, value);
 				} else {
 					phalcon_update_property_zval_zval(this_ptr, attribute, value TSRMLS_CC);
 				}
@@ -71963,7 +72095,7 @@
 				PHALCON_INIT_NVAR(possible_setter);
 				PHALCON_CONCAT_SV(possible_setter, "set", attribute_field);
 				if (phalcon_method_exists(this_ptr, possible_setter TSRMLS_CC) == SUCCESS) {
-					phalcon_call_method_p1_noret(this_ptr, Z_TYPE_P(possible_setter) == IS_STRING ? Z_STRVAL_P(possible_setter) : "", value);
+					phalcon_call_method_zval_p1_noret(this_ptr, possible_setter, value);
 				} else {
 					phalcon_update_property_zval_zval(this_ptr, attribute_field, value TSRMLS_CC);
 				}
@@ -72086,7 +72218,7 @@
 				PHALCON_INIT_NVAR(possible_setter);
 				PHALCON_CONCAT_SV(possible_setter, "set", attribute_field);
 				if (phalcon_method_exists(this_ptr, possible_setter TSRMLS_CC) == SUCCESS) {
-					phalcon_call_method_p1_noret(this_ptr, Z_TYPE_P(possible_setter) == IS_STRING ? Z_STRVAL_P(possible_setter) : "", value);
+					phalcon_call_method_zval_p1_noret(this_ptr, possible_setter, value);
 				} else {
 					phalcon_update_property_zval_zval(this_ptr, attribute_field, value TSRMLS_CC);
 				}
@@ -73306,7 +73438,7 @@
 	phalcon_array_update_quick_string(&parameters, SS("bind"), 210707666466UL, &bind_params, PH_COPY | PH_SEPARATE TSRMLS_CC);

 	PHALCON_INIT_VAR(result);
-	PHALCON_CALL_STATIC_ZVAL_PARAMS_1(result, model_name, Z_STRVAL_P(type), parameters);
+	phalcon_call_zval_static_p1(result, model_name, type, parameters);

 	RETURN_CCTOR(result);
 }
@@ -95087,7 +95219,7 @@
 		PHALCON_CONCAT_SV(method, "get", attribute);
 		if (phalcon_method_exists(entity, method TSRMLS_CC) == SUCCESS) {
 			PHALCON_INIT_VAR(value);
-			phalcon_call_method(value, entity, Z_TYPE_P(method) == IS_STRING ? Z_STRVAL_P(method) : "");
+			phalcon_call_method_zval(value, entity, method);
 		} else {
 			if (phalcon_method_quick_exists_ex(entity, SS("readattribute"), 15677543873686566549UL TSRMLS_CC) == SUCCESS) {
 				PHALCON_INIT_NVAR(value);


fix what should be unintialized variable warnings

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

--- mount_slash/ctl_cli.c
+++ mount_slash/ctl_cli.c
@@ -76,7 +76,6 @@
 	struct fidc_membh *fcmh;
 	struct slash_fidgen fg;
 	struct slash_creds cr;
-	struct srt_stat sstb;
 	uint32_t n;
 	int rc;

@@ -102,10 +101,11 @@
 		    mrq->mrq_fid, slstrerror(rc)));

 	FCMH_LOCK(fcmh);
-	if (!S_ISREG(sstb.sst_mode) && !S_ISDIR(sstb.sst_mode))
+	if (!S_ISREG(fcmh->fcmh_sstb.sst_mode) &&
+	    !S_ISDIR(fcmh->fcmh_sstb.sst_mode))
 		rc = ENOTSUP;
 	else
-		rc = checkcreds(&sstb, &cr, W_OK);
+		rc = checkcreds(&fcmh->fcmh_sstb, &cr, W_OK);
 	fg = fcmh->fcmh_fg;
 	fcmh_op_done_type(fcmh, FCMH_OPCNT_LOOKUP_FIDC);

@@ -168,7 +168,6 @@
 	struct fidc_membh *fcmh;
 	struct slash_fidgen fg;
 	struct slash_creds cr;
-	struct srt_stat sstb;
 	int added = 0, rc;

 	if (mrq->mrq_fid == FID_ANY) {
@@ -194,10 +193,11 @@
 		    mrq->mrq_fid, slstrerror(rc)));

 	FCMH_LOCK(fcmh);
-	if (!S_ISREG(sstb.sst_mode) && !S_ISDIR(sstb.sst_mode))
+	if (!S_ISREG(fcmh->fcmh_sstb.sst_mode) &&
+	    !S_ISDIR(fcmh->fcmh_sstb.sst_mode))
 		rc = ENOTSUP;
 	else
-		rc = checkcreds(&sstb, &cr, W_OK);
+		rc = checkcreds(&fcmh->fcmh_sstb, &cr, W_OK);
 	fg = fcmh->fcmh_fg;
 	fcmh_op_done_type(fcmh, FCMH_OPCNT_LOOKUP_FIDC);

@@ -284,7 +284,6 @@
 	struct fidc_membh *fcmh;
 	struct slash_fidgen fg;
 	struct slash_creds cr;
-	struct srt_stat sstb;
 	int rc;

 	rc = msctl_getcreds(fd, &cr);
@@ -304,10 +303,11 @@
 		    mfnrp->mfnrp_fid, slstrerror(rc)));

 	FCMH_LOCK(fcmh);
-	if (!S_ISREG(sstb.sst_mode) && !S_ISDIR(sstb.sst_mode))
+	if (!S_ISREG(fcmh->fcmh_sstb.sst_mode) &&
+	    !S_ISDIR(fcmh->fcmh_sstb.sst_mode))
 		rc = ENOTSUP;
 	else
-		rc = checkcreds(&sstb, &cr, W_OK);
+		rc = checkcreds(&fcmh->fcmh_sstb, &cr, W_OK);
 	fg = fcmh->fcmh_fg;
 	fcmh_op_done_type(fcmh, FCMH_OPCNT_LOOKUP_FIDC);

@@ -356,7 +356,6 @@
 	struct fidc_membh *fcmh;
 	struct slash_fidgen fg;
 	struct slash_creds cr;
-	struct srt_stat sstb;
 	int rc;

 	rc = msctl_getcreds(fd, &cr);
@@ -376,10 +375,10 @@
 		    mfbrp->mfbrp_fid, slstrerror(rc)));

 	FCMH_LOCK(fcmh);
-	if (!S_ISREG(sstb.sst_mode))
+	if (!S_ISREG(fcmh->fcmh_sstb.sst_mode))
 		rc = ENOTSUP;
 	else
-		rc = checkcreds(&sstb, &cr, W_OK);
+		rc = checkcreds(&fcmh->fcmh_sstb, &cr, W_OK);
 	fg = fcmh->fcmh_fg;
 	fcmh_op_done_type(fcmh, FCMH_OPCNT_LOOKUP_FIDC);


client/windows: fix several assigned but not used errors

--- common/gdi_canvas.c
+++ common/gdi_canvas.c
@@ -461,9 +461,6 @@
     uint8_t i_offset;
     int i_count = 0;
     int i = 0;
-    int width_div_stride;
-
-    width_div_stride = width / src_stride;

     if (alpha_bits_size == 1) {
         i_offset = 1;
@@ -1602,7 +1599,6 @@

 static uint32_t *gdi_get_userstyle(GdiCanvas *canvas, uint8_t nseg, SPICE_FIXED28_4* style, int start_is_gap)
 {
-    double offset = 0;
     uint32_t *local_style;
     int i;

@@ -1612,7 +1608,6 @@
     local_style = spice_new(uint32_t , nseg);

     if (start_is_gap) {
-        offset = (uint32_t)fix_to_double(*style);
         local_style[nseg - 1] = (uint32_t)fix_to_double(*style);
         style++;

@@ -1815,24 +1810,23 @@
                             )
 {
     GdiCanvas *canvas;
-    int init_ok;

     if (need_init) {
         return NULL;
     }
     canvas = spice_new0(GdiCanvas, 1);
-    init_ok = canvas_base_init(&canvas->base, &gdi_canvas_ops,
-                               width, height, format
+    canvas_base_init(&canvas->base, &gdi_canvas_ops,
+                     width, height, format,
 #ifdef SW_CANVAS_CACHE
-                               ,bits_cache
-                               ,palette_cache
+                     bits_cache,
+                     palette_cache,
 #elif defined(SW_CANVAS_IMAGE_CACHE)
-                               , bits_cache
+                     bits_cache,
 #endif
-                               , surfaces
-                               , glz_decoder
-                               , jpeg_decoder
-                               , zlib_decoder);
+                     surfaces,
+                     glz_decoder,
+                     jpeg_decoder,
+                     zlib_decoder);
     canvas->dc = dc;
     canvas->lock = lock;
     return (SpiceCanvas *)canvas;


Fixed small bug in rcv

Fixed small bug in rcv

--- udpc_send_file.c
+++ udpc_send_file.c
@@ -67,7 +67,7 @@
     size_t cnt = mis.cnt;
     fseeko(file, offset, SEEK_SET);
     for(size_t _i = 0; _i < cnt; _i++){
-      int i = mis.start + i;
+      int i = mis.start + _i;
       memcpy(buffer, &i, sizeof(i));
       size_t read = fread(buffer + sizeof(i), 1, buffer_size - sizeof(i), file);
       //logd("sending chunk: %i %i\n", read, i);
@@ -146,9 +146,10 @@
 	fwrite(buffer, 1, r, file);
 	if(seq != current + 1){
 	  logd("This happens.. %i %i\n", seq, current);
-	  //missing_seq seq2 = {current + 1, seq - current - 1};
-	  //udpc_pack(&seq2, sizeof(seq2), (void **) &missing, &missing_cnt);
+	  missing_seq seq2 = {current + 1, seq - current - 1};
+	  udpc_pack(&seq2, sizeof(seq2), (void **) &missing, &missing_cnt);
 	}
+	current = seq;
       }
     }
     if(missing2 != NULL)


* buckets/response_buckets.c   (parse_status_line): Following up on r2463, fix comment syntax.

--- buckets/response_buckets.c
+++ buckets/response_buckets.c
@@ -141,7 +141,6 @@
     /* ctx->linebuf.line should be of form: 'HTTP/1.1 200 OK',
        but we also explicitly allow the forms 'HTTP/1.1 200' (no reason)
        and 'HTTP/1.1 401.1 Logon failed' (iis extended error codes) */
-     */
     res = apr_date_checkmask(ctx->linebuf.line, "HTTP/#.# ###*");
     if (!res) {
         /* Not an HTTP response?  Well, at least we won't understand it. */


noise: disable CSMA and add some config options

--- noise/main.c
+++ noise/main.c
@@ -6,8 +6,10 @@
 #include "net/gnrc/pktbuf.h"
 #include "net/gnrc/netif/hdr.h"

-#define SILENT_INTERVAL     (500000)
-
+#define SILENT_INTERVAL     (50000)
+#define NOISE_NETIF         (3)
+#define NOISE_CHAN          (26)
+#define NOISE_PAN           (44)
 #define PAYLOAD     "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"

 static void _send(void)
@@ -19,6 +21,17 @@
     kernel_pid_t ifs[GNRC_NETIF_NUMOF];
     size_t numof = gnrc_netif_get(ifs);

+    unsigned res = NOISE_CHAN;
+    if (gnrc_netapi_set(NOISE_NETIF, NETOPT_CHANNEL, 0, (uint16_t *)&res, sizeof(uint16_t)) < 0) {
+        puts("main: error setting channel");
+    }
+    res = NOISE_PAN;
+    if (gnrc_netapi_set(NOISE_NETIF, NETOPT_NID, 0, (uint16_t *)&res, sizeof(uint16_t)) < 0) {
+        puts("main: error setting pan");
+    }
+    if (gnrc_netapi_set(NOISE_NETIF, NETOPT_CSMA, 0, NETOPT_DISABLE, sizeof(netopt_enable_t)) < 0) {
+        puts("failed to disable CSMA");
+    }
     for (size_t i = 0; i < numof && i < GNRC_NETIF_NUMOF; i++) {

         flags |= GNRC_NETIF_HDR_FLAGS_BROADCAST;
@@ -43,7 +56,6 @@
     while (1) {
         xtimer_usleep(SILENT_INTERVAL);
         _send();
-        puts(".");
     }
     return 0;
 }


Removed debug output.

Removed debug output.

git-svn-id: 64ebf368729f38804935acb7146e017e0f909c6b@57 6335cc39-0255-0410-8fd6-9bcaacd3b74c

--- projects/lookuplet/src/c/querybox.c
+++ projects/lookuplet/src/c/querybox.c
@@ -1,5 +1,5 @@
 /**
- * $Id: querybox.c,v 1.2 2001/02/24 02:35:20 mdb Exp $
+ * $Id: querybox.c,v 1.3 2001/02/24 02:48:22 mdb Exp $
  */

 #include <config.h>
@@ -42,8 +42,6 @@
     /* otherwise convert the key combo to a name and look it up */
     keystr = convert_keysym_state_to_string(ek->keyval, ek->state);
     bindings = lk_prefs_get_bindings();
-
-    g_print("key pressed: %s (%d %d)\n", keystr, ek->state, ek->keyval);

     for (i = 0; i < bindings->len; i++) {
 	LkBinding* binding = LK_BINDING(g_ptr_array_index(bindings, i));


rework on linear inequality dominance and inclusion

error: pathspec 'ortools/sat/inclusion.h' did not match any file(s) known to git

--- ortools/sat/inclusion.h
+++ ortools/sat/inclusion.h
@@ -0,0 +1,363 @@
+// Copyright 2010-2021 Google LLC
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//     http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+
+#ifndef OR_TOOLS_SAT_INCLUSION_H_
+#define OR_TOOLS_SAT_INCLUSION_H_
+
+#include <algorithm>
+#include <functional>
+#include <vector>
+
+#include "ortools/base/logging.h"
+
+namespace operations_research {
+namespace sat {
+
+// Small utility class to store a vector<vector<>> where one can only append new
+// vector and never change previously added ones.
+//
+// Note that we implement a really small subset of the vector<vector<>> API.
+template <typename T>
+class CompactVectorVector {
+ public:
+  // Same as push_back().
+  // Returns the previous size() as this is convenient for how we use it.
+  int Add(absl::Span<const T> data) {
+    const int index = size();
+    starts_.push_back(buffer_.size());
+    sizes_.push_back(data.size());
+    buffer_.insert(buffer_.end(), data.begin(), data.end());
+    return index;
+  }
+
+  // Warning: this is only valid until the next clear() or Add() call.
+  absl::Span<const T> operator[](int index) const {
+    DCHECK_GE(index, 0);
+    DCHECK_LT(index, starts_.size());
+    DCHECK_LT(index, sizes_.size());
+    const size_t size = static_cast<size_t>(sizes_[index]);
+    if (size == 0) return {};
+    return {&buffer_[starts_[index]], size};
+  }
+
+  void clear() {
+    starts_.clear();
+    sizes_.clear();
+    buffer_.clear();
+  }
+
+  size_t size() const { return starts_.size(); }
+
+ private:
+  std::vector<int> starts_;
+  std::vector<int> sizes_;
+  std::vector<T> buffer_;
+};
+
+// An helper class to process many sets of integer in [0, n] and detects all the
+// set included in each others. This is a common operations in presolve, and
+// while it can be slow the algorithm used here is pretty efficient in practice.
+//
+// The algorithm is based on the SAT preprocessing algorithm to detect clauses
+// that subsumes others. It uses a one-watcher scheme where each subset
+// candidate has only one element watched. To identify all potential subset of a
+// superset, one need to inspect the watch list for all element of the superset
+// candidate.
+//
+// The number n will be detected automatically but we allocate various vector
+// of size n, so avoid having large integer values in your sets.
+//
+// All set contents will be accessed via storage_[index]. And of course Storage
+// can be the CompactVectorVector defined above. But it can also be something
+// that return a class that support .size() and integer range iteration over the
+// element in the set on the fly.
+template <class Storage>
+class InclusionDetector {
+ public:
+  explicit InclusionDetector(const Storage& storage) : storage_(storage) {}
+
+  // Resets the class to an empty state.
+  void Reset() {
+    num_potential_subsets_ = 0;
+    num_potential_supersets_ = 0;
+    candidates_.clear();
+  }
+
+  // Adds a candidate set to consider for the next DetectInclusions() call.
+  // The argument is an index that will only be used via storage_[index] to get
+  // the content of the candidate set.
+  //
+  // Note that set with no element are just ignored and will never be returned
+  // as part of an inclusion.
+  void AddPotentialSubset(int index);
+  void AddPotentialSuperset(int index);
+  void AddPotentialSet(int index);
+
+  // By default we will detect all inclusions. It is possible to make sure we
+  // don't do more than O(work_limit) operations and eventually abort early by
+  // setting this. Note that we don't reset it on Reset().
+  //
+  // This is needed, because for m candidates of size n, we can have O(m ^ 2)
+  // inclusions, each requiring O(n) work to check.
+  void SetWorkLimit(uint64_t work_limit) { work_limit_ = work_limit; }
+
+  // Finds all subset included in a superset and call "process" on each of the
+  // detected inclusion. The std::function argument corresponds to indices
+  // passed to the Add*() calls.
+  //
+  // The order of detection will be by increasing superset size. For superset
+  // with the same size, the order will be deterministic but not specified. And
+  // similarly, for a given superset, the order of the included subsets is
+  // deterministic but not specified.
+  //
+  // Note that only the candidate marked as such can be a subset/superset.
+  // For the candidate than can be both and are duplicates (i.e. same set), only
+  // one pair will be returned. We will also never return identity inclusion and
+  // we always have subset != superset.
+  void DetectInclusions(
+      const std::function<void(int subset, int superset)>& process);
+
+  // Function that should only be used from within "process()".
+  // Returns the bitset corresponsing to the elements of the current superset
+  // passed to the process() function.
+  const std::vector<bool> IsInSuperset() const { return is_in_superset_; }
+
+  // Function that should only be used from within "process()".
+  // Stop will abort the current search. The other two will cause the
+  // corresponding candidate set to never appear in any future inclusion.
+  void StopProcessingCurrentSubset() { stop_with_current_subset_ = true; }
+  void StopProcessingCurrentSuperset() { stop_with_current_superset_ = true; }
+  void Stop() {
+    stop_ = true;
+    signatures_.clear();
+    one_watcher_.clear();
+    is_in_superset_.clear();
+  }
+
+  // The algorithm here can detect many small set included in a big set while
+  // only scanning the superset once. So if we do scan the superset in the
+  // process function, we can do a lot more work. This is here to reuse the
+  // deterministic limit mechanism.
+  void IncreaseWorkDone(uint64_t increase) { work_done_ += increase; }
+
+  // Stats.
+  int num_potential_subsets() const { return num_potential_subsets_; }
+  int num_potential_supersets() const { return num_potential_supersets_; }
+  uint64_t work_done() const { return work_done_; }
+
+ private:
+  // Allows to access the elements of each candidates via storage_[index];
+  const Storage& storage_;
+
+  // List of candidates, this will be sorted.
+  struct Candidate {
+    int index;  // Storage index.
+    int size;
+
+    // For identical sizes, we need this order for correctness
+    // 0: subset only, 1: both, 2: superset only.
+    int order = 1;
+
+    bool CanBeSubset() const { return order <= 1; }
+    bool CanBeSuperset() const { return order >= 1; }
+
+    // We use this with stable_sort, so no need to add the index.
+    bool operator<(const Candidate& other) const {
+      return std::tie(size, order) < std::tie(other.size, other.order);
+    }
+  };
+  std::vector<Candidate> candidates_;
+
+  int num_potential_subsets_ = 0;
+  int num_potential_supersets_ = 0;
+  uint64_t work_done_ = 0;
+  uint64_t work_limit_ = std::numeric_limits<uint64_t>::max();
+
+  // Temporary data only used by DetectInclusions().
+  bool stop_;
+  bool stop_with_current_subset_;
+  bool stop_with_current_superset_;
+  std::vector<uint64_t> signatures_;
+  std::vector<std::vector<int>> one_watcher_;  // Index in candidates_.
+  std::vector<bool> is_in_superset_;
+};
+
+// Deduction guide.
+template <typename Storage>
+InclusionDetector(const Storage& storage) -> InclusionDetector<Storage>;
+
+template <typename Storage>
+inline void InclusionDetector<Storage>::AddPotentialSet(int index) {
+  DCHECK_GE(index, 0);
+  DCHECK_LT(index, storage_.size());
+  const int num_elements = storage_[index].size();
+  if (num_elements == 0) return;
+
+  ++num_potential_subsets_;
+  ++num_potential_supersets_;
+  candidates_.push_back({index, num_elements, /*order=*/1});
+}
+
+template <typename Storage>
+inline void InclusionDetector<Storage>::AddPotentialSubset(int index) {
+  DCHECK_GE(index, 0);
+  DCHECK_LT(index, storage_.size());
+  const int num_elements = storage_[index].size();
+  if (num_elements == 0) return;
+
+  ++num_potential_subsets_;
+  candidates_.push_back({index, num_elements, /*order=*/0});
+}
+
+template <typename Storage>
+inline void InclusionDetector<Storage>::AddPotentialSuperset(int index) {
+  DCHECK_GE(index, 0);
+  DCHECK_LT(index, storage_.size());
+  const int num_elements = storage_[index].size();
+  if (num_elements == 0) return;
+
+  DCHECK_GE(index, 0);
+  DCHECK_LT(index, storage_.size());
+  ++num_potential_supersets_;
+  candidates_.push_back({index, num_elements, /*order=*/2});
+}
+
+template <typename Storage>
+inline void InclusionDetector<Storage>::DetectInclusions(
+    const std::function<void(int subset, int superset)>& process) {
+  // No need to do any work in these cases.
+  if (candidates_.size() <= 1) return;
+  if (num_potential_subsets_ == 0) return;
+  if (num_potential_supersets_ == 0) return;
+
+  // Temp data must be ready to use.
+  stop_ = false;
+  DCHECK(is_in_superset_.empty());
+  DCHECK(signatures_.empty());
+  DCHECK(one_watcher_.empty());
+
+  // Main algo.
+  work_done_ = 0;
+  std::stable_sort(candidates_.begin(), candidates_.end());
+  for (const Candidate& candidate : candidates_) {
+    const auto& candidate_elements = storage_[candidate.index];
+    const int candidate_index = signatures_.size();
+
+    // Compute the signature and also resize vector if needed. We want a
+    // signature that is order invariant and is compatible with inclusion.
+    uint64_t signature = 0;
+    int max_element = 0;
+    for (const int e : candidate_elements) {
+      DCHECK_GE(e, 0);
+      max_element = std::max(max_element, e);
+      signature |= (int64_t{1} << (e & 63));
+    }
+    DCHECK_EQ(is_in_superset_.size(), one_watcher_.size());
+    if (max_element >= is_in_superset_.size()) {
+      is_in_superset_.resize(max_element + 1, false);
+      one_watcher_.resize(max_element + 1);
+    }
+    signatures_.push_back(signature);
+
+    stop_with_current_superset_ = false;
+    if (candidate.CanBeSuperset()) {
+      const Candidate& superset = candidate;
+      const auto& superset_elements = candidate_elements;
+
+      // Bitset should be cleared.
+      DCHECK(std::all_of(is_in_superset_.begin(), is_in_superset_.end(),
+                         [](bool b) { return !b; }));
+
+      // Find any subset included in current superset.
+      work_done_ += 2 * superset.size;
+      if (work_done_ > work_limit_) return Stop();
+      for (const int e : superset_elements) {
+        is_in_superset_[e] = true;
+      }
+
+      const uint64_t superset_signature = signatures_.back();
+      for (const int superset_e : superset_elements) {
+        for (int i = 0; i < one_watcher_[superset_e].size(); ++i) {
+          const int c_index = one_watcher_[superset_e][i];
+          const Candidate& subset = candidates_[c_index];
+          DCHECK_LE(subset.size, superset.size);
+
+          // Quick check with signature.
+          if ((signatures_[c_index] & ~superset_signature) != 0) continue;
+
+          // Long check with bitset.
+          bool is_included = true;
+          work_done_ += subset.size;
+          if (work_done_ > work_limit_) return Stop();
+          for (const int subset_e : storage_[subset.index]) {
+            if (!is_in_superset_[subset_e]) {
+              is_included = false;
+              break;
+            }
+          }
+          if (!is_included) continue;
+
+          stop_with_current_subset_ = false;
+          process(subset.index, superset.index);
+
+          if (stop_) return;
+          if (work_done_ > work_limit_) return Stop();
+
+          if (stop_with_current_subset_) {
+            // Remove from the watcher list.
+            std::swap(one_watcher_[superset_e][i],
+                      one_watcher_[superset_e].back());
+            one_watcher_[superset_e].pop_back();
+            --i;
+          }
+          if (stop_with_current_superset_) break;
+        }
+        if (stop_with_current_superset_) break;
+      }
+
+      // Cleanup.
+      for (const int e : superset_elements) {
+        is_in_superset_[e] = false;
+      }
+    }
+
+    // Add new subset candidate to the watchers.
+    //
+    // Tricky: If this was also a superset and has been removed, we don't want
+    // to watch it!
+    if (candidate.CanBeSubset() && !stop_with_current_superset_) {
+      // Choose to watch the one with smallest list.
+      int best_choice = -1;
+      work_done_ += candidate.size;
+      if (work_done_ > work_limit_) return Stop();
+      for (const int e : candidate_elements) {
+        DCHECK_GE(e, 0);
+        DCHECK_LT(e, one_watcher_.size());
+        if (best_choice == -1 ||
+            one_watcher_[e].size() < one_watcher_[best_choice].size()) {
+          best_choice = e;
+        }
+      }
+      DCHECK_NE(best_choice, -1);
+      one_watcher_[best_choice].push_back(candidate_index);
+    }
+  }
+
+  // Stop also performs some cleanup.
+  Stop();
+}
+
+}  // namespace sat
+}  // namespace operations_research
+
+#endif  // OR_TOOLS_SAT_INCLUSION_H_


added PostConstruction

added PostConstruction

--- TerrainApps/Enviro/wx/EnviroFrame.h
+++ TerrainApps/Enviro/wx/EnviroFrame.h
@@ -59,6 +59,7 @@
 	virtual void Setup3DScene();
 	virtual bool IsAcceptable(vtTerrain *pTerr) { return true; }
 	virtual void FrameArgument(int i, const char *str) { }
+	virtual void PostConstruction() { }
 	void UpdateLODInfo();

 	// command handlers


tidy

tidy

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

--- mount_slash/pgcache.c
+++ mount_slash/pgcache.c
@@ -427,16 +427,14 @@
 	LIST_CACHE_LOCK(&bmpcLru);

 	lc_sort(&bmpcLru, qsort, bmpc_lru_cmp);
-	/* Should be sorted from oldest bmpc to newest.
-	 */
+	/* Should be sorted from oldest bmpc to newest. */
 	LIST_CACHE_FOREACH(bmpc, &bmpcLru) {
 		psclog_dbg("bmpc=%p npages=%d age(%ld:%ld) waiters=%d",
 		    bmpc, pll_nitems(&bmpc->bmpc_lru),
 		    bmpc->bmpc_oldest.tv_sec, bmpc->bmpc_oldest.tv_nsec,
 		    waiters);

-		/* First check for LRU items.
-		 */
+		/* First check for LRU items. */
 		if (!pll_nitems(&bmpc->bmpc_lru)) {
 			psclog_debug("skip bmpc=%p, nothing on lru", bmpc);
 			continue;


lwip: fix compilation warning on recvmsg

This commit is patch to fix compilation warning on recvmsg.
 - to prevent build compliation error, fix it

Signed-off-by: Jin-Seong Kim <c7ef485e0ddc445bcfb224daa3f265bce32dcc94@samsung.com>

--- os/net/socket/recvmsg.c
+++ os/net/socket/recvmsg.c
@@ -93,10 +93,10 @@
 	uint8_t *buf = (uint8_t *)(msg->msg_iov->iov_base);
 	size_t len = msg->msg_iov->iov_len;
 	struct sockaddr *from = (struct sockaddr *)msg->msg_name;
-	int *addrlen = &(msg->msg_namelen);
+	socklen_t *addrlen = &(msg->msg_namelen);

 	//printf("\n[Received IOTIVITY Packet][%s:%d] \n", __FUNCTION__, __LINE__);

-	return recvfrom(sockfd, buf, len, flags, from, (socklen_t *) addrlen);
+	return recvfrom(sockfd, buf, len, flags, from, addrlen);
 }
 #endif							/* CONFIG_NET */


remove debub bit

remove debub bit

--- mount_slash/pgcache.c
+++ mount_slash/pgcache.c
@@ -342,11 +342,8 @@
 		psc_pool_return(bmpce_pool, e2);
 	}

-	if (!rc) {
-		psclog_max("Get page %p (ref = %d) at %d\n",
-		    e, e->bmpce_ref, __LINE__);
+	if (!rc)
 		psc_dynarray_add(&r->biorq_pages, e);
-	}

 	DEBUG_BIORQ(PLL_DIAG, r, "registering bmpce@%p "
 	    "n=%d foff=%"PRIx64" rc = %d",
@@ -392,8 +389,6 @@
 	psc_assert(e->bmpce_ref > 0);
 	e->bmpce_ref--;
 	DEBUG_BMPCE(PLL_DIAG, e, "drop reference");
-	psclog_max("Drop page ref %p (ref = %d) at %d\n",
-	    e,  e->bmpce_ref, __LINE__);
 	if (e->bmpce_ref > 0) {
 		BMPCE_ULOCK(e);
 		return;
@@ -437,7 +432,6 @@
 		return;
 	}

-	psclog_max("Mark page free %p at %d\n", e, __LINE__);
 	e->bmpce_flags |= BMPCEF_TOFREE;
 	BMPCE_ULOCK(e);

@@ -577,7 +571,6 @@
 			continue;
 		}

-		psclog_max("Mark page free %p at %d\n", e, __LINE__);
 		e->bmpce_flags |= BMPCEF_TOFREE;
 		psc_assert(e->bmpce_flags & BMPCEF_LRU);


65534 --> -1

65534 --> -1

--- mount_slash/usermap.c
+++ mount_slash/usermap.c
@@ -47,7 +47,7 @@
 		cr->pcr_uid = um->um_val;
 	else {
 		/* uid squashing */
-		cr->pcr_uid = 65534;
+		cr->pcr_uid = -1;
 	}
 }

@@ -66,7 +66,7 @@
 	if (gm)
 		gid = gm->gm_val;
 	else
-		gid = 65534;
+		gid = -1;
 	j = 0;
 	for (i = 0; i < cr->pcr_ngid; i++) {
 		if (cr->pcr_gid == cr->pcr_gidv[i]) {


Automated commit to force versioning.

Automated commit to force versioning.

--- common/vtkVersion.h
+++ common/vtkVersion.h
@@ -59,7 +59,7 @@
 #define VTK_MINOR_VERSION 1
 #define VTK_BUILD_VERSION 2
 #define VTK_VERSION "3.1.2"
-#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.540 $, $Date: 2000-06-12 20:08:42 $ (GMT)"
+#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.541 $, $Date: 2000-06-13 20:08:28 $ (GMT)"

 class VTK_EXPORT vtkVersion : public vtkObject {


Automated commit to force versioning.

Automated commit to force versioning.

--- common/vtkVersion.h
+++ common/vtkVersion.h
@@ -58,7 +58,7 @@
 #define VTK_MAJOR_VERSION 2
 #define VTK_MINOR_VERSION 2
 #define VTK_BUILD_VERSION 2
-#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.41 $, $Date: 1998-12-24 03:04:38 $ (GMT)"
+#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.42 $, $Date: 1998-12-25 03:04:02 $ (GMT)"

 class VTK_EXPORT vtkVersion : public vtkObject {


Automated commit to force versioning.

Automated commit to force versioning.

--- common/vtkVersion.h
+++ common/vtkVersion.h
@@ -59,7 +59,7 @@
 #define VTK_MINOR_VERSION 2
 #define VTK_BUILD_VERSION 0
 #define VTK_VERSION "3.2.0"
-#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.780 $, $Date: 2001-02-15 01:04:47 $ (GMT)"
+#define VTK_SOURCE_VERSION "vtk version " VTK_VERSION ", vtk source $Revision: 1.781 $, $Date: 2001-02-16 01:04:04 $ (GMT)"

 class VTK_EXPORT vtkVersion : public vtkObject {


changed inputs for to_natural_frames

changed inputs for to_natural_frames

--- nv-control.h
+++ nv-control.h
@@ -37,9 +37,10 @@
 // if a target is specified, rotate all nulcei into the frame of that target;
 //  otherwise, rotate each nucleus into its own frame
 MatrixXcd to_natural_frames(const nv_system& nv, const vector<uint> cluster,
-                            const uint target = 0);
-inline MatrixXcd to_natural_frames(const nv_system& nv, const uint cluster,
-                                   const uint target = 0) {
+                            const uint target = -1);
+inline MatrixXcd to_natural_frames(const nv_system& nv, const uint spin_in_cluster,
+                                   const uint target = -1) {
+  const uint cluster = get_cluster_containing_target(nv,spin_in_cluster);
   return to_natural_frames(nv, nv.clusters.at(cluster), target);
 }


omx: Only handle for BufferDone message incase valid buffer

BufferDone message will be sent by EmptyBufferDone and FillBufferDone.
There will be case buffer is freed before message is handled
and lead to issue "Caunght SIGSEGV" due to handle for NULL pointer
So only handle for this message in case valid buffer.

refs #109937
Signed-off-by: Thao Luong <ef4308e16b91b9bcf00aabc74dbe961cf8111f94@rvc.renesas.com>

--- omx/gstomx.c
+++ omx/gstomx.c
@@ -3,7 +3,7 @@
  *   Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>, Collabora Ltd.
  * Copyright (C) 2013, Collabora Ltd.
  *   Author: Sebastian Dröge <sebastian.droege@collabora.co.uk>
- * Copyright (C) 2015, Renesas Electronics Corporation
+ * Copyright (C) 2015, 2017 Renesas Electronics Corporation
  *
  * This library is free software; you can redistribute it and/or
  * modify it under the terms of the GNU Lesser General Public
@@ -354,7 +354,11 @@
         GstOMXBuffer *buf = msg->content.buffer_done.buffer->pAppPrivate;
         GstOMXPort *port;

-        port = buf->port;
+        if (buf)
+          port = buf->port;
+        else
+          /* Buffer already freed */
+          break;

         if (msg->content.buffer_done.empty) {
           /* Input buffer is empty again and can be used to contain new input */


bug fix

bug fix

--- util/cpp/chtab.c
+++ util/cpp/chtab.c
@@ -58,9 +58,9 @@
 		exit(1);
 	}
 	if (signedch) {
-		fputs("#define CharOffset	128\n");
-	}
-	else	fputs("#define CharOffset	0\n");
+		fputs("#define CharOffset	128\n", fp);
+	}
+	else	fputs("#define CharOffset	0\n", fp);
 	fclose(fp);
 }


Memory allocation/deallocation for extends changed.

--- util/ego/bo/bo.c
+++ util/ego/bo/bo.c
@@ -22,6 +22,9 @@
 #include "../../../h/em_spec.h"

 #define LP_BLOCKS	lp_extend->lpx_ra.lpx_blocks
+
+#define newbolpx()	(lpext_p)	newstruct(lpext_ra)
+#define oldbolpx(x)	oldstruct(lpext_ra,x)

 STATIC int Sbo;  /* #optimizations found */

@@ -248,15 +251,11 @@

 	register loop_p lp;
 	register Lindex pi;
-	register bblock_p b;

 	for (pi = Lfirst(p->p_loops); pi != (Lindex) 0;
 	   pi = Lnext(pi,p->p_loops)) {
 		lp = (loop_p) Lelem(pi);
-		lp->lp_extend = newralpx();
-	}
-	for (b = p->p_start; b != (bblock_p) 0; b = b->b_next) {
-		b->b_extend = newrabx();
+		lp->lp_extend = newbolpx();
 	}
 }

@@ -289,10 +288,7 @@
 	for (pi = Lfirst(p->p_loops); pi != (Lindex) 0;
 	   pi = Lnext(pi,p->p_loops)) {
 		lp = (loop_p) Lelem(pi);
-		oldralpx(lp->lp_extend);
-	}
-	for (b = p->p_start; b != (bblock_p) 0; b = b->b_next) {
-		oldrabx(b->b_extend);
+		oldbolpx(lp->lp_extend);
 	}
 }


optimizer: fix recalc of catch_op/finally_op

--- mod_optimizer/xc_optimizer.c
+++ mod_optimizer/xc_optimizer.c
@@ -453,6 +453,10 @@
 	/* mark try start */
 	for (i = 0; i < op_array->last_try_catch; i ++) {
 		oplineinfos[op_array->try_catch_array[i].try_op].isbbhead = 1;
+		oplineinfos[op_array->try_catch_array[i].catch_op].isbbhead = 1;
+#ifdef ZEND_ENGINE_2_5
+		oplineinfos[op_array->try_catch_array[i].finally_op].isbbhead = 1;
+#endif
 	}
 	/* }}} */
 	/* {{{ fill op lines with newly allocated id */


AGM-157 Add support for _BV() macro

AGM-157 Add support for _BV() macro

Add support for _BV() macro

--- system/libarc32_arduino101/common/misc/util.h
+++ system/libarc32_arduino101/common/misc/util.h
@@ -95,6 +95,8 @@
 #define KHZ(x) ((x) * 1000)
 #define MHZ(x) (KHZ(x) * 1000)

+#define _BV(bit) (1U << (bit))
+
 #ifdef __cplusplus
 }
 #endif


Using error calling macro from server.h for better error detection.

The macro will return IB_ENOTIMPL when appropriate.

--- engine/rule_engine.c
+++ engine/rule_engine.c
@@ -420,9 +420,7 @@
     assert(tx != NULL);
     assert(tx->ctx != NULL);

-    rc = ib->plugin->err_fn(tx->ctx,
-                            tx->block_status,
-                            ib->plugin->err_data);
+    rc = ib_server_error_response(ib->plugin, tx->ctx, tx->block_status);

     IB_FTRACE_RET_STATUS(rc);
 }


fixing bug when reading invalid "." in non-decimal bignums (issue 32)

--- opt/bignum.c
+++ opt/bignum.c
@@ -225,8 +225,10 @@
   if (c=='.' || c=='e' || c=='E') {
     if (base != 10)
       res = sexp_read_error(ctx, "found non-base 10 float", SEXP_NULL, in);
-    if (c!='.') sexp_push_char(ctx, c, in);
-    res = sexp_read_float_tail(ctx, in, sexp_bignum_to_double(res), (sign==-1));
+    else {
+      if (c!='.') sexp_push_char(ctx, c, in); /* push the e back */
+      res = sexp_read_float_tail(ctx, in, sexp_bignum_to_double(res), (sign==-1));
+    }
   } else if ((c!=EOF) && ! is_separator(c)) {
     res = sexp_read_error(ctx, "invalid numeric syntax",
                           sexp_make_character(c), in);


Fix a crash in requestSync()

Fix a crash in requestSync()

It was possible for a thread to read invalid memory after a conflict
when multiple threads were synchronising.

I haven't been successful in constructing a test case that triggers
this, but we have some internal code that ran into it.

(cherry picked from commit ea3d1efb863ca83b28af9056576d47f1abf98fa9)

--- rts/Schedule.c
+++ rts/Schedule.c
@@ -1412,25 +1412,30 @@

 #if defined(THREADED_RTS)
 static rtsBool requestSync (
-    Capability **pcap, Task *task, PendingSync *sync,
+    Capability **pcap, Task *task, PendingSync *new_sync,
     SyncType *prev_sync_type)
 {
-    PendingSync *prev_sync;
-
-    prev_sync = (PendingSync*)cas((StgVolatilePtr)&pending_sync,
-                                  (StgWord)NULL,
-                                  (StgWord)sync);
-
-    if (prev_sync)
+    PendingSync *sync;
+
+    sync = (PendingSync*)cas((StgVolatilePtr)&pending_sync,
+                             (StgWord)NULL,
+                             (StgWord)new_sync);
+
+    if (sync != NULL)
     {
+        // sync is valid until we have called yieldCapability().
+        // After the sync is completed, we cannot read that struct any
+        // more because it has been freed.
+        *prev_sync_type = sync->type;
         do {
             debugTrace(DEBUG_sched, "someone else is trying to sync (%d)...",
-                       prev_sync->type);
+                       sync->type);
             ASSERT(*pcap);
             yieldCapability(pcap,task,rtsTrue);
-        } while (pending_sync);
+            sync = pending_sync;
+        } while (sync != NULL);
+
         // NOTE: task->cap might have changed now
-        *prev_sync_type = prev_sync->type;
         return rtsTrue;
     }
     else


More refactoring

More refactoring

--- SDL_vnc.c
+++ SDL_vnc.c
@@ -86,7 +86,7 @@

 char *strdup(const char *s);

-int WaitForMessage(tSDL_vnc *vnc, unsigned int usecs)
+static int WaitForMessage(tSDL_vnc *vnc, unsigned int usecs)
 {
 	fd_set fds;
 	struct timeval timeout;
@@ -106,7 +106,7 @@
 	return result;
 }

-int Recv(int s, void *buf, size_t len, int flags)
+static int Recv(int s, void *buf, size_t len, int flags)
 {
 	unsigned char *target=buf;
 	size_t to_read=len;
@@ -123,7 +123,7 @@
 	return len ;
 }

-void GrowUpdateRegion(tSDL_vnc *vnc, SDL_Rect *trec)
+static void GrowUpdateRegion(tSDL_vnc *vnc, SDL_Rect *trec)
 {
 	Sint16 ax1,ay1,ax2,ay2;
 	Sint16 bx1,by1,bx2,by2;
@@ -177,88 +177,70 @@

 static int read_security_type(tSDL_vnc *vnc) {
+    if (vnc->versionMinor < 7) {
+        // Read security type (simple)
+        CHECKED_READ(vnc, vnc->buffer, 4, "security type");
+        vnc->security_type=vnc->buffer[3];
+        DBMESSAGE("Security type (read): %i\n", vnc->security_type);
+        return 1;
+    }
+
     // Addition for RFB 003 008
-    if (vnc->versionMinor >= 7) {
-        // Read security type
-        int result = Recv(vnc->socket,vnc->buffer,1,0);
-        if (result == 1) {
-
-            // Security Type List! Receive number of supported Security Types
-            int nSecTypes = vnc->buffer[0];
-            if (nSecTypes == 0) {
-                DBERROR("Server offered an empty list of security types.\n");
-                return 0;
-            }
-
-            // Receive Security Type List (Buffer overflow possible!)
-            result = Recv(vnc->socket,vnc->buffer,nSecTypes,0);
-
-            // Find supported one...
-            vnc->security_type = 0;
-            int i;
-            for (i = 0; i < result; i++) {
-                vnc->security_type = vnc->buffer[i];
-                // Break if supported type (currently 1 or 2) found
-                if ((vnc->security_type == 1) || (vnc->security_type == 2)) break;
-            }
-
-            // Select it
-            DBMESSAGE("Security type (select): %i\n", vnc->security_type);
-            vnc->buffer[0] = vnc->security_type;
-
-            result = send(vnc->socket,vnc->buffer,1,0);
-            if (result != 1) {
-                DBERROR("Write error on security type selection.\n");
-                return 0;
-            }
-
-        } else {
-            DBERROR("Read error on security type select. Expected 1 Byte for security type length.\n");
-            return 0;
-        }
-    } else {
-        // Read security type (simple)
-        int result = Recv(vnc->socket,vnc->buffer,4,0);
-        if (result==4) {
-            vnc->security_type=vnc->buffer[3];
-            DBMESSAGE("Security type (read): %i\n", vnc->security_type);
-        } else {
-            DBERROR("Read error on security type read.\n");
-            return 0;
-        }
+
+    CHECKED_READ(vnc, vnc->buffer, 1, "security type");
+
+    // Security Type List! Receive number of supported Security Types
+    int nSecTypes = vnc->buffer[0];
+    if (nSecTypes == 0) {
+        DBERROR("Server offered an empty list of security types.\n");
+        return 0;
+    }
+
+    // Receive Security Type List (Buffer overflow possible!)
+    int result = Recv(vnc->socket,vnc->buffer,nSecTypes,0);
+
+    // Find supported one...
+    vnc->security_type = 0;
+    int i;
+    for (i = 0; i < result; i++) {
+        vnc->security_type = vnc->buffer[i];
+        // Break if supported type (currently 1 or 2) found
+        if ((vnc->security_type == 1) || (vnc->security_type == 2)) break;
+    }
+
+    // Select it
+    DBMESSAGE("Security type (select): %i\n", vnc->security_type);
+    vnc->buffer[0] = vnc->security_type;
+
+    result = send(vnc->socket,vnc->buffer,1,0);
+    if (result != 1) {
+        DBERROR("Write error on security type selection.\n");
+        return 0;
     }

     return 1;
 }

+/* FIXME: Is this valid when we never request a non-truecolor display? */
 static int HandleServerMessage_colormap(tSDL_vnc * vnc)
 {
 	tSDL_vnc_serverColormap serverColormap;
     DBMESSAGE("Message: colormap\n");
     // Read data, but ignore it
-    int result = Recv(vnc->socket,&serverColormap,5,0);
-    if (result==5) {
-        serverColormap.first=swap_16(serverColormap.first);
-        serverColormap.number=swap_16(serverColormap.number);
-        //
-        DBMESSAGE("Server colormap first color: %u\n",serverColormap.first);
-        DBMESSAGE("Server colormap number: %u\n",serverColormap.number);
-        //
-        while (serverColormap.number>0) {
-            result = Recv(vnc->socket,vnc->buffer,6,0);
-            if (result==6) {
-                DBMESSAGE("Got color %u.\n",serverColormap.first);
-            } else {
-                DBERROR("Read error on server colormap color. Got %i instead of %i.\n",result,6);
-                return 0;
-            }
-            serverColormap.first++;
-            serverColormap.number--;
-        }
-    } else {
-        DBERROR("Read error on server colormap. Got %i instead of %i.\n",result,5);
-        return 0;
+    CHECKED_READ(vnc, &serverColormap, 5, "server colormap");
+
+    serverColormap.first=swap_16(serverColormap.first);
+    serverColormap.number=swap_16(serverColormap.number);
+
+    DBMESSAGE("Server colormap first color: %u\n",serverColormap.first);
+    DBMESSAGE("Server colormap number: %u\n",serverColormap.number);
+
+    while (serverColormap.number>0) {
+        CHECKED_READ(vnc, &vnc->buffer, 6, "server colormap color");
+        DBMESSAGE("Got color %u.\n",serverColormap.first);
+        serverColormap.first++;
+        serverColormap.number--;
     }
     return 1;
 }
@@ -304,7 +286,6 @@
 {
     DBMESSAGE("RAW encoding.\n");
     int bytes_to_read = serverRectangle.width*serverRectangle.height*4;
-
     CHECKED_READ(vnc, (unsigned char *)vnc->scratchbuffer->pixels, bytes_to_read, "pixel data");
     DBMESSAGE("Blitting %i bytes of raw pixel data.\n",bytes_to_read);
     blit_scratch(vnc,serverRectangle);
@@ -327,7 +308,6 @@
     DBMESSAGE("Copyrect from %u,%u\n",srec.x,srec.y);
     srec.w=serverRectangle.width;
     srec.h=serverRectangle.height;
-
     vnc_to_sdl_rect(&serverRectangle,&trec);

     SDL_LockMutex(vnc->mutex);
@@ -396,29 +376,25 @@
 	tSDL_vnc_serverRRE serverRRE;
 	tSDL_vnc_serverRREdata serverRREdata;
     DBMESSAGE("RRE encoding.\n");
-    int result = Recv(vnc->socket,&serverRRE,8,0);
-    if (result==8) {
-        serverRRE.number=swap_32(serverRRE.number);
-        //
-        DBMESSAGE("RRE of %u rectangles. Background color 0x%06x\n",serverRRE.number,serverRRE.background);
-        SDL_FillRect(vnc->scratchbuffer, NULL, serverRRE.background);
-        /* Draw subrectangles */
-        unsigned int num_subrectangles=0;
-        SDL_Rect srec;
-        while (num_subrectangles<serverRRE.number) {
-            num_subrectangles++;
-            CHECKED_READ(vnc, &serverRREdata, 12, "RRE data");
-            vnc_rect_swap(&serverRREdata.rect);
-            vnc_to_sdl_rect(&serverRREdata.rect,&srec);
-            SDL_FillRect(vnc->scratchbuffer,&srec,serverRREdata.color);
-        }
-        DBMESSAGE("Drawn %i subrectangles.\n", num_subrectangles);
-        blit_scratch(vnc, serverRectangle.rect);
-        DBMESSAGE("Blitted RRE pixels.\n");
-    } else {
-        DBERROR("Error on RRE header. Got %i of %i bytes.\n",result,8);
-        return 0;
-    }
+    CHECKED_READ(vnc, &serverRRE, 8, "RRE header");
+    serverRRE.number=swap_32(serverRRE.number);
+
+    DBMESSAGE("RRE of %u rectangles. Background color 0x%06x\n",serverRRE.number,serverRRE.background);
+    SDL_FillRect(vnc->scratchbuffer, NULL, serverRRE.background);
+    /* Draw subrectangles */
+    unsigned int num_subrectangles=0;
+    SDL_Rect srec;
+    while (num_subrectangles<serverRRE.number) {
+        num_subrectangles++;
+        CHECKED_READ(vnc, &serverRREdata, 12, "RRE data");
+        vnc_rect_swap(&serverRREdata.rect);
+        vnc_to_sdl_rect(&serverRREdata.rect,&srec);
+        serverRREdata.color = serverRREdata.color;
+        SDL_FillRect(vnc->scratchbuffer,&srec,serverRREdata.color);
+    }
+    DBMESSAGE("Drawn %i subrectangles.\n", num_subrectangles);
+    blit_scratch(vnc, serverRectangle.rect);
+    DBMESSAGE("Blitted RRE pixels.\n");
     return 1;
 }

@@ -1025,6 +1001,9 @@
 			pixel_format.redmax=swap_16(255);
 			pixel_format.greenmax=swap_16(255);
 			pixel_format.bluemax=swap_16(255);
+
+            /* FIXME: These depends on endianness; current values below works for
+               little endian */
 			pixel_format.redshift=16; // Was 0, which doesn't match vnc->rmask
 			pixel_format.greenshift=8;
 			pixel_format.blueshift=0; // Was 16, which doesn't match vnc->bmask


making defaults for read merging a little more stringent

--- SeqPrep.c
+++ SeqPrep.c
@@ -11,7 +11,7 @@

 #define DEF_OL2MERGE_ADAPTER (10)
 #define DEF_OL2MERGE_READS (15)
-#define DEF_QCUT (13)
+#define DEF_QCUT (6)
 #define DEF_MIN_MATCH_ADAPTER (0.7)
 #define DEF_MIN_MATCH_READS (0.75)
 #define DEF_MIN_READ_LEN (30)


fix for issue of printing some 0 length sequences

--- SeqPrep.c
+++ SeqPrep.c
@@ -420,14 +420,25 @@
           num_pretty_print++;
           pretty_print_alignment_stdaln(ppaw,sqp,fraln,false,false,true);
         }
-        write_fastq(mfqw,sqp->fid,sqp->merged_seq,sqp->merged_qual);
+        if(strlen(sqp->merged_seq) >= min_read_len && strlen(sqp->merged_qual) >= min_read_len)
+          write_fastq(mfqw,sqp->fid,sqp->merged_seq,sqp->merged_qual);
+        else{
+          num_discarded++;
+        }
       }else if(fraln->score > read_thresh){
         // we know that the adapters are present, trimmed, and the resulting
         // read lengths are both long enough to print.
         // We also know that we aren't doing merging.
         // Now we just need to print.
-        write_fastq(ffqw, sqp->fid, sqp->fseq, sqp->fqual);
-        write_fastq(rfqw, sqp->rid, sqp->rseq, sqp->rqual);
+        if(strlen(sqp->fseq) >= min_read_len &&
+            strlen(sqp->fqual) >= min_read_len &&
+            strlen(sqp->rseq) >= min_read_len &&
+            strlen(sqp->rqual) >= min_read_len){
+          write_fastq(ffqw, sqp->fid, sqp->fseq, sqp->fqual);
+          write_fastq(rfqw, sqp->rid, sqp->rseq, sqp->rqual);
+        }else{
+          num_discarded++;
+        }

       }else{ //there was a bad looking read-read alignment, so lets not risk it and junk it
@@ -441,22 +452,42 @@
       if(do_read_merging){
         if(read_merge(sqp, min_ol_reads, min_match_reads, max_mismatch_reads, qcut)){
           //print merged output
-          num_merged++;
-          write_fastq(mfqw,sqp->fid,sqp->merged_seq,sqp->merged_qual);
-          if(pretty_print && num_pretty_print < max_pretty_print){
-            num_pretty_print++;
-            pretty_print_alignment(ppaw,sqp,qcut,false); //false b/c merged input in fixed order
+          if(strlen(sqp->merged_seq) >= min_read_len &&
+              strlen(sqp->merged_qual) >= min_read_len){
+            num_merged++;
+            write_fastq(mfqw,sqp->fid,sqp->merged_seq,sqp->merged_qual);
+            if(pretty_print && num_pretty_print < max_pretty_print){
+              num_pretty_print++;
+              pretty_print_alignment(ppaw,sqp,qcut,false); //false b/c merged input in fixed order
+            }
+          }else{
+            num_discarded++;
           }
         }else{
           //no significant overlap so just write them
-          write_fastq(ffqw, sqp->fid, sqp->fseq, sqp->fqual);
-          write_fastq(rfqw, sqp->rid, sqp->rseq, sqp->rqual);
+          if(strlen(sqp->fseq) >= min_read_len &&
+              strlen(sqp->fqual) >= min_read_len &&
+              strlen(sqp->rseq) >= min_read_len &&
+              strlen(sqp->rqual) >= min_read_len){
+            write_fastq(ffqw, sqp->fid, sqp->fseq, sqp->fqual);
+            write_fastq(rfqw, sqp->rid, sqp->rseq, sqp->rqual);
+          }else{
+            num_discarded++;
+          }
+
         }
         //done
         goto CLEAN_ADAPTERS;
       }else{ //just write reads to output fastqs
-        write_fastq(ffqw, sqp->fid, sqp->fseq, sqp->fqual);
-        write_fastq(rfqw, sqp->rid, sqp->rseq, sqp->rqual);
+        if(strlen(sqp->fseq) >= min_read_len &&
+            strlen(sqp->fqual) >= min_read_len &&
+            strlen(sqp->rseq) >= min_read_len &&
+            strlen(sqp->rqual) >= min_read_len){
+          write_fastq(ffqw, sqp->fid, sqp->fseq, sqp->fqual);
+          write_fastq(rfqw, sqp->rid, sqp->rseq, sqp->rqual);
+        }else{
+          num_discarded++;
+        }
         goto CLEAN_ADAPTERS;
       }
     }


Fixed RP-SR support problem

Fixed RP-SR support problem

--- vh/vh_setcover.c
+++ vh/vh_setcover.c
@@ -965,11 +965,12 @@
 	{
 		if( read_names[ptrReadMapping->readId].readCovered == 0 && listClusterEl[clusterId].indIdCount[ptrReadMapping->indId] > -1)
 		{
-			supOfIndSeen[ptrReadMapping->indId]++;

 			/* Count the number of split reads supporting this cluster */
 			if( strcmp( multiLibs[read_names[ptrReadMapping->readId].libId].libName, "SplitRead") == 0)
 				listClusterEl[clusterId].sr_support[ptrReadMapping->indId]++;
+
+			supOfIndSeen[ptrReadMapping->indId]++;

 			//////////////////////////////////////THE HUERISTIC//////////////////////////
 			//Instead of taking the total support as number of reads in each cluster, we use summation of


fprintf/perror --> av_log
patch by Gustavo Sverzut Barbieri, barbieri gmail com

git-svn-id: a4d7c1866f8397a4106e0b57fc4fbf792bbdaaaf@6222 9553f0bf-9b14-0410-a0b8-cfaf0461ba5b

--- vhook/drawtext.c
+++ vhook/drawtext.c
@@ -190,14 +190,14 @@
       case 'c':
         if (ParseColor(optarg, ci->fgcolor) == -1)
           {
-            fprintf(stderr, "ERROR: Invalid foreground color: '%s'. You must specify the color in the internet way(packaged hex): #RRGGBB, ie: -c #ffffff (for white foreground)\n",optarg);
+            av_log(NULL, AV_LOG_ERROR, "Invalid foreground color: '%s'. You must specify the color in the internet way(packaged hex): #RRGGBB, ie: -c #ffffff (for white foreground)\n", optarg);
             return -1;
           }
         break;
       case 'C':
         if (ParseColor(optarg, ci->bgcolor) == -1)
           {
-            fprintf(stderr, "ERROR: Invalid foreground color: '%s'. You must specify the color in the internet way(packaged hex): #RRGGBB, ie: -c #ffffff (for white foreground)\n",optarg);
+            av_log(NULL, AV_LOG_ERROR, "Invalid foreground color: '%s'. You must specify the color in the internet way(packaged hex): #RRGGBB, ie: -c #ffffff (for white foreground)\n", optarg);
             return -1;
           }
         break;
@@ -208,14 +208,14 @@
         ci->outline=1;
         break;
       case '?':
-        fprintf(stderr, "ERROR: Unrecognized argument '%s'\n", argv[optind]);
+        av_log(NULL, AV_LOG_ERROR, "Unrecognized argument '%s'\n", argv[optind]);
         return -1;
       }
     }

     if (!ci->text)
       {
-        fprintf(stderr,"ERROR: No text provided (-t text)\n");
+        av_log(NULL, AV_LOG_ERROR, "No text provided (-t text)\n");
         return -1;
       }

@@ -224,7 +224,7 @@
         FILE *fp;
         if ((fp=fopen(ci->file, "r")) == NULL)
           {
-            perror("WARNING: the file could not be opened. Using text provided with -t switch. ");
+            av_log(NULL, AV_LOG_INFO, "WARNING: The file could not be opened. Using text provided with -t switch: %s", strerror(errno));
           }
         else
           {
@@ -234,25 +234,25 @@

     if (!font)
       {
-        fprintf(stderr,"ERROR: No font file provided! (-f filename)\n");
+        av_log(NULL, AV_LOG_ERROR, "No font file provided! (-f filename)\n");
         return -1;
       }

     if ((error = FT_Init_FreeType(&(ci->library))) != 0)
       {
-        fprintf(stderr,"ERROR: Could not load FreeType (error# %d)\n",error);
+        av_log(NULL, AV_LOG_ERROR, "Could not load FreeType (error# %d).\n", error);
         return -1;
       }

     if ((error = FT_New_Face( ci->library, font, 0, &(ci->face) )) != 0)
       {
-        fprintf(stderr,"ERROR: Could not load face: %s  (error# %d)\n",font, error);
+        av_log(NULL, AV_LOG_ERROR, "Could not load face: %s  (error# %d).\n", font, error);
         return -1;
       }

     if ((error = FT_Set_Pixel_Sizes( ci->face, 0, size)) != 0)
       {
-        fprintf(stderr,"ERROR: Could not set font size to %d pixels (error# %d)\n",size, error);
+        av_log(NULL, AV_LOG_ERROR, "Could not set font size to %d pixels (error# %d).\n", size, error);
         return -1;
       }

@@ -400,7 +400,7 @@
       if (fd < 0)
         {
           text = ci->text;
-          perror("WARNING: the file could not be opened. Using text provided with -t switch. ");
+          av_log(NULL, AV_LOG_INFO, "WARNING: The file could not be opened. Using text provided with -t switch: %s", strerror(errno));
         }
       else
         {
@@ -414,7 +414,7 @@
           else
             {
               text = ci->text;
-              perror("WARNING: the file could not be opened. Using text provided with -t switch. ");
+              av_log(NULL, AV_LOG_INFO, "WARNING: The file could not be read. Using text provided with -t switch: %s", strerror(errno));
             }
           close(fd);
         }