r300g: fix texture border for 16-bits-per-channel formats

This is kinda hacky, but it's hard to come up with a generic solution for
all formats when only a few are used in practice (I mostly get B8G8R8*8).

--- src/gallium/drivers/r300/r300_state_derived.c
+++ src/gallium/drivers/r300/r300_state_derived.c
@@ -620,14 +620,19 @@
             }
             break;

-        default:
-            /* I think the fat formats (16, 32) are specified
-             * as the 8-bit ones. I am not sure how compressed formats
-             * work here. */
+        case 8:
             r = ((float_to_ubyte(border_swizzled[0]) & 0xff) << 0) |
                 ((float_to_ubyte(border_swizzled[1]) & 0xff) << 8) |
                 ((float_to_ubyte(border_swizzled[2]) & 0xff) << 16) |
                 ((float_to_ubyte(border_swizzled[3]) & 0xff) << 24);
+            break;
+
+        case 16:
+            r = ((float_to_ubyte(border_swizzled[2]) & 0xff) << 0) |
+                ((float_to_ubyte(border_swizzled[1]) & 0xff) << 8) |
+                ((float_to_ubyte(border_swizzled[0]) & 0xff) << 16) |
+                ((float_to_ubyte(border_swizzled[3]) & 0xff) << 24);
+            break;
     }

     return r;


Sony S730 has same id as S780

Sony S730 has same id as S780

git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@14446 67ed7778-7388-44ab-90cf-0a291f65f57c

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -711,6 +711,7 @@
 	{"Sony:DSC-U10 (PTP mode)",   0x054c, 0x004e, 0},
 	/* "Riccardo (C10uD)" <c10ud.dev@gmail.com> */
 	{"Sony:DSC-S730 (PTP mode)",  0x054c, 0x0296, 0},
+	{"Sony:DSC-S780 (PTP mode)",  0x054c, 0x0296, 0},
 	/* Fernando Santoro <fernando.lopezjr@gmail.com> */
 	{"Sony:DSC-A100 (PTP mode)",  0x054c, 0x02c0, 0},
 	/* Sam Tseng <samtz1223@gmail.com> */


r600g: print to stderr that a CS has been rejected by the kernel

Just fixing the warning that r is unused.

--- src/gallium/winsys/r600/drm/r600_hw_context.c
+++ src/gallium/winsys/r600/drm/r600_hw_context.c
@@ -1537,6 +1537,10 @@
 	chunk_array[1] = (uint64_t)(uintptr_t)&chunks[1];
 	r = drmCommandWriteRead(ctx->radeon->fd, DRM_RADEON_CS, &drmib,
 				sizeof(struct drm_radeon_cs));
+	if (r) {
+		fprintf(stderr, "radeon: The kernel rejected CS, "
+			"see dmesg for more information.\n");
+	}
 #else
 	*ctx->radeon->cfence = ctx->radeon->fence;
 #endif


Initial version of a deprecation mechanism.

This commit introduces the macro BALL_DEPRECATED that can be used to mark
members of classes as deprecated. Usage:

    BALL_DEPRECATED void foo();

This version has only been tested under Linux and only with methods. It should work
on windows and with classes and variables, too. Problems might occur, though, please fix them
as they show up.

--- include/BALL/COMMON/global.h
+++ include/BALL/COMMON/global.h
@@ -47,6 +47,17 @@
 #else
 # define BALL_EXPORT
 # define BALL_VIEW_EXPORT
+#endif
+
+//This declares a BALL_DEPRECATED macro that can be used to mark deprecated api
+//It is essentially copied from Qt 4.4.1 but simplified, thus there might be
+//some cases where it does not work as expected, yet.
+#if defined(BALL_COMPILER_MSVC) && (_MSC_VER >= 1300)
+    #define BALL_DEPRECATED __declspec(deprecated)
+#elif defined(BALL_COMPILER_GXX) && (BALL_COMPILER_VERSION_MAJOR - 0 > 3 || (BALL_COMPILER_VERSION_MAJOR - 0 == 3 && BALL_COMPILER_VERSION_MINOR - 0 >= 2))
+    #define BALL_DEPRECATED __attribute__((deprecated))
+#else
+    #define BALL_DEPRECATED
 #endif

 namespace BALL


Initialize priv->target to null on init

Initialize priv->target to null on init

--- src/graviton/client/introspection-interface.c
+++ src/graviton/client/introspection-interface.c
@@ -97,6 +97,7 @@
 {
   GravitonIntrospectionControlPrivate *priv;
   priv = self->priv = GRAVITON_INTROSPECTION_INTERFACE_GET_PRIVATE (self);
+  priv->target = NULL;
 }

 static void
@@ -109,6 +110,9 @@
 graviton_introspection_interface_finalize (GObject *object)
 {
   G_OBJECT_CLASS (graviton_introspection_interface_parent_class)->finalize (object);
+  GravitonIntrospectionControl *self = GRAVITON_INTROSPECTION_INTERFACE (object);
+  self->priv->target = NULL;
+  self->priv = NULL;
 }

 GravitonIntrospectionControl *
@@ -133,6 +137,7 @@
                                             method,
                                             err,
                                             args);
+  g_debug ("Got: %s", g_variant_print (result, TRUE));
   GList *ret = NULL;
   int i;
   if (result) {


fixed typo C_PTP_RET -> C_PTP_REP

fixed typo C_PTP_RET -> C_PTP_REP

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -7459,7 +7459,7 @@

 					if (xsize > BLOBSIZE)
 						xsize = BLOBSIZE;
-					C_PTP_RET (ptp_canon_eos_getpartialobject (params, oid, offset, xsize, &ximage));
+					C_PTP_REP (ptp_canon_eos_getpartialobject (params, oid, offset, xsize, &ximage));
 					gp_file_append (file, (char*)ximage, xsize);
 					free (ximage);
 					ximage = NULL;


always print exception msg.

always print exception msg.

--- include/LightGBM/utils/log.h
+++ include/LightGBM/utils/log.h
@@ -77,11 +77,11 @@
     vsprintf(str_buf, format, val);
 #endif
     va_end(val);
+    fprintf(stderr, str_buf);
     if (UseException()) {
       throw std::runtime_error(std::string(str_buf));
     } else {
-      fprintf(stderr, str_buf);
-      exit(-1);
+      std::exit(-1);
     }
   }


add some support for reading and writing old cache formats;
(fcc_store_cred): use krb5_store_creds; (fcc_read_cred): use
krb5_ret_creds

git-svn-id: 193148810cf65385f3a195dbc9a8b504846da3a2@5963 ec53bebd-3082-4978-b11e-865c3cabbd6b


Fix module_sensor

Fix module_sensor

--- bcl/src/bc_module_sensor.c
+++ bcl/src/bc_module_sensor.c
@@ -1,5 +1,6 @@
 #include <bc_module_sensor.h>
 #include <bc_tca9534a.h>
+#include <bc_onewire_gpio.h>

 #define _BC_MODULE_SENSOR_INITIALIZED_STATE 0xff
 #define _BC_MODULE_SENSOR_INITIALIZED_DIRECTION 0x00
@@ -310,7 +311,7 @@
 {
     if (!_bc_module_sensor.onewire_initialized)
     {
-        bc_onewire_init_gpio(&_bc_module_sensor.onewire, BC_GPIO_P5);
+        bc_onewire_gpio_init(&_bc_module_sensor.onewire, BC_GPIO_P5);

         _bc_module_sensor.onewire_initialized = true;
     }


new ids from t.ludewig

new ids from t.ludewig

--- camlibs/ptp2/library.c
+++ camlibs/ptp2/library.c
@@ -716,6 +716,12 @@
 	/* t.ludewig@gmail.com */
 	{"Sony:DSC-HX200V (PTP mode)",0x054c, 0x061f, 0},

+	/* t.ludewig@gmail.com */
+	{"Sony:DSC-HX300 (PTP mode)", 0x054c, 0x06ee, 0},
+
+	/* t.ludewig@gmail.com */
+	{"Sony:NEX-3N (PTP mode)",    0x054c, 0x072f, 0},
+
 	/* Nikon Coolpix 2500: M. Meissner, 05 Oct 2003 */
 	{"Nikon:Coolpix 2500 (PTP mode)", 0x04b0, 0x0109, 0},
 	/* Nikon Coolpix 5700: A. Tanenbaum, 29 Oct 2002 */
@@ -820,6 +826,8 @@
 	/* Dale Pontius <DEPontius@edgehp.net> */
 	{"Nikon:Coolpix P7100 (PTP mode)",0x04b0, 0x018b, PTP_CAP},

+	/* t.ludewig@gmail.com */
+	{"Nikon:Coolpix L820  (PTP mode)",0x04b0, 0x0192, PTP_CAP},
 	/* https://sourceforge.net/p/gphoto/feature-requests/429/ */
 	{"Nikon:Coolpix S9500 (PTP mode)",0x04b0, 0x0193, PTP_CAP},

@@ -845,6 +853,18 @@
 	{"Nikon:Coolpix P510 (PTP mode)", 0x04b0, 0x0223, 0},
 	/* Bernhard Schiffner <bernhard@schiffner-limbach.de> */
 	{"Nikon:Coolpix P7700 (PTP mode)",0x04b0, 0x0225, 0},
+
+	/* t.ludewig@gmail.com */
+	/* N CP A seems capture capable, but does not list vendor commands */
+	/* Reports 0x400d aka CaptureComplete event ... but has no
+	 * vendor commands? yeah right ... */
+	{"Nikon:Coolpix A (PTP mode)",	  0x04b0, 0x0226, 0}, /* PTP_CAP */
+
+	/* t.ludewig@gmail.com */
+	/* Also reports 0x400d aka CaptureComplete event ... but has no
+	 * vendor commands? yeah right... */
+	{"Nikon:Coolpix P520 (PTP mode)", 0x04b0, 0x0228, 0}, /* PTP_CAP */
+
 	/* Nikon Coolpix 2000 */
 	{"Nikon:Coolpix 2000 (PTP mode)", 0x04b0, 0x0302, 0},
 	/* From IRC reporter. */
@@ -937,7 +957,10 @@
 	{"Nikon:DSC D800E",               0x04b0, 0x042e, PTP_CAP|PTP_CAP_PREVIEW},
 	/* Simeon Pilgrim <simeon.pilgrim@gmail.com> */
 	{"Nikon:DSC D5200",               0x04b0, 0x042f, PTP_CAP|PTP_CAP_PREVIEW},
-
+
+	/* t.ludewig@gmail.com */
+	{"Nikon:DSC D7100",               0x04b0, 0x0430, PTP_CAP|PTP_CAP_PREVIEW},
+
 	/* http://sourceforge.net/tracker/?func=detail&aid=3536904&group_id=8874&atid=108874 */
 	{"Nikon:V1",    		  0x04b0, 0x0601, PTP_CAP},
 	/* https://sourceforge.net/tracker/?func=detail&atid=358874&aid=3556403&group_id=8874 */
@@ -1361,7 +1384,10 @@

 	/* "T. Ludewig" <t.ludewig@gmail.com> */
 	{"Canon:PowerShot S110",		0x04a9, 0x325b, PTPBUG_DELETE_SENDS_EVENT},
+	/* "T. Ludewig" <t.ludewig@gmail.com> */
 	{"Canon:PowerShot SX500IS",		0x04a9, 0x325c, PTPBUG_DELETE_SENDS_EVENT},
+	/* "T. Ludewig" <t.ludewig@gmail.com> */
+	{"Canon:EOS 700D",			0x04a9, 0x3272, PTP_CAP|PTP_CAP_PREVIEW},

 	/* Konica-Minolta PTP cameras */
 	{"Konica-Minolta:DiMAGE A2 (PTP mode)",        0x132b, 0x0001, 0},
@@ -1441,6 +1467,8 @@
 	{"Fuji:FinePix HS30EXR",		0x04cb, 0x0271, 0},
 	/* t.ludewig@gmail.com */
 	{"Fuji:FinePix XF1",			0x04cb, 0x0288, 0},
+	/* t.ludewig@gmail.com */
+	{"Fuji:FinePix X20",			0x04cb, 0x02a6, 0},

 	{"Ricoh:Caplio R5 (PTP mode)",          0x05ca, 0x0110, 0},
 	{"Ricoh:Caplio GX (PTP mode)",          0x05ca, 0x0325, 0},


[AST] Follow-up to r297972, add default value for setGetterName/setSetterName if a source-loc is not provided.

Fixes lldb build.

git-svn-id: ffe668792ed300d6c2daa1f6eba2e0aa28d7ec6c@297974 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/clang/AST/DeclObjC.h
+++ include/clang/AST/DeclObjC.h
@@ -858,14 +858,14 @@

   Selector getGetterName() const { return GetterName; }
   SourceLocation getGetterNameLoc() const { return GetterNameLoc; }
-  void setGetterName(Selector Sel, SourceLocation Loc) {
+  void setGetterName(Selector Sel, SourceLocation Loc = SourceLocation()) {
     GetterName = Sel;
     GetterNameLoc = Loc;
   }

   Selector getSetterName() const { return SetterName; }
   SourceLocation getSetterNameLoc() const { return SetterNameLoc; }
-  void setSetterName(Selector Sel, SourceLocation Loc) {
+  void setSetterName(Selector Sel, SourceLocation Loc = SourceLocation()) {
     SetterName = Sel;
     SetterNameLoc = Loc;
   }


Last fix was wrong..

Last fix was wrong..

--- src/lib-storage/index/mbox/mbox-sync-update.c
+++ src/lib-storage/index/mbox/mbox-sync-update.c
@@ -228,7 +228,7 @@
 		str_truncate(ctx->header, pos);
 		str_append_str(ctx->header, new_line);
 	} else {
-		mbox_sync_move_buffer(ctx, pos, str_len(new_line), p - hdr);
+		mbox_sync_move_buffer(ctx, pos, str_len(new_line), p - hdr + 1);
 		buffer_copy(ctx->header, pos, new_line, 0, (size_t)-1);
 	}
 }
@@ -266,7 +266,7 @@

 	t_push();
 	str = t_str_new(64);
-	str_printfa(str, "%u", ctx->mail.uid);
+	str_printfa(str, "%u\n", ctx->mail.uid);
 	mbox_sync_update_line(ctx, ctx->hdr_pos[MBOX_HDR_X_UID], str);
 	t_pop();
 }


linux: crypto: fix checking of GCM tags

linux: crypto: fix checking of GCM tags

Currently odp_crypto code will happily accept wrong tags, because the
check for EVP_DecryptFinal_ex return code is incorrect. This function
returns 0 if tag is incorrect, not < 0.
https://bugs.linaro.org/show_bug.cgi?id=3003

Signed-off-by: Dmitry Eremin-Solenikov <05e7612c354c8479a2d1e9b11fb63ce18664b3ca@linaro.org>
Reviewed-and-tested-by: Bill Fischofer <52f3c909d51cc5d355a68a403df6906b3c1a8f83@linaro.org>
Signed-off-by: Maxim Uvarov <db4d16e02ae2d7493db430203537da8b2e34f290@linaro.org>

--- platform/linux-generic/odp_crypto.c
+++ platform/linux-generic/odp_crypto.c
@@ -384,7 +384,7 @@
 				  auth_len - (aad_tail - aad_head));
 	}

-	if (EVP_DecryptFinal_ex(ctx, cipherdata + cipher_len, &plain_len) < 0)
+	if (EVP_DecryptFinal_ex(ctx, cipherdata + cipher_len, &plain_len) <= 0)
 		return ODP_CRYPTO_ALG_ERR_ICV_CHECK;

 	return ODP_CRYPTO_ALG_ERR_NONE;


coap_session.h: Adjust whitespace

coap_session.h: Adjust whitespace

--- include/coap2/coap_session.h
+++ include/coap2/coap_session.h
@@ -50,10 +50,10 @@
  * coap_session_state_t values
  */
 #define COAP_SESSION_STATE_NONE                0
-#define COAP_SESSION_STATE_CONNECTING        1
-#define COAP_SESSION_STATE_HANDSHAKE        2
-#define COAP_SESSION_STATE_CSM                3
-#define COAP_SESSION_STATE_ESTABLISHED        4
+#define COAP_SESSION_STATE_CONNECTING          1
+#define COAP_SESSION_STATE_HANDSHAKE           2
+#define COAP_SESSION_STATE_CSM                 3
+#define COAP_SESSION_STATE_ESTABLISHED         4

 typedef struct coap_session_t {
   coap_proto_t proto;               /**< protocol used */


libglnx porting: Drop last use of gs_transfer_out_value()

Closes: #319
Approved by: jlebon

--- src/libostree/ostree-repo-static-delta-core.c
+++ src/libostree/ostree-repo-static-delta-core.c
@@ -159,7 +159,8 @@
     }

   ret = TRUE;
-  gs_transfer_out_value (out_deltas, &ret_deltas);
+  if (out_deltas)
+    *out_deltas = g_steal_pointer (&ret_deltas);
  out:
   return ret;
 }


Fixed detection of windows-native

Fixed detection of windows-native

--- platform/minimal-net/contiki-conf.h
+++ platform/minimal-net/contiki-conf.h
@@ -35,7 +35,7 @@

 #include <inttypes.h>
 #include <limits.h>
-#ifndef WIN32_LEAN_AND_MEAN
+#ifndef _WIN32
 #include <sys/select.h>
 #endif


add rho comment

add rho comment

--- platform/shared/ruby/thread_win32.c
+++ platform/shared/ruby/thread_win32.c
@@ -495,6 +495,7 @@
     volatile HANDLE thread_id = th->thread_id;

     native_thread_init_stack(th);
+//RHO
 /*    th->native_thread_data.interrupt_event = CreateEvent(0, TRUE, FALSE, 0);

     if ( !th->native_thread_data.interrupt_event)
@@ -503,7 +504,7 @@
         thread_debug("thread interrupt_event error: %d\n", dwErr );
     }
 */
-
+//RHO
     /* run */
     thread_debug("thread created (th: %p, thid: %p, event: %p)\n", th,
 		 th->thread_id, th->native_thread_data.interrupt_event);


str: use flb_strndup to implement flb_strdup (#4302)

This patch changes flb_strdup to use flb_strndup as
flb_strdup is an alias of flb_strndup(s, strlen(s)).

Signed-off-by: Emma Haruka Iwao <2e1cbee671064ab29b34254786a03b529fd96c06@google.com>

--- include/fluent-bit/flb_str.h
+++ include/fluent-bit/flb_str.h
@@ -28,22 +28,6 @@
 #include <stdlib.h>
 #include <string.h>

-static inline char *flb_strdup(const char *s)
-{
-    int len;
-    char *str;
-
-    len = strlen(s);
-    str = (char *) flb_malloc(len + 1);
-    if (!str) {
-        return NULL;
-    }
-    memcpy(str, s, len);
-    str[len] = '\0';
-
-    return str;
-}
-
 static inline char *flb_strndup(const char *s, size_t n)
 {
     char *str;
@@ -58,6 +42,11 @@
     return str;
 }

+static inline char *flb_strdup(const char *s)
+{
+    return flb_strndup(s, strlen(s));
+}
+
 /* emptyval checks whether a string has a non-null value "". */
 static inline int flb_str_emptyval(const char *s)
 {


Drop unused field

Drop unused field

--- include/freerdp/crypto/tls.h
+++ include/freerdp/crypto/tls.h
@@ -72,7 +72,6 @@
 	void* tsg;
 	SSL_CTX* ctx;
 	BYTE* PublicKey;
-	BIO_METHOD* methods;
 	DWORD PublicKeyLength;
 	rdpSettings* settings;
 	SecPkgContext_Bindings* Bindings;


Texture activation optimization

Texture activation optimization

--- include/graphics/gltexture.h
+++ include/graphics/gltexture.h
@@ -16,8 +16,10 @@
         ~GLTexture();

         void activate() {
-            glActiveTexture(GL_TEXTURE0);
-            glBindTexture(GL_TEXTURE_2D, id);
+            if (GLTexture::activeTexture != id) {
+                glBindTexture(GL_TEXTURE_2D, id);
+                GLTexture::activeTexture = id;
+            }
         }

         // call before draw loop; resets active texture to 0


Reorganize header

Reorganize header

--- include/grpc/grpc_security.h
+++ include/grpc/grpc_security.h
@@ -28,14 +28,6 @@
 #ifdef __cplusplus
 extern "C" {
 #endif
-
-/** --- grpc_call_credentials object.
-
-   A call credentials object represents a way to authenticate on a particular
-   call. These credentials can be composed with a channel credentials object
-   so that they are sent with every call on this channel.  */
-
-typedef struct grpc_call_credentials grpc_call_credentials;

 /** --- Authentication Context. --- */

@@ -126,6 +118,18 @@
 /** Create a channel arg with the given cache object. */
 GRPCAPI grpc_arg
 grpc_ssl_session_cache_create_channel_arg(grpc_ssl_session_cache* cache);
+
+/** --- grpc_call_credentials object.
+
+   A call credentials object represents a way to authenticate on a particular
+   call. These credentials can be composed with a channel credentials object
+   so that they are sent with every call on this channel.  */
+
+typedef struct grpc_call_credentials grpc_call_credentials;
+
+/** Releases a call credentials object.
+   The creator of the credentials object is responsible for its release. */
+GRPCAPI void grpc_call_credentials_release(grpc_call_credentials* creds);

 /** --- grpc_channel_credentials object. ---

@@ -293,15 +297,13 @@
     const char* pem_root_certs, grpc_ssl_pem_key_cert_pair* pem_key_cert_pair,
     const grpc_ssl_verify_peer_options* verify_options, void* reserved);

-/** Releases a call credentials object.
-   The creator of the credentials object is responsible for its release. */
-GRPCAPI void grpc_call_credentials_release(grpc_call_credentials* creds);
-
 /** Creates a composite channel credentials object. The security level of
  * resulting connection is determined by channel_creds. */
 GRPCAPI grpc_channel_credentials* grpc_composite_channel_credentials_create(
     grpc_channel_credentials* channel_creds, grpc_call_credentials* call_creds,
     void* reserved);
+
+/** --- composite credentials. */

 /** Creates a composite call credentials object. */
 GRPCAPI grpc_call_credentials* grpc_composite_call_credentials_create(


cxx: remove jive_output_node

cxx: remove jive_output_node

Signed-off-by: Helge Bahmann <c5618920f622561f9c0ec5c42219c4c08180149f@chaoticmind.net>

--- include/jive/vsdg/basetype.h
+++ include/jive/vsdg/basetype.h
@@ -215,12 +215,6 @@
 void
 jive_output_destroy(jive_output * self);

-JIVE_EXPORTED_INLINE struct jive_node *
-jive_output_node(const jive_output * output)
-{
-	return output->node();
-}
-
 /**	@}	*/

 /**


getters for member count

getters for member count

--- include/libtelegram/sender.h
+++ include/libtelegram/sender.h
@@ -114,17 +114,24 @@
                                int_fast32_t user_id);
   inline bool kick_chat_member(std::string const &chat_id,
                                int_fast32_t user_id);
+
   inline bool unban_chat_member(int_fast64_t chat_id,
                                 int_fast32_t user_id);
   inline bool unban_chat_member(std::string const &chat_id,
                                 int_fast32_t user_id);
+
   inline bool leave_chat(int_fast64_t chat_id);
   inline bool leave_chat(std::string const &chat_id);
+
   inline std::experimental::optional<types::chat> get_chat(int_fast64_t chat_id);
   inline std::experimental::optional<types::chat> get_chat(std::string const &chat_id);
+
   std::experimental::optional<std::vector<types::chat_member>> get_chat_administrators(int_fast64_t chat_id);
   std::experimental::optional<std::vector<types::chat_member>> get_chat_administrators(std::string const &chat_id);
-  // TODO: getChatMembersCount
+
+  inline std::experimental::optional<int_fast32_t> get_chat_members_count(int_fast64_t chat_id);
+  inline std::experimental::optional<int_fast32_t> get_chat_members_count(std::string const &chat_id);
+
   inline std::experimental::optional<types::chat_member> get_chat_member(int_fast64_t chat_id,
                                                                          int_fast32_t user_id);
   inline std::experimental::optional<types::chat_member> get_chat_member(std::string const &chat_id,
@@ -552,9 +559,22 @@
   return send_json_and_parse_vector<types::chat_member>("getChatAdministrators", tree);
 }

+inline std::experimental::optional<int_fast32_t> sender::get_chat_members_count(int_fast64_t chat_id) {
+  /// Get a count of users in a chat, numerical chat id variant - see https://core.telegram.org/bots/api#getchatmemberscount
+  nlohmann::json tree;
+  tree["chat_id"] = chat_id;
+  return send_json_and_parse<int_fast32_t>("getChatMembersCount", tree);
+}
+inline std::experimental::optional<int_fast32_t> sender::get_chat_members_count(std::string const &chat_id) {
+  /// Get a count of users in a chat, string supergroup name variant - see https://core.telegram.org/bots/api#getchatmemberscount
+  nlohmann::json tree;
+  tree["chat_id"] = chat_id;
+  return send_json_and_parse<int_fast32_t>("getChatMembersCount", tree);
+}
+
 inline std::experimental::optional<types::chat_member> sender::get_chat_member(int_fast64_t chat_id,
                                                                                int_fast32_t user_id) {
-  /// Get a chat member by id, numerical chat id variant- see https://core.telegram.org/bots/api#getchatmember
+  /// Get a chat member by id, numerical chat id variant - see https://core.telegram.org/bots/api#getchatmember
   nlohmann::json tree;
   tree["chat_id"] = chat_id;
   tree["user_id"] = user_id;


Rework the cpuset printing macro to remove useless zeros:
* keep all zeros in non-empty subsets
* keep a single zero if the last subset is empty
  (so that we don't end the string with a ',')
* just print a ',' for intermediate subsets
* drop starting subsets entirely if empty

git-svn-id: 14be032f8f42541b1a281b51ae8ea69814daf20e@213 4b44e086-7f34-40ce-a3bd-00e031736276

--- include/libtopology/cpuset.h
+++ include/libtopology/cpuset.h
@@ -42,14 +42,26 @@
 #    define TOPO_CPUSUBSET_STRING_LENGTH	(TOPO_BITS_PER_LONG/4)
 #    define TOPO_CPUSET_STRING_LENGTH		(TOPO_CPUSUBSET_COUNT*(TOPO_CPUSUBSET_STRING_LENGTH+1))
 #    define TOPO_PRIxCPUSET		"s"
-#    define TOPO_CPUSET_PRINTF_VALUE(x)	({				\
-	char *__buf = alloca(TOPO_CPUSET_STRING_LENGTH+1);		\
-	char *__tmp = __buf;						\
-	int __i;							\
-	for(__i=TOPO_CPUSUBSET_COUNT-1; __i>=0; __i--)			\
-	  __tmp += sprintf(__tmp, TOPO_PRIxCPUSUBSET ",", (x).s[__i]);	\
-	*(__tmp-1) = '\0';						\
-	__buf;								\
+#    define TOPO_CPUSET_PRINTF_VALUE(x)	({					\
+	char *__buf = alloca(TOPO_CPUSET_STRING_LENGTH+1);			\
+	char *__tmp = __buf;							\
+	int __i;								\
+	*__tmp = '\0';								\
+	for(__i=TOPO_CPUSUBSET_COUNT-1; __i>=0; __i--)				\
+	  if ((x).s[__i] != 0)							\
+	    /* print the whole subset if not empty */				\
+	    __tmp += sprintf(__tmp, TOPO_PRIxCPUSUBSET ",", (x).s[__i]);	\
+	  else if (__i == 0)							\
+	    /* print a single 0 to mark the last subset */			\
+	    __tmp += sprintf(__tmp, "0,");					\
+	  else if (__tmp != __buf)						\
+	    /* print nothing if we haven't printed anything yet */		\
+	    *(__tmp++) = ',';							\
+	/* remove the ending comma if we printed something */			\
+	if (__tmp != __buf)							\
+	  *(__tmp-1) = '\0';							\
+	/* return the alloca'ted buffer */					\
+	__buf;									\
      })


Use explicit std:: qualification to avoid relying on Koenig lookup, which
VC++ does not do properly.  Thanks to Morten Ofstad for the patch!

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@16955 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/ADT/SetVector.h
+++ include/llvm/ADT/SetVector.h
@@ -112,7 +112,7 @@
   /// @brief Remove an item from the set vector.
   void remove(const value_type& X) {
     if (0 < set_.erase(X)) {
-      iterator I = find(vector_.begin(),vector_.end(),X);
+      iterator I = std::find(vector_.begin(),vector_.end(),X);
       assert(I != vector_.end() && "Corrupted SetVector instances!");
       vector_.erase(I);
     }


Various public StringMap methods take or return "MapEntryTy", make it public.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@148732 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/ADT/StringMap.h
+++ include/llvm/ADT/StringMap.h
@@ -229,8 +229,9 @@
 template<typename ValueTy, typename AllocatorTy = MallocAllocator>
 class StringMap : public StringMapImpl {
   AllocatorTy Allocator;
+public:
   typedef StringMapEntry<ValueTy> MapEntryTy;
-public:
+
   StringMap() : StringMapImpl(static_cast<unsigned>(sizeof(MapEntryTy))) {}
   explicit StringMap(unsigned InitialSize)
     : StringMapImpl(InitialSize, static_cast<unsigned>(sizeof(MapEntryTy))) {}


Remove 3 gross global functions that don't belong here

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@523 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/ConstPoolVals.h
+++ include/llvm/ConstPoolVals.h
@@ -175,24 +175,4 @@
   inline const vector<Use> &getValues() const { return Operands; }
 };

-//===---------------------------------------------------------------------------
-// External functions
-//
-
-// Convenience functions to get the value of an integer constant, for an
-// appropriate integer or non-integer type that can be held in an integer.
-// The type of the argument must be the following:
-//   GetSignedIntConstantValue:   signed integer or bool
-//   GetUnsignedIntConstantValue: unsigned integer, bool, or pointer
-//   GetConstantValueAsSignedInt: any of the above, but the value
-//				  must fit into a int64_t.
-//
-// isValidConstant is set to true if a valid constant was found.
-//
-int64_t	 GetSignedIntConstantValue	(const Value* val, bool& isValidConst);
-uint64_t GetUnsignedIntConstantValue	(const Value* val, bool& isValidConst);
-int64_t	 GetConstantValueAsSignedInt	(const Value* val, bool& isValidConst);
-
-//===---------------------------------------------------------------------------
-
 #endif


Fix quotes.

Fix quotes.

git-svn-id: 0ff597fd157e6f4fc38580e8d64ab130330d2411@19909 91177308-0d34-0410-b5e6-96231b3b80d8

--- include/llvm/Support/Timer.h
+++ include/llvm/Support/Timer.h
@@ -15,7 +15,7 @@
 #ifndef LLVM_SUPPORT_TIMER_H
 #define LLVM_SUPPORT_TIMER_H

-#include <llvm/Support/DataTypes.h>
+#include "llvm/Support/DataTypes.h"
 #include <string>
 #include <vector>
 #include <iosfwd>


IShow: Use a default destructor instead of an empty one

--- include/medialibrary/IShow.h
+++ include/medialibrary/IShow.h
@@ -31,7 +31,7 @@
 class IShow
 {
     public:
-        virtual ~IShow() {}
+        virtual ~IShow() = default;
         virtual int64_t id() const = 0;
         virtual const std::string& title() const = 0;
         virtual time_t releaseDate() const = 0;


Time for a better name for the global stash.

git-svn-id: 6e74a02f85675cec270f5d931b0f6998666294a3@4848 d31e2699-5ff4-0310-a27c-f18f2fbe73fe

--- include/parrot/interpreter.h
+++ include/parrot/interpreter.h
@@ -144,7 +144,7 @@
     struct Parrot_Context ctx;          /* All the registers and stacks that
                                            matter when context switching */

-    struct Stash *perl_stash;           /* Pointer to the global variable
+    struct Stash *globals;              /* Pointer to the global variable
                                          * area */
     struct Arenas *arena_base;          /* Pointer to this interpreter's
                                          * arena */


Fix filename specified in documentation

Fix filename specified in documentation

--- include/phosphor/trace_log.h
+++ include/phosphor/trace_log.h
@@ -166,7 +166,7 @@
          * Logs an event in the current buffer (if applicable)
          *
          * This method should not be used directly, instead the
-         * macros contained within sentinel.h should be used instead.
+         * macros contained within phosphor.h should be used instead.
          *
          * @param category The category to log the event into. This (and
          *        the name) should usually be a string literal as the


ccn.h: minor reformatting and comment edits

--- ccnd/include/ccn/ccn.h
+++ ccnd/include/ccn/ccn.h
@@ -16,6 +16,7 @@
 #include <ccn/charbuf.h>
 #include <ccn/indexbuf.h>

+// XXX - this is no longer a halflife, it should be renamed
 #define CCN_INTEREST_HALFLIFE_MICROSEC 4000000

 /* opaque declarations */
@@ -30,7 +31,7 @@
 /*
  * Types for implementing upcalls
  * To receive notifications of incoming interests and content, the
- * client create closures (using client-managed memory).
+ * client creates closures (using client-managed memory).
  */

 /*
@@ -129,7 +130,7 @@
 void ccn_destroy(struct ccn **hp);

 /***********************************
- * Writing Names:
+ * Writing Names
  * Names for interests are constructed in charbufs using
  * the following routines.
  */
@@ -189,7 +190,7 @@
  */
 int
 ccn_signed_info_create_default(struct ccn_charbuf *c, /* output signed info */
-			enum ccn_content_type Type);
+                               enum ccn_content_type Type);

 /*
  * ccn_signed_info_create: create signed info in a charbuf
@@ -198,13 +199,14 @@
  * Return value is 0, or -1 for error.
  */
 int
-ccn_signed_info_create(struct ccn_charbuf *c,
-                const void *publisher_key_id,	/* input, (sha256) hash */
-                size_t publisher_key_id_size, 	/* input, 32 for sha256 hashes */
-                const char *datetime,		/* input, NULL for "now" */
-                enum ccn_content_type type,	/* input */
-                int freshness,			/* input, -1 means omit */
-                const struct ccn_charbuf *key_locator);	/* input, optional, ccnb encoded */
+ccn_signed_info_create(
+    struct ccn_charbuf *c,              /* filled with result */
+    const void *publisher_key_id,	/* input, (sha256) hash */
+    size_t publisher_key_id_size, 	/* input, 32 for sha256 hashes */
+    const char *datetime,		/* input, NULL for "now" */
+    enum ccn_content_type type,         /* input */
+    int freshness,			/* input, -1 means omit */
+    const struct ccn_charbuf *key_locator); /* input, optional, ccnb encoded */

 /***********************************
  * ccn_express_interest:
@@ -293,7 +295,7 @@

 /***********************************
  * Binary decoding
- * These routines require the whole binary object be buffered.
+ * These routines require that the whole binary object be buffered.
  */

 struct ccn_buf_decoder {
@@ -325,7 +327,7 @@
 void ccn_buf_check_close(struct ccn_buf_decoder *d);

 /*
- * ccn_ref_tagged_BLOB: Get address and size associated with a blob-valued element
+ * ccn_ref_tagged_BLOB: Get address & size associated with blob-valued element
  * Returns 0 for success, negative value for error.
  */
 int ccn_ref_tagged_BLOB(enum ccn_dtag tt,
@@ -546,8 +548,7 @@
                              const void *data,
                              size_t size,
                              const char *digest_algorithm,
-                             const void *private_key
-                             );
+                             const void *private_key);

 /*
  * ccn_encode_Content:
@@ -570,7 +571,7 @@
  * final name component is implicit (as in the on-wire format)
  * or explicit (as within ccnd's content store).
  * Valid parse information (pc and pi) may be provided to speed things
- * up; if NULL they will be reconstructed.
+ * up; if NULL they will be reconstructed internally.
  */
 int ccn_content_matches_interest(const unsigned char *content_object,
                                  size_t content_object_size,


Change SILValue::operator*()'s return type from ValueBase * -> ValueBase & to match the normal canonical implementation of operator*.

Thanks Dave A!

Swift SVN r8740

--- include/swift/SIL/SILValue.h
+++ include/swift/SIL/SILValue.h
@@ -120,7 +120,7 @@
     return ValueAndResultNumber.getPointer();
   }
   ValueBase *operator->() const { return getDef(); }
-  ValueBase *operator*() const { return getDef(); }
+  ValueBase &operator*() const { return *getDef(); }
   unsigned getResultNumber() const { return ValueAndResultNumber.getInt(); }

   SILType getType() const {


Adapt header guards to new location of file

--- include/visionaray/swizzle.h
+++ include/visionaray/swizzle.h
@@ -3,8 +3,8 @@

 #pragma once

-#ifndef VSNRAY_TEXTURE_SWIZZLE_H
-#define VSNRAY_TEXTURE_SWIZZLE_H
+#ifndef VSNRAY_SWIZZLE_H
+#define VSNRAY_SWIZZLE_H 1

 #include <vector>

@@ -103,4 +103,4 @@

 } // visionaray

-#endif // VSNRAY_TEXTURE_SWIZZLE_H
+#endif // VSNRAY_SWIZZLE_H


Update windowstyle.h

Update windowstyle.h

--- include/window/windowstyle.h
+++ include/window/windowstyle.h
@@ -5,9 +5,9 @@
 	namespace WindowStyle {
 		/** Window style */
 		enum {
-			Fullscreen = 1 << 3,
-			Window     = 1 << 2,
-			PopUp      = 1 << 1
+			Fullscreen = 0xFFFF,
+			Window     = 0xFF00,
+			PopUp      = 0x1111
 		};
 	}
 }


n.mem: _realloc0: realloc case: only memset tail in growing case

--- lib/n/mem/mem.n.c
+++ lib/n/mem/mem.n.c
@@ -28,7 +28,9 @@
     if (r == NULL) {
       NB(Abort)();
     }
-    memset(r + old_bsz, 0, bsz - old_bsz);
+    if (bsz > old_bsz) {
+      memset(r + old_bsz, 0, bsz - old_bsz);
+    }
   }
   return r;
 }


Simplify

Simplify

--- lib/ngtcp2_conn.c
+++ lib/ngtcp2_conn.c
@@ -2303,7 +2303,8 @@
         return nwrite;
       }
       return res;
-    } else if (nwrite) {
+    }
+    if (nwrite) {
       return res + nwrite;
     }

@@ -2318,9 +2319,9 @@
           return nwrite;
         }
         return res;
-      } else {
-        return res + nwrite;
-      }
+      }
+
+      return res + nwrite;
     }

     if (cwnd < NGTCP2_MIN_PKTLEN) {
@@ -2333,9 +2334,9 @@
           return nwrite;
         }
         return res;
-      } else {
-        return res + nwrite;
-      }
+      }
+
+      return res + nwrite;
     }

     if (ngtcp2_rtb_lost_head(&pktns->rtb)) {
@@ -2359,9 +2360,9 @@
         return nwrite;
       }
       return res;
-    } else {
-      return res + nwrite;
-    }
+    }
+
+    return res + nwrite;
   case NGTCP2_CS_CLOSING:
     return NGTCP2_ERR_CLOSING;
   case NGTCP2_CS_DRAINING:


* modules/access/dvdnav.c: When no path is specified, use libdvdcss    autodetection.

--- modules/access/dvdnav.c
+++ modules/access/dvdnav.c
@@ -1368,6 +1368,12 @@
     uint16_t i_tag_id = 0;
     int i_fd, i_ret;

+    if( !*psz_name )
+    {
+        /* Triggers libdvdcss autodetection */
+        return VLC_SUCCESS;
+    }
+
     if( stat( psz_name, &stat_info ) || !S_ISREG( stat_info.st_mode ) )
     {
         /* Let dvdnav_open() do the probing */


SH-874 Followup -- fix for mac build

SH-874 Followup -- fix for mac build

--- indra/llrender/llglheaders.h
+++ indra/llrender/llglheaders.h
@@ -847,4 +847,12 @@
 #define	GL_GPU_MEMORY_INFO_EVICTED_MEMORY_NVX            0x904B
 #endif

+//GL_ATI_meminfo constants
+#ifndef GL_ATI_meminfo
+#define GL_ATI_meminfo
+#define GL_VBO_FREE_MEMORY_ATI                     0x87FB
+#define GL_TEXTURE_FREE_MEMORY_ATI                 0x87FC
+#define GL_RENDERBUFFER_FREE_MEMORY_ATI            0x87FD
+#endif
+
 #endif // LL_LLGLHEADERS_H


Fix and clean up ngtcp2_conn_stat resetting function

--- lib/ngtcp2_conn.c
+++ lib/ngtcp2_conn.c
@@ -533,23 +533,44 @@
   return a->ts_retired < b->ts_retired;
 }

-static void conn_reset_conn_stat(ngtcp2_conn *conn, ngtcp2_conn_stat *cstat) {
+/*
+ * conn_reset_conn_stat_cc resets congestion state in |cstat|.
+ */
+static void conn_reset_conn_stat_cc(ngtcp2_conn *conn,
+                                    ngtcp2_conn_stat *cstat) {
   cstat->latest_rtt = 0;
   cstat->min_rtt = UINT64_MAX;
   cstat->smoothed_rtt = conn->local.settings.initial_rtt;
   cstat->rttvar = conn->local.settings.initial_rtt / 2;
   cstat->pto_count = 0;
   cstat->loss_detection_timer = 0;
-  // Initializes them with UINT64_MAX.
-  memset(cstat->loss_time, 0xff, sizeof(cstat->loss_time));
   cstat->cwnd =
       ngtcp2_cc_compute_initcwnd(conn->local.settings.max_udp_payload_size);
   cstat->ssthresh = UINT64_MAX;
   cstat->congestion_recovery_start_ts = 0;
   cstat->bytes_in_flight = 0;
-  cstat->max_udp_payload_size = conn->local.settings.max_udp_payload_size;
   cstat->delivery_rate_sec = 0;
   cstat->recv_rate_sec = 0;
+}
+
+/*
+ * reset_conn_stat_recovery resets the fields related to the recovery
+ * function
+ */
+static void reset_conn_stat_recovery(ngtcp2_conn_stat *cstat) {
+  // Initializes them with UINT64_MAX.
+  memset(cstat->loss_time, 0xff, sizeof(cstat->loss_time));
+  memset(cstat->last_tx_pkt_ts, 0xff, sizeof(cstat->last_tx_pkt_ts));
+}
+
+/*
+ * conn_reset_conn_stat resets |cstat|.  The following fields are not
+ * reset: initial_rtt, max_udp_payload_size, bytes_sent, and
+ * bytes_recv.
+ */
+static void conn_reset_conn_stat(ngtcp2_conn *conn, ngtcp2_conn_stat *cstat) {
+  conn_reset_conn_stat_cc(conn, cstat);
+  reset_conn_stat_recovery(cstat);
 }

 static void conn_reset_rx_rate(ngtcp2_conn *conn) {
@@ -708,8 +729,8 @@

   conn_reset_conn_stat(*pconn, &(*pconn)->cstat);
   (*pconn)->cstat.initial_rtt = settings->initial_rtt;
-  memset((*pconn)->cstat.last_tx_pkt_ts, 0xff,
-         sizeof((*pconn)->cstat.last_tx_pkt_ts));
+  (*pconn)->cstat.max_udp_payload_size =
+      (*pconn)->local.settings.max_udp_payload_size;

   ngtcp2_rst_init(&(*pconn)->rst);

@@ -3851,6 +3872,7 @@

   ngtcp2_cpymem(token->base, retry.token.base, retry.token.len);

+  reset_conn_stat_recovery(&conn->cstat);
   conn_reset_congestion_state(conn);

   return 0;
@@ -4296,7 +4318,7 @@
  * conn_reset_congestion_state resets congestion state.
  */
 static void conn_reset_congestion_state(ngtcp2_conn *conn) {
-  conn_reset_conn_stat(conn, &conn->cstat);
+  conn_reset_conn_stat_cc(conn, &conn->cstat);

   conn_reset_rx_rate(conn);


Fixed integer overflow in avi index creation.

It fixes #2583.

--- modules/demux/avi/avi.c
+++ modules/demux/avi/avi.c
@@ -106,7 +106,7 @@
     uint32_t     i_flags;
     off_t        i_pos;
     uint32_t     i_length;
-    uint32_t     i_lengthtotal;
+    int64_t      i_lengthtotal;

 } avi_entry_t;


AVI: reverse the height only if it needs to be reversed

--- modules/demux/avi/avi.c
+++ modules/demux/avi/avi.c
@@ -553,7 +553,7 @@
                          p_vids->p_bih->biBitCount,
                          (float)tk->i_rate/(float)tk->i_scale );

-                if( p_vids->p_bih->biCompression == 0x00 )
+                if( p_vids->p_bih->biCompression == 0x00 && fmt.video.i_height <= 0 )
                 {
                     /* RGB DIB are coded from bottom to top */
                     fmt.video.i_height =


demux: mp4: don't expect cdat/cdt2 pair for eia608

--- modules/demux/mp4/mp4.c
+++ modules/demux/mp4/mp4.c
@@ -430,13 +430,14 @@
 {
     /* Rebuild codec data from encap */
     size_t i_copied = 0;
-    size_t i_remaining = p_block->i_buffer;
+    size_t i_remaining = __MIN(p_block->i_buffer, INT64_MAX / 3);
     uint32_t i_bytes = 0;
     block_t *p_newblock;

+    /* always need at least 10 bytes (atom size+header+1pair)*/
     if ( i_remaining < 10 ||
          !(i_bytes = GetDWBE(p_block->p_buffer)) ||
-         (i_bytes + 8 > i_remaining) ||
+         (i_bytes > i_remaining) ||
          memcmp("cdat", &p_block->p_buffer[4], 4) ||
          !(p_newblock = block_Alloc( i_remaining * 3 - 8 )) )
     {
@@ -459,9 +460,10 @@
         i_remaining -= 2;
     } while( i_bytes >= 2 );

+    /* cdt2 is optional */
     if ( i_remaining >= 10 &&
          (i_bytes = GetDWBE(p_read)) &&
-         (i_bytes + 8 <= i_remaining) &&
+         (i_bytes <= i_remaining) &&
          !memcmp("cdt2", &p_read[4], 4) )
     {
         p_read += 8;


Fixed xml_reader usage in the freetype module.

--- modules/misc/freetype.c
+++ modules/misc/freetype.c
@@ -2236,7 +2236,7 @@
             {
                 /* Only text and karaoke tags are supported */
                 msg_Dbg( p_filter, "Unsupported top-level tag '%s' ignored.", psz_node );
-                xml_ReaderDelete( p_xml_reader );
+                p_filter->p_sys->p_xml = xml_ReaderReset( p_xml_reader, NULL );
                 p_xml_reader = NULL;
                 rv = VLC_EGENERIC;
             }
@@ -2297,7 +2297,7 @@
                                 result.x, result.y );
             }
         }
-        xml_ReaderReset( p_xml_reader, NULL );
+        p_filter->p_sys->p_xml = xml_ReaderReset( p_xml_reader, NULL );
         FreeLines( p_lines );
     }
     stream_Delete( p_sub );


xtag.c: Don't create pcdata elements outside the root element. try harder to read entire stream. make xml_ReaderValue return pcdata when available. Added some more debug printfs when XTAG_DEBUG is defined.

--- modules/misc/xml/xtag.c
+++ modules/misc/xml/xtag.c
@@ -165,14 +165,19 @@
     xml_reader_t *p_reader;
     xml_reader_sys_t *p_sys;
     char *p_buffer;
-    int i_buffer;
+    int i_size,i_buffer;
     XTag *p_root;

     /* Open and read file */

-    i_buffer = stream_Size( s );
-    p_buffer = malloc( i_buffer + 1 );
-    i_buffer = stream_Read( s, p_buffer, i_buffer );
+    i_size = stream_Size( s ) - stream_Tell( s );
+    p_buffer = malloc( i_size + 1 );
+    i_buffer = 0;
+    while( i_buffer < i_size )
+    {
+        msg_Dbg( p_xml, "got %d, want %d", i_buffer, i_size );
+        i_buffer += stream_Read( s, &p_buffer[i_buffer], i_size - i_buffer );
+    }
     p_buffer[ i_buffer ] = 0;

     if( !i_buffer )
@@ -279,6 +284,13 @@
 static char *ReaderValue( xml_reader_t *p_reader )
 {
     const char *psz_name;
+    if( p_reader->p_sys->p_curtag->pcdata )
+    {
+#ifdef XTAG_DEBUG
+        printf( "%s\n", p_reader->p_sys->p_curtag->pcdata );
+#endif
+        return strdup( p_reader->p_sys->p_curtag->pcdata );
+    }

     if( !p_reader->p_sys->p_curattr ) return 0;

@@ -706,13 +718,25 @@
     parser.start = (char *)s;

     if( n == -1 ) parser.end = NULL;
-    else if( n == 0 ) return NULL;
+    else if( n == 0 )
+    {
+#ifdef XTAG_DEBUG
+        printf ("empty buffer");
+#endif
+        return NULL;
+    }
     else parser.end = (char *)&s[n];

+    /* can't have whitespace pcdata outside rootnode */
+    xtag_skip_whitespace( &parser );
+
     tag = xtag_parse_tag( &parser );

     if( !parser.valid )
     {
+#ifdef XTAG_DEBUG
+        printf ("invalid file");
+#endif
         xtag_free( tag );
         return NULL;
     }


Render NBSP (\h) as normal space

Render NBSP (\h) as normal space

Many fonts don't have a non-breaking space (NBSP) character and this
can cause problems when these glyphs are substituted.  Render them
like a regular space.

--- libass/ass_font.c
+++ libass/ass_font.c
@@ -421,6 +421,9 @@

     if (ch < 0x20)
         return 0;
+    // Handle NBSP like a regular space when rendering the glyph
+    if (ch == 0xa0)
+        ch = ' ';
     if (font->n_faces == 0)
         return 0;


Fixed SDL2 compilation

Fixed SDL2 compilation

git-svn-id: ab66a9de07fa9d47c5829c82992f5279466c775f@4967 63c20433-aa62-49bd-875c-5a186b69a8fb

--- modules/sdl_out/video.c
+++ modules/sdl_out/video.c
@@ -364,20 +364,20 @@
 		evt->key_code = GF_KEY_ALT;
 		evt->flags = GF_KEY_EXT_RIGHT;
 		break;
-#if (SDL_MAJOR_VERSION>=1) && (SDL_MINOR_VERSION>=3)
-	case SDLK_LGUI:
-#else
-	case SDLK_LMETA:
-	case SDLK_LSUPER:
+#if (SDL_MAJOR_VERSION<=1) && (SDL_MINOR_VERSION<3)
+    case SDLK_LMETA:
+    case SDLK_LSUPER:
+#else
+    case SDLK_LGUI:
 #endif
 		evt->key_code = GF_KEY_META;
 		evt->flags = GF_KEY_EXT_LEFT;
 		break;
-#if (SDL_MAJOR_VERSION>=1) && (SDL_MINOR_VERSION>=3)
-	case SDLK_RGUI:
-#else
-	case SDLK_RMETA:
-	case SDLK_RSUPER:
+#if (SDL_MAJOR_VERSION<=1) && (SDL_MINOR_VERSION<3)
+    case SDLK_RMETA:
+    case SDLK_RSUPER:
+#else
+    case SDLK_RGUI:
 #endif
 		evt->key_code = GF_KEY_META;
 		evt->flags = GF_KEY_EXT_RIGHT;


change function parameters for metadata_streaminfo()

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

--- libavcodec/flac.c
+++ libavcodec/flac.c
@@ -94,7 +94,7 @@
     return val;
 }

-static void metadata_streaminfo(FLACContext *s);
+static void metadata_streaminfo(AVCodecContext *avctx, FLACContext *s, const uint8_t *buffer);
 static void allocate_buffers(FLACContext *s);
 static int metadata_parse(FLACContext *s);

@@ -107,7 +107,7 @@
         /* initialize based on the demuxer-supplied streamdata header */
         init_get_bits(&s->gb, avctx->extradata, avctx->extradata_size*8);
         if (avctx->extradata_size == FLAC_STREAMINFO_SIZE) {
-            metadata_streaminfo(s);
+            metadata_streaminfo(avctx, s, avctx->extradata);
             allocate_buffers(s);
         } else {
             metadata_parse(s);
@@ -143,26 +143,30 @@
     s->bitstream= av_fast_realloc(s->bitstream, &s->allocated_bitstream_size, s->max_framesize);
 }

-static void metadata_streaminfo(FLACContext *s)
-{
+static void metadata_streaminfo(AVCodecContext *avctx, FLACContext *s,
+                                const uint8_t *buffer)
+{
+    GetBitContext gb;
+    init_get_bits(&gb, buffer, FLAC_STREAMINFO_SIZE*8);
+
     /* mandatory streaminfo */
-    s->min_blocksize = get_bits(&s->gb, 16);
-    s->max_blocksize = get_bits(&s->gb, 16);
-
-    skip_bits(&s->gb, 24); /* skip min frame size */
-    s->max_framesize = get_bits_long(&s->gb, 24);
-
-    s->samplerate = get_bits_long(&s->gb, 20);
-    s->channels = get_bits(&s->gb, 3) + 1;
-    s->bps = get_bits(&s->gb, 5) + 1;
-
-    s->avctx->channels = s->channels;
-    s->avctx->sample_rate = s->samplerate;
-
-    skip_bits(&s->gb, 36); /* total num of samples */
-
-    skip_bits(&s->gb, 64); /* md5 sum */
-    skip_bits(&s->gb, 64); /* md5 sum */
+    s->min_blocksize = get_bits(&gb, 16);
+    s->max_blocksize = get_bits(&gb, 16);
+
+    skip_bits(&gb, 24); /* skip min frame size */
+    s->max_framesize = get_bits_long(&gb, 24);
+
+    s->samplerate = get_bits_long(&gb, 20);
+    s->channels = get_bits(&gb, 3) + 1;
+    s->bps = get_bits(&gb, 5) + 1;
+
+    avctx->channels = s->channels;
+    avctx->sample_rate = s->samplerate;
+
+    skip_bits(&gb, 36); /* total num of samples */
+
+    skip_bits(&gb, 64); /* md5 sum */
+    skip_bits(&gb, 64); /* md5 sum */

     dump_headers(s);
 }
@@ -193,9 +197,8 @@
             if (metadata_size) {
                 switch (metadata_type) {
                 case METADATA_TYPE_STREAMINFO:
-                    metadata_streaminfo(s);
+                    metadata_streaminfo(s->avctx, s, s->gb.buffer+get_bits_count(&s->gb)/8);
                     streaminfo_updated = 1;
-                    break;

                 default:
                     for (i=0; i<metadata_size; i++)


Support decoding of sample_g726.asf.

Support decoding of sample_g726.asf.

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

--- libavcodec/g726.c
+++ libavcodec/g726.c
@@ -266,11 +266,11 @@
     return av_clip(re_signal << 2, -0xffff, 0xffff);
 }

-static av_cold int g726_reset(G726Context* c, int bit_rate)
+static av_cold int g726_reset(G726Context* c, int index)
 {
     int i;

-    c->tbls = &G726Tables_pool[bit_rate/8000 - 2];
+    c->tbls = &G726Tables_pool[index];
     for (i=0; i<2; i++) {
         i2f(0, &c->sr[i]);
         c->a[i] = 0;
@@ -322,6 +322,7 @@
 static av_cold int g726_init(AVCodecContext * avctx)
 {
     AVG726Context* c = (AVG726Context*)avctx->priv_data;
+    unsigned int index= (avctx->bit_rate + avctx->sample_rate/2) / avctx->sample_rate - 2;

     if (avctx->channels != 1 ||
         (avctx->bit_rate != 16000 && avctx->bit_rate != 24000 &&
@@ -333,7 +334,7 @@
         av_log(avctx, AV_LOG_ERROR, "G726: unsupported audio format\n");
         return -1;
     }
-    g726_reset(&c->c, avctx->bit_rate);
+    g726_reset(&c->c, index);
     c->code_size = c->c.tbls->bits;
     c->bit_buffer = 0;
     c->bits_left = 0;


Remove CONFIG_H264_ENCODER references

Remove CONFIG_H264_ENCODER references

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


cosmetics: spelling/grammar

cosmetics: spelling/grammar

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

--- libavcodec/snow.c
+++ libavcodec/snow.c
@@ -406,7 +406,7 @@
     int stride;
     int width;
     int height;
-    int qlog;                                   ///< log(qscale)/log[2^(1/6)]
+    int qlog;        ///< log(qscale)/log[2^(1/6)]
     DWTELEM *buf;
     IDWTELEM *ibuf;
     int buf_x_offset;
@@ -433,7 +433,7 @@
 }Plane;

 typedef struct SnowContext{
-//    MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to make the motion estimation eventually independent of MpegEncContext, so this will be removed then (FIXME/XXX)
+//    MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to eventually make the motion estimation independent of MpegEncContext, so this will be removed then (FIXME/XXX)

     AVCodecContext *avctx;
     RangeCoder c;
@@ -487,7 +487,7 @@
     int me_cache_generation;
     slice_buffer sb;

-    MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to make the motion estimation eventually independent of MpegEncContext, so this will be removed then (FIXME/XXX)
+    MpegEncContext m; // needed for motion estimation, should not be used for anything else, the idea is to eventually make the motion estimation independent of MpegEncContext, so this will be removed then (FIXME/XXX)
 }SnowContext;

 typedef struct {
@@ -2416,7 +2416,7 @@
     }
 }

-//FIXME name clenup (b_w, block_w, b_width stuff)
+//FIXME name cleanup (b_w, block_w, b_width stuff)
 static av_always_inline void add_yblock(SnowContext *s, int sliced, slice_buffer *sb, IDWTELEM *dst, uint8_t *dst8, const uint8_t *obmc, int src_x, int src_y, int b_w, int b_h, int w, int h, int dst_stride, int src_stride, int obmc_stride, int b_x, int b_y, int add, int offset_dst, int plane_index){
     const int b_width = s->b_width  << s->block_max_depth;
     const int b_height= s->b_height << s->block_max_depth;
@@ -2446,7 +2446,7 @@
         rb= rt;
     }

-    if(src_x<0){ //FIXME merge with prev & always round internal width upto *16
+    if(src_x<0){ //FIXME merge with prev & always round internal width up to *16
         obmc -= src_x;
         b_w += src_x;
         if(!sliced && !offset_dst)
@@ -2730,12 +2730,12 @@
                 if(x<0) obmc_v += obmc[index + block_w];
                 if(y+block_w>h) obmc_v += obmc[index - block_w*obmc_stride];
                 if(x+block_w>w) obmc_v += obmc[index - block_w];
-                //FIXME precalc this or simplify it somehow else
+                //FIXME precalculate this or simplify it somehow else

                 d = -dst[index] + (1<<(FRAC_BITS-1));
                 dst[index] = d;
                 ab += (src[x2 + y2*ref_stride] - (d>>FRAC_BITS)) * obmc_v;
-                aa += obmc_v * obmc_v; //FIXME precalclate this
+                aa += obmc_v * obmc_v; //FIXME precalculate this
             }
         }
     }
@@ -2767,7 +2767,7 @@
 00001XXXX   15-30   8-15
 */
 //FIXME try accurate rate
-//FIXME intra and inter predictors if surrounding blocks arent the same type
+//FIXME intra and inter predictors if surrounding blocks are not the same type
     if(b->type & BLOCK_INTRA){
         return 3+2*( av_log2(2*FFABS(left->color[0] - b->color[0]))
                    + av_log2(2*FFABS(left->color[1] - b->color[1]))
@@ -2846,10 +2846,10 @@
     if(block_w==16){
         /* FIXME rearrange dsputil to fit 32x32 cmp functions */
         /* FIXME check alignment of the cmp wavelet vs the encoding wavelet */
-        /* FIXME cmps overlap but don't cover the wavelet's whole support,
-         * so improving the score of one block is not strictly guaranteed to
-         * improve the score of the whole frame, so iterative motion est
-         * doesn't always converge. */
+        /* FIXME cmps overlap but do not cover the wavelet's whole support.
+         * So improving the score of one block is not strictly guaranteed
+         * to improve the score of the whole frame, thus iterative motion
+         * estimation does not always converge. */
         if(s->avctx->me_cmp == FF_CMP_W97)
             distortion = w97_32_c(&s->m, src + sx + sy*ref_stride, dst + sx + sy*ref_stride, ref_stride, 32);
         else if(s->avctx->me_cmp == FF_CMP_W53)
@@ -2982,7 +2982,8 @@
     }
 }

-/* special case for int[2] args we discard afterward, fixes compilation prob with gcc 2.95 */
+/* special case for int[2] args we discard afterwards,
+ * fixes compilation problem with gcc 2.95 */
 static av_always_inline int check_block_inter(SnowContext *s, int mb_x, int mb_y, int p0, int p1, const uint8_t *obmc_edged, int *best_rd){
     int p[2] = {p0, p1};
     return check_block(s, mb_x, mb_y, p, 0, obmc_edged, best_rd);
@@ -3074,7 +3075,7 @@
                     memset(s->me_cache, 0, sizeof(s->me_cache));
                 s->me_cache_generation += 1<<22;

-                //FIXME precalc
+                //FIXME precalculate
                 {
                     int x, y;
                     memcpy(obmc_edged, obmc_tab[s->block_max_depth], b_w*b_w*4);
@@ -3157,7 +3158,7 @@
                         check_block_inter(s, mb_x, mb_y, mvr[b_stride][0], mvr[b_stride][1], *obmc_edged, &best_rd);

                     /* fullpel ME */
-                    //FIXME avoid subpel interpol / round to nearest integer
+                    //FIXME avoid subpel interpolation / round to nearest integer
                     do{
                         dia_change=0;
                         for(i=0; i<FFMAX(s->avctx->dia_size, 1); i++){
@@ -3700,7 +3701,7 @@
     height= s->avctx->height;

     s->spatial_idwt_buffer= av_mallocz(width*height*sizeof(IDWTELEM));
-    s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME this doesnt belong here
+    s->spatial_dwt_buffer= av_mallocz(width*height*sizeof(DWTELEM)); //FIXME this does not belong here

     for(i=0; i<MAX_REF_FRAMES; i++)
         for(j=0; j<MAX_REF_FRAMES; j++)
@@ -3771,7 +3772,7 @@

 static int ratecontrol_1pass(SnowContext *s, AVFrame *pict)
 {
-    /* estimate the frame's complexity as a sum of weighted dwt coefs.
+    /* Estimate the frame's complexity as a sum of weighted dwt coefficients.
      * FIXME we know exact mv bits at this point,
      * but ratecontrol isn't set up to include them. */
     uint32_t coef_sum= 0;
@@ -3864,7 +3865,7 @@
     if(orientation&2)
         yo= step>>1;

-    //FIXME bias for non zero ?
+    //FIXME bias for nonzero ?
     //FIXME optimize
     memset(score, 0, sizeof(*score)*score_stride*((p->height + Q2_STEP-1)/Q2_STEP));
     for(y=0; y<p->height; y++){
@@ -3912,7 +3913,7 @@
             SubBand *b= &p->band[level][orientation];
             IDWTELEM *dst= best_dequant + (b->ibuf - s->spatial_idwt_buffer);
              DWTELEM *src=       buffer + (b-> buf - s->spatial_dwt_buffer);
-            assert(src == b->buf); // code doesnt depen on this but its true currently
+            assert(src == b->buf); // code does not depend on this but it is true currently

             quantize(s, b, dst, src, b->stride, s->qbias);
         }
@@ -3937,7 +3938,7 @@
                             for(x=xs; x<b->width; x+= Q2_STEP){
                                 if(dst[x + y*b->stride]<0) dst[x + y*b->stride]++;
                                 if(dst[x + y*b->stride]>0) dst[x + y*b->stride]--;
-                                //FIXME try more then just --
+                                //FIXME try more than just --
                             }
                         }
                         dequantize_all(s, p, idwt2_buffer, width, height);
@@ -3959,7 +3960,7 @@
             }
         }
     }
-    memcpy(s->spatial_idwt_buffer, best_dequant, height * stride * sizeof(IDWTELEM)); //FIXME work with that directly insteda of copy at the end
+    memcpy(s->spatial_idwt_buffer, best_dequant, height * stride * sizeof(IDWTELEM)); //FIXME work with that directly instead of copy at the end
 }

 #endif /* QUANTIZE2==1 */
@@ -3970,15 +3971,15 @@
     int plane_index;

     if(avctx->strict_std_compliance > FF_COMPLIANCE_EXPERIMENTAL){
-        av_log(avctx, AV_LOG_ERROR, "this codec is under development, files encoded with it may not be decodable with future versions!!!\n"
-               "use vstrict=-2 / -strict -2 to use it anyway\n");
+        av_log(avctx, AV_LOG_ERROR, "This codec is under development, files encoded with it may not be decodable with future versions!!!\n"
+               "Use vstrict=-2 / -strict -2 to use it anyway.\n");
         return -1;
     }

     if(avctx->prediction_method == DWT_97
        && (avctx->flags & CODEC_FLAG_QSCALE)
        && avctx->global_quality == 0){
-        av_log(avctx, AV_LOG_ERROR, "the 9/7 wavelet is incompatible with lossless mode\n");
+        av_log(avctx, AV_LOG_ERROR, "The 9/7 wavelet is incompatible with lossless mode.\n");
         return -1;
     }

@@ -4197,7 +4198,7 @@
     if(s->qlog < 0 || (!pict->quality && (avctx->flags & CODEC_FLAG_QSCALE))){
         s->qlog= LOSSLESS_QLOG;
         s->lambda = 0;
-    }//else keep previous frame's qlog until after motion est
+    }//else keep previous frame's qlog until after motion estimation

     frame_start(s);

@@ -4508,7 +4509,7 @@
     if(!s->block) alloc_blocks(s);

     frame_start(s);
-    //keyframe flag dupliaction mess FIXME
+    //keyframe flag duplication mess FIXME
     if(avctx->debug&FF_DEBUG_PICT_INFO)
         av_log(avctx, AV_LOG_ERROR, "keyframe:%d qlog:%d\n", s->keyframe, s->qlog);


Decrease returning probe score for WAV demuxer to avoid
probe conflict between WAV and future ACT demuxer.
This is necessary because ACT has standard WAV header
at top of it's own.

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

--- libavformat/wav.c
+++ libavformat/wav.c
@@ -145,7 +145,12 @@
         p->buf[2] == 'F' && p->buf[3] == 'F' &&
         p->buf[8] == 'W' && p->buf[9] == 'A' &&
         p->buf[10] == 'V' && p->buf[11] == 'E')
-        return AVPROBE_SCORE_MAX;
+        /*
+          Since ACT demuxer has standard WAV header at top of it's own,
+          returning score is decreased to avoid probe conflict
+          between ACT and WAV.
+        */
+        return AVPROBE_SCORE_MAX - 1;
     else
         return 0;
 }


lua_getfenv()/lua_setfenv() are called lua_getuservalue()/lua_setuservalue() from 5.2 onwards

--- libextl/luaextl.c
+++ libextl/luaextl.c
@@ -53,6 +53,10 @@
 #define flushtrace()
 #endif

+#if LUA_VERSION_NUM<502
+#define lua_getuservalue lua_getfenv
+#define lua_setuservalue lua_setfenv
+#endif

 /*{{{ Safer rawget/set/getn */

@@ -1649,7 +1653,7 @@
     lua_pushvalue(st, lua_upvalueindex(1));

     /* Fill 'arg' */
-    lua_getfenv(st, -1);
+    lua_getuservalue(st, -1);
     lua_pushstring(st, "arg");

     if(nargs>0){
@@ -1695,14 +1699,14 @@
     /* Now there's fn, newenv in stack */
     lua_newtable(st); /* Create metatable */
     lua_pushstring(st, "__index");
-    lua_getfenv(st, -4); /* Get old environment */
+    lua_getuservalue(st, -4); /* Get old environment */
     lua_rawset_check(st, -3); /* Set metatable.__index */
     lua_pushstring(st, "__newindex");
-    lua_getfenv(st, -4); /* Get old environment */
+    lua_getuservalue(st, -4); /* Get old environment */
     lua_rawset_check(st, -3); /* Set metatable.__newindex */
     /* Now there's fn, newenv, meta in stack */
     lua_setmetatable(st, -2); /* Set metatable for new environment */
-    lua_setfenv(st, -2);
+    lua_setuservalue(st, -2);
     /* Now there should be just fn in stack */

     /* Callloaded will put any parameters it gets in the table 'arg' in


I still need to work on this header.
I need to make sure the right thing is in the header and the right thing is in
the main file.

git-svn-id: 40dd595c6684d839db675001a64203a1457e7319@2237 67ed7778-7388-44ab-90cf-0a291f65f57c


nodes: simplify node_set_ctx() logic

nodes: simplify node_set_ctx() logic

--- libnodegl/nodes.c
+++ libnodegl/nodes.c
@@ -260,13 +260,9 @@
     int ret;

     if (ctx) {
-        if (node->ctx) {
-            if (node->ctx != ctx) {
-                LOG(ERROR, "\"%s\" is associated with another rendering context", node->name);
-                return -1;
-            }
-        } else {
-            node->ctx = ctx;
+        if (node->ctx && node->ctx != ctx) {
+            LOG(ERROR, "\"%s\" is associated with another rendering context", node->name);
+            return -1;
         }
     } else {
         node_uninit(node);
@@ -277,8 +273,10 @@
         (ret = node_set_children_ctx((uint8_t *)node, ngli_base_node_params, ctx)) < 0)
         return ret;

-    if (node->ctx)
+    if (ctx) {
+        node->ctx = ctx;
         return ngli_node_init(node);
+    }

     return 0;
 }


unused var removed

unused var removed

--- libs/characters.c
+++ libs/characters.c
@@ -28,7 +28,6 @@

 void enemy(char *ene, chara *bad, char *ename, int enN){
     char ch[78];
-    int n =0;
     char file_name[25];
     int aux =rand()%enN;
     char eList[10];


minor cleanup

minor cleanup

--- libs/kernel/vfs.c
+++ libs/kernel/vfs.c
@@ -1,8 +1,8 @@
 #include <fudge/kernel.h>
 #include "vfs.h"

+static struct list backends;
 static struct list protocols;
-static struct list backends;

 unsigned int vfs_findnext(unsigned int count, const char *path)
 {
@@ -107,8 +107,8 @@
 void vfs_setup()
 {

+    list_init(&backends);
     list_init(&protocols);
-    list_init(&backends);

 }


added set_locale.

added set_locale.

git-svn-id: 4b6d41e9940b00d32d826e7d279a79f5b8ae3021@124 459513c6-d918-8e31-8e7a-abb81885386f


PROGRESS

PROGRESS

--- food/src/linkedlist.c
+++ food/src/linkedlist.c
@@ -1,93 +1,86 @@
-#include <stdlib.h>
+#include <stdlib.h>
 #include <stdio.h>
 #include <string.h>

 Food * createRecord(char * name, char * group, int calories, char theType)
 {

-
-    /**
-     * createRecord
-     * Allocates memory for a food struct, and initalizes it's members to the
-     * supplied parameters.
-     * ->next is set to NULL.
-     * The value for name and group are copied into new memory, the passed in
-     * strings should be destroyed
-     * Returned record should be destroyed with destroyRecord()
-     * @param  name     String (<50 length)
-     * @param  group    String (<50 length)
-     * @param  calories int (>0)
-     * @param  theType  char (h for healthy, or j for junk)
-     * @return          Food* to malloc'd memory
-     *                  NULL on failure
-     */
-
     Food * temp = malloc(sizeof(Food));
-    temp->name = name;
-    temp->group = group;
+    temp->name = malloc(sizeof(char)*50);
+    temp->group = malloc(sizeof(char)*50);
     temp->calories = calories;
     temp->theType = theType;
     temp->next = NULL;

-    if(Food * temp == NULL)
+    if(temp == NULL || temp->name == NULL || temp->group == NULL)
     {
-        reutrn NULL;
+        return NULL;
     }
-    else
-    {
-        return temp;
-    }
+
+    return temp;
+
 }

 char * printRecord(Food * toPrint)
 {

-/**
- * printRecord
- * Returns allocated memory containing a string filled with Food data in the
- * following format:
- * Name (Food Group):calories[type]
- * Note: The string should not contain a newline.
- * The string memory is allocated in this function and must be freed by the
- * caller.
- * @param  toPrint Food* (not NULL)
- * @return         char* to malloc'd memory
- *                 NULL on failure
- */
+    /**
+     * printRecord
+     * Returns allocated memory containing a string filled with Food data in the
+     * following format:
+     * Name (Food Group):calories[type]
+     * Note: The string should not contain a newline.
+     * The string memory is allocated in this function and must be freed by the
+     * caller.
+     * @param  toPrint Food* (not NULL)
+     * @return         char* to malloc'd memory
+     *                 NULL on failure
+     */

 }

 void destroyRecord(Food * toDie)
 {

-/**
- * destroyRecord
- * Frees memory associated with a Food* record
- * Note: This function also frees the internal variables
- * @param toDie Address to memory that should be freed (not NULL)
- */
+    /**
+     * destroyRecord
+     * Frees memory associated with a Food* record
+     * Note: This function also frees the internal variables
+     * @param toDie Address to memory that should be freed (not NULL)
+     */

 }

 Food * addToFront(Food * theList, Food * toBeAdded)
 {
+    if(!isEmpty(theList))
+    {
+        toBeAdded->next = theList;
+    }

-/**
- * addToBack
- * Takes a pointer to the head of the list, and a created Food* record
- * Adds record to the tail of the list
- * In the event theList is NULL, it's assumed that the list is empty
- * and toBeAdded becomes a new list with one element
- * Returns the head of the list after the operation is performed
- * @param  theList   Food* representing the head of the list
- * @param  toBeAdded Food* to add to the front of the list
- * @return           Food* new head of the list
- */
-
+    return toBeAdded;
 }

 Food * addToBack(Food * theList, Food * toBeAdded)
 {
+
+    Food * temp;
+    temp = theList;
+
+    if(isEmpty(theList))
+    {
+        return toBeAdded;
+    }
+
+    while(temp->next != NULL)
+    {
+        temp = temp->next;
+    }
+
+    temp->next = ToBeAdded;
+    temp->next->next = NULL;
+
+    return theList;

 }

@@ -103,84 +96,84 @@
 Food * removeFromBack(Food * theList)
 {

-/**
- * removeFromBack
- * Takes a pointer to the head of the list. Removes the front
- * item from the list. Does not free the memory for
- * the item removed. You will need to have previously gotten it
- * with getFirstItem, so that you can free it after removal.
- * @param  theList Food* representing the head of the list
- * @return         Food* new head of the list
- */
+    /**
+     * removeFromBack
+     * Takes a pointer to the head of the list. Removes the front
+     * item from the list. Does not free the memory for
+     * the item removed. You will need to have previously gotten it
+     * with getFirstItem, so that you can free it after removal.
+     * @param  theList Food* representing the head of the list
+     * @return         Food* new head of the list
+     */

 }

 Food * getLastItem(Food * theList)
 {
-/**
- * getLastItem
- * Takes a pointer to the head of the list. Returns the last item in the list.
- * Does not remove the item from the list. Do not destroy the record until
- * it is removed from the list.
- * @param  theList Food* representing the head of the list
- * @return         Food* last item in the list.
- */
+    /**
+     * getLastItem
+     * Takes a pointer to the head of the list. Returns the last item in the list.
+     * Does not remove the item from the list. Do not destroy the record until
+     * it is removed from the list.
+     * @param  theList Food* representing the head of the list
+     * @return         Food* last item in the list.
+     */
 }

 Food * getFirstItem(Food * theList)
 {

-/**
- * getFirstItem
- * Takes a pointer to the head of the list. Returns the first item in the list.
- * Does not remove the item from the list. Do not destroy the record until
- * it is removed from the list.
- * @param  theList Food* representing the head of the list
- * @return         Food* first item in the list.
- */
+    /**
+     * getFirstItem
+     * Takes a pointer to the head of the list. Returns the first item in the list.
+     * Does not remove the item from the list. Do not destroy the record until
+     * it is removed from the list.
+     * @param  theList Food* representing the head of the list
+     * @return         Food* first item in the list.
+     */

 }

 int isEmpty(Food * theList)
 {

-/**
- * isEmpty
- * Takes a pointer to a list, and checks if it's empty
- * @param  theList Food* representing the head of the list
- * @return         1 if list is empty
- *                 0 if list has elements
- */
+    /**
+     * isEmpty
+     * Takes a pointer to a list, and checks if it's empty
+     * @param  theList Food* representing the head of the list
+     * @return         1 if list is empty
+     *                 0 if list has elements
+     */

 }

 void printList(Food * theList)
 {

-/**
- * printList
- * Takes a pointer to the head of the list. Prints each element to stdout,
- * following the format specified for printRecord seperated by newlines.
- * @param theList Food* representing head of the list
- */
+    /**
+     * printList
+     * Takes a pointer to the head of the list. Prints each element to stdout,
+     * following the format specified for printRecord seperated by newlines.
+     * @param theList Food* representing head of the list
+     */

 }

 void destroyList(Food * theList)
 {

- Food * temp;
- while(head != NULL)
- {
- 	temp = head;
- 	head = head->next;
- 	free(temp->name);
- 	free(temp->group);
- 	free(temp->calories);
- 	free(temp->theType);
- 	free(temp);
- }
- return NULL;
- printf("list has been destroyed\n");
+    Food * temp;
+    while(head != NULL)
+    {
+        temp = head;
+        head = head->next;
+        free(temp->name);
+        free(temp->group);
+        free(temp->calories);
+        free(temp->theType);
+        free(temp);
+    }
+    return NULL;
+    printf("list has been destroyed\n");

 }


Don't segfault wlr_keyboard when no xkb state

--- types/wlr_keyboard.c
+++ types/wlr_keyboard.c
@@ -48,6 +48,9 @@
 void wlr_keyboard_notify_modifiers(struct wlr_keyboard *keyboard,
 		uint32_t mods_depressed, uint32_t mods_latched, uint32_t mods_locked,
 		uint32_t group) {
+	if (!keyboard->xkb_state) {
+		return;
+	}
 	xkb_state_update_mask(keyboard->xkb_state, mods_depressed, mods_latched,
 		mods_locked, 0, 0, group);
 	keyboard_modifier_update(keyboard);
@@ -55,6 +58,9 @@

 void wlr_keyboard_notify_key(struct wlr_keyboard *keyboard,
 		struct wlr_event_keyboard_key *event) {
+	if (!keyboard->xkb_state) {
+		return;
+	}
 	if (event->update_state) {
 		uint32_t keycode = event->keycode + 8;
 		xkb_state_update_key(keyboard->xkb_state, keycode,


Use exceptions to report errors

Use exceptions to report errors

--- test/CmdLineQt.h
+++ test/CmdLineQt.h
@@ -16,10 +16,9 @@
 template <>
 struct Parser<QString>
 {
-    bool operator()(StringRef /*name*/, StringRef arg, size_t /*i*/, QString& value) const
+    void operator()(StringRef /*name*/, StringRef arg, size_t /*i*/, QString& value) const
     {
         value.fromUtf8(arg.data(), arg.size());
-        return true;
     }
 };
 #endif
@@ -28,10 +27,15 @@
 template <>
 struct Parser<QUrl>
 {
-    bool operator()(StringRef /*name*/, StringRef arg, size_t /*i*/, QUrl& value) const
+    void operator()(StringRef /*name*/, StringRef arg, size_t /*i*/, QUrl& value) const
     {
-        value.setEncodedUrl(QByteArray(arg.data(), arg.size()), QUrl::StrictMode);
-        return value.isValid();
+        value.setUrl(QString::fromUtf8(arg.data(), arg.size()), QUrl::StrictMode);
+
+        if (!value.isValid())
+        {
+            throw std::runtime_error("invalid argument '" + arg + "' for option '" + name + "'"
+                + " not a valid URL");
+        }
     }
 };
 #endif


UefiCpuPkg/CpuDxe: fix SetMemoryAttributes issue in 32-bit mode

In 32-bit mode, the BIOS will not create page table for memory beyond
4GB and therefore it cannot handle the attributes change request for
those memory. But current CpuDxe doesn't check this situation and still
try to complete the request, which will cause attributes of incorrect
memory address to be changed due to type cast from 64-bit to 32-bit.

This patch fixes this issue by checking the end address of input
memory block and returning EFI_UNSUPPORTED if it's out of range.

Cc: Eric Dong <fa9eeec52367040ac98013bc4b2913db170588f8@intel.com>
Cc: Laszlo Ersek <7437296077edea1cb64451c122c4dac071f0cfbc@redhat.com>
Cc: Ruiyu Ni <9fa3a6894a36bca79e6a72ad65af5a5702efecd1@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Jian J Wang <01d7c53c587e21672fb6c249cfdc88bbd3aecc19@intel.com>
Reviewed-by: Ruiyu Ni <9fa3a6894a36bca79e6a72ad65af5a5702efecd1@intel.com>

--- UefiCpuPkg/CpuDxe/CpuPageTable.c
+++ UefiCpuPkg/CpuDxe/CpuPageTable.c
@@ -697,6 +697,10 @@
     }
     if ((CurrentPagingContext.ContextData.Ia32.Attributes & PAGE_TABLE_LIB_PAGING_CONTEXT_IA32_X64_ATTRIBUTES_PAE) == 0) {
       DEBUG ((DEBUG_ERROR, "Non-PAE Paging!\n"));
+      return EFI_UNSUPPORTED;
+    }
+    if ((BaseAddress + Length) > BASE_4GB) {
+      DEBUG ((DEBUG_ERROR, "Beyond 4GB memory in 32-bit mode!\n"));
       return EFI_UNSUPPORTED;
     }
     break;


Add necessary macro definitions in PalCallLib.h of MdePkg.

git-svn-id: 5648d1bec6962b0a6d1d1b40eba8cf5cdb62da3d@3229 6f19259b-4bc3-4df7-8a09-765794883524

--- MdePkg/Include/Library/PalCallLib.h
+++ MdePkg/Include/Library/PalCallLib.h
@@ -15,6 +15,8 @@

 #ifndef __PAL_CALL_LIB_H__
 #define __PAL_CALL_LIB_H__
+
+#define PAL_SUCCESS             0x0

 //
 // CacheType of PAL_CACHE_FLUSH.
@@ -28,8 +30,10 @@
 //
 // Bitmask of Opearation of PAL_CACHE_FLUSH.
 //
-#define PAL_CACHE_FLUSH_INVIDED_LINES     BIT0
-#define PAL_CACHE_FLUSH_PROBE_INTERRUPT   BIT1
+#define PAL_CACHE_FLUSH_INVALIDATE_LINES     BIT0
+#define PAL_CACHE_FLUSH_NO_INVALIDATE_LINES  0
+#define PAL_CACHE_FLUSH_POLL_INTERRUPT       BIT1
+#define PAL_CACHE_FLUSH_NO_INTERRUPT       0

 /**

@@ -185,6 +189,13 @@
 #define PAL_CACHE_INIT_ALL  0xffffffffffffffffULL

 //
+// CacheType
+//
+#define PAL_CACHE_INIT_TYPE_INSTRUCTION                 0x1
+#define PAL_CACHE_INIT_TYPE_DATA                        0x2
+#define PAL_CACHE_INIT_TYPE_INSTRUCTION_AND_DATA        0x3
+
+//
 // Restrict of PAL_CACHE_INIT.
 //
 #define PAL_CACHE_INIT_NO_RESTRICT  0
@@ -1315,6 +1326,9 @@

 **/
 #define PAL_PERF_MON_INFO 15
+
+#define PAL_PLATFORM_ADDR_INTERRUPT_BLOCK_TOKEN                       0x0
+#define PAL_PLATFORM_ADDR_IO_BLOCK_TOKEN                              0x1

 /**


Reworking pthreads affinity setting to use the proper thread id. (#7955)

--- iree/base/internal/threading_pthreads.c
+++ iree/base/internal/threading_pthreads.c
@@ -300,17 +300,21 @@
   if (!affinity.specified) return;
   IREE_TRACE_ZONE_BEGIN(z0);

-  // NOTE: Android uses Linux lightweight processes (LWP) for threads, so the
-  // pid is really the tid. This is *not* anything related to pthreads_self.
-  pid_t tid = gettid();
-
   cpu_set_t cpu_set;
   CPU_ZERO(&cpu_set);
   CPU_SET(affinity.id, &cpu_set);
   if (affinity.smt) {
     CPU_SET(affinity.id + 1, &cpu_set);
   }
+
+#if defined(IREE_PLATFORM_ANDROID)
+  // Android doesn't have pthread_setaffinity_np but that's usually just
+  // implemented as this sequence anyway:
+  pid_t tid = pthread_gettid_np(thread->handle);
   sched_setaffinity(tid, sizeof(cpu_set), &cpu_set);
+#else
+  pthread_setaffinity_np(thread->handle, sizeof(cpu_set), &cpu_set);
+#endif  // IREE_PLATFORM_ANDROID

   IREE_TRACE_ZONE_END(z0);
 }


fix with php://input from master

fix with php://input from master

--- php_http_env.c
+++ php_http_env.c
@@ -229,36 +229,37 @@
 PHP_HTTP_API php_http_message_body_t *php_http_env_get_request_body(TSRMLS_D)
 {
 	if (!PHP_HTTP_G->env.request.body) {
-		php_stream *s = NULL;
-
+		php_stream *s = php_stream_temp_new();
+#if PHP_VERSION_ID >= 50600
+		php_stream *input = php_stream_open_wrapper("php://input", "r", 0, NULL);
+
+		/* php://input does not support stat */
+		php_stream_copy_to_stream(input, s, -1);
+		php_stream_close(input);
+#else
 		if (SG(request_info).post_data || SG(request_info).raw_post_data) {
-			if ((s = php_stream_temp_new())) {
-				/* php://input does not support seek() */
-				if (SG(request_info).raw_post_data) {
-					php_stream_write(s, SG(request_info).raw_post_data, SG(request_info).raw_post_data_length);
-				} else {
-					php_stream_write(s, SG(request_info).post_data, SG(request_info).post_data_length);
-				}
-				php_stream_rewind(s);
+			/* php://input does not support seek() in PHP <= 5.5 */
+			if (SG(request_info).raw_post_data) {
+				php_stream_write(s, SG(request_info).raw_post_data, SG(request_info).raw_post_data_length);
+			} else {
+				php_stream_write(s, SG(request_info).post_data, SG(request_info).post_data_length);
 			}
 		} else if (sapi_module.read_post && !SG(read_post_bytes)) {
-			if ((s = php_stream_temp_new())) {
-				char *buf = emalloc(4096);
-				int len;
-
-				while (0 < (len = sapi_module.read_post(buf, 4096 TSRMLS_CC))) {
-					SG(read_post_bytes) += len;
-					php_stream_write(s, buf, len);
-
-					if (len < 4096) {
-						break;
-					}
+			char *buf = emalloc(4096);
+			int len;
+
+			while (0 < (len = sapi_module.read_post(buf, 4096 TSRMLS_CC))) {
+				SG(read_post_bytes) += len;
+				php_stream_write(s, buf, len);
+
+				if (len < 4096) {
+					break;
 				}
-				efree(buf);
-
-				php_stream_rewind(s);
 			}
-		}
+			efree(buf);
+		}
+#endif
+		php_stream_rewind(s);
 		PHP_HTTP_G->env.request.body = php_http_message_body_init(NULL, s TSRMLS_CC);
 	}

@@ -962,14 +963,30 @@

 static SAPI_POST_HANDLER_FUNC(php_http_json_post_handler)
 {
-	if (SG(request_info).raw_post_data) {
-		zval *zarg = arg;
+	zval *zarg = arg;
+	char *json_str = NULL;
+	size_t json_len = 0;
+
+#if PHP_VERSION_ID >= 50600
+	php_http_message_body_to_string(php_http_env_get_request_body(TSRMLS_C),
+			&json_str, &json_len, 0, -1 TSRMLS_CC);
+#else
+	json_str = SG(request_info).raw_post_data;
+	json_len = SG(request_info).raw_post_data_length;
+#endif
+
+	if (json_len) {
 		zval_dtor(zarg);
 		ZVAL_NULL(zarg);
-		php_json_decode(zarg, SG(request_info).raw_post_data, SG(request_info).raw_post_data_length, 1, PG(max_input_nesting_level) TSRMLS_CC);
-		if (Z_TYPE_P(zarg) == IS_NULL) {
-			array_init(zarg);
-		}
+		php_json_decode(zarg, json_str, json_len, 1, PG(max_input_nesting_level) TSRMLS_CC);
+	}
+#if PHP_VERSION_ID >= 50600
+	STR_FREE(json_str);
+#endif
+
+	/* always let $_POST be array() */
+	if (Z_TYPE_P(zarg) == IS_NULL) {
+		array_init(zarg);
 	}
 }


fixed the device id of one of the memory controllers.  they should all work now


Rewrited SD_ioctl method

Rewrited SD_ioctl method

--- Src/sd_io_controller.c
+++ Src/sd_io_controller.c
@@ -166,7 +166,6 @@
 DRESULT SD_ioctl(BYTE lun, BYTE cmd, void *buff)
 {
   DRESULT res = RES_ERROR;
-  SD_CardInfo CardInfo;

   if (Stat & STA_NOINIT) return RES_NOTRDY;

@@ -179,8 +178,8 @@

   /* Get number of sectors on the disk (DWORD) */
   case GET_SECTOR_COUNT :
-    BSP_SD_GetCardInfo(&CardInfo);
-    *(DWORD*)buff = CardInfo.CardCapacity / STORAGE_BLOCK_SIZE;
+    //BSP_SD_GetCardInfo(&CardInfo);
+    *(DWORD*)buff = getPartition().sectorNumber;
     res = RES_OK;
     break;

@@ -245,7 +244,7 @@
 		partitionsStructure.partitions[1].startSector = partitionsStructure.partitions[0].lastSector + 1;
 		partitionsStructure.partitions[1].lastSector = SDCardInfo.CardCapacity / STORAGE_BLOCK_SIZE;
 		partitionsStructure.partitions[1].sectorNumber = partitionsStructure.partitions[1].lastSector - partitionsStructure.partitions[1].startSector;
-		partitionsStructure.currPartitionNumber = 1;
+		partitionsStructure.currPartitionNumber = 0;
 		//-------
 		res = RES_OK;
 	}


Fixed compilation on gcc 4.x after 599448 (HARMONY-2170)

svn path=/harmony/; revision=599488

--- enhanced/drlvm/trunk/vm/jitrino/src/optimizer/LoopUtils.h
+++ enhanced/drlvm/trunk/vm/jitrino/src/optimizer/LoopUtils.h
@@ -78,6 +78,7 @@
 protected:
     OpndLoopInfo(InductionDetector* id, SsaOpnd* opnd):
          mainOpnd(opnd), inductionDetector(id) {};
+    virtual ~OpndLoopInfo() {}

     SsaOpnd*            mainOpnd;
     InductionDetector*  inductionDetector;
@@ -166,6 +167,7 @@
         header(NULL), isPhiSplit(false) {
         base = (base == NULL) ? this : base;
     }
+    virtual ~InductiveOpndLoopInfo() {}

 private:
     void findBoundInfo();
@@ -194,6 +196,7 @@

 protected:
     InvariantOpndLoopInfo(InductionDetector* id, SsaOpnd* opnd): OpndLoopInfo(id, opnd) {}
+    virtual ~InvariantOpndLoopInfo() {}
 };

 class ConstOpndLoopInfo : public InvariantOpndLoopInfo {
@@ -207,6 +210,7 @@
 protected:
     ConstOpndLoopInfo(InductionDetector* id, SsaOpnd* opnd, int32 val):
         InvariantOpndLoopInfo(id, opnd), value(val) {}
+    virtual ~ConstOpndLoopInfo() {}

 private:
     int32 value;


Declaring some methods constant.

Declaring some methods constant.

--- THijing/AliGenHijing.h
+++ THijing/AliGenHijing.h
@@ -82,8 +82,8 @@

 // Physics Routines
-    virtual Bool_t ProvidesCollisionGeometry() {return kTRUE;}
-    virtual AliCollisionGeometry* CollisionGeometry() {return fCollisionGeometry;}
+    virtual Bool_t ProvidesCollisionGeometry() const {return kTRUE;}
+    virtual AliCollisionGeometry* CollisionGeometry() const {return fCollisionGeometry;}
     virtual void EvaluateCrossSections();
     virtual void Boost();
     virtual TGraph* CrossSection()     {return fDsigmaDb;}


Btrfs: kerneldoc comments for extent_map.c

Add kerneldoc comments for all exported functions.

Signed-off-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>
Signed-off-by: Chris Mason <a169954b4cb1a46cee25f659d3bddfebe02b5fba@oracle.com>

--- fs/btrfs/extent_map.c
+++ fs/btrfs/extent_map.c
@@ -31,6 +31,14 @@
 		kmem_cache_destroy(extent_map_cache);
 }

+/**
+ * extent_map_tree_init - initialize extent map tree
+ * @tree:		tree to initialize
+ * @mask:		flags for memory allocations during tree operations
+ *
+ * Initialize the extent tree @tree.  Should be called for each new inode
+ * or other user of the extent_map interface.
+ */
 void extent_map_tree_init(struct extent_map_tree *tree, gfp_t mask)
 {
 	tree->map.rb_node = NULL;
@@ -39,6 +47,14 @@
 }
 EXPORT_SYMBOL(extent_map_tree_init);

+/**
+ * alloc_extent_map - allocate new extent map structure
+ * @mask:	memory allocation flags
+ *
+ * Allocate a new extent_map structure.  The new structure is
+ * returned with a reference count of one and needs to be
+ * freed using free_extent_map()
+ */
 struct extent_map *alloc_extent_map(gfp_t mask)
 {
 	struct extent_map *em;
@@ -52,6 +68,13 @@
 }
 EXPORT_SYMBOL(alloc_extent_map);

+/**
+ * free_extent_map - drop reference count of an extent_map
+ * @em:		extent map beeing releasead
+ *
+ * Drops the reference out on @em by one and free the structure
+ * if the reference count hits zero.
+ */
 void free_extent_map(struct extent_map *em)
 {
 	if (!em)
@@ -166,10 +189,15 @@
 	return 0;
 }

-/*
- * add_extent_mapping tries a simple forward/backward merge with existing
- * mappings.  The extent_map struct passed in will be inserted into
- * the tree directly (no copies made, just a reference taken).
+/**
+ * add_extent_mapping - add new extent map to the extent tree
+ * @tree:	tree to insert new map in
+ * @em:		map to insert
+ *
+ * Insert @em into @tree or perform a simple forward/backward merge with
+ * existing mappings.  The extent_map struct passed in will be inserted
+ * into the tree directly, with an additional reference taken, or a
+ * reference dropped if the merge attempt was sucessfull.
  */
 int add_extent_mapping(struct extent_map_tree *tree,
 		       struct extent_map *em)
@@ -220,11 +248,16 @@
 	return start + len;
 }

-/*
- * lookup_extent_mapping returns the first extent_map struct in the
- * tree that intersects the [start, len] range.  There may
- * be additional objects in the tree that intersect, so check the object
- * returned carefully to make sure you don't need additional lookups.
+/**
+ * lookup_extent_mapping - lookup extent_map
+ * @tree:	tree to lookup in
+ * @start:	byte offset to start the search
+ * @len:	length of the lookup range
+ *
+ * Find and return the first extent_map struct in @tree that intersects the
+ * [start, len] range.  There may be additional objects in the tree that
+ * intersect, so check the object returned carefully to make sure that no
+ * additional lookups are needed.
  */
 struct extent_map *lookup_extent_mapping(struct extent_map_tree *tree,
 					 u64 start, u64 len)
@@ -273,9 +306,13 @@
 }
 EXPORT_SYMBOL(lookup_extent_mapping);

-/*
- * removes an extent_map struct from the tree.  No reference counts are
- * dropped, and no checks are done to  see if the range is in use
+/**
+ * remove_extent_mapping - removes an extent_map from the extent tree
+ * @tree:	extent tree to remove from
+ * @em:		extent map beeing removed
+ *
+ * Removes @em from @tree.  No reference counts are dropped, and no checks
+ * are done to see if the range is in use
  */
 int remove_extent_mapping(struct extent_map_tree *tree, struct extent_map *em)
 {


[GFS2] Use correct include file in ops_address.c

Something changed in the upstream kernel, and it needs this
one-liner to allow ops_address.c to build.

Signed-off-by: Steven Whitehouse <9801c4ef11586b619a1c43ac9377eea2aee672dd@redhat.com>

--- fs/gfs2/ops_address.c
+++ fs/gfs2/ops_address.c
@@ -20,7 +20,7 @@
 #include <linux/swap.h>
 #include <linux/gfs2_ondisk.h>
 #include <linux/lm_interface.h>
-#include <linux/swap.h>
+#include <linux/backing-dev.h>
 #include <linux/pagevec.h>

 #include "gfs2.h"


[PATCH] NFS4: fix for recursive locking problem

When I was performing some operations on NFS, I got below error on server
side.

  =============================================
  [ INFO: possible recursive locking detected ]
  2.6.19-prep #1
  ---------------------------------------------
  nfsd4/3525 is trying to acquire lock:
   (&inode->i_mutex){--..}, at: [<c0611e5a>] mutex_lock+0x21/0x24

  but task is already holding lock:
   (&inode->i_mutex){--..}, at: [<c0611e5a>] mutex_lock+0x21/0x24

  other info that might help us debug this:
  2 locks held by nfsd4/3525:
   #0:  (client_mutex){--..}, at: [<c0611e5a>] mutex_lock+0x21/0x24
   #1:  (&inode->i_mutex){--..}, at: [<c0611e5a>] mutex_lock+0x21/0x24

  stack backtrace:
   [<c04051ed>] show_trace_log_lvl+0x58/0x16a
   [<c04057fa>] show_trace+0xd/0x10
   [<c0405913>] dump_stack+0x19/0x1b
   [<c043b6f1>] __lock_acquire+0x778/0x99c
   [<c043be86>] lock_acquire+0x4b/0x6d
   [<c0611ceb>] __mutex_lock_slowpath+0xbc/0x20a
   [<c0611e5a>] mutex_lock+0x21/0x24
   [<c047fd7e>] vfs_rmdir+0x76/0xf8
   [<f94b7ce9>] nfsd4_clear_clid_dir+0x2c/0x41 [nfsd]
   [<f94b7de9>] nfsd4_remove_clid_dir+0xb1/0xe8 [nfsd]
   [<f94b307b>] laundromat_main+0x9b/0x1c3 [nfsd]
   [<c04333d6>] run_workqueue+0x7a/0xbb
   [<c0433d0b>] worker_thread+0xd2/0x107
   [<c0436285>] kthread+0xc3/0xf2
   [<c0402005>] kernel_thread_helper+0x5/0xb
  ===================================================================

Cause for this problem was,2 successive mutex_lock calls on 2 diffrent inodes ,as shown below

	static int
	nfsd4_clear_clid_dir(struct dentry *dir, struct dentry *dentry)
	{
	        int status;

	        /* For now this directory should already be empty, but we empty it of
        	 * any regular files anyway, just in case the directory was created by
	         * a kernel from the future.... */
        	nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file);
	        mutex_lock(&dir->d_inode->i_mutex);
	        status = vfs_rmdir(dir->d_inode, dentry);
	...

	int vfs_rmdir(struct inode *dir, struct dentry *dentry)
	{
	        int error = may_delete(dir, dentry, 1);

	        if (error)
	                return error;

	        if (!dir->i_op || !dir->i_op->rmdir)
        	        return -EPERM;

	        DQUOT_INIT(dir);

	        mutex_lock(&dentry->d_inode->i_mutex);
	...

So I have developed the patch to overcome this problem.

Signed-off-by: Srinivasa DS <832681e67afd861cc9e5b0d13774eead4869330b@in.ibm.com>
Cc: Neil Brown <1c00aa603bb92d594c03cff60ecf8e63b2a5bcb1@suse.de>
Cc: Peter Zijlstra <645ca7d3a8d3d4f60557176cd361ea8351edc32b@chello.nl>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- fs/nfsd/nfs4recover.c
+++ fs/nfsd/nfs4recover.c
@@ -274,7 +274,7 @@
 	 * any regular files anyway, just in case the directory was created by
 	 * a kernel from the future.... */
 	nfsd4_list_rec_dir(dentry, nfsd4_remove_clid_file);
-	mutex_lock(&dir->d_inode->i_mutex);
+	mutex_lock_nested(&dir->d_inode->i_mutex, I_MUTEX_PARENT);
 	status = vfs_rmdir(dir->d_inode, dentry);
 	mutex_unlock(&dir->d_inode->i_mutex);
 	return status;


ocfs2: framework for version LVB

ocfs2: framework for version LVB

Use the native DLM locks for version control negotiation.  Most of the
framework is taken from gfs2/lock_dlm.c

Signed-off-by: Goldwyn Rodrigues <c9a1f5b69e66eac203c1a3ccc3e06e47e8b65275@suse.com>
Reviewed-by: Mark Fasheh <8f0bc92cac940f3e83deb53ced7a1f201bce5732@suse.de>
Cc: Joel Becker <9d3d88cacb47f143c6cf36b9a61c09b528b2c49a@evilplan.org>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@linux-foundation.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@linux-foundation.org>


xfs: use xfs_ioerror_alert in xfs_buf_iodone_callbacks

Use xfs_ioerror_alert instead of opencoding a very similar error
message.

Signed-off-by: Christoph Hellwig <923f7720577207a44b32e59bbfbea59d27f1ae8e@lst.de>
Reviewed-by: Dave Chinner <4d9e23a041ac966f5316a7481300d4ae12e806fe@redhat.com>
Signed-off-by: Alex Elder <f556392d917047d964350b9c68912016c96d5e94@sgi.com>

--- fs/xfs/xfs_buf_item.c
+++ fs/xfs/xfs_buf_item.c
@@ -975,9 +975,7 @@
 	if (bp->b_target != lasttarg ||
 	    time_after(jiffies, (lasttime + 5*HZ))) {
 		lasttime = jiffies;
-		xfs_alert(mp, "Device %s: metadata write error block 0x%llx",
-			xfs_buf_target_name(bp->b_target),
-		      (__uint64_t)XFS_BUF_ADDR(bp));
+		xfs_buf_ioerror_alert(bp, __func__);
 	}
 	lasttarg = bp->b_target;


xfs: fix rounding in xfs_free_file_space

The offset passed into xfs_free_file_space() needs to be rounded
down to a certain size, but the rounding mask is built by a 32 bit
variable. Hence the mask will always mask off the upper 32 bits of
the offset and lead to incorrect writeback and invalidation ranges.

This is not actually exposed as a bug because we writeback and
invalidate from the rounded offset to the end of the file, and hence
the offset we are actually punching a hole out of will always be
covered by the code. This needs fixing, however, if we ever want to
use exact ranges for writeback/invalidation here...

Signed-off-by: Dave Chinner <4d9e23a041ac966f5316a7481300d4ae12e806fe@redhat.com>
Reviewed-by: Brian Foster <335646b5e374a776a6a2caca10969d6e3ec1cd2b@redhat.com>
Signed-off-by: Ben Myers <46e490cac450e85a9cba3059365826296771cc03@sgi.com>

--- fs/xfs/xfs_vnodeops.c
+++ fs/xfs/xfs_vnodeops.c
@@ -1453,7 +1453,7 @@
 	xfs_mount_t		*mp;
 	int			nimap;
 	uint			resblks;
-	uint			rounding;
+	xfs_off_t		rounding;
 	int			rt;
 	xfs_fileoff_t		startoffset_fsb;
 	xfs_trans_t		*tp;
@@ -1482,7 +1482,7 @@
 		inode_dio_wait(VFS_I(ip));
 	}

-	rounding = max_t(uint, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE);
+	rounding = max_t(xfs_off_t, 1 << mp->m_sb.sb_blocklog, PAGE_CACHE_SIZE);
 	ioffset = offset & ~(rounding - 1);
 	error = -filemap_write_and_wait_range(VFS_I(ip)->i_mapping,
 					      ioffset, -1);


futility: cmd_update: Preserve sections blocked by management engine

On Intel platforms, when management engine is not in manufacturing mode the
SI_DESC will be read only and SI_ME can't be accessed by CPU.

For RW-FULL mode when we want to reflash whole firmware, flashrom will skip
SI_ME but it'll still try to update SI_DESC if the content looks different,
which would make all firmware update to fail when a new image is pushed with
different SI_DESC contents.

As a result, we have to preserve and skip SI_DESC changes when ME is locked.

BUG=chromium:875551
TEST=make futil; tests/futility/run_test_scripts.sh $(pwd)/build/futility
BRANCH=None

Change-Id: I834405ad519dcb7ccd44073addfd63e844b74168
Signed-off-by: Hung-Te Lin <8a7fce4940baad93a69f5073b383c85deed9d9c4@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/1197022
Reviewed-by: Randall Spangler <62698fdbb84d1779579ee80c3f39fac22017e5bc@chromium.org>

--- futility/cmd_update.c
+++ futility/cmd_update.c
@@ -40,7 +40,9 @@
 		  * const FMAP_RW_FWID_B = "RW_FWID_B",
 		  * const FMAP_RW_SHARED = "RW_SHARED",
 		  * const FMAP_RW_NVRAM = "RW_NVRAM",
-		  * const FMAP_RW_LEGACY = "RW_LEGACY";
+		  * const FMAP_RW_LEGACY = "RW_LEGACY",
+		  * const FMAP_SI_DESC = "SI_DESC",
+		  * const FMAP_SI_ME = "SI_ME";

 /* System environment values. */
 static const char * const FWACT_A = "A",
@@ -439,6 +441,23 @@
 	struct firmware_section section;
 	find_firmware_section(&section, image, section_name);
 	return section.data != NULL;
+}
+
+/*
+ * Checks if the section is filled with given character.
+ * If section size is 0, return 0. If section is not empty, return non-zero if
+ * the section is filled with same character c, otherwise 0.
+ */
+static int section_is_filled_with(const struct firmware_section *section,
+				  uint8_t c)
+{
+	uint32_t i;
+	if (!section->size)
+		return 0;
+	for (i = 0; i < section->size; i++)
+		if (section->data[i] != c)
+			return 0;
+	return 1;
 }

 /*
@@ -844,6 +863,29 @@
 }

 /*
+ * Preserves the regions locked by Intel management engine.
+ */
+static int preserve_management_engine(const struct firmware_image *image_from,
+				      struct firmware_image *image_to)
+{
+	struct firmware_section section;
+
+	find_firmware_section(&section, image_from, FMAP_SI_ME);
+	if (!section.data) {
+		Debug("%s: Skipped because no section %s\n", __FUNCTION__,
+		      FMAP_SI_ME);
+		return 0;
+	}
+	if (section_is_filled_with(&section, 0xFF)) {
+		Debug("%s: ME is probably locked - preserving %s.\n",
+		      __FUNCTION__, FMAP_SI_DESC);
+		return preserve_firmware_section(
+				image_from, image_to, FMAP_SI_DESC);
+	}
+	return 0;
+}
+
+/*
  * Preserves the critical sections from the current (active) firmware.
  * Currently only GBB, VPD (RO+RW) and NVRAM sections are preserved.
  * Returns 0 if success, non-zero if error.
@@ -853,6 +895,7 @@
 	int errcnt = 0;
 	struct firmware_image *from = &cfg->image_current, *to = &cfg->image;
 	errcnt += preserve_gbb(from, to);
+	errcnt += preserve_management_engine(from, to);
 	errcnt += preserve_firmware_section(from, to, FMAP_RO_VPD);
 	errcnt += preserve_firmware_section(from, to, FMAP_RW_VPD);
 	errcnt += preserve_firmware_section(from, to, FMAP_RW_NVRAM);


Remove broken Collision::operator!

Remove broken Collision::operator!

This was wrong and the explicit bool conversion should be enough anyway

--- game/tileview/voxel.h
+++ game/tileview/voxel.h
@@ -17,7 +17,6 @@
 	sp<TileObject> obj;
 	sp<Projectile> projectile;
 	Vec3<float> position;
-	bool operator!() { return !!obj; }
 	explicit operator bool() const { return obj != nullptr; }
 };