Document libdrachen's API.

Document libdrachen's API.

--- src/drachen.h
+++ src/drachen.h
@@ -14,35 +14,190 @@
 #endif

 /* Error codes specific to drachen */
+/**
+ * Indicates that the input file's first 8 bytes do not match the magic
+ * sequence expected by Drachen.
+ */
 #define DRACHEN_BAD_MAGIC -1
+/**
+ * Indicates that the caller creating a decoder expected a frame size different
+ * from the frame size used in the given input file.
+ */
 #define DRACHEN_WRONG_FRAME_SIZE -2
+/**
+ * Indicates that the reverse transformation matrix in the input file contained
+ * integers which pointed outside the framespace.
+ */
 #define DRACHEN_BAD_XFORM -3
+/**
+ * Indicates that, while decoding, a frame segment or RLE run indicated a size
+ * which exceeded the boundaries imposed by its container.
+ */
 #define DRACHEN_OVERRUN -4
+/**
+ * Indicates that the end of the input file was encountered at a position other
+ * than where a new frame would be expected.
+ */
 #define DRACHEN_PREMATURE_EOF -5
+/**
+ * Indicates that decoding of the input file has completed.
+ *
+ * This is not an error, and will never be returned by drachen_error().
+ */
 #define DRACHEN_END_OF_STREAM -6

+/**
+ * Opaque type which stores Drachen encoding/decoding information.
+ */
 struct drachen_encoder;
 typedef struct drachen_encoder drachen_encoder;

+/**
+ * Indicates that the data between segment_end (exclusive) and some unknown
+ * starting point (which is implicit) should be encoded using a block size of
+ * block_size.
+ *
+ * @see drachen_set_block_size().
+ */
 typedef struct {
   uint32_t segment_end, block_size;
 } drachen_block_spec;

+/**
+ * Creates an encoder to write a new stream to the given FILE, which has frames
+ * of the size specified in the second argument. If the third argument is
+ * non-NULL, the given alternate transformation matrix specified there is
+ * used. The length of the third argument must be at least the frame size; the
+ * contents are copied, so the array pointed to is not owned by the resulting
+ * encoder.
+ *
+ * On success, returns the constructed encoder. Headers have already been
+ * written to the file. On failure, may either return an encoder in a failure
+ * state (see drachen_error) or NULL if it could not allocate memory.
+ *
+ * A transformation matrix is an array which maps data as such:
+ *   for (i = 0; i < frame_size; ++i)
+ *     destination[i] = source[transform[i]];
+ * The default transformation matrix is the identity matrix; that is, it results
+ * in a simple copy of the source data.
+ */
 drachen_encoder* drachen_create_encoder(FILE*, uint32_t, const uint32_t*);
+
+/**
+ * Creates an encoder which is ready to decode from the given file. If the
+ * second argument is non-zero, this call fails if the input file does not use
+ * exactly that frame size.
+ *
+ * On success, returns an encoder. On failure, returns NULL if memory was
+ * exhausted, or an encoder in an error state (see drachen_error).
+ */
 drachen_encoder* drachen_create_decoder(FILE*, uint32_t);

+/**
+ * Frees all memory used by the given encoder, closes its file, and frees the
+ * encoder itself.
+ */
 int drachen_free(drachen_encoder*);

+/**
+ * Changes the block size specification for the given encoder. The second
+ * argument is an array of drachen_block_specs, where the segment_end field of
+ * the last one is greater than or equal to the frame size. The block size in
+ * each element is used for bytes between the segment_end (or 0 if this is the
+ * first) of the previous spec, and its own segment_end (exclusive). The array
+ * belongs to the caller; it is not copied, and will not be freed when the
+ * encoder is. It is the responsibility of the caller to ensure that the
+ * lifetime of the array extends at least to the destruction of the encoder, or
+ * to a time where drachen_set_block_size() is called with a different array.
+ *
+ * The drachen_block_specs' segment_end fields must be in ascending order, and
+ * there may be no duplicates. block_size must be greater than zero for all
+ * specs.
+ *
+ * By default, Drachen uses a small, consistent block size.
+ *
+ * Block size generally does not affect speed, but rather compression
+ * ratio. Too small a block size will cause the encoder to switch encoding
+ * methods too frequently; too large a block size will reduce the encoder's
+ * ability to notice localised coincidences, thus reducing compressibility.
+ */
 void drachen_set_block_size(drachen_encoder*, const drachen_block_spec*);
+
+/**
+ * Encodes a new frame via the given encoder. buffer is an array of bytes whose
+ * length must be at least the frame size of the encoder. name is a
+ * NUL-terminated string which names this frame. It does not need to be
+ * unique (though it should be).
+ *
+ * Returns 0 on success; returns non-zero and sets the encoder's error field on
+ * failure.
+ */
 int drachen_encode(drachen_encoder*, const unsigned char* buffer,
                    const char* name);
+/**
+ * Decodes the next frame from the given decoder, storing it in buffer, which
+ * must have a length greater than or equal to the frame size. If name is
+ * non-NULL, it must point to a buffer at least namelen bytes long. The name of
+ * the next frame will be copied into that buffer. If the frame's name is
+ * greater than (namelen-1), it is truncated, so that name will always be a
+ * valid NUL-terminated string.
+ *
+ * On success, returns 0. If the end of the stream has been reached, returns
+ * DRACHEN_END_OF_STREAM. On failure, sets the error field in the encoder and
+ * returns non-zero.
+ *
+ * If DRACHEN_END_OF_STREAM is returned, and the input file was opened in
+ * read-write mode, it is then possible to use drachen_encode() to append more
+ * frames to the stream.
+ */
 int drachen_decode(unsigned char* buffer, char* name, uint32_t namelen,
                    drachen_encoder*);

+/**
+ * Returns the error status of the given encoder.
+ *
+ * 0 means that no error has occurred.
+ * A positive value is the value of errno when a system or library call failed.
+ * A negative value is a drachen-specific error code.
+ *
+ * Once this function returns non-zero, it is no longer valid to use the
+ * encoder for any purpose, other than to free it and query its status.
+ */
 int drachen_error(const drachen_encoder*);
+/**
+ * Returns a human-readable error description of the error status in the given
+ * encoder, or NULL if no error has occurred.
+ */
 const char* drachen_get_error(const drachen_encoder*);
+/**
+ * Returns the frame size being used by the given encoder.
+ *
+ * There is no way to change the frame size of an encoder.
+ */
 uint32_t drachen_frame_size(const drachen_encoder*);

+/**
+ * Creates a transformation matrix optimal for encoding an uncompressed image,
+ * storing it into the first argument, which must be at least
+ * (offset+num_components*cols*rows) long (elements beyond that length will not
+ * be touched).
+ *
+ * offset specifies the byte offset of the first part of image data. No byte
+ * reordering happens before the offset.
+ *
+ * cols and rows indicate the number of columns and rows in the image data,
+ * respectively.
+ *
+ * num_components indicates how many bytes wide each pixel is. Bytes in the
+ * image data are reordered so that each component is in a single, contiguous
+ * block.
+ *
+ * block_width and block_height specify dimensions for "blocks" of pixels
+ * within the image data, which are rectangles of those dimensions. Bytes are
+ * reordered so that sub-pixels belonging to the same block are contiguous. If
+ * block_width is not evenly divisible into cols, or block_height into rows, it
+ * is resized so that it is.
+ */
 void drachen_make_image_xform_matrix(uint32_t*,
                                      uint32_t offset,
                                      uint32_t cols,


Remove some dead code (it is over in old-and-busted.c)

* subversion/libsvn_wc/entries.c:
  (string_to_opt_revision, opt_revision_to_string,
      unserialize_file_external, serialize_file_external,
      resolve_to_defaults): removed

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@875994 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_wc/entries.c
+++ subversion/libsvn_wc/entries.c
@@ -104,155 +104,6 @@
   return SVN_NO_ERROR;
 }

-#ifdef UNUSED_NOW
-
-/**
- * Parse the string at *STR as an revision and save the result in
- * *OPT_REV.  After returning successfully, *STR points at next
- * character in *STR where further parsing can be done.
- */
-static svn_error_t *
-string_to_opt_revision(svn_opt_revision_t *opt_rev,
-                       const char **str,
-                       apr_pool_t *pool)
-{
-  const char *s = *str;
-
-  SVN_ERR_ASSERT(opt_rev);
-
-  while (*s && *s != ':')
-    ++s;
-
-  /* Should not find a \0. */
-  if (!*s)
-    return svn_error_createf
-      (SVN_ERR_INCORRECT_PARAMS, NULL,
-       _("Found an unexpected \\0 in the file external '%s'"), *str);
-
-  if (0 == strncmp(*str, "HEAD:", 5))
-    {
-      opt_rev->kind = svn_opt_revision_head;
-    }
-  else
-    {
-      svn_revnum_t rev;
-      const char *endptr;
-
-      SVN_ERR(svn_revnum_parse(&rev, *str, &endptr));
-      SVN_ERR_ASSERT(endptr == s);
-      opt_rev->kind = svn_opt_revision_number;
-      opt_rev->value.number = rev;
-    }
-
-  *str = s + 1;
-
-  return SVN_NO_ERROR;
-}
-
-/**
- * Given a revision, return a string for the revision, either "HEAD"
- * or a string representation of the revision value.  All other
- * revision kinds return an error.
- */
-static svn_error_t *
-opt_revision_to_string(const char **str,
-                       const char *path,
-                       const svn_opt_revision_t *rev,
-                       apr_pool_t *pool)
-{
-  switch (rev->kind)
-    {
-    case svn_opt_revision_head:
-      *str = apr_pstrmemdup(pool, "HEAD", 4);
-      break;
-    case svn_opt_revision_number:
-      *str = apr_itoa(pool, rev->value.number);
-      break;
-    default:
-      return svn_error_createf
-        (SVN_ERR_INCORRECT_PARAMS, NULL,
-         _("Illegal file external revision kind %d for path '%s'"),
-         rev->kind, path);
-      break;
-    }
-
-  return SVN_NO_ERROR;
-}
-
-/* Parse a file external specification in the NULL terminated STR and
-   place the path in PATH_RESULT, the peg revision in PEG_REV_RESULT
-   and revision number in REV_RESULT.  STR may be NULL, in which case
-   PATH_RESULT will be set to NULL and both PEG_REV_RESULT and
-   REV_RESULT set to svn_opt_revision_unspecified.
-
-   The format that is read is the same as a working-copy path with a
-   peg revision; see svn_opt_parse_path(). */
-static svn_error_t *
-unserialize_file_external(const char **path_result,
-                          svn_opt_revision_t *peg_rev_result,
-                          svn_opt_revision_t *rev_result,
-                          const char *str,
-                          apr_pool_t *pool)
-{
-  if (str)
-    {
-      svn_opt_revision_t peg_rev;
-      svn_opt_revision_t op_rev;
-      const char *s = str;
-
-      SVN_ERR(string_to_opt_revision(&peg_rev, &s, pool));
-      SVN_ERR(string_to_opt_revision(&op_rev, &s, pool));
-
-      *path_result = apr_pstrdup(pool, s);
-      *peg_rev_result = peg_rev;
-      *rev_result = op_rev;
-    }
-  else
-    {
-      *path_result = NULL;
-      peg_rev_result->kind = svn_opt_revision_unspecified;
-      rev_result->kind = svn_opt_revision_unspecified;
-    }
-
-  return SVN_NO_ERROR;
-}
-
-/* Serialize into STR the file external path, peg revision number and
-   the operative revision number into a format that
-   unserialize_file_external() can parse.  The format is
-     %{peg_rev}:%{rev}:%{path}
-   where a rev will either be HEAD or the string revision number.  If
-   PATH is NULL then STR will be set to NULL.  This method writes to a
-   string instead of a svn_stringbuf_t so that the string can be
-   protected by write_str(). */
-static svn_error_t *
-serialize_file_external(const char **str,
-                        const char *path,
-                        const svn_opt_revision_t *peg_rev,
-                        const svn_opt_revision_t *rev,
-                        apr_pool_t *pool)
-{
-  const char *s;
-
-  if (path)
-    {
-      const char *s1;
-      const char *s2;
-
-      SVN_ERR(opt_revision_to_string(&s1, path, peg_rev, pool));
-      SVN_ERR(opt_revision_to_string(&s2, path, rev, pool));
-
-      s = apr_pstrcat(pool, s1, ":", s2, ":", path, NULL);
-    }
-  else
-    s = NULL;
-
-  *str = s;
-
-  return SVN_NO_ERROR;
-}
-
-#endif /* UNUSED_NOW */

 svn_error_t *
@@ -651,70 +502,6 @@
     }
 }

-
-#ifdef UNUSED_NOW
-
-/* Resolve any missing information in ENTRIES by deducing from the
-   directory's own entry (which must already be present in ENTRIES). */
-static svn_error_t *
-resolve_to_defaults(apr_hash_t *entries,
-                    apr_pool_t *pool)
-{
-  apr_hash_index_t *hi;
-  svn_wc_entry_t *default_entry
-    = apr_hash_get(entries, SVN_WC_ENTRY_THIS_DIR, APR_HASH_KEY_STRING);
-
-  /* First check the dir's own entry for consistency. */
-  if (! default_entry)
-    return svn_error_create(SVN_ERR_ENTRY_NOT_FOUND,
-                            NULL,
-                            _("Missing default entry"));
-
-  if (default_entry->revision == SVN_INVALID_REVNUM)
-    return svn_error_create(SVN_ERR_ENTRY_MISSING_REVISION,
-                            NULL,
-                            _("Default entry has no revision number"));
-
-  if (! default_entry->url)
-    return svn_error_create(SVN_ERR_ENTRY_MISSING_URL,
-                            NULL,
-                            _("Default entry is missing URL"));
-
-
-  /* Then use it to fill in missing information in other entries. */
-  for (hi = apr_hash_first(pool, entries); hi; hi = apr_hash_next(hi))
-    {
-      void *val;
-      svn_wc_entry_t *this_entry;
-
-      apr_hash_this(hi, NULL, NULL, &val);
-      this_entry = val;
-
-      if (this_entry == default_entry)
-        /* THIS_DIR already has all the information it can possibly
-           have.  */
-        continue;
-
-      if (this_entry->kind == svn_node_dir)
-        /* Entries that are directories have everything but their
-           name, kind, and state stored in the THIS_DIR entry of the
-           directory itself.  However, we are disallowing the perusing
-           of any entries outside of the current entries file.  If a
-           caller wants more info about a directory, it should look in
-           the entries file in the directory.  */
-        continue;
-
-      if (this_entry->kind == svn_node_file)
-        /* For file nodes that do not explicitly have their ancestry
-           stated, this can be derived from the default entry of the
-           directory in which those files reside.  */
-        take_from_entry(default_entry, this_entry, pool);
-    }
-
-  return SVN_NO_ERROR;
-}
-
-#endif /* UNUSED_NOW */

 /* Fill the entries cache in ADM_ACCESS. The full hash cache will be


Otimização do código

Otimização do código

--- src/dstring.c
+++ src/dstring.c
@@ -31,11 +31,11 @@
     int capacity; /* number of bytes allocated */
 };

-bool calloc_string( String *string, unsigned int capacity );
-bool realloc_string( String *string, unsigned int capacity );
-int get_length_required( const char *format, va_list *list );
-int count_substring( const String *string, const char *substring );
-void concat_n_string( String *destination, const char *replacement );
+bool static calloc_string( String *string, unsigned int capacity );
+bool static realloc_string( String *string, unsigned int capacity );
+int static get_length_required( const char *format, va_list *list );
+int static count_substring( const String *string, const char *substring );
+void static concat_n_string( String *destination, const char *replacement );

 String *string_new() {
     String *string = calloc( 1, sizeof( String ) );
@@ -89,27 +89,23 @@
     int capacity_required;
     bool result;
     va_list args;
+
     va_start( args, format );
     capacity_required = get_length_required( format, &args );
     va_end( args );

     va_start( args, format );
-    if( string->capacity > capacity_required ) {
+    if( string->capacity <= capacity_required && !realloc_string( string, capacity_required ) ) {
+        result = false;
+    } else {
         vsprintf( string->char_array, format, args );
         result = true;
-    } else {
-        if( realloc_string( string, capacity_required ) ) {
-            vsprintf( string->char_array, format, args );
-            result = true;
-        } else {
-            result = false;
-        }
     }
     va_end( args );
     return result;
 }

-int get_length_required( const char *format, va_list *list ) {
+int static get_length_required( const char *format, va_list *list ) {
     return vsnprintf( NULL, 0, format, *list );
 }

@@ -118,14 +114,12 @@
 }

 bool string_concat_char_array( String *destination, const char *source ) {
-    if( strlen( destination->char_array ) + strlen( source ) < destination->capacity ) {
+    if( strlen( destination->char_array ) + strlen( source ) >= destination->capacity &&
+        !realloc_string( destination, destination->capacity + strlen( source ) ) ) {
+        return false;
+    } else {
         strcat( destination->char_array, source );
         return true;
-    } else {
-        if( !realloc_string( destination, destination->capacity + strlen( source ) ) ) {
-            return false;
-        }
-        return string_concat_char_array( destination, source );
     }
 }

@@ -146,10 +140,11 @@
 }

 bool string_replace_first( String *string, const char *regex, const char *replacement ) {
-    int total = count_substring( string, regex );
+    char *test = strstr( string->char_array, regex );
     int length_necessary = strlen( replacement ) - strlen( regex );
     String *new_string = string_new_with_size( strlen( string->char_array ) + length_necessary );
-    if( total == 0 || new_string == NULL ) {
+
+    if( test == NULL || new_string == NULL ) {
         return false;
     }
     char *tmp = string->char_array;
@@ -207,11 +202,11 @@
     return true;
 }

-void concat_n_string( String *destination, const char *replacement ) {
+void static concat_n_string( String *destination, const char *replacement ) {
     strncat( destination->char_array, replacement, strlen( replacement ) + 1 ); //+1 for '\0'
 }

-int count_substring( const String *string, const char *substring ) {
+int static count_substring( const String *string, const char *substring ) {
     int count = 0;
     char *tmp_char_array = string->char_array;
     while( ( tmp_char_array = strstr( tmp_char_array, substring ) ) != NULL ) {
@@ -262,9 +257,8 @@
     return realloc_string( string, strlen( string->char_array ) );
 }

-bool calloc_string( String *string, unsigned int capacity ) {
-    capacity++;
-    string->char_array = calloc( capacity, sizeof( char ) );
+bool static calloc_string( String *string, unsigned int capacity ) {
+    string->char_array = calloc( ++capacity, sizeof( char ) );

     if( string->char_array != NULL ) {
         string->capacity = capacity;
@@ -274,9 +268,8 @@
     }
 }

-bool realloc_string( String *string, unsigned int capacity ) {
-    capacity++;
-    char *tmp = realloc( string->char_array, capacity * sizeof( char ) );
+bool static realloc_string( String *string, unsigned int capacity ) {
+    char *tmp = realloc( string->char_array, ++capacity * sizeof( char ) );

     if( tmp != NULL ) {
         string->char_array = tmp;


Forgot to commit as well.

Forgot to commit as well.

error: pathspec 'include/editor/idialog.h' did not match any file(s) known to git

--- include/editor/idialog.h
+++ include/editor/idialog.h
@@ -0,0 +1,65 @@
+/*
+The MIT License
+
+Copyright (c) 2012 by Jorrit Tyberghein
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
+ */
+
+#ifndef __idialog_h__
+#define __idialog_h__
+
+#include "csutil/scf.h"
+#include <wx/wx.h>
+
+struct iDynamicObject;
+struct i3DView;
+struct iAresEditor;
+
+/**
+ * A dialog plugin for the editor.
+ */
+struct iDialogPlugin : public virtual iBase
+{
+  SCF_INTERFACE(iDialogPlugin,0,0,1);
+
+  /**
+   * Set the application.
+   */
+  virtual void SetApplication (iAresEditor* app) = 0;
+
+  /**
+   * Set the wxWindow parent for the panel of this mode.
+   */
+  virtual void SetParent (wxWindow* parent) = 0;
+
+  /**
+   * The name of this panel.
+   */
+  virtual const char* GetDialogName () const = 0;
+
+  /**
+   * Open the dialog.
+   */
+  virtual void ShowDialog () = 0;
+};
+
+
+#endif // __idialog_h__
+


Fix for Ruby 1.9: rb_block_given_p() no longer returns Qtrue

Signed-off-by: Wincent Colaiuta <c76ac2e9cd86441713c7dfae92c451f3e6d17fdc@wincent.com>

--- ext/mkdtemp.c
+++ ext/mkdtemp.c
@@ -106,7 +106,7 @@
         rb_raise(rb_eSystemCallError, "mkdtemp failed (error #%d: %s)", errno, strerror(errno));

     // yield to block if given, inside Dir.chdir
-    if (rb_block_given_p() == Qtrue)
+    if (rb_block_given_p())
         rb_iterate(call_chdir, template, yield_block, block);
     return template;
 }


* subversion/libsvn_wc/upgrade.c
  (remove_suffix): Use correct type to avoid bit-wise mismatches.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@1058632 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/libsvn_wc/upgrade.c
+++ subversion/libsvn_wc/upgrade.c
@@ -942,8 +942,8 @@
 static char *
 remove_suffix(const char *str, const char *suffix, apr_pool_t *result_pool)
 {
-  int str_len = strlen(str);
-  int suffix_len = strlen(suffix);
+  size_t str_len = strlen(str);
+  size_t suffix_len = strlen(suffix);

   if (str_len > suffix_len
       && strcmp(str + str_len - suffix_len, suffix) == 0)


implement a basic HTTP client programme; this reuses the HTTP session class, which should make that more resilient in the long run. Currently relies on well-behaved servers and strange syntax, which is probably bad.

--- include/ef.gy/fortuned.h
+++ include/ef.gy/fortuned.h
@@ -67,14 +67,11 @@
   return true;
 }

-static cli::option
-    count("-{0,2}count", [](std::smatch &m) -> bool {
-                           std::cout << fortune::common().size()
-                                     << " cookie(s) loaded\n";
+static cli::option count("-{0,2}count", [](std::smatch &m) -> bool {
+  std::cout << fortune::common().size() << " cookie(s) loaded\n";

-                           return true;
-                         },
-          "Prints the number of fortune cookies in the database.");
+  return true;
+}, "Prints the number of fortune cookies in the database.");

 static cli::option print("-{0,2}print(:([0-9]+))?",
                          [](std::smatch &m) -> bool {


Fix compiler warning.

Fix compiler warning.

* mod_dav_svn/repos.c (dav_svn_split_uri):  initialize 'end' to NULL.

--- subversion/mod_dav_svn/repos.c
+++ subversion/mod_dav_svn/repos.c
@@ -1016,7 +1016,7 @@
                         /* Skip past defn->numcomponents components,
                            return everything beyond that.*/
                         int j;
-                        const char *end, *start = relative + len3 + 1;
+                        const char *end = NULL, *start = relative + len3 + 1;

                         for (j = 0; j < defn->numcomponents; j++)
                           {


reorder local variables to the top for style

--- src/dyndnsd.c
+++ src/dyndnsd.c
@@ -33,10 +33,15 @@
 int
 main(int argc, char *argv[])
 {
-	int opt, error;
+	int opt;
 	bool optd, optn;
 	char *optf;
+	char buf[READ_MEM_LIMIT];
+	long http_status;
+
 	struct ast *ast;
+	struct ast_iface *aif;
+	struct ast_domain *ad;

 	optn = false;
 	optd = false;
@@ -71,7 +76,7 @@
 	if (NULL == devnull)
 		err(1, "fopen(\"/dev/null\")");

-	error = yyparse(&ast);
+	int error = yyparse(&ast);
 	fclose(yyin);

 	if (!ast_is_valid(ast) || optn)
@@ -104,10 +109,6 @@
 		daemon(0, 0);

 	while (true) {
-		struct ast_iface *aif;
-		struct ast_domain *ad;
-		char buf[READ_MEM_LIMIT];
-
 		ssize_t numread = read(routefd, buf, sizeof(buf));
 		if (-1 == numread)
 			err(1, "read(2)");
@@ -124,9 +125,8 @@
 				char *url2 = strsub(url1, "$ip_address", ipaddr);

 				if (httpget(curl, url2)) {
-					long status;
-					curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &status);
-					syslog(LOG_INFO, "%s %s %s %ld", ifname, ipaddr, url2, status);
+					curl_easy_getinfo(curl, CURLINFO_RESPONSE_CODE, &http_status);
+					syslog(LOG_INFO, "%s %s %s %ld", ifname, ipaddr, url2, http_status);
 				}

 				free(url1);


Fix type names

Fix type names

--- include/groonga/plugin.h
+++ include/groonga/plugin.h
@@ -154,12 +154,12 @@
                                               grn_user_data *user_data,
                                               const char *name,
                                               int name_size,
-                                              grn_int32 default_value);
+                                              int32_t default_value);
 GRN_API const char *grn_plugin_proc_get_var_string(grn_ctx *ctx,
                                                    grn_user_data *user_data,
                                                    const char *name,
                                                    int name_size,
-                                                   uint32_t *size);
+                                                   size_t *size);

 GRN_API grn_obj *grn_plugin_proc_get_var_by_offset(grn_ctx *ctx,
                                                    grn_user_data *user_data,


* repos.c (dav_svn_set_headers): Set content type for collection GET based on the output format. (dav_svn_deliver): XML attributes are #IMPLIED, not #OPTIONAL.

--- subversion/mod_dav_svn/repos.c
+++ subversion/mod_dav_svn/repos.c
@@ -1346,13 +1346,16 @@
   /* we accept byte-ranges */
   apr_table_setn(r->headers_out, "Accept-Ranges", "bytes");

-  /* For a directory, we will generate text/html. If we have a delta
+  /* For a directory, we will send text/html or text/xml. If we have a delta
      base, then we will always be generating an svndiff.  Otherwise,
      we need to fetch the appropriate MIME type from the resource's
      properties (and use text/plain if it isn't there). */
   if (resource->collection)
     {
-      mimetype = "text/html";
+      if (resource->info->repos->xslt_uri)
+        mimetype = "text/xml";
+      else
+        mimetype = "text/html";
     }
   else if (resource->info->delta_base != NULL)
     {
@@ -1479,9 +1482,9 @@
       "  <!ATTLIST svn   version CDATA #REQUIRED\n"
       "                  href    CDATA #REQUIRED>\n"
       "  <!ELEMENT index (updir?, (file | dir)*)>\n"
-      "  <!ATTLIST index name    CDATA #OPTIONAL\n"
-      "                  path    CDATA #OPTIONAL\n"
-      "                  rev     CDATA #OPTIONAL>\n"
+      "  <!ATTLIST index name    CDATA #IMPLIED\n"
+      "                  path    CDATA #IMPLIED\n"
+      "                  rev     CDATA #IMPLIED>\n"
       "  <!ELEMENT updir EMPTY>\n"
       "  <!ELEMENT file  (prop)*>\n"
       "  <!ATTLIST file  name    CDATA #REQUIRED>\n"


unfactor set_dyndnsd_env() and parse_fqdn()

As well, I was able to determine that the setenv() functions should almost never fail. The only reason they might fail is if the system is out of memory.

--- src/dyndnsd.c
+++ src/dyndnsd.c
@@ -34,10 +34,8 @@
 static char *rtm_getifname(void*);
 static char *rtm_getipaddr(void*);
 static struct sockaddr *rtm_getsa(uint8_t*, int);
-static pid_t spawn(char *, int);
-static void set_dyndnsd_env(char *, char *, char *);
+static pid_t spawn(char *, int, char *, char *, char *);
 static char *getshell(void);
-static void parse_fqdn(char *, char **, char **, char **);
 static struct ast_iface *find_iface(struct ast_root *, char *);

 char *filename;
@@ -176,11 +174,7 @@
 				free(ifname);

 				for(size_t j = 0; j < aif->domain_len; j++) {
-					pid_t pid;
-
-					set_dyndnsd_env(aif->domain[j], ipaddr, aif->if_name);
-
-					pid = spawn(ast->cmd, devnull);
+					pid_t pid = spawn(ast->cmd, devnull, aif->domain[j], ipaddr, aif->if_name);
 					if (-1 == pid)
 						syslog(LOG_ERR, "cannot run command: %m");
 					else
@@ -287,7 +281,7 @@
 }

 static pid_t
-spawn(char *cmd, int fd)
+spawn(char *cmd, int fd, char *domain, char *ipaddr, char *iface)
 {
 	pid_t pid;

@@ -302,6 +296,9 @@
 		dup2(fd, STDOUT_FILENO);
 		dup2(fd, STDERR_FILENO);
 		setsid();
+		setenv("DYNDNSD_DOMAIN", domain, true);
+		setenv("DYNDNSD_IPADDR", ipaddr, true);
+		setenv("DYNDNSD_INTERFACE", iface, true);
 		execl(getshell(), getshell(), "-c", cmd, NULL);
 	}

@@ -312,54 +309,6 @@
 getshell(void)
 {
 	return getenv("SHELL") ?: "/bin/sh";
-}
-
-static void
-set_dyndnsd_env(char *fqdn, char *ipaddr, char *iface)
-{
-	char *hostname, *domain, *tld;
-	parse_fqdn(fqdn, &hostname, &domain, &tld);
-
-	if (-1 == setenv("DYNDNSD_FQDN", fqdn, true))
-		syslog(LOG_WARNING, "cannot set DYNDNSD_FQDN: setenv(3): %m");
-	if (-1 == setenv("DYNDNSD_HOSTNAME", hostname, true))
-		syslog(LOG_WARNING, "cannot set DYNDNSD_HOSTNAME: setenv(3): %m");
-	if (-1 == setenv("DYNDNSD_DOMAIN", domain, true))
-		syslog(LOG_WARNING, "cannot set DYNDNSD_DOMAIN: setenv(3): %m");
-	if (-1 == setenv("DYNDNSD_TLD", tld, true))
-		syslog(LOG_WARNING, "cannot set DYNDNSD_TLD: setenv(3): %m");
-	if (-1 == setenv("DYNDNSD_IPADDR", ipaddr, true))
-		syslog(LOG_WARNING, "cannot set DYNDNSD_IPADDR: setenv(3): %m");
-	if (-1 == setenv("DYNDNSD_INTERFACE", iface, true))
-		syslog(LOG_WARNING, "cannot set DYNDNSD_INTERFACE: setenv(3): %m");
-
-	free(hostname);
-	free(domain);
-	free(tld);
-}
-
-static void
-parse_fqdn(char *fqdn, char **hostname, char **domain, char **tld)
-{
-	size_t n;
-	const char *i, *j;
-
-	/* parse TLD */
-	for (j = fqdn + strlen(fqdn); '.' != *j; j--);
-	*tld = strdup(j + 1);
-
-	/* parse 2-label FQDN */
-	for (i = fqdn; '.' != *i; i++);
-	if (i == j) {
-		*hostname = strdup("@");
-		*domain = strdup(fqdn);
-		return;
-	}
-
-	/* parse FQDNs with more than 3 labels */
-	n = i - fqdn;
-	*domain = strdup(i + 1);
-	*hostname = strndup(fqdn, n);
 }

 static struct ast_iface *


doc-comments

doc-comments

--- include/h2o/httpclient.h
+++ include/h2o/httpclient.h
@@ -32,9 +32,25 @@

 typedef struct st_h2o_httpclient_t h2o_httpclient_t;

+/**
+ * This is a struct used for passing additional properties from the application to the HTTP client implementation, when the
+ * connection to the server is being established.
+ */
 typedef struct st_h2o_httpclient_properties_t {
+    /**
+     * When the value is a non-NULL pointer (at the moment, only happens with the HTTP/1 client), the application MAY set it to an
+     * iovec pointing to the payload of the PROXY protocol (i.e., the first line).
+     */
     h2o_iovec_t *proxy_protocol;
+    /**
+     * When the value is a non-NULL pointer (at the moment, only happens with the HTTP/1 client), the application MAY set it to 1 to
+     * indicate that the request body should be encoded using the chunked transfer-encoding.
+     */
     int *chunked;
+    /**
+     * When the value is a non-NULL pointer (at the moment, only happens with the HTTP/1 client), the application MAY set it to the
+     * value of the connection header field to be sent to the server. This can be used for upgrading an HTTP/1.1 connection.
+     */
     h2o_iovec_t *connection_header;
 } h2o_httpclient_properties_t;


* subversion/mod_dav_svn/repos.c: Formatting fixes only.  This file
    was almost entirely in the no-space-before-paren style, but it
    had a few exceptions, which r12003 brought to light.  This fixes
    them all, including but not limited to the ones seen in r12003.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@852097 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/mod_dav_svn/repos.c
+++ subversion/mod_dav_svn/repos.c
@@ -555,9 +555,9 @@
   if (serr != NULL)
     {
       return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
-                                 apr_psprintf (pool, "Error checking kind of "
-                                               "path '%s' in repository",
-                                               comb->priv.repos_path),
+                                 apr_psprintf(pool, "Error checking kind of "
+                                              "path '%s' in repository",
+                                              comb->priv.repos_path),
                                  pool);
     }

@@ -732,14 +732,14 @@
                                  pool);
     }

-  serr = svn_fs_check_path (&kind, comb->priv.root.root,
-                            comb->priv.repos_path, pool);
+  serr = svn_fs_check_path(&kind, comb->priv.root.root,
+                           comb->priv.repos_path, pool);
   if (serr != NULL)
     {
       return dav_svn_convert_err
         (serr, HTTP_INTERNAL_SERVER_ERROR,
-         apr_psprintf (pool, "Error checking kind of path '%s' in repository",
-                       comb->priv.repos_path),
+         apr_psprintf(pool, "Error checking kind of path '%s' in repository",
+                      comb->priv.repos_path),
          pool);
     }

@@ -865,14 +865,14 @@

 AP_MODULE_DECLARE(dav_error *)
-dav_svn_split_uri (request_rec *r,
-                   const char *uri_to_split,
-                   const char *root_path,
-                   const char **cleaned_uri,
-                   int *trailing_slash,
-                   const char **repos_name,
-                   const char **relative_path,
-                   const char **repos_path)
+dav_svn_split_uri(request_rec *r,
+                  const char *uri_to_split,
+                  const char *root_path,
+                  const char **cleaned_uri,
+                  int *trailing_slash,
+                  const char **repos_name,
+                  const char **relative_path,
+                  const char **repos_path)
 {
   apr_size_t len1;
   int had_slash;
@@ -1145,9 +1145,9 @@
   xslt_uri = dav_svn_get_xslt_uri(r);

   /* This does all the work of interpreting/splitting the request uri. */
-  err = dav_svn_split_uri (r, r->uri, root_path,
-                           &cleaned_uri, &had_slash,
-                           &repos_name, &relative, &repos_path);
+  err = dav_svn_split_uri(r, r->uri, root_path,
+                          &cleaned_uri, &had_slash,
+                          &repos_name, &relative, &repos_path);
   if (err)
     return err;

@@ -1201,9 +1201,9 @@

   /* Remember checksums, if any. */
   comb->priv.base_checksum =
-    apr_table_get (r->headers_in, SVN_DAV_BASE_FULLTEXT_MD5_HEADER);
+    apr_table_get(r->headers_in, SVN_DAV_BASE_FULLTEXT_MD5_HEADER);
   comb->priv.result_checksum =
-    apr_table_get (r->headers_in, SVN_DAV_RESULT_FULLTEXT_MD5_HEADER);
+    apr_table_get(r->headers_in, SVN_DAV_RESULT_FULLTEXT_MD5_HEADER);

   /* "relative" is part of the "uri" string, so it has the proper
      lifetime to store here. */
@@ -1266,10 +1266,10 @@

           /* Return a slightly less informative error to dav. */
           svn_error_clear(serr);
-          return dav_svn_convert_err (sanitized_error,
-                                      HTTP_INTERNAL_SERVER_ERROR,
-                                      apr_psprintf(r->pool, new_msg),
-                                      r->pool);
+          return dav_svn_convert_err(sanitized_error,
+                                     HTTP_INTERNAL_SERVER_ERROR,
+                                     apr_psprintf(r->pool, new_msg),
+                                     r->pool);
         }

       /* Cache the open repos for the next request on this connection */
@@ -1278,7 +1278,7 @@
     }

   /* cache the filesystem object */
-  repos->fs = svn_repos_fs (repos->repos);
+  repos->fs = svn_repos_fs(repos->repos);

   /* capture warnings during cleanup of the FS */
   svn_fs_set_warning_func(repos->fs, log_warning, r);
@@ -1413,23 +1413,23 @@
       if (res2->info->root.txn_name)
         {
           /* reopen the txn by name */
-          svn_error_clear (svn_fs_open_txn(&(res2->info->root.txn),
-                                           res2->info->repos->fs,
-                                           res2->info->root.txn_name,
-                                           res2->info->repos->pool));
+          svn_error_clear(svn_fs_open_txn(&(res2->info->root.txn),
+                                          res2->info->repos->fs,
+                                          res2->info->root.txn_name,
+                                          res2->info->repos->pool));

           /* regenerate the txn "root" object */
-          svn_error_clear (svn_fs_txn_root(&(res2->info->root.root),
-                                           res2->info->root.txn,
-                                           res2->info->repos->pool));
+          svn_error_clear(svn_fs_txn_root(&(res2->info->root.root),
+                                          res2->info->root.txn,
+                                          res2->info->repos->pool));
         }
       else if (res2->info->root.rev)
         {
           /* default:  regenerate the revision "root" object */
-          svn_error_clear (svn_fs_revision_root(&(res2->info->root.root),
-                                                res2->info->repos->fs,
-                                                res2->info->root.rev,
-                                                res2->info->repos->pool));
+          svn_error_clear(svn_fs_revision_root(&(res2->info->root.root),
+                                               res2->info->repos->fs,
+                                               res2->info->root.rev,
+                                               res2->info->repos->pool));
         }
     }

@@ -1471,10 +1471,10 @@
 }

-dav_error * dav_svn_resource_kind (request_rec *r,
-                                   const char *uri,
-                                   const char *root_path,
-                                   svn_node_kind_t *kind)
+dav_error * dav_svn_resource_kind(request_rec *r,
+                                  const char *uri,
+                                  const char *root_path,
+                                  svn_node_kind_t *kind)
 {
   dav_error *derr;
   svn_error_t *serr;
@@ -1526,8 +1526,8 @@

       else /* ver */
         {
-          serr = svn_fs_check_path (kind, resource->info->root.root,
-                                    resource->info->repos_path, r->pool);
+          serr = svn_fs_check_path(kind, resource->info->root.root,
+                                   resource->info->repos_path, r->pool);

           if (serr)
             return dav_svn_convert_err
@@ -1548,10 +1548,10 @@
         {
           /* don't call fs_check_path on the txn, but on the original
              revision that the txn is based on. */
-          base_rev = svn_fs_txn_base_revision (resource->info->root.txn);
-          serr = svn_fs_revision_root (&base_rev_root,
-                                       resource->info->repos->fs,
-                                       base_rev, r->pool);
+          base_rev = svn_fs_txn_base_revision(resource->info->root.txn);
+          serr = svn_fs_revision_root(&base_rev_root,
+                                      resource->info->repos->fs,
+                                      base_rev, r->pool);
           if (serr)
             return dav_svn_convert_err
               (serr, HTTP_INTERNAL_SERVER_ERROR,
@@ -1560,8 +1560,8 @@
                             base_rev),
                r->pool);

-          serr = svn_fs_check_path (kind, base_rev_root,
-                                    resource->info->repos_path, r->pool);
+          serr = svn_fs_check_path(kind, base_rev_root,
+                                   resource->info->repos_path, r->pool);
           if (serr)
             return dav_svn_convert_err
               (serr, HTTP_INTERNAL_SERVER_ERROR,
@@ -1877,7 +1877,7 @@

       mimetype = value ? value->data : "text/plain";

-      serr = svn_mime_type_validate (mimetype, resource->pool);
+      serr = svn_mime_type_validate(mimetype, resource->pool);
       if (serr)
         {
           /* Probably serr->apr == SVN_ERR_BAD_MIME_TYPE, but
@@ -2414,11 +2414,11 @@
         return dav_new_error
           (dst->pool, HTTP_INTERNAL_SERVER_ERROR, 0,
            "Copy source and destination are in different repositories.");
-      serr = svn_fs_copy (src->info->root.root,  /* root object of src rev*/
-                          src->info->repos_path, /* relative path of src */
-                          dst->info->root.root,  /* root object of dst txn*/
-                          dst->info->repos_path, /* relative path of dst */
-                          src->pool);
+      serr = svn_fs_copy(src->info->root.root,  /* root object of src rev*/
+                         src->info->repos_path, /* relative path of src */
+                         dst->info->root.root,  /* root object of dst txn*/
+                         dst->info->repos_path, /* relative path of dst */
+                         src->pool);
     }
   if (serr)
     return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
@@ -2494,10 +2494,10 @@
   if (SVN_IS_VALID_REVNUM(resource->info->version_name))
     {
       svn_revnum_t created_rev;
-      serr = svn_fs_node_created_rev (&created_rev,
-                                      resource->info->root.root,
-                                      resource->info->repos_path,
-                                      resource->pool);
+      serr = svn_fs_node_created_rev(&created_rev,
+                                     resource->info->root.root,
+                                     resource->info->repos_path,
+                                     resource->pool);
       if (serr)
         return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
                                    "Could not get created rev of resource",
@@ -2505,9 +2505,9 @@

       if (resource->info->version_name < created_rev)
         {
-          serr = svn_error_createf (SVN_ERR_RA_OUT_OF_DATE, NULL,
-                                    "Item '%s' is out of date",
-                                    resource->info->repos_path);
+          serr = svn_error_createf(SVN_ERR_RA_OUT_OF_DATE, NULL,
+                                   "Item '%s' is out of date",
+                                   resource->info->repos_path);
           return dav_svn_convert_err(serr, HTTP_CONFLICT,
                                      "Can't DELETE out-of-date resource",
                                      resource->pool);
@@ -2571,11 +2571,11 @@
     return err;

   /* Copy the src to the dst. */
-  serr = svn_fs_copy (src->info->root.root,  /* the root object of src rev*/
-                      src->info->repos_path, /* the relative path of src */
-                      dst->info->root.root,  /* the root object of dst txn*/
-                      dst->info->repos_path, /* the relative path of dst */
-                      src->pool);
+  serr = svn_fs_copy(src->info->root.root,  /* the root object of src rev*/
+                     src->info->repos_path, /* the relative path of src */
+                     dst->info->root.root,  /* the root object of dst txn*/
+                     dst->info->repos_path, /* the relative path of dst */
+                     src->pool);
   if (serr)
     return dav_svn_convert_err(serr, HTTP_INTERNAL_SERVER_ERROR,
                                "Unable to make a filesystem copy.",


compile fix

compile fix

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@26565 8cc4aa7f-3514-0410-904f-f2cc9021211c

--- include/imesh/skeleton.h
+++ include/imesh/skeleton.h
@@ -53,6 +53,8 @@
 	CS_BGT_SPHERE,
 	CS_BGT_CYLINDER
 };
+
+class csReversibleTransform;

 /**
  * The skeleton bone class.


When browsing the Subversion repository with your favorite browser,
print the Subversion version number after the "Powered by Subversion"
message.

* Subversion/svn/subversion/mod_dav_svn/repos.c
  (dav_svn_deliver): Print "version " SVN_VERSION "." after the
  already existing "Powered by Subversion" string.  Include
  svn_version.h.

git-svn-id: f8a4e5e023278da1e04e203c7fe051e3c4285d88@841821 13f79535-47bb-0310-9956-ffa450edef68

--- subversion/mod_dav_svn/repos.c
+++ subversion/mod_dav_svn/repos.c
@@ -35,6 +35,7 @@
 #include "svn_repos.h"
 #include "svn_dav.h"
 #include "svn_sorts.h"
+#include "svn_version.h"

 #include "dav_svn.h"

@@ -1550,7 +1551,8 @@

     ap_fputs(output, bb,
              "
\n
Powered by "
-             "Subversion"
+             "Subversion "
+             "version " SVN_VERSION "."
              "\n");

     bkt = apr_bucket_eos_create(output->c->bucket_alloc);


Better save before commit.

Better save before commit.

git-svn-id: 28d9401aa571d5108e51b194aae6f24ca5964c06@23604 8cc4aa7f-3514-0410-904f-f2cc9021211c

--- include/iutil/document.h
+++ include/iutil/document.h
@@ -314,7 +314,7 @@
    * Parse document file from an iFile.
    * \param file The file to parse. It should contain data in whatever format
    *   is understood by the iDocument implementation receiving this invocation.
-   * \param collapse Some document format implementations may have the option
+   * \param collapse Document format implementations have the option
    *   of condensing extraneous whitespace in returned #CS_NODE_TEXT nodes.
    *   Set this to true to enable this option.  By default, whitepsace is
    *   preserved.
@@ -327,7 +327,7 @@
    * Parse document file from an iDataBuffer.
    * \param buf The buffer to parse. It should contain data in whatever format
    *   is understood by the iDocument implementation receiving this invocation.
-   * \param collapse Some document format implementations may have the option
+   * \param collapse Document format implementations have the option
    *   of condensing extraneous whitespace in returned #CS_NODE_TEXT nodes.
    *   Set this to true to enable this option.  By default, whitepsace is
    *   preserved.
@@ -340,7 +340,7 @@
    * Parse document file from an iString.
    * \param str The string to parse. It should contain data in whatever format
    *   is understood by the iDocument implementation receiving this invocation.
-   * \param collapse Some document format implementations may have the option
+   * \param collapse Document format implementations have the option
    *   of condensing extraneous whitespace in returned #CS_NODE_TEXT nodes.
    *   Set this to true to enable this option.  By default, whitepsace is
    *   preserved.
@@ -353,7 +353,7 @@
    * Parse document file from a null-terminated C-string.
    * \param buf The buffer to parse. It should contain data in whatever format
    *   is understood by the iDocument implementation receiving this invocation.
-   * \param collapse Some document format implementations may have the option
+   * \param collapse Document format implementations have the option
    *   of condensing extraneous whitespace in returned #CS_NODE_TEXT nodes.
    *   Set this to true to enable this option.  By default, whitepsace is
    *   preserved.


* subversion/mod_dav_svn/repos.c
  (dav_svn_get_resource): Make sure fs_parent_path gets initialized,
  and micro-optimize to lose a redundant conditional later on.

Thanks to Blair Zajac for noticing the warnings.

--- subversion/mod_dav_svn/repos.c
+++ subversion/mod_dav_svn/repos.c
@@ -836,8 +836,10 @@
      the error pool, as a subpool of the request pool. */
   (void) svn_error_init_pool(r->pool);

-  if (((fs_path = dav_svn_get_fs_path(r)) == NULL)
-      && ((fs_parent_path = dav_svn_get_fs_parent_path(r)) == NULL))
+  fs_path = dav_svn_get_fs_path(r);
+  fs_parent_path = dav_svn_get_fs_parent_path(r);
+
+  if ((fs_path == NULL) && (fs_parent_path == NULL))
     {
       /* ### are SVN_ERR_APMOD codes within the right numeric space? */
       return dav_new_error(r->pool, HTTP_INTERNAL_SERVER_ERROR,
@@ -923,7 +925,7 @@
       true_root_path = root_path;
       true_fs_path = fs_path;
     }
-  else if (fs_parent_path != NULL)
+  else /* else we know that fs_parent_path != NULL */
     {
       /* SVNParentPath was used: assume the first component of
          'relative' is the name of a repository. */


used new ir_exc_region_t type

used new ir_exc_region_t type

[r14304]

--- include/libfirm/irprog.h
+++ include/libfirm/irprog.h
@@ -221,6 +221,6 @@
 void                  set_irp_callee_info_state(irg_callee_info_state s);

 /** Returns a new, unique exception region number. */
-unsigned long get_irp_next_region_nr(void);
+ir_exc_region_t get_irp_next_region_nr(void);

 #endif


(unw_tdep_fpreg_t): New type.
(UNW_TDEP_EH_ARG0): Make it an alias for r15.
(UNW_TDEP_EH_ARG1): Make it an alias for r16.
(UNW_TDEP_EH_ARG2): Make it an alias for r17.
(UNW_TDEP_EH_ARG3): Make it an alias for r18.

(Logical change 1.45)

--- include/libunwind-ia64.h
+++ include/libunwind-ia64.h
@@ -48,6 +48,17 @@

 typedef uint64_t unw_tdep_word_t;

+/* On IA-64, we want to access the contents of floating-point
+   registers as a pair of "words", but to ensure 16-byte alignment, we
+   make it a union that contains a "long double".  This will do the
+   Right Thing on all known IA-64 platforms, including HP-UX.  */
+typedef union
+  {
+    struct { unw_tdep_word_t bits[2]; } raw;
+    long double dummy;	/* dummy to force 16-byte alignment */
+  }
+unw_tdep_fpreg_t;
+
 typedef enum
   {
     /* Note: general registers are excepted to start with index 0.
@@ -88,7 +99,11 @@
     UNW_TDEP_LAST_REG = UNW_IA64_SP,

     UNW_TDEP_IP = UNW_IA64_IP,
-    UNW_TDEP_SP = UNW_IA64_SP
+    UNW_TDEP_SP = UNW_IA64_SP,
+    UNW_TDEP_EH_ARG0 = UNW_IA64_GR + 15,
+    UNW_TDEP_EH_ARG1 = UNW_IA64_GR + 16,
+    UNW_TDEP_EH_ARG2 = UNW_IA64_GR + 17,
+    UNW_TDEP_EH_ARG3 = UNW_IA64_GR + 18
   }
 ia64_regnum_t;


Make sure an inline function does not emit a symbol (C99).

--- include/libxsmm_macros.h
+++ include/libxsmm_macros.h
@@ -46,7 +46,7 @@
 # if (199901L <= __STDC_VERSION__)
 #   define LIBXSMM_PRAGMA(DIRECTIVE) _Pragma(LIBXSMM_STRINGIFY(DIRECTIVE))
 #   define LIBXSMM_RESTRICT restrict
-#   define LIBXSMM_INLINE inline
+#   define LIBXSMM_INLINE static inline
 # else
 #   define LIBXSMM_INLINE static
 # endif /*C99*/


kvm: add a memslot flag for incoherent memory regions

Memory regions may be incoherent with the caches, typically when the
guest has mapped a host system RAM backed memory region as uncached.
Add a flag KVM_MEMSLOT_INCOHERENT so that we can tag these memslots
and handle them appropriately when mapping them.

Signed-off-by: Ard Biesheuvel <66d3c5fdaeea7ff1f996ad04f2c45e08ab38e2f5@linaro.org>
Signed-off-by: Marc Zyngier <a16cc0c82647c52d401177f8e50567df5499e36c@arm.com>

--- include/linux/kvm_host.h
+++ include/linux/kvm_host.h
@@ -43,6 +43,7 @@
  * include/linux/kvm_h.
  */
 #define KVM_MEMSLOT_INVALID	(1UL << 16)
+#define KVM_MEMSLOT_INCOHERENT	(1UL << 17)

 /* Two fragments for cross MMIO pages. */
 #define KVM_MAX_MMIO_FRAGMENTS	2


mmc: core: Remove unused host cap MMC_CAP2_BROKEN_VOLTAGE

Signed-off-by: Ulf Hansson <fe47b31f388f85ce6ddf64bf3a0cf6b46077d0e6@linaro.org>
Signed-off-by: Chris Ball <711c73f64afdce07b7e38039a96d2224209e9a6c@printf.net>


ACPI: mark acpi_sfi_table_parse() as __init

Mark function acpi_sfi_table_parse() as __init to avoid warning messages:

WARNING: vmlinux.o(.text+0x4cd2d2): Section mismatch in reference from the
function acpi_sfi_table_parse.clone.0() to the function

Function acpi_sfi_table_parse() calls acpi_table_parse() and
pci_parse_mcfg(), which are both marked as __init.  Currently
acpi_sfi_table_parse() is only used by MMCONFIG to scan MCFG table
at boot time only, so it's safe to mark acpi_sfi_table_parse() as __init.

Reviewed-by: Yinghai Lu <0674548f4d596393408a51d6287a76ebba2f42aa@kernel.org>
Signed-off-by: Jiang Liu <c745fa7b96fe79db6d669643d5feb03ff0641332@gmail.com>
Signed-off-by: Bjorn Helgaas <f10ec01be0c6b54271af5c550cd257810bdf3268@google.com>

--- include/linux/sfi_acpi.h
+++ include/linux/sfi_acpi.h
@@ -66,7 +66,7 @@
 				char *oem_table_id,
 				int (*handler)(struct acpi_table_header *));

-static inline int acpi_sfi_table_parse(char *signature,
+static inline int __init acpi_sfi_table_parse(char *signature,
 				int (*handler)(struct acpi_table_header *))
 {
 	if (!acpi_table_parse(signature, handler))
@@ -83,7 +83,7 @@
 	return -1;
 }

-static inline int acpi_sfi_table_parse(char *signature,
+static inline int __init acpi_sfi_table_parse(char *signature,
 				int (*handler)(struct acpi_table_header *))
 {
 	return acpi_table_parse(signature, handler);


[APInt] Use MathExtras.h BitsToFloat/Double and Float/DoubleToBits instead of type punning through a union

The functions in MathExtras.h uses a safer memcpy instead of going through a union.

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

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

--- include/llvm/ADT/APInt.h
+++ include/llvm/ADT/APInt.h
@@ -1657,12 +1657,7 @@
   /// re-interprets the bits as a double. Note that it is valid to do this on
   /// any bit width. Exactly 64 bits will be translated.
   double bitsToDouble() const {
-    union {
-      uint64_t I;
-      double D;
-    } T;
-    T.I = (isSingleWord() ? U.VAL : U.pVal[0]);
-    return T.D;
+    return BitsToDouble(getWord(0));
   }

   /// \brief Converts APInt bits to a double
@@ -1671,12 +1666,7 @@
   /// re-interprets the bits as a float. Note that it is valid to do this on
   /// any bit width. Exactly 32 bits will be translated.
   float bitsToFloat() const {
-    union {
-      unsigned I;
-      float F;
-    } T;
-    T.I = unsigned((isSingleWord() ? U.VAL : U.pVal[0]));
-    return T.F;
+    return BitsToFloat(getWord(0));
   }

   /// \brief Converts a double to APInt bits.
@@ -1684,12 +1674,7 @@
   /// The conversion does not do a translation from double to integer, it just
   /// re-interprets the bits of the double.
   static APInt doubleToBits(double V) {
-    union {
-      uint64_t I;
-      double D;
-    } T;
-    T.D = V;
-    return APInt(sizeof T * CHAR_BIT, T.I);
+    return APInt(sizeof(double) * CHAR_BIT, DoubleToBits(V));
   }

   /// \brief Converts a float to APInt bits.
@@ -1697,12 +1682,7 @@
   /// The conversion does not do a translation from float to integer, it just
   /// re-interprets the bits of the float.
   static APInt floatToBits(float V) {
-    union {
-      unsigned I;
-      float F;
-    } T;
-    T.F = V;
-    return APInt(sizeof T * CHAR_BIT, T.I);
+    return APInt(sizeof(float) * CHAR_BIT, FloatToBits(V));
   }

   /// @}


Fix bogus assertion using getSExtValue for legitimate values, like -1 in
an 128-bit-wide integer.  No testcase; the issue I ran into depends on
local changes.

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

--- include/llvm/ADT/APInt.h
+++ include/llvm/ADT/APInt.h
@@ -1046,7 +1046,7 @@
     if (isSingleWord())
       return int64_t(VAL << (APINT_BITS_PER_WORD - BitWidth)) >>
                      (APINT_BITS_PER_WORD - BitWidth);
-    assert(getActiveBits() <= 64 && "Too many bits for int64_t");
+    assert(getMinSignedBits() <= 64 && "Too many bits for int64_t");
     return int64_t(pVal[0]);
   }


Don't try to convert PPC long double.

Don't try to convert PPC long double.

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

--- include/llvm/Constants.h
+++ include/llvm/Constants.h
@@ -263,6 +263,9 @@
   bool isExactlyValue(const APFloat& V) const;

   bool isExactlyValue(double V) const {
+    // convert is not supported on this type
+    if (&Val.getSemantics() == &APFloat::PPCDoubleDouble)
+      return false;
     APFloat FV(V);
     FV.convert(Val.getSemantics(), APFloat::rmNearestTiesToEven);
     return isExactlyValue(FV);


暫定用lockfree_queueを追加

暫定用lockfree_queueを追加

git-svn-id: 0930b66baa5e2e0a6692efdeea927b533cefb008@7929 1ed66053-1c2d-0410-8867-f7571e6e31d3

--- include/lockfree_queue.h
+++ include/lockfree_queue.h
@@ -1,100 +1,44 @@
 #ifndef LOCKFREE_QUEUE_H
-#define LOCKFREE_QUEUE_H
+#define LOCFFREE_QUEUE_H

 #include <boost/noncopyable.hpp>
+#include <queue>
+#include "wrlock.h"

 namespace l7vs{

 template<class Tvalue>
 class lockfree_queue : protected boost::noncopyable {
 protected:
-	struct node_type {
-		Tvalue*					value;
-		volatile node_type*  	next;
-		volatile bool			dummy;
-		node_type() : value( NULL ) , next( NULL ) , dummy ( false ) {}
-	};
-	mutable volatile size_t	counter;
-	volatile node_type*	headloc;
-	volatile node_type*	tailloc;
-
-	node_type*		new_node;
+	std::queue< Tvalue* >	stl_queue;
+	wr_mutex		mutex;
 public:
-	// constractor
-	explicit lockfree_queue() : counter(0){
-		new_node = new node_type();
-		headloc = tailloc = new_node;
-		new_node->dummy = true;
+	explicit lockfree_queue(){
 	}

 	// destractor
 	~lockfree_queue(){
-		while( counter-- ){
-			pop();
-		}
-		delete headloc;
 	}

 	void push(const Tvalue* value){
-		volatile	node_type* _new_node	= new node_type();
-		volatile	node_type* _tail;
-		volatile	node_type* _next;
-
-		_new_node->value = const_cast<Tvalue*>( value );
-
-		// transaction st
-		while(1){
-			_tail = tailloc;
-			_next = tailloc->next;
-			if(_tail == tailloc){
-				if(!_next){
-					if(__sync_bool_compare_and_swap(&tailloc->next,_next,_new_node)) break;
-				}
-			}else{
-				__sync_bool_compare_and_swap(&tailloc,_tail,_next);
-			}
-		}
-		// tracsaction ed
-		__sync_bool_compare_and_swap( &tailloc,tailloc,_new_node );
-		__sync_add_and_fetch( &counter, 1 );
+		mutex.wrlock();
+		stl_queue.push( const_cast< Tvalue* >( value ) );
+		mutex.unlock();
 	}

 	Tvalue* pop() {
-		volatile node_type*		_head_node;
-		volatile node_type*		_next_node;
-		Tvalue*					rtn_value;
-
-		//transaction st
-		while(1){
-			_head_node = headloc;
-			_next_node = headloc->next;
-
-			if(headloc ==tailloc){
-				//false
-				return NULL;
-			}else{
-				if(__sync_bool_compare_and_swap(&headloc,_head_node,_next_node)){
-					rtn_value = _next_node->value;
-					if( __sync_lock_test_and_set(&_next_node->dummy,true) )
-						break;
-					break;
-				}
-			}
-		}
-		//transaction ed
-		while(!_head_node->dummy){
-		}
-		delete _head_node;
-		__sync_sub_and_fetch( &counter, 1 );
-		return rtn_value;
+		mutex.wrlock();
+		Tvalue*	ptr = stl_queue.front();
+		stl_queue.pop();
+		mutex.unlock();
+		return ptr;
 	}

 	bool empty() const{
-		if( tailloc == headloc ) return true;
-		return false;
+		return stl_queue.empty();
 	}
 	size_t size() const{
-		return counter;
+		return stl_queue.size();
 	}
 };


Register interfaces when all static ones has been registered and before mgdschema types are registered.

--- midgard.c
+++ midgard.c
@@ -312,8 +312,8 @@
 	global_loghandler = g_log_set_handler(G_LOG_DOMAIN, G_LOG_LEVEL_MASK, midgard_error_default_log,
 										  NULL);

-	//g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL);
-	//g_log_set_fatal_mask("GLib-GObject", G_LOG_LEVEL_CRITICAL);
+	g_log_set_always_fatal(G_LOG_LEVEL_CRITICAL);
+	g_log_set_fatal_mask("GLib-GObject", G_LOG_LEVEL_WARNING);

 	/* Get DateTime class pointer and set global */
 	zend_datetime_class_ptr = php_date_get_date_ce();
@@ -351,7 +351,6 @@
 	PHP_MINIT(midgard2_config)(INIT_FUNC_ARGS_PASSTHRU);
 	PHP_MINIT(midgard2_blob)(INIT_FUNC_ARGS_PASSTHRU);
 	PHP_MINIT(midgard2_object_class)(INIT_FUNC_ARGS_PASSTHRU);
-	PHP_MINIT(midgard2_object)(INIT_FUNC_ARGS_PASSTHRU);
 	PHP_MINIT(midgard2_user)(INIT_FUNC_ARGS_PASSTHRU);
 	PHP_MINIT(midgard2_collector)(INIT_FUNC_ARGS_PASSTHRU);
 	PHP_MINIT(midgard2_connection)(INIT_FUNC_ARGS_PASSTHRU);
@@ -371,7 +370,9 @@
 	PHP_MINIT(midgard2_query)(INIT_FUNC_ARGS_PASSTHRU);
 	PHP_MINIT(midgard2_g_mainloop)(INIT_FUNC_ARGS_PASSTHRU);
 	PHP_MINIT(midgard2_workspaces)(INIT_FUNC_ARGS_PASSTHRU);
+	PHP_MINIT(midgard2_base_interface)(INIT_FUNC_ARGS_PASSTHRU);
 	PHP_MINIT(midgard2_base_abstract)(INIT_FUNC_ARGS_PASSTHRU);
+	PHP_MINIT(midgard2_object)(INIT_FUNC_ARGS_PASSTHRU);

 	/* Register midgard_metadata class */
 	static zend_class_entry midgard_metadata_class_entry;


~ markup documentation

~ markup documentation


update ocilib version in C header

update ocilib version in C header

--- include/ocilibc/config.h
+++ include/ocilibc/config.h
@@ -86,8 +86,8 @@
  * --------------------------------------------------------------------------------------------- */

 #define OCILIB_MAJOR_VERSION     4
-#define OCILIB_MINOR_VERSION     6
-#define OCILIB_REVISION_VERSION  4
+#define OCILIB_MINOR_VERSION     7
+#define OCILIB_REVISION_VERSION  0

 /* Import mode */


Fix a typo in GetZ. (was returning fEy instead of fEZ)

git-svn-id: ecbadac9c76e8cf640a0bca86f6bd796c98521e3@11022 27541ba8-7e3a-0410-8455-c3a389f83636

--- hist/inc/TGraph2DErrors.h
+++ hist/inc/TGraph2DErrors.h
@@ -43,7 +43,7 @@
         Double_t        GetErrorZ(Int_t bin) const;
         Double_t       *GetEX() const {return fEX;}
         Double_t       *GetEY() const {return fEY;}
-        Double_t       *GetEZ() const {return fEY;}
+        Double_t       *GetEZ() const {return fEZ;}
         virtual void    SetPoint(Int_t i, Double_t x, Double_t y, Double_t z);
         virtual void    SetPointError(Int_t i, Double_t ex, Double_t ey, Double_t ez);


Fixed wallpaper order

Fixed wallpaper order

--- include/pkmds/pkmds_g5.h
+++ include/pkmds/pkmds_g5.h
@@ -2401,9 +2401,9 @@
 		seafloor,
 		river,
 		sky,
-		checks,
 		poke_center,
 		machine,
+		checks,
 		simple,
 		reshiram,
 		zekrom,


Align AddressorRecord on 8-bits for ARM

Align AddressorRecord on 8-bits for ARM

--- include/swift/AST/Decl.h
+++ include/swift/AST/Decl.h
@@ -3838,7 +3838,7 @@
   struct GetSetRecord;

   /// This is stored immediately before the GetSetRecord.
-  struct AddressorRecord {
+  struct alignas(1 << 3) AddressorRecord {
     FuncDecl *Address = nullptr;        // User-defined address accessor
     FuncDecl *MutableAddress = nullptr; // User-defined mutableAddress accessor


hls: fixed discontinuity, fixed audio buffering

--- hls/ngx_rtmp_hls_module.c
+++ hls/ngx_rtmp_hls_module.c
@@ -25,7 +25,6 @@

 #define NGX_RTMP_HLS_BUFSIZE            (1024*1024)
-#define NGX_RTMP_HLS_MAX_AUDIO_DELAY    30000
 #define NGX_RTMP_HLS_DIR_ACCESS         0744

@@ -33,7 +32,7 @@
     uint64_t                            id;
     double                              duration;
     unsigned                            active:1;
-    unsigned                            discont:1; /* after */
+    unsigned                            discont:1; /* before */
 } ngx_rtmp_hls_frag_t;

@@ -72,6 +71,7 @@
 typedef struct {
     ngx_flag_t                          hls;
     ngx_msec_t                          fraglen;
+    ngx_msec_t                          max_fraglen;
     ngx_msec_t                          muxdelay;
     ngx_msec_t                          sync;
     ngx_msec_t                          playlen;
@@ -82,6 +82,8 @@
     ngx_uint_t                          naming;
     ngx_uint_t                          slicing;
     ngx_path_t                         *slot;
+    ngx_msec_t                          max_audio_delay;
+    size_t                              audio_buffer_size;
 } ngx_rtmp_hls_app_conf_t;

@@ -125,6 +127,13 @@
       offsetof(ngx_rtmp_hls_app_conf_t, fraglen),
       NULL },

+    { ngx_string("hls_max_fragment"),
+      NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_msec_slot,
+      NGX_RTMP_APP_CONF_OFFSET,
+      offsetof(ngx_rtmp_hls_app_conf_t, max_fraglen),
+      NULL },
+
     { ngx_string("hls_path"),
       NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
       ngx_rtmp_hls_path,
@@ -180,6 +189,20 @@
       NGX_RTMP_APP_CONF_OFFSET,
       offsetof(ngx_rtmp_hls_app_conf_t, slicing),
       &ngx_rtmp_hls_slicing_slots },
+
+    { ngx_string("hls_max_audio_delay"),
+      NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_msec_slot,
+      NGX_RTMP_APP_CONF_OFFSET,
+      offsetof(ngx_rtmp_hls_app_conf_t, max_audio_delay),
+      NULL },
+
+    { ngx_string("hls_audio_buffer_size"),
+      NGX_RTMP_MAIN_CONF|NGX_RTMP_SRV_CONF|NGX_RTMP_APP_CONF|NGX_CONF_TAKE1,
+      ngx_conf_set_size_slot,
+      NGX_RTMP_APP_CONF_OFFSET,
+      offsetof(ngx_rtmp_hls_app_conf_t, audio_buffer_size),
+      NULL },

     ngx_null_command
 };
@@ -369,13 +392,13 @@
         f = ngx_rtmp_hls_get_frag(s, i);

         p = ngx_snprintf(buffer, sizeof(buffer),
+                         "%s"
                          "#EXTINF:%.3f,\n"
-                         "%V%s%uL.ts\n"
-                         "%s",
+                         "%V%s%uL.ts\n",
+                         f->discont ? "#EXT-X-DISCONTINUITY\n" : "",
                          f->duration,
                          hacf->nested ? &empty : &ctx->name,
-                         hacf->nested ? "" : "-",
-                         f->id, f->discont ? "#EXT-X-DISCONTINUITY\n" : "");
+                         hacf->nested ? "" : "-", f->id);

         ngx_log_debug5(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
                        "hls: fragment frag=%uL, n=%ui/%ui, duration=%.3f, "
@@ -647,11 +670,6 @@
         return NGX_OK;
     }

-    if (ctx->nfrags && discont) {
-        f = ngx_rtmp_hls_get_frag(s, ctx->nfrags - 1);
-        f->discont = 1;
-    }
-
     id = ngx_rtmp_hls_get_fragment_id(s, ts);

     *ngx_sprintf(ctx->stream.data + ctx->stream.len, "%uL.ts", id) = 0;
@@ -702,6 +720,7 @@
     ngx_memzero(f, sizeof(*f));

     f->active = 1;
+    f->discont = discont;
     f->id = id;

     ctx->frag_ts = ts;
@@ -725,6 +744,7 @@
     u_char                         *p, *last, *end, *next, *pa;
     ngx_rtmp_hls_frag_t            *f;
     double                          duration;
+    ngx_int_t                       discont;
     uint64_t                        mag;
     static u_char                   buffer[4096];

@@ -746,6 +766,7 @@
     ctx->nfrags = 0;
     f = NULL;
     duration = 0;
+    discont = 0;

     for ( ;; ) {

@@ -809,9 +830,7 @@

             if (ngx_memcmp(p, NGX_RTMP_DISCONT, NGX_RTMP_DISCONT_LEN) == 0) {

-                if (f) {
-                    f->discont = 1;
-                }
+                discont = 1;

                 ngx_log_debug0(NGX_LOG_DEBUG_RTMP, s->connection->log, 0,
                                "hls: discontinuity");
@@ -827,8 +846,11 @@
                 ngx_memzero(f, sizeof(*f));

                 f->duration = duration;
+                f->discont = discont;
                 f->active = 1;
                 f->id = 0;
+
+                discont = 0;

                 mag = 1;
                 for (pa = last - 4; pa >= p; pa--) {
@@ -1076,7 +1098,7 @@

 static void
 ngx_rtmp_hls_update_fragment(ngx_rtmp_session_t *s, uint64_t ts,
-    ngx_int_t boundary)
+    ngx_int_t boundary, ngx_uint_t flush_rate)
 {
     ngx_rtmp_hls_ctx_t         *ctx;
     ngx_rtmp_hls_app_conf_t    *hacf;
@@ -1090,15 +1112,16 @@
     ctx = ngx_rtmp_get_module_ctx(s, ngx_rtmp_hls_module);

     f = NULL;
+
     if (ctx->opened) {
+
         f = ngx_rtmp_hls_get_frag(s, ctx->nfrags);
         f->duration = (ts - ctx->frag_ts) / 90000.;

-        b = ctx->aframe;
-        if (b && b->last > b->pos &&
-            ctx->aframe_pts + NGX_RTMP_HLS_MAX_AUDIO_DELAY > ts)
-        {
-            ngx_rtmp_hls_flush_audio(s);
+        if (f->duration * 1000 > hacf->max_fraglen) {
+            ngx_log_error(NGX_LOG_ERR, s->connection->log, 0,
+                          "hls: max fragment length reached");
+            boundary = 1;
         }
     }

@@ -1126,13 +1149,18 @@
             break;
     }

-    if (!boundary) {
-        return;
-    }
-
-    ngx_rtmp_hls_close_fragment(s, 0);
-
-    ngx_rtmp_hls_open_fragment(s, ts, !f);
+    if (boundary) {
+        ngx_rtmp_hls_close_fragment(s, 0);
+        ngx_rtmp_hls_open_fragment(s, ts, !f);
+    }
+
+    b = ctx->aframe;
+    if (ctx->opened && b && b->last > b->pos &&
+        ctx->aframe_pts + (uint64_t) hacf->max_audio_delay * 90 / flush_rate
+        < ts)
+    {
+        ngx_rtmp_hls_flush_audio(s);
+    }
 }

@@ -1224,12 +1252,12 @@

         ctx->aframe = b;

-        b->start = ngx_palloc(s->connection->pool, NGX_RTMP_HLS_BUFSIZE);
-        if (b->pos == NULL) {
+        b->start = ngx_palloc(s->connection->pool, hacf->audio_buffer_size);
+        if (b->start == NULL) {
             return NGX_ERROR;
         }

-        b->end = b->start + NGX_RTMP_HLS_BUFSIZE;
+        b->end = b->start + hacf->audio_buffer_size;
         b->pos = b->last = b->start;
     }

@@ -1242,7 +1270,13 @@
         return NGX_OK;
     }

-    ngx_rtmp_hls_update_fragment(s, pts, codec_ctx->avc_header == NULL);
+    /*
+     * start new fragment here if
+     * there's no video at all, otherwise
+     * do it in video handler
+     */
+
+    ngx_rtmp_hls_update_fragment(s, pts, codec_ctx->avc_header == NULL, 2);

     if (b->last + size > b->end) {
         ngx_rtmp_hls_flush_audio(s);
@@ -1373,11 +1407,11 @@
     u_char                         *p;
     uint8_t                         fmt, ftype, htype, nal_type, src_nal_type;
     uint32_t                        len, rlen;
-    ngx_buf_t                       out;
+    ngx_buf_t                       out, *b;
     uint32_t                        cts;
     ngx_rtmp_mpegts_frame_t         frame;
     ngx_uint_t                      nal_bytes;
-    ngx_int_t                       aud_sent, sps_pps_sent, rc;
+    ngx_int_t                       aud_sent, sps_pps_sent, rc, boundary;
     static u_char                   buffer[NGX_RTMP_HLS_BUFSIZE];

     hacf = ngx_rtmp_get_module_app_conf(s, ngx_rtmp_hls_module);
@@ -1549,7 +1583,16 @@
     frame.sid = 0xe0;
     frame.key = (ftype == 1);

-    ngx_rtmp_hls_update_fragment(s, frame.dts, frame.key);
+    /*
+     * start new fragment if
+     * - we have video key frame AND
+     * - we have audio buffered or have no audio at all
+     */
+
+    b = ctx->aframe;
+    boundary = frame.key && (codec_ctx->aac_header == NULL || b->last > b->pos);
+
+    ngx_rtmp_hls_update_fragment(s, frame.dts, boundary, 1);

     if (!ctx->opened) {
         return NGX_OK;
@@ -1798,6 +1841,7 @@

     conf->hls = NGX_CONF_UNSET;
     conf->fraglen = NGX_CONF_UNSET;
+    conf->max_fraglen = NGX_CONF_UNSET;
     conf->muxdelay = NGX_CONF_UNSET;
     conf->sync = NGX_CONF_UNSET;
     conf->playlen = NGX_CONF_UNSET;
@@ -1805,6 +1849,8 @@
     conf->nested = NGX_CONF_UNSET;
     conf->naming = NGX_CONF_UNSET_UINT;
     conf->slicing = NGX_CONF_UNSET_UINT;
+    conf->max_audio_delay = NGX_CONF_UNSET;
+    conf->audio_buffer_size = NGX_CONF_UNSET;

     return conf;
 }
@@ -1819,6 +1865,8 @@

     ngx_conf_merge_value(conf->hls, prev->hls, 0);
     ngx_conf_merge_msec_value(conf->fraglen, prev->fraglen, 5000);
+    ngx_conf_merge_msec_value(conf->max_fraglen, prev->max_fraglen,
+                              conf->fraglen * 10);
     ngx_conf_merge_msec_value(conf->muxdelay, prev->muxdelay, 700);
     ngx_conf_merge_msec_value(conf->sync, prev->sync, 300);
     ngx_conf_merge_msec_value(conf->playlen, prev->playlen, 30000);
@@ -1829,6 +1877,10 @@
                               NGX_RTMP_HLS_NAMING_SEQUENTIAL);
     ngx_conf_merge_uint_value(conf->slicing, prev->slicing,
                               NGX_RTMP_HLS_SLICING_PLAIN);
+    ngx_conf_merge_msec_value(conf->max_audio_delay, prev->max_audio_delay,
+                              300);
+    ngx_conf_merge_size_value(conf->audio_buffer_size, prev->audio_buffer_size,
+                              NGX_RTMP_HLS_BUFSIZE);

     if (conf->fraglen) {
         conf->winfrags = conf->playlen / conf->fraglen;


Make comparison of buffers parametric

Make comparison of buffers parametric

--- include/tiramisu/utils.h
+++ include/tiramisu/utils.h
@@ -88,7 +88,7 @@

 template<typename T>
 inline void compare_buffers_approximately(const std::string &test, const Halide::Buffer<T> &result,
-                                          const Halide::Buffer<T> &expected)
+                                          const Halide::Buffer<T> &expected, float threshold)
 {
     if ((result.dimensions() != expected.dimensions()) ||
         (result.channels() != expected.channels()) ||
@@ -101,7 +101,7 @@
     for (int z = 0; z < result.channels(); z++) {
         for (int y = 0; y < result.height(); y++) {
             for (int x = 0; x < result.width(); x++) {
-                if (result(x, y, z) - expected(x, y, z) > 0.1) {
+                if ((float) (result(x, y, z) - expected(x, y, z)) > threshold) {
                     ERROR("\033[1;31mTest " + test + " failed. At (" + std::to_string(x) +
                                     ", " + std::to_string(y) + ", " + std::to_string(z) + "), expected: " +
                                     std::to_string(expected(x, y, z)) + ", got: " +
@@ -112,6 +112,13 @@
         }
     }
     tiramisu::str_dump("\033[1;32mTest " + test + " succeeded.\033[0m\n");
+}
+
+template<typename T>
+inline void compare_buffers_approximately(const std::string &test, const Halide::Buffer<T> &result,
+                                          const Halide::Buffer<T> &expected)
+{
+    compare_buffers_approximately(test, result, expected, 0.1);
 }

 template<typename T>


Fixes to Scalar and Dim helper structs

Fixes to Scalar and Dim helper structs

--- include/uvector/scalar.h
+++ include/uvector/scalar.h
@@ -245,20 +245,19 @@

 	namespace details
 	{
-		template <class T>
-		struct Scalar
-		{
-			static_assert(is_scalar_v<T>, "Type has no scalar type");
-			using type = T;
-		};
+		template <class T, class = void>
+		struct Scalar { };
 		template <class T> struct Scalar<T&> : Scalar<T> { };
 		template <class T> struct Scalar<const T> : Scalar<T> { };

+		template <class T>
+		struct Scalar<T, if_scalar_t<T>> { using type = T; };
+
+
 		template <class T, class = void>
-		struct Dim : std::integral_constant<size_t, 1>
-		{
-			static_assert(is_scalar_v<T>, "Type is not a scalar and has no static member dim");
-		};
+		struct Dim { };
+		template <class T>
+		struct Dim<T, if_scalar_t<T>> : std::integral_constant<size_t, 1> { };
 		template <class T>
 		struct Dim<T, std::void_t<decltype(std::decay_t<T>::dim)>>
 		{


comment out options and user data

comment out options and user data

--- include/votca/csg/bead.h
+++ include/votca/csg/bead.h
@@ -18,12 +18,14 @@
 #ifndef _VOTCA_CSG_BEAD_H
 #define _VOTCA_CSG_BEAD_H

-#include "basebead.h"
+#include <assert.h>
 #include <cassert>
 #include <string>
 #include <votca/tools/property.h>
 #include <votca/tools/types.h>
 #include <votca/tools/vec.h>
+
+#include "basebead.h"

 namespace votca {
 namespace csg {
@@ -186,7 +188,8 @@
    * \return reference to velocity
    */
   vec &Vel() {
-    assert(bead_velocity_set_);
+    assert(bead_velocity_set_ &&
+           "Cannot access velocity, it has not been set.");
     return velocity_;
   }

@@ -195,7 +198,7 @@
    * \return reference to u
    */
   vec &U() {
-    assert(bU_);
+    assert(bU_ && "Cannot access bead orientation u, has not been set.");
     return u_;
   }

@@ -204,7 +207,7 @@
    * \return reference to v
    */
   vec &V() {
-    assert(bV_);
+    assert(bV_ && "Cannot access bead orientation v, has not been set.");
     return v_;
   }

@@ -213,7 +216,7 @@
    * \return reference to w
    */
   vec &W() {
-    assert(bW_);
+    assert(bW_ && "Cannot access bead orientation w, has not been set.");
     return w_;
   }

@@ -222,7 +225,7 @@
    * \return reference to force
    */
   vec &F() {
-    assert(bead_force_set_);
+    assert(bead_force_set_ && "Cannot access bead force, has not been set.");
     return bead_force_;
   }

@@ -276,7 +279,7 @@
    * If it is a mapped beads, returns te bead id the cg bead was created from
    * \return vector of bead ids of reference atoms
    */
-  std::vector<int> &ParentBeads() { return parent_beads_; };
+  const std::vector<int> &ParentBeads() { return parent_beads_; };

   /**
    * \brief Function to add arbitrary user data to bead
@@ -288,19 +291,19 @@
    *
    * \param userdata userdata
    */
-  template <typename T>
-  void setUserData(T *userdata) {
-    _userdata = (void *)userdata;
-  }
+  // template <typename T>
+  // void setUserData(T *userdata) {
+  //  _userdata = (void *)userdata;
+  //}

   /**
    * get userdata attached to bead
    * @return pointer to userdata
    */
-  template <typename T>
-  T *getUserData() {
-    return (T *)_userdata;
-  }
+  // template <typename T>
+  // T *getUserData() {
+  //  return (T *)_userdata;
+  //}

   /**
    * \brief Additional options of bead
@@ -312,20 +315,20 @@
    *
    * \return Property object containing options
    */
-  Property &Options() { return *options_; }
+  // Property &Options() { return *options_; }

   /**
    * update pointer to options object of bead
    * \param options pointer to options object of bead
    */
-  void setOptions(Property &options) { options_ = &options; }
+  // void setOptions(Property &options) { options_ = &options; }

  protected:
   std::vector<int> parent_beads_;

   // TODO: this is so far a pointer. this should change! each bead should have
   // own options.
-  Property *options_;
+  // Property *options_;

   byte_t symmetry_;
   double charge_;
@@ -357,7 +360,7 @@
     bead_force_set_ = false;
   }

-  void *_userdata;
+  // void *_userdata;

   friend class Topology;
   friend class Molecule;
@@ -369,7 +372,8 @@
 }

 inline const vec &Bead::getVel() const {
-  assert(bead_velocity_set_);
+  assert(bead_velocity_set_ &&
+         "Cannot access bead velocity, has not been set.");
   return velocity_;
 }

@@ -379,7 +383,7 @@
 }

 inline const vec &Bead::getU() const {
-  assert(bU_);
+  assert(bU_ && "Cannot access bead orientation u, has not been set.");
   return u_;
 }

@@ -399,7 +403,7 @@
 }

 inline const vec &Bead::getW() const {
-  assert(bW_);
+  assert(bW_ && "Cannot access bead orientation w, has not been set.");
   return w_;
 }

@@ -409,7 +413,7 @@
 }

 inline const vec &Bead::getF() const {
-  assert(bead_force_set_);
+  assert(bead_force_set_ && "Cannot access bead force, has not been set.");
   return bead_force_;
 }


Rewrite Window to use new Resource

Rewrite Window to use new Resource

--- include/wrapper/window.h
+++ include/wrapper/window.h
@@ -63,24 +63,15 @@
 	Window(Window&& other)
 	:Resource {nullptr}
 	{
-		std::swap(other.res, this->res);
+		std::swap(this->resource(), other.resource());
 	}

 	Window(const Window&) =delete;

 	Window& operator=(const Window&) =delete;

-	~Window() { destroy(); }
-
-	void destroy() override {
-		if (this->res) {
-			SDL_DestroyWindow(this->res);
-			this->res = nullptr;
-		}
-	}
-
 	inline SDL_Renderer* get_renderer() {
-		return SDL_GetRenderer(this->res);
+		return SDL_GetRenderer(Resource::get());
 	}
 };


Move to namespace include/use model

Move to namespace include/use model

Now if you want to declare a namespaced name, use ZD()
If you want to use a namesapce name, use ZU()

--- include/zephyr/CExport.h
+++ include/zephyr/CExport.h
@@ -1,12 +1,21 @@
 #ifndef ZEPHYR_CEXPORT_H
 #define ZEPHYR_CEXPORT_H

+/* declare a namespaced name */
 #ifdef __cplusplus
-#define Z_VAR(ns, n) n
+#define ZD(ns)
 #else
-#define Z_VAR(ns, n) ns ## _ ## n
+#define ZD(ns) ns_
 #endif

+/* use a namespaced name */
+#ifdef __cplusplus
+#define ZU(ns) ns::
+#else
+#define ZU(ns) ns_
+#endif
+
+/* declare a namespace */
 #ifdef __cplusplus
 #define Z_NS_START(n) namespace n {
 #define Z_NS_END }
@@ -15,22 +24,11 @@
 #define Z_NS_END
 #endif

+/* enum class vs enum */
 #ifdef __cplusplus
-#define Z_ENUM_CLASS(ns, n) enum class n
+#define Z_ENUM_CLASS enum class
 #else
-#define Z_ENUM_CLASS(ns, n) enum Z_VAR(ns, n)
-#endif
-
-#ifdef __cplusplus
-#define Z_ENUM(ns, n) enum n
-#else
-#define Z_ENUM(ns, n) enum Z_VAR(ns, n)
-#endif
-
-#ifdef __cplusplus
-#define Z_STRUCT(ns, n) struct n
-#else
-#define Z_STRUCT(ns, n) struct Z_VAR(ns, n)
+#define Z_ENUM_CLASS enum
 #endif

 #endif


fixing typo

fixing typo

git-svn-id: 70e004b0fe139654417ecae95160fb6d1b675565@191 bc2ad3ca-9a4d-0410-8d14-35da9c29b421

--- includes/core/TTObject.h
+++ includes/core/TTObject.h
@@ -109,7 +109,7 @@
 	@functiongroup	TTBlue Utilities
 	@discussion		constant used by the ttantidenormal function
 */
-extern const double TTSqrt2;
+extern const double TTAntiDenormalValue;

 /*! @constant 		TTSqrt2
 	@functiongroup	TTBlue Utilities


記号を入力できるようにする。(SHIFTキーが上手く動作しないので暫定コードで対応。


Add twr.h

Add twr.h

error: pathspec 'twr/inc/twr.h' did not match any file(s) known to git

--- twr/inc/twr.h
+++ twr/inc/twr.h
@@ -0,0 +1,109 @@
+#ifndef _TWR_H
+#define _TWR_H
+
+// Miscellaneous
+
+#include <twr_ir_rx.h>
+#include <twr_irq.h>
+#include <twr_led_strip.h>
+#include <twr_radio.h>
+#include <twr_radio_pub.h>
+#include <twr_radio_node.h>
+#include <twr_log.h>
+
+// Peripheral drivers
+
+#include <twr_adc.h>
+#include <twr_button.h>
+#include <twr_dac.h>
+#include <twr_eeprom.h>
+#include <twr_gpio.h>
+#include <twr_i2c.h>
+#include <twr_led.h>
+#include <twr_rtc.h>
+#include <twr_uart.h>
+#include <twr_spi.h>
+#include <twr_pwm.h>
+
+// Chip drivers
+
+#include <twr_sgp30.h>
+#include <twr_sgpc3.h>
+#include <twr_cp201t.h>
+#include <twr_hc_sr04.h>
+#include <twr_lis2dh12.h>
+#include <twr_lp8.h>
+#include <twr_spirit1.h>
+#include <twr_ls013b7dh03.h>
+#include <twr_cmwx1zzabz.h>
+#include <twr_sam_m8q.h>
+#include <twr_esp8266.h>
+#include <twr_ds2484.h>
+
+// HARDWARIO tags
+
+#include <twr_tag_barometer.h>
+#include <twr_tag_humidity.h>
+#include <twr_tag_lux_meter.h>
+#include <twr_tag_temperature.h>
+#include <twr_tag_nfc.h>
+#include <twr_tag_voc.h>
+#include <twr_tag_voc_lp.h>
+
+// HARDWARIO modules
+
+#include <twr_module_battery.h>
+#include <twr_module_climate.h>
+#include <twr_module_encoder.h>
+#include <twr_module_gps.h>
+#include <twr_module_pir.h>
+#include <twr_module_power.h>
+#include <twr_module_relay.h>
+#include <twr_module_rs485.h>
+#include <twr_module_sigfox.h>
+#include <twr_module_lcd.h>
+#include <twr_module_co2.h>
+#include <twr_module_sensor.h>
+#include <twr_module_infra_grid.h>
+
+// Other
+
+#include <twr_analog_sensor.h>
+#include <twr_config.h>
+#include <twr_data_stream.h>
+#include <twr_flood_detector.h>
+#include <twr_pulse_counter.h>
+#include <twr_soil_sensor.h>
+#include <twr_font_common.h>
+#include <twr_image.h>
+#include <twr_system.h>
+#include <twr_switch.h>
+#include <twr_timer.h>
+#include <twr_error.h>
+#include <twr_dice.h>
+#include <twr_ramp.h>
+#include <twr_gfx.h>
+#include <twr_atci.h>
+#include <twr_base64.h>
+#include <twr_sha256.h>
+#include <twr_ds18b20.h>
+#include <twr_onewire.h>
+#include <twr_onewire_gpio.h>
+#include <twr_onewire_ds2484.h>
+#include <twr_delay.h>
+
+#pragma GCC diagnostic ignored "-Wunused-parameter"
+
+//! @mainpage Overview
+//! Here you will find all the documented firmware SDK APIs.
+//!
+//! The SDK currently supports the following hardware platforms:
+//! \li HARDWARIO Core Module
+//! \li HARDWARIO USB Dongle
+//! \li HARDWARIO Cloony
+//!
+//! Go to the Modules page for complete listing.
+//!
+//! For more information visit the Basic Overview document in BigClown Documentation.
+
+#endif // _TWR_H


pkg/semtech-loramac: use uint8_t for NETOPT_RX_SYMBOL_TIMEOUT

--- pkg/semtech-loramac/contrib/semtech_loramac_radio.c
+++ pkg/semtech-loramac/contrib/semtech_loramac_radio.c
@@ -127,7 +127,10 @@
     loramac_netdev_ptr->driver->set(loramac_netdev_ptr, NETOPT_CHANNEL_HOP_PERIOD, &hopPeriod, sizeof(uint8_t));
     netopt_enable_t iq_inverted = (iqInverted) ? NETOPT_ENABLE : NETOPT_DISABLE;
     loramac_netdev_ptr->driver->set(loramac_netdev_ptr, NETOPT_IQ_INVERT, &iq_inverted, sizeof(netopt_enable_t));
-    loramac_netdev_ptr->driver->set(loramac_netdev_ptr, NETOPT_RX_SYMBOL_TIMEOUT, &symbTimeout, sizeof(uint16_t));
+    assert(symbTimeout <= UINT8_MAX);
+    uint8_t symbol_timeout = symbTimeout;
+    loramac_netdev_ptr->driver->set(loramac_netdev_ptr, NETOPT_RX_SYMBOL_TIMEOUT,
+                                    &symbol_timeout, sizeof(symbol_timeout));
     netopt_enable_t single_rx = rxContinuous ? NETOPT_DISABLE : NETOPT_ENABLE;
     loramac_netdev_ptr->driver->set(loramac_netdev_ptr, NETOPT_SINGLE_RECEIVE, &single_rx, sizeof(netopt_enable_t));
 }


cacasink: fix masks and strides

cacasink: fix masks and strides

Use the right endianness to read the masks.
Use the right strides for the bitmap.

Fixes #638569

--- ext/libcaca/gstcacasink.c
+++ ext/libcaca/gstcacasink.c
@@ -209,12 +209,14 @@
 {
   GstCACASink *cacasink;
   GstStructure *structure;
+  gint endianness;

   cacasink = GST_CACASINK (basesink);

   structure = gst_caps_get_structure (caps, 0);
   gst_structure_get_int (structure, "width", &(cacasink->width));
   gst_structure_get_int (structure, "height", &(cacasink->height));
+  gst_structure_get_int (structure, "endianness", &endianness);
   gst_structure_get_int (structure, "bpp", (int *) &cacasink->bpp);
   gst_structure_get_int (structure, "red_mask", (int *) &cacasink->red_mask);
   gst_structure_get_int (structure, "green_mask",
@@ -233,10 +235,16 @@
     cacasink->blue_mask = GUINT32_FROM_BE (cacasink->blue_mask);
   }

-  else if (cacasink->bpp == 16 || cacasink->bpp == 15) {
-    cacasink->red_mask = GUINT16_FROM_BE (cacasink->red_mask);
-    cacasink->green_mask = GUINT16_FROM_BE (cacasink->green_mask);
-    cacasink->blue_mask = GUINT16_FROM_BE (cacasink->blue_mask);
+  else if (cacasink->bpp == 16) {
+    if (endianness == G_BIG_ENDIAN) {
+      cacasink->red_mask = GUINT16_FROM_BE (cacasink->red_mask);
+      cacasink->green_mask = GUINT16_FROM_BE (cacasink->green_mask);
+      cacasink->blue_mask = GUINT16_FROM_BE (cacasink->blue_mask);
+    } else {
+      cacasink->red_mask = GUINT16_FROM_LE (cacasink->red_mask);
+      cacasink->green_mask = GUINT16_FROM_LE (cacasink->green_mask);
+      cacasink->blue_mask = GUINT16_FROM_LE (cacasink->blue_mask);
+    }
   }

   if (cacasink->bitmap) {
@@ -246,7 +254,7 @@
   cacasink->bitmap = caca_create_bitmap (cacasink->bpp,
       cacasink->width,
       cacasink->height,
-      cacasink->width * cacasink->bpp / 8,
+      GST_ROUND_UP_4 (cacasink->width * cacasink->bpp / 8),
       cacasink->red_mask, cacasink->green_mask, cacasink->blue_mask, 0);

   if (!cacasink->bitmap) {


Fix equals functions for math types.

Fix equals functions for math types.

Now simply returns false if the types aren't compatible. Raising an
exception seems a little like overkill for equivalency tests.

--- ext/snow-math/snow-math.c
+++ ext/snow-math/snow-math.c
@@ -602,12 +602,8 @@

 static VALUE sm_vec3_equals(VALUE sm_self, VALUE sm_other)
 {
-  if (!RTEST(sm_other)) {
+  if (!RTEST(sm_other) || (!SM_IS_A(sm_other, vec3) && !SM_IS_A(sm_other, vec4) && !SM_IS_A(sm_other, quat))) {
     return Qfalse;
-  } else if (!SM_IS_A(sm_other, vec3) && !SM_IS_A(sm_other, vec4) && !SM_IS_A(sm_other, quat)) {
-    rb_raise(rb_eTypeError,
-      "Expected Vec3, Vec4, or Quat, got %s",
-      rb_obj_classname(sm_other));
   }

   return vec3_equals(*sm_unwrap_vec3(sm_self, NULL), *sm_unwrap_vec3(sm_other, NULL)) ? Qtrue : Qfalse;
@@ -805,12 +801,8 @@

 static VALUE sm_vec4_equals(VALUE sm_self, VALUE sm_other)
 {
-  if (!RTEST(sm_other)) {
+  if (!RTEST(sm_other) || (!SM_IS_A(sm_other, vec4) && !SM_IS_A(sm_other, quat))) {
     return Qfalse;
-  } else if (!SM_IS_A(sm_other, vec4) && !SM_IS_A(sm_other, quat)) {
-    rb_raise(rb_eTypeError,
-      "Expected Vec4 or Quat, got %s",
-      rb_obj_classname(sm_other));
   }

   return vec4_equals(*sm_unwrap_vec4(sm_self, NULL), *sm_unwrap_vec4(sm_other, NULL)) ? Qtrue : Qfalse;
@@ -1983,10 +1975,8 @@

 static VALUE sm_mat4_equals(VALUE sm_self, VALUE sm_other)
 {
-  if (!RTEST(sm_other)) {
+  if (!RTEST(sm_other) || !SM_IS_A(sm_other, mat4)) {
     return Qfalse;
-  } else {
-    SM_RAISE_IF_NOT_TYPE(sm_other, mat4);
   }

   return mat4_equals(*sm_unwrap_mat4(sm_self, NULL), *sm_unwrap_mat4(sm_other, NULL)) ? Qtrue : Qfalse;
@@ -2407,10 +2397,8 @@

 static VALUE sm_mat3_equals(VALUE sm_self, VALUE sm_other)
 {
-  if (!RTEST(sm_other)) {
+  if (!RTEST(sm_other) || !SM_IS_A(sm_other, mat3)) {
     return Qfalse;
-  } else {
-    SM_RAISE_IF_NOT_TYPE(sm_other, mat3);
   }

   return mat3_equals(*sm_unwrap_mat3(sm_self, NULL), *sm_unwrap_mat3(sm_other, NULL)) ? Qtrue : Qfalse;


souphttpsrc: fix metadata writable warnings

Set metadata on buffer first, when the refcount is still 1, and only
ref again afterwards.

--- ext/soup/gstsouphttpsrc.c
+++ ext/soup/gstsouphttpsrc.c
@@ -1004,13 +1004,15 @@

   /* Extract the GstBuffer from the SoupBuffer and set its fields. */
   *src->outbuf = GST_BUFFER_CAST (soup_buffer_get_owner (chunk));
-  gst_buffer_ref (*src->outbuf);
+
   GST_BUFFER_SIZE (*src->outbuf) = chunk->length;
   GST_BUFFER_OFFSET (*src->outbuf) = basesrc->segment.last_stop;

   gst_buffer_set_caps (*src->outbuf,
       (src->src_caps) ? src->src_caps :
       GST_PAD_CAPS (GST_BASE_SRC_PAD (basesrc)));
+
+  gst_buffer_ref (*src->outbuf);

   new_position = src->read_position + chunk->length;
   if (G_LIKELY (src->request_position == src->read_position))


check for malloc error in ebur128_loudness_range

--- src/ebur128.c
+++ src/ebur128.c
@@ -427,6 +427,7 @@
   }
   if (!stl_size) return 0.0;
   stl_vector = calloc(stl_size, sizeof(double));
+  if (!stl_vector) return 0.0 / 0.0;
   i = 0;
   for (it = st->short_term_block_list.lh_first; it != NULL;
        it = it->entries.le_next) {