updated memory pool object

updated memory pool object

--- StateOS/kernel/inc/os_mem.h
+++ StateOS/kernel/inc/os_mem.h
@@ -482,11 +482,11 @@
 	explicit
 	MemoryPoolTT( void ): MemoryPoolT<_limit, sizeof(T)>() {}

-	unsigned waitUntil( T **_data, uint32_t _time )  { return mem_waitUntil(this, _data, _time);  }
-	unsigned waitFor  ( T **_data, uint32_t _delay ) { return mem_waitFor  (this, _data, _delay); }
-	unsigned wait     ( T **_data )                  { return mem_wait     (this, _data);         }
-	unsigned take     ( T **_data )                  { return mem_take     (this, _data);         }
-	unsigned takeISR  ( T **_data )                  { return mem_takeISR  (this, _data);         }
+	unsigned waitUntil( T **_data, uint32_t _time )  { return mem_waitUntil(this, reinterpret_cast<void **>(_data), _time);  }
+	unsigned waitFor  ( T **_data, uint32_t _delay ) { return mem_waitFor  (this, reinterpret_cast<void **>(_data), _delay); }
+	unsigned wait     ( T **_data )                  { return mem_wait     (this, reinterpret_cast<void **>(_data));         }
+	unsigned take     ( T **_data )                  { return mem_take     (this, reinterpret_cast<void **>(_data));         }
+	unsigned takeISR  ( T **_data )                  { return mem_takeISR  (this, reinterpret_cast<void **>(_data));         }
 };

 #endif


update 3 days to one hour

update 3 days to one hour

#define NRJ_TARGETTIMESPAN 60*60;
//3.0 * 24 * 60 * 60 = 3 days to
//60 * 60  = 1 hour

--- src/nrjconf.h
+++ src/nrjconf.h
@@ -25,7 +25,8 @@
 #define NRJ_BLOCKCOIN_PREMINING 100100000 //coins per gen block

 // Nrjcoin: 3.5 days to 3.0 days
-#define NRJ_TARGETTIMESPAN 3.0 * 24 * 60 * 60
+//3.0 * 24 * 60 * 60 3 days to 1 hour = 60 * 60
+#define NRJ_TARGETTIMESPAN 60*60;
 // Nrjcoin: 2.5 minutes to 2.0 minutes
 #define NRJ_TARGETSPACING  2.0 * 60


keyboard: it83xx: add COL02 inverted feature

The other chips support this feature so we implement it too.

Signed-off-by: Dino Li <00c808bcd0610e8dd73a10880490949c0c589d41@ite.com.tw>

BRANCH=none
BUG=none
TEST=The behavior of kso2 is inverted
     if define 'CONFIG_KEYBOARD_COL2_INVERTED'.

Change-Id: I70d1694ca7d3d10278a484a632e88dc204b71b23
Reviewed-on: https://chromium-review.googlesource.com/342488
Commit-Ready: Dino Li <00c808bcd0610e8dd73a10880490949c0c589d41@ite.com.tw>
Tested-by: Dino Li <00c808bcd0610e8dd73a10880490949c0c589d41@ite.com.tw>
Reviewed-by: Randall Spangler <62698fdbb84d1779579ee80c3f39fac22017e5bc@chromium.org>

--- chip/it83xx/keyboard_raw.c
+++ chip/it83xx/keyboard_raw.c
@@ -29,8 +29,13 @@
 	/* bit2, 1 enables the internal pull-up of the KSI[7:0] pins. */
 	IT83XX_KBS_KSICTRL = 0x04;

+#ifdef CONFIG_KEYBOARD_COL2_INVERTED
+	/* KSO[2] is high, others are low. */
+	IT83XX_KBS_KSOL = (1 << 2);
+#else
 	/* KSO[7:0] pins low. */
 	IT83XX_KBS_KSOL = 0x00;
+#endif

 	/* KSO[15:8] pins low. */
 	IT83XX_KBS_KSOH1 = 0x00;
@@ -74,6 +79,10 @@
 	else
 		mask = 0xffff ^ (1 << col);

+#ifdef CONFIG_KEYBOARD_COL2_INVERTED
+	/* KSO[2] is inverted. */
+	mask ^= (1 << 2);
+#endif
 	IT83XX_KBS_KSOL = mask & 0xff;
 	IT83XX_KBS_KSOH1 = (mask >> 8) & 0xff;
 }


Fix intermittent mongoose webserver crash on Windows. Occassionally, a new worker thread will be started, but will have not have a connection to handle because another worker thread grabs it first. If no further connections arrive, the new worker thread will proceed to exit. This will crash when accessing the worker's connection's context, which has never been set.
The fix is to use the context that was given to the worker initially in this case.
BUG=none
TEST=none

Review URL: http://codereview.chromium.org/6244002

git-svn-id: de016e52bd170d2d4f2344f9bf92d50478b649e0@73034 0039d316-1c4b-4281-b951-d872f2087c98

--- third_party/mongoose/mongoose.c
+++ third_party/mongoose/mongoose.c
@@ -4543,12 +4543,12 @@
   }

   /* Signal master that we're done with connection and exiting */
-  pthread_mutex_lock(&conn.ctx->thr_mutex);
-  conn.ctx->num_threads--;
-  conn.ctx->num_idle--;
-  pthread_cond_signal(&conn.ctx->thr_cond);
-  assert(conn.ctx->num_threads >= 0);
-  pthread_mutex_unlock(&conn.ctx->thr_mutex);
+  pthread_mutex_lock(&ctx->thr_mutex);
+  ctx->num_threads--;
+  ctx->num_idle--;
+  pthread_cond_signal(&ctx->thr_cond);
+  assert(ctx->num_threads >= 0);
+  pthread_mutex_unlock(&ctx->thr_mutex);

   DEBUG_TRACE((DEBUG_MGS_PREFIX "%s: thread %p exiting",
       __func__, (void *) pthread_self()));


zephyr: test chgoverride console command for invalid port

Add a test to execute the chgoverride console command using a port number
that's too big (CHARGE_PORT_COUNT).

BRANCH=none
BUG=b:222630005
TEST=zmake test test-drivers

Signed-off-by: Yuval Peress <50dc11c009bd4d7e9d9d15a383c1743ce5ee82ef@google.com>
Change-Id: I592fd0742f28dd383ce6e9005dcb5f71de2e2f4e
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/3518069
Reviewed-by: Aaron Massey <79529a820df71f45023239a3663736629646cc34@google.com>

--- zephyr/test/drivers/src/console_cmd/charge_manager.c
+++ zephyr/test/drivers/src/console_cmd/charge_manager.c
@@ -129,3 +129,13 @@
 	zassert_equal(shell_execute_cmd(get_ec_shell(), "chgoverride 0"),
 		      EC_ERROR_INVAL, NULL);
 }
+
+ZTEST_USER(console_cmd_charge_manager, test_chgoverride_invalid_port)
+{
+	char cmd[256];
+
+	zassume_true(sprintf(cmd, "chgoverride %d", CHARGE_PORT_COUNT) > 0,
+		     NULL);
+	zassert_equal(shell_execute_cmd(get_ec_shell(), cmd), EC_ERROR_PARAM1,
+		      NULL);
+}


remove get_ prefix from accessor function names

Summary: Remove get_ from Thrift AST accessor function names

Reviewed By: yfeldblum

Differential Revision: D26965800

fbshipit-source-id: 6857e7e513426bb89af038f70528c42e313ed8d1

--- thrift/compiler/ast/t_program.h
+++ thrift/compiler/ast/t_program.h
@@ -117,31 +117,31 @@
   /**
    * Get program elements
    */
-  const std::vector<t_typedef*>& get_typedefs() const {
+  const std::vector<t_typedef*>& typedefs() const {
     return typedefs_;
   }
-  const std::vector<t_enum*>& get_enums() const {
+  const std::vector<t_enum*>& enums() const {
     return enums_;
   }
-  const std::vector<t_const*>& get_consts() const {
+  const std::vector<t_const*>& consts() const {
     return consts_;
   }
-  const std::vector<t_struct*>& get_structs() const {
+  const std::vector<t_struct*>& structs() const {
     return structs_;
   }
-  const std::vector<t_exception*>& get_xceptions() const {
+  const std::vector<t_exception*>& xceptions() const {
     return xceptions_;
   }
-  const std::vector<t_struct*>& get_objects() const {
+  const std::vector<t_struct*>& objects() const {
     return objects_;
   }
-  const std::vector<t_service*>& get_services() const {
+  const std::vector<t_service*>& services() const {
     return services_;
   }
-  const std::vector<t_typedef*>& get_placeholder_typedefs() const {
+  const std::vector<t_typedef*>& placeholder_typedefs() const {
     return placeholder_typedefs_;
   }
-  const std::vector<t_service*>& get_interactions() const {
+  const std::vector<t_service*>& interactions() const {
     return interactions_;
   }

@@ -170,11 +170,11 @@
   /**
    * t_program getters
    */
-  const std::string& get_path() const {
+  const std::string& path() const {
     return path_;
   }

-  const std::string& get_name() const {
+  const std::string& name() const {
     return name_;
   }

@@ -182,7 +182,7 @@
     return namespace_;
   }

-  const std::string& get_include_prefix() const {
+  const std::string& include_prefix() const {
     return include_prefix_;
   }

@@ -191,7 +191,7 @@
    * type t_include*, and contains information about the program included, as
    * well as the location of the include statement.
    */
-  const std::vector<t_include*>& get_includes() const {
+  const std::vector<t_include*>& includes() const {
     return includes_;
   }

@@ -211,12 +211,12 @@
   }

   // Only used in py_frontend.tcc
-  const std::map<std::string, std::string>& get_namespaces() const {
+  const std::map<std::string, std::string>& namespaces() const {
     return namespaces_;
   }

   // Only used in t_cpp_generator
-  const std::vector<std::string>& get_cpp_includes() const {
+  const std::vector<std::string>& cpp_includes() const {
     return cpp_includes_;
   }

@@ -259,6 +259,55 @@
    * @param path - A *.thrift file path
    */
   std::string compute_name_from_file_path(std::string path);
+
+  /**
+   * TODO: remove, see: T84718055
+   */
+  const std::vector<t_typedef*>& get_typedefs() const {
+    return typedefs();
+  }
+  const std::vector<t_enum*>& get_enums() const {
+    return enums();
+  }
+  const std::vector<t_const*>& get_consts() const {
+    return consts();
+  }
+  const std::vector<t_struct*>& get_structs() const {
+    return structs();
+  }
+  const std::vector<t_exception*>& get_xceptions() const {
+    return xceptions();
+  }
+  const std::vector<t_struct*>& get_objects() const {
+    return objects();
+  }
+  const std::vector<t_service*>& get_services() const {
+    return services();
+  }
+  const std::vector<t_typedef*>& get_placeholder_typedefs() const {
+    return placeholder_typedefs();
+  }
+  const std::vector<t_service*>& get_interactions() const {
+    return interactions();
+  }
+  const std::string& get_path() const {
+    return path();
+  }
+  const std::string& get_name() const {
+    return name();
+  }
+  const std::string& get_include_prefix() const {
+    return include_prefix();
+  }
+  const std::vector<t_include*>& get_includes() const {
+    return includes();
+  }
+  const std::map<std::string, std::string>& get_namespaces() const {
+    return namespaces();
+  }
+  const std::vector<std::string>& get_cpp_includes() const {
+    return cpp_includes();
+  }

  private:
   // All the elements owned by this program.


[master] win32 sockets don't support dscp

--- lib/isc/win32/socket.c
+++ lib/isc/win32/socket.c
@@ -1471,7 +1471,6 @@

 	sock->manager = manager;
 	sock->type = type;
-	sock->dscp = 0;		/* TOS/TCLASS is zero until set. */
 	sock->fd = INVALID_SOCKET;

 	ISC_LINK_INIT(sock, link);


Added missing "inline".

Added missing "inline".

--- src/zorbatypes/integer.h
+++ src/zorbatypes/integer.h
@@ -591,7 +591,7 @@
 #ifdef ZORBA_WITH_BIG_INTEGER
 #if ZORBA_SIZEOF_INT != ZORBA_SIZEOF_LONG
 TEMPLATE_DECL(T)
-INTEGER_IMPL(T)::IntegerImpl( unsigned int n ) :
+inline INTEGER_IMPL(T)::IntegerImpl( unsigned int n ) :
   value_( static_cast<long>( (unsigned long)n ) )
 {
 }


staging: lustre: remove assignment in if condition

This patch removes the assignment in if conditions to do away with the
checkpatch warning :'do not use assignment in if condition'.

Signed-off-by: Himangi Saraogi <23256c5b125c18bd580b7fa252de87dcf0c3a427@gmail.com>
Reviewed-by: Paul E. McKenney <1e0ce936bb9b355d257bf5790d2513c3f28be22b@linux.vnet.ibm.com>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>

--- drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c
+++ drivers/staging/lustre/lustre/ptlrpc/gss/gss_krb5_mech.c
@@ -678,7 +678,8 @@
 	__u32		  code = GSS_S_FAILURE;
 	int		    rc;

-	if (!(tfm = ll_crypto_alloc_hash(ke->ke_hash_name, 0, 0))) {
+	tfm = ll_crypto_alloc_hash(ke->ke_hash_name, 0, 0);
+	if (!tfm) {
 		CERROR("failed to alloc TFM: %s\n", ke->ke_hash_name);
 		return GSS_S_FAILURE;
 	}


staging: unisys: visorchannel: Improved cleanup code

kfree on NULL pointer is a no-op.

This patch used the following semantic patch to find an instance where NULL
check is present before kfree

// <smpl>
@@ expression E; @@
- if (E != NULL) { kfree(E); }
+ kfree(E);
@@ expression E; @@
- if (E != NULL) { kfree(E); E = NULL; }
+ kfree(E);
+ E = NULL;
// </smpl>

Code is made more simpler by breaking up of sequence of kmallocs and adding
some more exit labels.
Removed unnecessary initialization of buf and fmtbuf to NULL as they are local
variables.

Suggested-by: Arnd Bergmann <f2c659f01951776204a6c5b902787d9019fbeebd@arndb.de>
Suggested-by: Julia Lawall <018ee4f95fc49739477deedb13d2cd210889e607@lip6.fr>
Signed-off-by: Tapasweni Pathak <3b69268f7ace5bdf0735d0c2203b969d339216e4@gmail.com>
Acked-by: Julia Lawall <018ee4f95fc49739477deedb13d2cd210889e607@lip6.fr>
Signed-off-by: Greg Kroah-Hartman <4645f7897fd33786a2ee1264d590b3c400559d85@linuxfoundation.org>


Report write and read duration during SDRAM test

--- sdram_test/sdram_test_main.c
+++ sdram_test/sdram_test_main.c
@@ -229,6 +229,7 @@
     uint32_t index;
     uint32_t num_errors;
     uint32_t offset;
+    unsigned int write_duration, read_duration;

     MMUConfigAndEnable ();
     CacheEnable (CACHE_ALL);
@@ -244,11 +245,14 @@
     {
         time_resolve (RTCTimeGet (SOC_RTC_0_REGS));
         UARTprintf ("Write test starting\n");
+        (void) SysPerfTimerConfig (1);
         for (index = 0; index < SDRAM_SIZE_WORDS; index++)
         {
             sdram_base[index] = index + offset;
         }
-
+        write_duration = SysPerfTimerConfig (0);
+
+        (void) SysPerfTimerConfig (1);
         for (index = 0; index < SDRAM_SIZE_WORDS; index++)
         {
             if (sdram_base[index] != (index + offset))
@@ -256,8 +260,10 @@
                 num_errors++;
             }
         }
+        read_duration = SysPerfTimerConfig (0);

         time_resolve (RTCTimeGet (SOC_RTC_0_REGS));
+        UARTprintf ("Write duration = %u  Read duration = %u\n", write_duration, read_duration);
         UARTprintf ("After index write num_errors=%u\n", num_errors);

         for (index = 0; index < SDRAM_SIZE_WORDS; index++)


Initialise the al variable

Initialise the al variable

al can be used uninitialised in an error path.

Reviewed-by: Rich Salz <c04971a99e5a9ee80eaab4b1deb37e845b0bd697@openssl.org>
(Merged from https://github.com/openssl/openssl/pull/2020)

--- ssl/statem/statem_clnt.c
+++ ssl/statem/statem_clnt.c
@@ -3012,7 +3012,7 @@

 int tls_construct_client_certificate(SSL *s, WPACKET *pkt)
 {
-    int al;
+    int al = SSL_AD_INTERNAL_ERROR;

     /*
      * TODO(TLS1.3): For now we must put an empty context. Needs to be filled in


libfreerdp-core: fix pcap rfx playback

libfreerdp-core: fix pcap rfx playback

--- libfreerdp/core/freerdp.c
+++ libfreerdp/core/freerdp.c
@@ -124,21 +124,20 @@
 			rdpUpdate* update;
 			pcap_record record;

-			s = Stream_New(NULL, 1024);
-			instance->update->pcap_rfx = pcap_open(instance->settings->PlayRemoteFxFile, FALSE);
-
-			if (instance->update->pcap_rfx)
-				instance->update->play_rfx = TRUE;
+			update = instance->update;
+
+			s = StreamPool_Take(rdp->transport->ReceivePool, 0);
+			instance->update->pcap_rfx = pcap_open(settings->PlayRemoteFxFile, FALSE);
+
+			if (update->pcap_rfx)
+				update->play_rfx = TRUE;

-			update = instance->update;
-
-			while (instance->update->play_rfx && pcap_has_next_record(update->pcap_rfx))
+			while (update->play_rfx && pcap_has_next_record(update->pcap_rfx))
 			{
 				pcap_get_next_record_header(update->pcap_rfx, &record);

-				Stream_Buffer(s) = (BYTE*) realloc(Stream_Buffer(s), record.length);
+				Stream_EnsureCapacity(s, record.length);
 				record.data = Stream_Buffer(s);
-				Stream_Capacity(s) = record.length;

 				pcap_get_next_record_content(update->pcap_rfx, &record);
 				Stream_SetPosition(s, 0);
@@ -148,7 +147,8 @@
 				update->EndPaint(update->context);
 			}

-			free(Stream_Buffer(s));
+			Stream_Release(s);
+
 			return TRUE;
 		}
 	}


remove bogus dt from att rate

remove bogus dt from att rate

--- apps/multirotor_att_control/multirotor_attitude_control.c
+++ apps/multirotor_att_control/multirotor_attitude_control.c
@@ -249,7 +249,7 @@
 			att->roll, att->rollspeed, deltaT);

 	/* control yaw rate */
-	rates_sp->yaw= deltaT * p.yaw_p * atan2f(sinf(att->yaw - att_sp->yaw_body), cosf(att->yaw - att_sp->yaw_body));
+	rates_sp->yaw = p.yaw_p * atan2f(sinf(att->yaw - att_sp->yaw_body), cosf(att->yaw - att_sp->yaw_body));


add selection info to status line

add selection info to status line

--- bview.c
+++ bview.c
@@ -813,15 +813,26 @@

     // Anchor indicator
     int i_anchor_fg, i_anchor_bg;
+    bint_t anchor_len, anchor_nlines, anchor_tmp;
     char* i_anchor;
+    cursor_t* cursor;
     if (active_edit->active_cursor->is_anchored) {
         i_anchor_fg = TB_WHITE | TB_BOLD;
         i_anchor_bg = TB_BLACK;
-        i_anchor = "\xe2\x97\xa8";
+        i_anchor = "a";
+        cursor = active_edit->active_cursor;
+        mark_get_offset(cursor->anchor, &anchor_tmp);
+        mark_get_offset(cursor->mark, &anchor_len);
+        anchor_len -= anchor_tmp;
+        anchor_nlines = cursor->anchor->bline->line_index - cursor->mark->bline->line_index;
+        if (anchor_nlines < 0) anchor_nlines *= -1;
+        anchor_nlines += 1;
     } else {
         i_anchor_fg = 0;
         i_anchor_bg = 0;
         i_anchor = ".";
+        anchor_len = 0;
+        anchor_nlines = 0;
     }

     // Async indicator
@@ -867,11 +878,12 @@
     tb_printf(editor->rect_status, 0, 0, 0, 0, "%*.*s", editor->rect_status.w, editor->rect_status.w, " ");
     tb_printf_attr(editor->rect_status, 0, 0,
         "@%d,%d;%s@%d,%d;"                                // mle_normal    mode
-        "(@%d,%d;%s@%d,%d;%s@%d,%d;%s@%d,%d;%s@%d,%d;)  " // (....)        need_input,anchor,macro,async
-        "buf:@%d,%d;%d@%d,%d;/@%d,%d;%d@%d,%d;  "         // buf[1/2]      bview num
+        "[@%d,%d;%s@%d,%d;%s@%d,%d;%s@%d,%d;%s@%d,%d;]  " // [....]        need_input,anchor,macro,async
+        "buf:@%d,%d;%d@%d,%d;/@%d,%d;%d@%d,%d;  "         // buf:1/2       bview num
         "<@%d,%d;%s@%d,%d;>  "                            // <php>         syntax
         "line:@%d,%d;%llu@%d,%d;/@%d,%d;%llu@%d,%d;  "    // line:1/100    line
-        "col:@%d,%d;%llu@%d,%d;/@%d,%d;%llu@%d,%d; ",     // col:0/80      col
+        "col:@%d,%d;%llu@%d,%d;/@%d,%d;%llu@%d,%d;  "     // col:0/80      col
+        "%s@%d,%d;%lld@%d,%d;,@%d,%d;%llu@%d,%d;  ",      // sel:10,1      sel len, nlines
         TB_MAGENTA | TB_BOLD, 0, active->kmap_tail->kmap->name, 0, 0,
         i_needinput_fg, i_needinput_bg, i_needinput,
         i_anchor_fg, i_anchor_bg, i_anchor,
@@ -880,7 +892,11 @@
         TB_BLUE | TB_BOLD, 0, bview_num, 0, 0, TB_BLUE, 0, bview_count, 0, 0,
         TB_CYAN | TB_BOLD, 0, active_edit->syntax ? active_edit->syntax->name : "none", 0, 0,
         TB_YELLOW | TB_BOLD, 0, mark->bline->line_index + 1, 0, 0, TB_YELLOW, 0, active_edit->buffer->line_count, 0, 0,
-        TB_YELLOW | TB_BOLD, 0, mark->col, 0, 0, TB_YELLOW, 0, mark->bline->char_count, 0, 0
+        TB_YELLOW | TB_BOLD, 0, mark->col, 0, 0, TB_YELLOW, 0, mark->bline->char_count, 0, 0,
+        anchor_nlines == 0 ? "" : "sel:",
+        anchor_nlines == 0 ? TB_BLACK : TB_YELLOW | TB_BOLD, 0, anchor_len,
+        anchor_nlines == 0 ? TB_BLACK : 0, 0,
+        anchor_nlines == 0 ? TB_BLACK : TB_YELLOW, 0, anchor_nlines, 0, 0
     );

     // Overlay errstr if present


[PATCH] SELinux: handle sel_make_bools() failure in selinuxfs

This patch fixes error handling in sel_make_bools(), where currently we'd
get a memory leak via security_get_bools() and try to kfree() the wrong
pointer if called again.

Signed-off-by: James Morris <10d11de3abc355eabe955bb734f0f8e71da56e16@namei.org>
Acked-by: Stephen Smalley <d6e1285e1c84d3d5885c2124fdacc780e9fc0a94@tycho.nsa.gov>
Signed-off-by: Andrew Morton <5c1e68b099950c134891f0b6e179498a8ebe9cf9@osdl.org>
Signed-off-by: Linus Torvalds <69652caca27c8b940640ad396ab71f93cacec34f@osdl.org>

--- security/selinux/selinuxfs.c
+++ security/selinux/selinuxfs.c
@@ -879,7 +879,7 @@
 	if (sscanf(page, "%d", &new_value) != 1)
 		goto out;

-	if (new_value) {
+	if (new_value && bool_pending_values) {
 		security_set_bools(bool_num, bool_pending_values);
 	}

@@ -952,6 +952,7 @@

 	/* remove any existing files */
 	kfree(bool_pending_values);
+	bool_pending_values = NULL;

 	sel_remove_bools(dir);

@@ -1002,6 +1003,7 @@
 	}
 	return ret;
 err:
+	kfree(values);
 	d_genocide(dir);
 	ret = -ENOMEM;
 	goto out;


Stop calling strlen() repeatedly, turning O(n^2) search into O(N)

git-svn-id: 0e603907cfa4f06ae5dc5acf3d8fa5d387d7bd3e@8604 aec4f576-4910-0410-beeb-ecb0427469e7

--- liblicense/license_info.c
+++ liblicense/license_info.c
@@ -194,8 +194,10 @@
       int position;
       ll_version_t result;

+      size_t version_length = strlen(version);
+
       divisions = 1;
-      for (c = 0; c < strlen (version); ++c)
+      for (c = 0; c < version_length; ++c)
         {
           if (version[c] == '.')
             {


down_rdata: drop redundant include

down_rdata: drop redundant include

--- wdns/msg/downcase_rdata.c
+++ wdns/msg/downcase_rdata.c
@@ -1,5 +1,4 @@
 #include "private.h"
-#include "record_descr.h"

 wdns_msg_status
 wdns_downcase_rdata(wdns_rdata_t *rdata, uint16_t rrtype, uint16_t rrclass)


More return type deduction

More return type deduction

--- DEM/Low/src/Data/Metadata.h
+++ DEM/Low/src/Data/Metadata.h
@@ -72,9 +72,9 @@
 	{
 	}

-	//CMember& Get(TGetter pGetter) { _pGetter = pGetter; }
-	//CMember& Set(TSetter pSetter) { _pSetter = pSetter; }
-	// TODO: specials like SetRange for numerics
+	// TODO: nicer Extras. But how?
+	// CMember(n, g, s, Ex<T>().Min().Max())?
+	//???or CMemberBase + per-type overloads with embedded extras?

 	constexpr CMember& Extras(CTypeMetadata<T>&& Value) { _Extras = std::move(Value); return *this; }
 	constexpr auto&    Extras() const { return _Extras; }
@@ -141,19 +141,19 @@
 };

 template<typename TClass, typename T, typename TGetter = std::nullptr_t, typename TSetter = std::nullptr_t>
-inline constexpr CMember<TClass, T, TGetter, TSetter> Member(const char* pName, TGetter pGetter = nullptr, TSetter pSetter = nullptr)
+inline constexpr auto Member(const char* pName, TGetter pGetter = nullptr, TSetter pSetter = nullptr)
 {
 	return CMember<TClass, T, TGetter, TSetter>(pName, pGetter, pSetter);
 }

 template<typename TClass, typename T>
-inline constexpr CMember<TClass, T, T TClass::*, std::nullptr_t> Member(const char* pName, T TClass::* pGetter)
+inline constexpr auto Member(const char* pName, T TClass::* pGetter)
 {
 	return CMember<TClass, T, T TClass::*, std::nullptr_t>(pName, pGetter, nullptr);
 }

 template<typename TClass, typename T>
-inline constexpr CMember<TClass, T, T TClass::*, T TClass::*> Member(const char* pName, T TClass::* pGetter, T TClass::* pSetter)
+inline constexpr auto Member(const char* pName, T TClass::* pGetter, T TClass::* pSetter)
 {
 	return CMember<TClass, T, T TClass::*, T TClass::*>(pName, pGetter, pSetter);
 }


Fix default license header.

Fix default license header.

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

--- libpostproc/postprocess.c
+++ libpostproc/postprocess.c
@@ -3,7 +3,7 @@
  *
  * AltiVec optimizations (C) 2004 Romain Dolbeau <romain@dolbeau.org>
  *
- * FFmpeg is free software.
+ * This file is part of FFmpeg.
  *
  * FFmpeg is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by


Make devname(3) return something more intelligent than NULL if it doesn't find anything in the database.

--- lib/libc/gen/devname.c
+++ lib/libc/gen/devname.c
@@ -44,9 +44,10 @@
 #include <paths.h>
 #include <stdio.h>
 #include <string.h>
+#include <sys/stat.h>

-char *
-devname(dev, type)
+static char *
+xdevname(dev, type)
 	dev_t dev;
 	mode_t type;
 {
@@ -78,3 +79,27 @@
 	key.size = sizeof(bkey);
 	return ((db->get)(db, &key, &data, 0) ? NULL : (char *)data.data);
 }
+
+char *
+devname(dev, type)
+	dev_t dev;
+	mode_t type;
+{
+	static char buf[20];
+	char *r;
+
+	r = xdevname(dev, type);
+	if (!r) {
+		r = buf;
+		if (minor(dev) > 255) {
+			sprintf(buf, "#%c%d:0x%x",
+			    (type & S_IFMT) == S_IFCHR ? 'C' : 'B',
+			    major(dev), minor(dev));
+		} else {
+			sprintf(buf, "#%c%d:%d",
+			    (type & S_IFMT) == S_IFCHR ? 'C' : 'B',
+			    major(dev), minor(dev));
+		}
+	}
+	return (r);
+}


make libkvm capable of dealing with a crashdump on alphas Reviewed by: Doug Rabson <dfr@nlsystems.com>

--- lib/libkvm/kvm_alpha.c
+++ lib/libkvm/kvm_alpha.c
@@ -1,4 +1,4 @@
-/* $Id$ */
+/* $Id: kvm_alpha.c,v 1.1 1998/08/15 12:12:22 dfr Exp $ */
 /*	$NetBSD: kvm_alpha.c,v 1.7.2.1 1997/11/02 20:34:26 mellon Exp $	*/

 /*
@@ -32,6 +32,8 @@
 #include <sys/user.h>
 #include <sys/proc.h>
 #include <sys/stat.h>
+#include <sys/types.h>
+#include <sys/uio.h>
 #include <unistd.h>
 #include <nlist.h>
 #include <kvm.h>
@@ -42,8 +44,16 @@
 #include <limits.h>
 #include <db.h>
 #include <stdlib.h>
-
+#include <machine/pmap.h>
 #include "kvm_private.h"
+
+static off_t   _kvm_pa2off(kvm_t *kd, u_long pa);
+
+struct vmstate {
+	u_int64_t       lev1map_pa;             /* PA of Lev1map */
+        u_int64_t       page_size;              /* Page size */
+        u_int64_t       nmemsegs;               /* Number of RAM segm */
+};

 void
 _kvm_freevtop(kd)
@@ -59,8 +69,39 @@
 _kvm_initvtop(kd)
 	kvm_t *kd;
 {
-
+	struct vmstate *vm;
+	struct nlist nlist[2];
+	u_long pa;
+
+	vm = (struct vmstate *)_kvm_malloc(kd, sizeof(*vm));
+	if (vm == 0) {
+		_kvm_err(kd, kd->program, "cannot allocate vm");
+		return (-1);
+	}
+	kd->vmst = vm;
+	vm->page_size = ALPHA_PGBYTES;
+
+	nlist[0].n_name = "_Lev1map";
+	nlist[1].n_name = 0;
+
+	if (kvm_nlist(kd, nlist) != 0) {
+		_kvm_err(kd, kd->program, "bad namelist");
+		return (-1);
+	}
+
+	if(!ISALIVE(kd)) {
+		if (kvm_read(kd, (nlist[0].n_value), &pa, sizeof(pa)) != sizeof(pa)) {
+			_kvm_err(kd, kd->program, "cannot read Lev1map");
+			return (-1);
+		}
+	} else
+		if (kvm_read(kd, (nlist[0].n_value), &pa, sizeof(pa)) != sizeof(pa)) {
+			_kvm_err(kd, kd->program, "cannot read Lev1map");
+			return (-1);
+		}
+	vm->lev1map_pa = pa;
 	return (0);
+
 }

 int
@@ -69,35 +110,42 @@
 	u_long va;
 	u_long *pa;
 {
-#if 0
-	cpu_kcore_hdr_t *cpu_kh;
+	u_int64_t       lev1map_pa;             /* PA of Lev1map */
+        u_int64_t       page_size;
 	int rv, page_off;
 	alpha_pt_entry_t pte;
 	off_t pteoff;
+	struct vmstate *vm;
+	vm = kd->vmst ;
+

         if (ISALIVE(kd)) {
                 _kvm_err(kd, 0, "vatop called in live kernel!");
                 return(0);
         }
-
-	cpu_kh = kd->cpu_data;
-	page_off = va & (cpu_kh->page_size - 1);
-
+	lev1map_pa = vm->lev1map_pa;
+	page_size  = vm->page_size;
+
+	page_off = va & (page_size - 1);
 	if (va >= ALPHA_K0SEG_BASE && va <= ALPHA_K0SEG_END) {
 		/*
 		 * Direct-mapped address: just convert it.
 		 */

 		*pa = ALPHA_K0SEG_TO_PHYS(va);
-		rv = cpu_kh->page_size - page_off;
+		rv = page_size - page_off;
 	} else if (va >= ALPHA_K1SEG_BASE && va <= ALPHA_K1SEG_END) {
 		/*
 		 * Real kernel virtual address: do the translation.
 		 */
+#define PTMASK			((1 << ALPHA_PTSHIFT) - 1)
+#define pmap_lev1_index(va)	(((va) >> ALPHA_L1SHIFT) & PTMASK)
+#define pmap_lev2_index(va)	(((va) >> ALPHA_L2SHIFT) & PTMASK)
+#define pmap_lev3_index(va)	(((va) >> ALPHA_L3SHIFT) & PTMASK)

 		/* Find and read the L1 PTE. */
-		pteoff = cpu_kh->lev1map_pa +
-		    kvtol1pte(va) * sizeof(alpha_pt_entry_t);
+		pteoff = lev1map_pa +
+			pmap_lev1_index(va)  * sizeof(alpha_pt_entry_t);
 		if (lseek(kd->pmfd, _kvm_pa2off(kd, pteoff), 0) == -1 ||
 		    read(kd->pmfd, (char *)&pte, sizeof(pte)) != sizeof(pte)) {
 			_kvm_syserr(kd, 0, "could not read L1 PTE");
@@ -109,8 +157,8 @@
 			_kvm_err(kd, 0, "invalid translation (invalid L1 PTE)");
 			goto lose;
 		}
-		pteoff = ALPHA_PTE_TO_PFN(pte) * cpu_kh->page_size +
-		    vatoste(va) * sizeof(alpha_pt_entry_t);
+		pteoff = ALPHA_PTE_TO_PFN(pte) * page_size +
+		    pmap_lev2_index(va) * sizeof(alpha_pt_entry_t);
 		if (lseek(kd->pmfd, _kvm_pa2off(kd, pteoff), 0) == -1 ||
 		    read(kd->pmfd, (char *)&pte, sizeof(pte)) != sizeof(pte)) {
 			_kvm_syserr(kd, 0, "could not read L2 PTE");
@@ -122,8 +170,8 @@
 			_kvm_err(kd, 0, "invalid translation (invalid L2 PTE)");
 			goto lose;
 		}
-		pteoff = ALPHA_PTE_TO_PFN(pte) * cpu_kh->page_size +
-		    vatopte(va) * sizeof(alpha_pt_entry_t);
+		pteoff = ALPHA_PTE_TO_PFN(pte) * page_size +
+		    pmap_lev3_index(va) * sizeof(alpha_pt_entry_t);
 		if (lseek(kd->pmfd, _kvm_pa2off(kd, pteoff), 0) == -1 ||
 		    read(kd->pmfd, (char *)&pte, sizeof(pte)) != sizeof(pte)) {
 			_kvm_syserr(kd, 0, "could not read L3 PTE");
@@ -135,8 +183,8 @@
 			_kvm_err(kd, 0, "invalid translation (invalid L3 PTE)");
 			goto lose;
 		}
-		*pa = ALPHA_PTE_TO_PFN(pte) * cpu_kh->page_size + page_off;
-		rv = cpu_kh->page_size - page_off;
+		*pa = ALPHA_PTE_TO_PFN(pte) * page_size + page_off;
+		rv = page_size - page_off;
 	} else {
 		/*
 		 * Bogus address (not in KV space): punt.
@@ -149,9 +197,6 @@
 	}

 	return (rv);
-#else
-	return (0);
-#endif
 }

 /*
@@ -162,36 +207,6 @@
 	kvm_t *kd;
 	u_long pa;
 {
-#if 0
-	off_t off;
-	cpu_kcore_hdr_t *cpu_kh;
-
-	cpu_kh = kd->cpu_data;
-
-	off = 0;
-	pa -= cpu_kh->core_seg.start;
-
-	return (kd->dump_off + off + pa);
-#else
-	return 0;		/* XXX fixme */
-#endif
-}
-
-/*
- * Machine-dependent initialization for ALL open kvm descriptors,
- * not just those for a kernel crash dump.  Some architectures
- * have to deal with these NOT being constants!  (i.e. m68k)
- */
-int
-_kvm_mdopen(kd)
-	kvm_t	*kd;
-{
-
-#if 0				/* XXX fixme */
-	kd->usrstack = USRSTACK;
-	kd->min_uva = VM_MIN_ADDRESS;
-	kd->max_uva = VM_MAXUSER_ADDRESS;
-#endif
-
-	return (0);
-}
+	return ALPHA_K0SEG_TO_PHYS(pa);
+}
+


[Author: agrieve]

[Author: agrieve]

-Delete unmatched and unnecessary extern "C" from GTMTypeCasting.h

R=dmaclach
APPROVED=dmaclach
DELTA=4  (0 added, 4 deleted, 0 changed)

git-svn-id: de279663232b6350d3cffc59c8efba27ad613299@466 7dc7ac4e-7543-0410-b95c-c1676fc8e2a3

--- DebugUtils/GTMTypeCasting.h
+++ DebugUtils/GTMTypeCasting.h
@@ -18,10 +18,6 @@

 #import <Foundation/Foundation.h>
 #import "GTMDefines.h"
-
-#ifdef __cplusplus
-extern "C" {
-#endif

 // These are some basic macros for making down-casting safer in Objective C.
 // They are loosely based on the same cast types with similar names in C++.


cannot seek to right frame

cannot seek to right frame

--- library-jni/jni/reverse.c
+++ library-jni/jni/reverse.c
@@ -115,14 +115,13 @@
   return bRet;
 }

-int decode2YUV(const char* SRC_FILE, const char* TMP_FOLDER,
+int decode2YUV(const char* SRC_FILE, const char* OUT_FMT_FILE,
                AVCodecContext *codecContext,
                int *stream_index) {
   AVFormatContext *formatContext_src = NULL;
   AVStream *st_src = NULL;
   AVCodec *codec_src = NULL;
   AVFrame *frame_src = NULL;
-  char DST_FILE[100];

   AVPacketList *pktListHeader = NULL;
   AVPacketList *pktListItem = NULL;
@@ -181,11 +180,190 @@
   frame_src = avcodec_alloc_frame();

   int got_frame = -1, got_output = -1, numBytes = 0;
-  uint8_t *buffer = NULL;
+  float start_timestamp;
+  float timestamp_interval;
+  // first step: get the frame count, start timestamp and the timestamp interval
   while (1) {
     av_init_packet(&pt_src);
     pt_src.data = NULL;
     pt_src.size = 0;
+    if (av_read_frame(formatContext_src, &pt_src) < 0) {
+      break;
+    }
+    if (pt_src.stream_index == (*stream_index)) {
+      ret = avcodec_decode_video2(st_src->codec, frame_src, &got_frame, &pt_src);
+      if (ret < 0) {
+        LOGI(LOG_LEVEL, "Error decoding video frame\n");
+        goto end;
+      }
+      if (got_frame) {
+        LOGI(LOG_LEVEL, "video_frame n:%d coded_n:%d pts:%s\n",
+             frameCount, frame_src->coded_picture_number,
+             av_ts2timestr(frame_src->pts, &st_src->codec->time_base));
+        if (frameCount == 1) {
+          start_timestamp = st_src->start_time;
+          timestamp_interval = av_q2d(st_src->codec->time_base) * frame_src->pts;
+        }
+        frameCount++;
+      }
+    }
+  }
+  LOGI(LOG_LEVEL, "Decoding video frame DONE!\n");
+  avcodec_close(st_src->codec);
+  if ((ret = avcodec_open2(st_src->codec, codec_src, NULL)) < 0) {
+    LOGI(LOG_LEVEL, "Failed to open %s codec\n",
+         av_get_media_type_string(st_src->codec->codec_id));
+    goto end;
+  }
+  // second step: get the seeked frame and encode it to video
+  LOGI(LOG_LEVEL, "Start encoding ...\n");
+  int i = 0;
+  frameCount -= 1;
+  AVFormatContext *formatContext_dst = NULL;
+  AVCodec *codec_dst;
+  AVStream *st_dst;
+  AVFrame *frame_pic;
+  AVPicture picture_pic;
+  int width, height;
+  AVPacket pkt;
+
+  width = codecContext->width;
+  height = codecContext->height;
+
+  /* init AVFormatContext */
+  avformat_alloc_output_context2(&formatContext_dst, NULL, NULL, OUT_FMT_FILE);
+  if (!formatContext_dst) {
+    LOGI(LOG_LEVEL, "[output]Could not deduce output format from file extension: using MPEG.\n");
+    avformat_alloc_output_context2(&formatContext_dst, NULL, "mpeg", OUT_FMT_FILE);
+  }
+  if (!formatContext_dst) {
+    return 0;
+  }
+
+  LOGI(LOG_LEVEL, "Encode video file %s\n", OUT_FMT_FILE);
+  int codec_id = formatContext_dst->oformat->video_codec;
+
+  /* find the mpeg1 video encoder */
+  codec_dst = avcodec_find_encoder(codec_id);
+  if (!codec_dst) {
+      LOGI(LOG_LEVEL, "Codec not found\n");
+      return 0;
+  }
+  /* init AVStream */
+  st_dst = avformat_new_stream(formatContext_dst, codec_dst);
+  if (!st_dst) {
+    LOGI(LOG_LEVEL, "[output]Could not allocate stream\n");
+    return 0;
+  }
+  st_dst->id = 1;
+  if (formatContext_dst->oformat->flags & AVFMT_GLOBALHEADER)
+    st_dst->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
+
+  /* init AVCodecContext */
+  avcodec_get_context_defaults3(st_dst->codec, codec_dst);
+  {
+    /* init AVCodecContext for open */
+    st_dst->codec->codec_id = codec_id;
+
+    /* Put sample parameters. */
+    st_dst->codec->codec_type = AVMEDIA_TYPE_VIDEO;
+    st_dst->codec->bit_rate = 400000;//codecContext->bit_rate;
+    /* Resolution must be a multiple of two. */
+    st_dst->codec->width    = width;
+    st_dst->codec->height   = height;
+    /* timebase: This is the fundamental unit of time (in seconds) in terms
+     * of which frame timestamps are represented. For fixed-fps content,
+     * timebase should be 1/framerate and timestamp increments should be
+     * identical to 1. */
+    st_dst->codec->time_base.den = 25;//STREAM_FRAME_RATE;//st_src->codec->time_base.den;
+    st_dst->codec->time_base.num = 1;//st_src->codec->time_base.num;
+    st_dst->codec->gop_size      = 12;//st_src->codec->gop_size;
+    st_dst->codec->pix_fmt       = PIX_FMT_YUV420P;//st_src->codec->pix_fmt;
+    st_dst->codec->qmin          = 10;//st_src->codec->qmin;
+    st_dst->codec->qmax          = 51;//st_src->codec->qmax;
+    if (st_dst->codec->codec_id == AV_CODEC_ID_MPEG2VIDEO) {
+        /* just for testing, we also add B frames */
+        st_dst->codec->max_b_frames = 2;
+    }
+    if (st_dst->codec->codec_id == AV_CODEC_ID_MPEG1VIDEO) {
+        /* Needed to avoid using macroblocks in which some coeffs overflow.
+         * This does not happen with normal video, it just happens here as
+         * the motion of the chroma plane does not match the luma plane. */
+        st_dst->codec->mb_decision = 2;
+    }
+    /* Some formats want stream headers to be separate. */
+    if (formatContext_dst->oformat->flags & AVFMT_GLOBALHEADER)
+        st_dst->codec->flags |= CODEC_FLAG_GLOBAL_HEADER;
+  }
+
+  /* open it */
+  if (avcodec_open2(st_dst->codec, codec_dst, NULL) < 0) {
+      LOGI(LOG_LEVEL, "Could not open codec\n");
+      return 0;
+  }
+
+  frame_pic = avcodec_alloc_frame();
+  if (!frame_pic) {
+      LOGI(LOG_LEVEL, "Could not allocate video frame\n");
+      return 0;
+  }
+  if (avpicture_alloc(&picture_pic, st_dst->codec->pix_fmt,
+                      width, height) < 0) {
+    LOGI(LOG_LEVEL, "[output]Could not allocate video picture\n");
+    return 0;
+  }
+  if (st_dst->codec->pix_fmt != PIX_FMT_YUV420P) {
+    LOGI(LOG_LEVEL, "[output]pix_fmt: %d\n", st_dst->codec->pix_fmt);
+    ret = avpicture_alloc(&picture_pic, PIX_FMT_YUV420P,
+                          width, height);
+    if (ret < 0) {
+      LOGI(LOG_LEVEL, "[output]Could not allocate temporary picture\n");
+      return 0;
+    }
+  }
+  /* copy data and linesize picture pointers to frame */
+  *((AVPicture *)frame_pic) = picture_pic;
+
+  /* open the output file, if needed */
+  if (!(formatContext_dst->oformat->flags & AVFMT_NOFILE)) {
+    if (avio_open(&formatContext_dst->pb, OUT_FMT_FILE, AVIO_FLAG_WRITE) < 0) {
+      LOGI(LOG_LEVEL, "[output]Could not open '%s'\n", OUT_FMT_FILE);
+      return 0;
+    }
+  }
+  /* Write the stream header, if any. */
+  if (avformat_write_header(formatContext_dst, NULL) < 0) {
+    LOGI(LOG_LEVEL, "[output]Error occurred when opening output file\n");
+    return 0;
+  }
+
+  static struct SwsContext *sws_ctx;
+  struct SwsContext* fooContext = sws_getContext(width, height,
+                                                 PIX_FMT_YUV420P,
+                                                 width, height,
+                                                 PIX_FMT_YUV420P,
+                                                 SWS_BICUBIC,
+                                                 NULL, NULL, NULL);
+  /************ end of init decoder ******************/
+
+  for(; frameCount >= 0; frameCount--) {
+    av_init_packet(&pt_src);
+    pt_src.data = NULL;
+    pt_src.size = 0;
+#if 1
+    uint64_t seeked_ts = (frameCount * timestamp_interval - start_timestamp) *
+                         st_src->time_base.den / st_src->time_base.num;
+#else
+    uint64_t seeked_ts = av_rescale_q(frameCount * timestamp_interval - start_timestamp,
+                                   st_src->time_base, AV_TIME_BASE_Q);
+#endif
+    LOGI(LOG_LEVEL, "Seek.... ts[%.6g], origin[%.6g], interval[%.6g]\n",
+         seeked_ts, frameCount * timestamp_interval, timestamp_interval);
+    if (avformat_seek_file(formatContext_src, *stream_index,
+                           INT64_MIN, seeked_ts, INT64_MAX, 0) < 0) {
+      LOGI(LOG_LEVEL, "Seek error.\n");
+      continue;
+    }
     if (av_read_frame(formatContext_src, &pt_src) < 0) {
       break;
     }
@@ -197,75 +375,47 @@
       }
       if (got_frame) {
         LOGI(LOG_LEVEL, "Decoding...[%d]\n", frameCount);
-#ifdef USE_MEMORY_BUFFER
-        int widthMultiHeight = st_src->codec->width * st_src->codec->height;
-        yuvBufferListItem = (YUVBufferList*)av_malloc(sizeof(YUVBufferList));
-        if (yuvBufferListItem == NULL) {
-          LOGI(LOG_LEVEL, "Memory error!\n");
-          frameCount = 0;
-          break;
+        LOGI(LOG_LEVEL, "video_frame n:%d coded_n:%d pts:%s\n",
+             frameCount, frame_src->coded_picture_number,
+             av_ts2timestr(frame_src->pts, &st_src->codec->time_base));
+        sws_scale(fooContext, frame_src->data, frame_src->linesize,
+                  0, height,
+                  frame_pic->data, frame_pic->linesize);
+
+        av_init_packet(&pkt);
+        pkt.data = NULL;    // packet data will be allocated by the encoder
+        pkt.size = 0;
+
+        frame_pic->pts = i;
+        //((AVFrame*)&picture_pic)->pts = i;
+        /* encode the image */
+        ret = avcodec_encode_video2(st_dst->codec, &pkt, frame_pic, &got_output);
+        if (ret < 0) {
+            LOGI(LOG_LEVEL, "Error encoding frame\n");
+            break;
         }
-        memset(yuvBufferListItem, 0, sizeof(YUVBufferList));
-        yuvBufferListItem->data[0] = (uint8_t*)malloc(widthMultiHeight * sizeof(uint8_t));
-        if (yuvBufferListItem->data[0] == NULL) {
-          LOGI(LOG_LEVEL, "Memory error!\n");
-          frameCount = 0;
-          break;
+
+        if (got_output) {
+          LOGI(LOG_LEVEL, "Encoding to video...[%d]", i);
+//          if (st_dst->codec->coded_frame->pts != AV_NOPTS_VALUE) {
+//            pkt.pts = av_rescale_q(st_dst->codec->coded_frame->pts,
+//                                      st_dst->codec->time_base,
+//                                      st_dst->time_base);
+//          }
+          /* Write the compressed frame to the media file. */
+          pkt.stream_index = (*stream_index);
+          ret = av_interleaved_write_frame(formatContext_dst, &pkt);
+          if (ret < 0) {
+            LOGI(LOG_LEVEL, "[output] write frame failed: %d \n", ret);
+          } else {
+            i++;
+          }
         }
-        yuvBufferListItem->data[1] = (uint8_t*)malloc(widthMultiHeight * sizeof(uint8_t) >> 2);
-        if (yuvBufferListItem->data[1] == NULL) {
-          LOGI(LOG_LEVEL, "Memory error!\n");
-          frameCount = 0;
-          break;
-        }
-        yuvBufferListItem->data[2] = (uint8_t*)malloc(widthMultiHeight * sizeof(uint8_t) >> 2);
-        if (yuvBufferListItem->data[2] == NULL) {
-          LOGI(LOG_LEVEL, "Memory error!\n");
-          frameCount = 0;
-          break;
-        }
-        yuvBufferListItem->data[3] = 0;
-        memset(yuvBufferListItem->data[0], 0, widthMultiHeight * sizeof(uint8_t));
-        memset(yuvBufferListItem->data[1], 0, widthMultiHeight * sizeof(uint8_t) >> 2);
-        memset(yuvBufferListItem->data[2], 0, widthMultiHeight * sizeof(uint8_t) >> 2);
-        CopyYuv(frame_src->data[0], frame_src->linesize[0], st_src->codec->width, st_src->codec->height, yuvBufferListItem->data[0]);
-        CopyYuv(frame_src->data[1], frame_src->linesize[1], st_src->codec->width / 2, st_src->codec->height / 2, yuvBufferListItem->data[1]);
-        CopyYuv(frame_src->data[2], frame_src->linesize[2], st_src->codec->width / 2, st_src->codec->height / 2, yuvBufferListItem->data[2]);
-        yuvBufferListItem->linesize[0] = frame_src->linesize[0];
-        yuvBufferListItem->linesize[1] = frame_src->linesize[1];
-        yuvBufferListItem->linesize[2] = frame_src->linesize[2];
-        yuvBufferListItem->linesize[3] = 0;
-        yuvBufferListItem->width = st_src->codec->width;
-        yuvBufferListItem->height = st_src->codec->height;
-        yuvBufferListItem->next = (void*)yuvBufferListHeader;
-        yuvBufferListHeader = (YUVBufferList*)yuvBufferListItem;
-#else
-        memset(DST_FILE, 0, strlen(DST_FILE));
-        strcpy(DST_FILE, TMP_FOLDER);
-        strcat(DST_FILE, "//");
-        char frame_count_str[8];
-        sprintf(frame_count_str, "%d", frameCount);
-        strcat(DST_FILE, frame_count_str);
-        strcat(DST_FILE, ".yuv");
-        FILE *f = fopen(DST_FILE, "ab+");
-        if (f != NULL) {
-          SaveYuv(frame_src->data[0], frame_src->linesize[0],
-                  st_src->codec->width, st_src->codec->height,
-                  f);
-          SaveYuv(frame_src->data[1], frame_src->linesize[1],
-                  st_src->codec->width / 2, st_src->codec->height / 2,
-                  f);
-          SaveYuv(frame_src->data[2], frame_src->linesize[2],
-                  st_src->codec->width / 2, st_src->codec->height / 2,
-                  f);
-          fclose(f);
-        }
-#endif
-        frameCount++;
       }
     }
   }
-  LOGI(LOG_LEVEL, "Decoding video frame DONE!\n");
+  av_write_trailer(formatContext_dst);
+  LOGI(LOG_LEVEL, "Encoding video frame DONE!\n");
 end:
   if (formatContext_src) {
     avformat_close_input(&formatContext_src);
@@ -273,6 +423,7 @@
   if (frame_src) {
     av_free(frame_src);
   }
+  sws_freeContext(fooContext);
   return frameCount;
 }

@@ -521,7 +672,7 @@
   return 1;
 }

-int doReverseViaBmp(const char* SRC_FILE, const char* TMP_FOLDER, const char* OUT_FMT_FILE) {
+int doReverseViaBmp(const char* SRC_FILE, const char* OUT_FMT_FILE) {
   AVCodecContext *codecContext = NULL;
   AVCodec *codec = NULL;

@@ -538,8 +689,7 @@
     return 0;
   }
   int stream_index = 0;
-  int frameCount = decode2YUV(SRC_FILE, TMP_FOLDER, codecContext, &stream_index) - 1;
-  return encodeYUV2Video(TMP_FOLDER, frameCount, stream_index, OUT_FMT_FILE, codecContext);
+  return decode2YUV(SRC_FILE, OUT_FMT_FILE, codecContext, &stream_index);
 }

 int reverse(char *file_path_src, char *file_path_desc,
@@ -548,7 +698,7 @@
             int subtitle_stream_no) {
   const char *TMP_FOLDER = "/sdcard/tmp";
   LOGI(LOG_LEVEL, "reversing...");
-  return doReverseViaBmp(file_path_src, TMP_FOLDER, file_path_desc);
-}
-
-
+  return doReverseViaBmp(file_path_src, file_path_desc);
+}
+
+


Hardened SimTK::Spline_ against thread races

- Because a spline does not mutate its data, SimTK::Spline_
  internally uses a shareable reference-counted SplineImpl to
  hold its data. This makes copying a Spline_ cheap (just increment
  the counter, rather than copying the data)

- However, the reference count was a standard (non-atomic) int. This
  opens up the possibility of a race when multiple threads concurrently
  copy a Spline_ object. Example: if two threads concurrently increment
  the reference counter then the result could be +1 or +2, depending on
  timing - this could result in a double-destruction event when each
  thread is calling Spline's destructor

- Typical C++ developers are likely to expect that copy-construction is
  threadsafe, so the not-threadsafe behavior or SimTK::Spline_ may be
  surprising to downstream users. Worse, thread-safety may be expected
  from an object that indirectly composes a SimTK::Spline_ in its
  (potentially, large) hierarchy. e.g. a user tries to copy-construct
  large model objects that contain SimTK::Spline_s from multiple threads

- This patch lifts the (intrusive) reference counter in SplineImpl into
  a shared_ptr in Spline_. The semantics of a shared_ptr (cheap aliased
  copies, reference counting, single destruction) closely match the original
  semantics, but shared_ptr is designed to be threadsafe

- see: https://en.cppreference.com/w/cpp/memory/shared_ptr

- Excerpt:

    > All member functions (including copy constructor and copy assignment)
    > can be called by multiple threads on different instances of shared_ptr
    > without additional synchronization even if these instances are copies
    > and share ownership of the same object.

--- SimTKmath/Geometry/include/simmath/internal/Spline.h
+++ SimTKmath/Geometry/include/simmath/internal/Spline.h
@@ -29,6 +29,7 @@
 #include "simmath/internal/GCVSPLUtil.h"

 #include <limits>
+#include <memory>

 namespace SimTK {

@@ -61,40 +62,24 @@
     @param[in]  y
         Values of the dependent variables for each Bezier control point.
     **/
-    Spline_(int degree, const Vector& x, const Vector_<T>& y)
-    :   impl(new SplineImpl(degree, x, y)) {}
+    Spline_(int degree, const Vector& x, const Vector_<T>& y)
+      :   impl(std::make_shared<SplineImpl>(degree, x, y)) {}

     /** Default constructor creates an empty %Spline_ handle; not very
     useful. **/
-    Spline_() : impl(nullptr) {}
+    Spline_() = default;

     /** Copy constructor is shallow and reference-counted; that is, the new
     %Spline_ refers to the same object as does \a source. **/
-    Spline_(const Spline_& source) : impl(source.impl)
-    {   if (impl) impl->referenceCount++; }
+    Spline_(const Spline_& source) = default;

     /** Copy assignment is shallow and reference-counted; that is, after the
     assignment this %Spline_ refers to the same object as does \a source. **/
-    Spline_& operator=(const Spline_& source) {
-        if (impl) {
-            impl->referenceCount--;
-            if (impl->referenceCount == 0)
-                delete impl;
-        }
-        impl = source.impl;
-        if (impl) impl->referenceCount++;
-        return *this;
-    }
+    Spline_& operator=(const Spline_& source) = default;

     /** Destructor decrements the reference count and frees the heap space if
     this is the last reference. **/
-    ~Spline_() {
-        if (impl) {
-            impl->referenceCount--;
-            if (impl->referenceCount == 0)
-                delete impl;
-        }
-    }
+    ~Spline_() = default;

     /** Calculate the values of the dependent variables at a particular value
     of the independent variable.
@@ -173,7 +158,7 @@

 private:
     class SplineImpl;
-    SplineImpl* impl;
+    std::shared_ptr<SplineImpl> impl;
 };

 /** Provide a convenient name for a scalar-valued Spline_. **/
@@ -183,18 +168,16 @@
 template <class T>
 class Spline_<T>::SplineImpl {
 public:
-    SplineImpl(int degree, const Vector& x, const Vector_<T>& y)
-    :   referenceCount(1), degree(degree), x(x), y(y) {}
-    ~SplineImpl() {
-        assert(referenceCount == 0);
-    }
+    SplineImpl(int degree, const Vector& x, const Vector_<T>& y)
+      : degree(degree), x(x), y(y) {}
+
     T getValue(Real t) const {
         return GCVSPLUtil::splder(0, degree, t, x, y);
     }
     T getDerivative(int derivOrder, Real t) const {
         return GCVSPLUtil::splder(derivOrder, degree, t, x, y);
     }
-    int         referenceCount;
+
     int         degree;
     Vector      x;
     Vector_<T>  y;


fix rc_filter_duplicate initialization check

--- library/src/math/filter.c
+++ library/src/math/filter.c
@@ -157,7 +157,7 @@

 int rc_filter_duplicate(rc_filter_t* f, rc_filter_t old)
 {
-	if(unlikely(old.initialized)){
+	if(unlikely(!old.initialized)){
 		fprintf(stderr, "ERROR in rc_filter_duplicate, old filter not initialized\n");
 		return -1;
 	}


streamline the setattr logic

streamline the setattr logic

--- slashd/mds.c
+++ slashd/mds.c
@@ -2007,25 +2007,20 @@
 slm_setattr_core(struct fidc_membh *f, struct srt_stat *sstb,
     int to_set)
 {
-	int rc = 0;
+	int rc;
 	struct fcmh_mds_info *fmi;

-	if ((to_set & PSCFS_SETATTRF_DATASIZE) && sstb->sst_size) {
-		if (!slm_ptrunc_enabled) {
-			DEBUG_SSTB(PLL_MAX, sstb, "ptrunc averted");
-			return 0;
-		}
-		FCMH_LOCK_ENSURE(f);
-		f->fcmh_flags |= FCMH_MDS_IN_PTRUNC;
-		fmi = fcmh_2_fmi(f);
-		fmi->fmi_ptrunc_size = sstb->sst_size;
-
-		FCMH_ULOCK(f);
-
-		rc = slm_ptrunc_prepare(f);
-
-		FCMH_LOCK(f);
-	}
+	psc_assert(sstb->sst_size);
+
+	FCMH_LOCK_ENSURE(f);
+	f->fcmh_flags |= FCMH_MDS_IN_PTRUNC;
+	fmi = fcmh_2_fmi(f);
+	fmi->fmi_ptrunc_size = sstb->sst_size;
+
+	FCMH_ULOCK(f);
+	rc = slm_ptrunc_prepare(f);
+	FCMH_LOCK(f);
+
 	return (rc);
 }


renamed "Err" to "Val" (cosmetic change)

--- TerrainSDK/vtlib/core/FP8.h
+++ TerrainSDK/vtlib/core/FP8.h
@@ -16,22 +16,22 @@
 #  define INLINE inline
 #endif

-INLINE unsigned char EncodeFP8( unsigned short nErr )
+INLINE unsigned char EncodeFP8( unsigned short nVal )
 {
-	if( nErr < 64   ) return          nErr;
-	if( nErr < 128  ) return (0x40 | (nErr-  64)/2);
-	if( nErr < 256  ) return (0x60 | (nErr- 128)/4);
-	if( nErr < 512  ) return (0x80 | (nErr- 256)/8);
-	if( nErr < 1024 ) return (0xa0 | (nErr- 512)/16);
-	if( nErr < 2048 ) return (0xc0 | (nErr-1024)/32);
-	if( nErr < 4096 ) return (0xe0 | (nErr-2048)/64);
+	if( nVal < 64   ) return          nVal;
+	if( nVal < 128  ) return (0x40 | (nVal-  64)/2);
+	if( nVal < 256  ) return (0x60 | (nVal- 128)/4);
+	if( nVal < 512  ) return (0x80 | (nVal- 256)/8);
+	if( nVal < 1024 ) return (0xa0 | (nVal- 512)/16);
+	if( nVal < 2048 ) return (0xc0 | (nVal-1024)/32);
+	if( nVal < 4096 ) return (0xe0 | (nVal-2048)/64);
 	                  return  0xff;
 }

-INLINE unsigned short DecodeFP8( unsigned char nErr )
+INLINE unsigned short DecodeFP8( unsigned char nVal )
 {
-	int a = nErr >> 5;
-	int b = nErr & 31;
+	int a = nVal >> 5;
+	int b = nVal & 31;

 	if( a < 2 ) {
 		return b;


xxx

xxx

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

--- slashd/rmc.c
+++ slashd/rmc.c
@@ -162,6 +162,10 @@
 	if (mp->rc)
 		PFL_GOTOERR(out, mp->rc);

+	/*
+	 * XXX we can cut this out and just lie and return
+	 * xattrsize with a nonzero value.
+	 */
 	zfsslash2_listxattr(vfsid, &rootcreds, NULL, 0, &xlen,
 	    fcmh_2_mdsio_fid(f));


Implemented methods for playback with GPAC

git-svn-id: 33bf1455041ebe448dbaea643fd5b4b7ce02239d@2125 63c20433-aa62-49bd-875c-5a186b69a8fb

--- modules/m3u8_in/m3u8_in.c
+++ modules/m3u8_in/m3u8_in.c
@@ -23,6 +23,10 @@
  *
  */

+#include <gpac/modules/service.h>
+#include <gpac/internal/terminal_dev.h>
+#include <gpac/thread.h>
+#include <gpac/network.h>
 #include "m3u8_in.h"
 #include <gpac/list.h>
 #include "m3u8_parser.h"
@@ -39,6 +43,13 @@
 	char needs_connection;
 	VariantPlaylist * playlist;
 	u32 preferredBitrate;
+
+    PlaylistElement *ple;
+
+    /* Service really managing the media */
+    GF_InputService *media_ifce;
+    GF_Thread *dl_thread;
+
 } M3U8Reader;

@@ -120,50 +131,75 @@

 void M3U8_NetIO(void *cbk, GF_NETIO_Parameter *param)
 {
-	GF_Err e;
 	M3U8Reader *read = (M3U8Reader *) cbk;
 	MYLOG(("***** M3U8_NetIO %d\n", param->msg_type));
 	gf_term_download_update_stats(read->dnload);

-	if ( param->msg_type==GF_NETIO_DATA_TRANSFERED ) {
-		gf_term_download_update_stats(read->dnload);
-		e = M3U8_parseM3U8File( read );
-		MYLOG(("***** M3U8_NetIO DONE %d\n", param->msg_type));
-		/*gf_term_download_del(read->dnload);
-		MYLOG(("***** M3U8_NetIO deleted %d\n", param->msg_type));*/
-		if (e){
-				MYLOG(("***** Error while reading playlist %d\n", e));
-		} else {
-			PlaylistElement *ple = findNextPlaylistElementToPlay(read);
-		}
-		return;
-	}
-	if (param->error && read->needs_connection) {
-		gf_term_on_connect(read->service, NULL, param->error);
-	}
-	/*we never receive data from here since the downloader is not threaded*/
-}
-
-
+}

 void M3U8_DownloadFile(GF_InputService *plug, const char *url)
 {
+    GF_Err e;
 	M3U8Reader *read = (M3U8Reader*) plug->priv;
     MYLOG(("***** M3U8_DownloadFile %s\n", url));
-	read->dnload = gf_term_download_new(read->service, url, 0, M3U8_NetIO, read);
+	read->dnload = gf_term_download_new(read->service, url, GF_NETIO_SESSION_NOT_THREADED, M3U8_NetIO, read);
 	if (!read->dnload) {
 		MYLOG(("***** M3U8_DownloadFile FAILED\n"));
 		gf_term_on_connect(read->service, NULL, GF_NOT_SUPPORTED);
 	}
-	/*service confirm is done once fetched, but start the demuxer thread*/
-	/*gf_th_run(read->demuxer, OggDemux, read);*/
-}
-
+    /* do the actual download (because not threaded )*/
+	e = gf_dm_sess_process(read->dnload);
+	if (e!=GF_OK) {
+        gf_term_on_connect(read->service, NULL, GF_IO_ERR);
+    }
+}
+
+static u32 download_media_files(void *par)
+{
+    GF_Err e;
+	M3U8Reader *read = (M3U8Reader*) par;
+
+        /*
+    while (1) {
+        period = gf_list_get(mpdin->mpd.periods, mpdin->active_period_index);
+        rep = &period->representations[mpdin->active_rep_index];
+        new_seg_url = rep->segment_urls[mpdin->active_segment_index];
+        if (rep->default_base_url) {
+            new_base_seg_url = gf_url_concatenate(rep->default_base_url, new_seg_url);
+        } else {
+            new_base_seg_url = gf_strdup(new_seg_url);
+        }
+
+        gf_dm_setup_from_url(read->dnload, new_base_seg_url);
+        gf_dm_sess_dash_reset(read->dnload);
+        fprintf(stderr, "Downloading new media file: %s\n", new_base_seg_url);
+        gf_free(new_base_seg_url);
+
+        e = gf_dm_sess_process(read->dnload);
+        if (e == GF_OK) {
+			//signal the slave service the segment has been downloaded
+			if (read->dnload) {
+			}
+//            if (mpdin->active_segment_index<10) {
+            if (mpdin->active_segment_index<(rep->nb_segments-1)) {
+                mpdin->active_segment_index++;
+            } else {
+                break;
+            }
+        } else {
+            break;
+        }
+        gf_sleep(1000);
+    }
+    */
+    gf_sleep(1000);
+    return 0;
+}

 static GF_Err M3U8_ConnectService(GF_InputService *plug, GF_ClientService *serv, const char *url)
 {
 	char szURL[2048];
-	GF_Err reply;
+	GF_Err e;
 	FILE * f;
 	M3U8Reader *read = plug->priv;
 	MYLOG(("***** M3U8_ConnectService %s\n", url));
@@ -187,17 +223,67 @@
 		MYLOG(("***** M3U8_ConnectService Remote %s\n", url));
 		read->needs_connection = 1;
 		M3U8_DownloadFile(plug, szURL);
-		return GF_OK;
 	} else {
 		MYLOG(("***** M3U8_ConnectService local %s\n", url));
 		f = fopen(szURL, "rb");
 		if (!f) {
-			reply = GF_URL_ERROR;
+			e = GF_URL_ERROR;
 		} else {
-			reply = GF_OK;
+			e = GF_OK;
 		}
 	}
-	gf_term_on_connect(serv, NULL, reply);
+    e = M3U8_parseM3U8File( read );
+    if (e){
+	    MYLOG(("***** Error while reading playlist %d\n", e));
+        gf_term_on_connect(read->service, NULL, e);
+        return GF_OK;
+    } else {
+	    read->ple = findNextPlaylistElementToPlay(read);
+
+    	if (read->dnload) gf_term_download_del(read->dnload);
+        read->dnload = gf_term_download_new(read->service, read->ple->url, GF_NETIO_SESSION_NOT_THREADED,
+                                            M3U8_NetIO, read);
+        if (!read->dnload) {
+            gf_term_on_connect(read->service, NULL, GF_BAD_PARAM);
+            return GF_OK;
+        } else {
+            e = gf_dm_sess_process(read->dnload);
+            if (e!=GF_OK) {
+                gf_term_on_connect(read->service, NULL, e);
+                return GF_OK;
+            } else {
+                const char *local_url = gf_dm_sess_get_cache_name(read->dnload);
+                /*load from mime type*/
+                const char *sPlug = gf_cfg_get_key(read->service->term->user->config, "MimeTypes", "video/mp2t");
+                if (sPlug) sPlug = strrchr(sPlug, '"');
+                if (sPlug) {
+	                sPlug += 2;
+	                read->media_ifce = (GF_InputService *) gf_modules_load_interface_by_name(read->service->term->user->modules, sPlug, GF_NET_CLIENT_INTERFACE);
+                    if (read->media_ifce) {
+#if 1
+						gf_th_run(read->dl_thread, download_media_files, read);
+#else
+                        e = download_media_files(read);
+                        if (e) {
+                            gf_term_on_connect(read->service, NULL, GF_BAD_PARAM);
+                            return GF_OK;
+                        }
+#endif
+                        /* Forward the ConnectService message to the appropriate service for this type of media */
+                        read->media_ifce->ConnectService(read->media_ifce, serv, local_url);
+                    } else {
+                        gf_term_on_connect(read->service, NULL, GF_BAD_PARAM);
+                        return GF_OK;
+                    }
+                } else {
+                    gf_term_on_connect(read->service, NULL, GF_BAD_PARAM);
+                    return GF_OK;
+                }
+		    }
+        }
+    }
+
+    gf_term_on_connect(serv, NULL, e);
 	return GF_OK;
 }

@@ -207,6 +293,9 @@
 	MYLOG(("***** M3U8_CloseService %p\n", plug->priv));
 	if (read == NULL)
 		return GF_OK;
+	if (read->media_ifce) {
+        read->media_ifce->CloseService(read->media_ifce);
+    }
 	MYLOG(("***** M3U8_CloseService2\n"));
 	gf_term_on_disconnect(read->service, NULL, GF_OK);
 	if (read->dnload){
@@ -220,162 +309,148 @@

 static Bool M3U8_CanHandleURLInService(GF_InputService *plug, const char *url)
 {
-	/*char szURL[2048], *sep;*/
-	/*M3U8Reader *read = (M3U8Reader *)plug->priv;*/
 	MYLOG(("***** M3U8_CanHandleURLInService %s\n", url));
-	/*const char *this_url = gf_term_get_service_url(read->service);*/
 	return 0;
 }

 static GF_Descriptor *M3U8_GetServiceDesc(GF_InputService *plug, u32 expect_type, const char *sub_url)
 {
-	/*u32 i;
-	GF_ObjectDescriptor *od;*/
-	MYLOG(("***** M3U8_CanHandleURLInService %s\n", sub_url));
-	/*OGGStream *st;
-	OGGReader *read = plug->priv;*/
-	/*since we don't handle multitrack in ogg yes, we don't need to check sub_url, only use expected type*/
-
-	/*single object*/
-	/*
-	if ((expect_type==GF_MEDIA_OBJECT_AUDIO) || (expect_type==GF_MEDIA_OBJECT_VIDEO)) {
-		if ((expect_type==GF_MEDIA_OBJECT_AUDIO) && !read->has_audio) return NULL;
-		if ((expect_type==GF_MEDIA_OBJECT_VIDEO) && !read->has_video) return NULL;
-		i=0;
-		while ((st = gf_list_enum(read->streams, &i))) {
-			if ((expect_type==GF_MEDIA_OBJECT_AUDIO) && (st->info.streamType!=GF_STREAM_AUDIO)) continue;
-			if ((expect_type==GF_MEDIA_OBJECT_VIDEO) && (st->info.streamType!=GF_STREAM_VISUAL)) continue;
-
-			od = OGG_GetOD(st);
-			read->is_single_media = 1;
-			return (GF_Descriptor *) od;
-		}
-		//not supported yet - we need to know what's in the ogg stream for that
-	}
-	read->is_inline = 1;*/
-	return NULL;
+	M3U8Reader *read = plug->priv;
+	MYLOG(("***** M3U8_GetServiceDesc %s\n", sub_url));
+    if (read->media_ifce) {
+        return read->media_ifce->GetServiceDescriptor(read->media_ifce, expect_type, sub_url);
+    } else {
+        return NULL;
+    }
 }

 static GF_Err M3U8_ConnectChannel(GF_InputService *plug, LPNETCHANNEL channel, const char *url, Bool upstream)
 {
-	/*u32 ES_ID, i;*/
-	GF_Err e = GF_OK;
-	M3U8Reader *read = plug->priv;
-	/*OGGStream *st;
-
-
-	e = GF_STREAM_NOT_FOUND;
-	if (strstr(url, "ES_ID")) {
-		sscanf(url, "ES_ID=%d", &ES_ID);
-	}*/
-	/*URL setup*/
-	/*
-		else if (!read->es_ch && OGG_CanHandleURL(plug, url)) ES_ID = 3;
-	i=0;
-	while ((st = gf_list_enum(read->streams, &i))) {
-		if (st->ESID==ES_ID) {
-			st->ch = channel;
-			e = GF_OK;
-			break;
-		}
-	}*/
-	gf_term_on_connect(read->service, channel, e);
-	return e;
+	M3U8Reader *read = plug->priv;
+	MYLOG(("***** M3U8_ConnectChannel\n"));
+	if (!plug || !plug->priv || !read->media_ifce) return GF_SERVICE_ERROR;
+    return read->media_ifce->ConnectChannel(read->media_ifce, channel, url, upstream);
 }

 static GF_Err M3U8_DisconnectChannel(GF_InputService *plug, LPNETCHANNEL channel)
 {
-	GF_Err e = GF_OK;
-	M3U8Reader *read = plug->priv;
-	/*
-
-	OGGStream *st;
-	u32 i=0;
-
-
-	e = GF_STREAM_NOT_FOUND;
-	while ((st = gf_list_enum(read->streams, &i))) {
-		if (st->ch==channel) {
-			st->ch = NULL;
-			e = GF_OK;
-			break;
-		}
-	}*/
-	gf_term_on_disconnect(read->service, channel, e);
-	return e;
-}
+	M3U8Reader *read = plug->priv;
+	MYLOG(("***** M3U8_DisconnectChannel\n"));
+	if (!plug || !plug->priv || !read->media_ifce) return GF_SERVICE_ERROR;
+    return read->media_ifce->DisconnectChannel(read->media_ifce, channel);
+}
+
+static GF_Err M3U8_ChannelGetSLP(GF_InputService *plug, LPNETCHANNEL channel, char **out_data_ptr, u32 *out_data_size, GF_SLHeader *out_sl_hdr, Bool *sl_compressed, GF_Err *out_reception_status, Bool *is_new_data)
+{
+	M3U8Reader *read = plug->priv;
+	MYLOG(("***** M3U8_ChannelGetSLP\n"));
+	if (!plug || !plug->priv || !read->media_ifce) return GF_SERVICE_ERROR;
+    return read->media_ifce->ChannelGetSLP(read->media_ifce, channel, out_data_ptr, out_data_size, out_sl_hdr, sl_compressed, out_reception_status, is_new_data);
+}
+
+static GF_Err M3U8_ChannelReleaseSLP(GF_InputService *plug, LPNETCHANNEL channel)
+{
+	M3U8Reader *read = plug->priv;
+	MYLOG(("***** M3U8_ChannelReleaseSLP\n"));
+	if (!plug || !plug->priv || !read->media_ifce) return GF_SERVICE_ERROR;
+    return read->media_ifce->ChannelReleaseSLP(read->media_ifce, channel);
+}
+

 static GF_Err M3U8_ServiceCommand(GF_InputService *plug, GF_NetworkCommand *com)
 {
+	M3U8Reader *read = plug->priv;
 	MYLOG(("***** M3U8_ServiceCommand %s\n", com));
-	/*
-	OGGStream *st;
-	u32 i;
-	OGGReader *read = plug->priv;
-
-	if (!com->base.on_channel) {
-		// if live session we may cache
-		if (read->is_live && (com->command_type==GF_NET_IS_CACHABLE)) return GF_OK;
-		return GF_NOT_SUPPORTED;
-	}
-	switch (com->command_type) {
-		case GF_NET_CHAN_SET_PULL:
-			//no way to demux streams independently, and we keep OD as dynamic ogfile to handle
-			// chained streams
-			return GF_NOT_SUPPORTED;
-		case GF_NET_CHAN_INTERACTIVE:
-			//live: return GF_NOT_SUPPORTED;
-			return GF_OK;
-		case GF_NET_CHAN_BUFFER:
-			com->buffer.min = com->buffer.max = 0;
-			if (read->is_live) com->buffer.max = read->data_buffer_ms;
-			return GF_OK;
-		case GF_NET_CHAN_SET_PADDING: return GF_NOT_SUPPORTED;
-
-		case GF_NET_CHAN_DURATION:
-			com->duration.duration = read->dur;
-			return GF_OK;
-		case GF_NET_CHAN_PLAY:
-			read->start_range = com->play.start_range;
-			read->end_range = com->play.end_range;
-			i=0;
-			while ((st = gf_list_enum(read->streams, &i))) {
-				if (st->ch == com->base.on_channel) {
-					st->is_running = 1;
-					st->map_time = read->dur ? 1 : 0;
-					if (!read->nb_playing) read->do_seek = 1;
-					read->nb_playing ++;
-					break;
-				}
-			}
-			//recfg duration in case
-			if (!read->is_remote && read->dur) {
-				GF_NetworkCommand rcfg;
-				rcfg.base.on_channel = NULL;
-				rcfg.base.command_type = GF_NET_CHAN_DURATION;
-				rcfg.duration.duration = read->dur;
-				gf_term_on_command(read->service, &rcfg, GF_OK);
-			}
-			return GF_OK;
-		case GF_NET_CHAN_STOP:
-			i=0;
-			while ((st = gf_list_enum(read->streams, &i))) {
-				if (st->ch == com->base.on_channel) {
-					st->is_running = 0;
-					read->nb_playing --;
-					break;
-				}
-			}
-			return GF_OK;
-		default:
-			return GF_OK;
-	}*/
-	return GF_OK;
-}
-
-
-
-
+	if (!plug || !plug->priv || !com || !read->media_ifce) return GF_SERVICE_ERROR;
+
+    switch(com->command_type) {
+        case GF_NET_SERVICE_INFO:
+            /* defer to the real input service */
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_SERVICE_HAS_AUDIO:
+            /* defer to the real input service */
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_SET_PADDING:
+            /* for padding settings, the MPD level should not change anything */
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_SET_PULL:
+            /* defer to the real input service */
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_INTERACTIVE:
+            /* defer to the real input service */
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_BUFFER:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_BUFFER_QUERY:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_DURATION:
+            /* Ignore the duration given by the input service and use the one given in the playlist */
+            {
+                Double duration;
+                duration = (read->ple ? read->ple->durationInfo : 0);
+                com->duration.duration = duration;
+        		return GF_OK;
+            }
+            break;
+        case GF_NET_CHAN_PLAY:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_STOP:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_PAUSE:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_RESUME:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_SET_SPEED:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+	    case GF_NET_CHAN_CONFIG:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_GET_PIXEL_AR:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_GET_DSI:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_MAP_TIME:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_RECONFIG:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_DRM_CFG:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_CHAN_GET_ESD:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_BUFFER_QUERY:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_GET_STATS:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_IS_CACHABLE:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        case GF_NET_SERVICE_MIGRATION_INFO:
+            return read->media_ifce->ServiceCommand(read->media_ifce, com);
+            break;
+        default:
+            return GF_SERVICE_ERROR;
+    }
+}

 GF_InputService *M3U8_LoadDemux()
 {
@@ -399,15 +474,14 @@
 	/* To check for seeking / getTrackInfo... GF_NET_SERVICE_INFO */
 	plug->ServiceCommand = M3U8_ServiceCommand;

+	/* to transmit packets */
+    plug->ChannelGetSLP = M3U8_ChannelGetSLP;
+	plug->ChannelReleaseSLP = M3U8_ChannelReleaseSLP;
+
 	reader = gf_malloc(sizeof(M3U8Reader));
 	memset(reader, 0, sizeof(M3U8Reader));
 	reader->playlist = NULL;
 	reader->rootURL = NULL;
-	/*
-	reader->streams = gf_list_new();
-	reader->demuxer = gf_th_new("M3U8Demux");
-	reader->data_buffer_ms = 1000;
-*/
 	plug->priv = reader;
 	return plug;
 }
@@ -416,19 +490,6 @@
 {
 	GF_InputService *plug = (GF_InputService *) ifce;
 	M3U8Reader *read = plug->priv;
-
-	/*gf_th_del(read->demuxer);*/
-
-	/*just in case something went wrong
-	while (gf_list_count(read->streams)) {
-		M3U8Stream *st = gf_list_get(read->streams, 0);
-		gf_list_rem(read->streams, 0);
-		ogg_stream_clear(&st->os);
-		if (st->dsi) gf_free(st->dsi);
-		gf_free(st);
-	}
-	gf_list_del(read->streams);
-	 */
 	if (read){
 		if (read->rootURL)
 			gf_free(read->rootURL);


sdp.c: fixed sdp_session_cmp() - extra m

darcs-hash:20070709180043-65a35-78e958826b8355789e6929a29386ba506bb027f1.gz

--- libsofia-sip-ua/sdp/sdp.c
+++ libsofia-sip-ua/sdp/sdp.c
@@ -1180,7 +1180,7 @@
       return rv;

   for (am = a->sdp_media, bm = b->sdp_media;
-       am || bb;
+       am || bm;
        am = am->m_next, bm = bm->m_next)
     if ((rv = sdp_media_cmp(am, bm)))
       return rv;


soup-connection: don't disconnect the connection on dispose

In the normal case, SoupSession will do it itself, and in other cases
it might not be wanted.

https://bugzilla.gnome.org/show_bug.cgi?id=721343

--- libsoup/soup-connection.c
+++ libsoup/soup-connection.c
@@ -97,11 +97,6 @@
 	SoupConnectionPrivate *priv = SOUP_CONNECTION_GET_PRIVATE (conn);

 	stop_idle_timer (priv);
-
-	if (priv->socket) {
-		g_warning ("Disposing connection while connected");
-		soup_connection_disconnect (conn);
-	}

 	G_OBJECT_CLASS (soup_connection_parent_class)->dispose (object);
 }


* h264: fixed nal decoding.

* h264: fixed nal decoding.


in a poor attempt at performance, clip the image

--- libswfdec/swfdec_player.c
+++ libswfdec/swfdec_player.c
@@ -433,6 +433,8 @@
     return;
   SWFDEC_INFO ("=== %p: START RENDER, area %g %g  %g %g ===", player,
       area->x0, area->y0, area->x1, area->y1);
+  cairo_rectangle (cr, 0, 0, player->width, player->height);
+  cairo_clip (cr);
   /* FIXME: find a nicer way to render the background */
   if (player->roots && SWFDEC_MOVIE (player->roots->data)->list &&
       SWFDEC_IS_SPRITE_MOVIE (SWFDEC_MOVIE (player->roots->data)->list->data)) {


h264 packet: Remove trailing spaces

h264 packet: Remove trailing spaces

--- modules/packetizer/h264.c
+++ modules/packetizer/h264.c
@@ -701,7 +701,7 @@
         block_ChainAppend( &p_sys->p_frame, p_frag );

     *pb_used_ts = false;
-    if( p_sys->i_frame_dts <= VLC_TS_INVALID &&
+    if( p_sys->i_frame_dts <= VLC_TS_INVALID &&
         p_sys->i_frame_pts <= VLC_TS_INVALID )
     {
         p_sys->i_frame_dts = i_frag_dts;
@@ -1198,7 +1198,7 @@
             bs_t s;
             const int      i_rec = i_size;
             const uint8_t *p_rec = &pb_dec[i_used];
-
+
             bs_init( &s, p_rec, i_rec );
             int i_recovery_frames = bs_read_ue( &s );
             //bool b_exact_match = bs_read( &s, 1 );


ACPI: define struct for SDT headers.

ACPI: define struct for SDT headers.

--- kernel/platforms/x86/include/kernel/x86/acpi.h
+++ kernel/platforms/x86/include/kernel/x86/acpi.h
@@ -18,6 +18,18 @@
 	uint8_t _reserved[3];
 }__attribute__((packed));

+struct acpi_SDTHeader {
+	uint8_t signature[4];
+	uint32_t length;
+	uint8_t revision;
+	uint8_t checksum;
+	uint8_t oemid[6];
+	uint8_t oem_table_id[8];
+	uint32_t oem_revision;
+	uint32_t creator_id;
+	uint32_t creator_revision;
+}__attribute__((packed));
+
 /* Locate the RSDP in memory, returning its address. Returns NULL if the RSDP
  * cannot be found. The BIOS's memory must be identity-mapped for this to work. */
 acpi_RSDP *acpi_find_rsdp(void);


cast to an int, so 64bit machines don't get confused

--- libswfdec/swfdec_player.c
+++ libswfdec/swfdec_player.c
@@ -1747,7 +1747,7 @@
     g_signal_emit (player, signals[FSCOMMAND], 0, command, target);
     return;
   }
-  g_signal_emit (player, signals[LAUNCH], 0, request, url, target, data);
+  g_signal_emit (player, signals[LAUNCH], 0, (int) request, url, target, data);
 }

 /**


handle null pointers: replace_item_in_object

--- cJSON.c
+++ cJSON.c
@@ -2008,7 +2008,7 @@

 static cJSON_bool replace_item_in_object(cJSON *object, const char *string, cJSON *replacement, cJSON_bool case_sensitive)
 {
-    if (replacement == NULL)
+    if ((replacement == NULL) || (string == NULL))
     {
         return false;
     }


Ignore return value, if any, of debugfs_create_u32 et al.

These used to return a `dentry` and now return `void`.

See the patch series at https://lore.kernel.org/patchwork/patch/1138609/

--- kernel_modules/kmod_meltdown/meltdown_module.c
+++ kernel_modules/kmod_meltdown/meltdown_module.c
@@ -69,17 +69,11 @@
     goto out_remove;
   }

-  child = debugfs_create_u32("secret_data_length", 0400, debugfs_dir,
+  debugfs_create_u32("secret_data_length", 0400, debugfs_dir,
       &secret_data_length);
-  if (!child) {
-    goto out_remove;
-  }

-  child = debugfs_create_x64("secret_data_address", 0400, debugfs_dir,
+  debugfs_create_x64("secret_data_address", 0400, debugfs_dir,
       &secret_data_address);
-  if (!child) {
-    goto out_remove;
-  }

   child = debugfs_create_file("secret_data_in_cache", 0400, debugfs_dir, NULL,
       &fops_secret_data_in_cache);


inherit the scope chain from the current scope chain, not from this

YOUUUUUTUUUUUBE!!!!

--- libswfdec/swfdec_script.c
+++ libswfdec/swfdec_script.c
@@ -1662,11 +1662,11 @@
   if (*function_name == '\0') {
     /* anonymous function */
     fun = JS_NewFunction (cx, NULL, n_args, JSFUN_LAMBDA | JSFUN_HEAVYWEIGHT,
-	cx->fp->thisp, NULL);
+	cx->fp->scopeChain, NULL);
   } else {
     /* named function */
     fun = JS_NewFunction (cx, NULL, n_args, JSFUN_HEAVYWEIGHT,
-	cx->fp->thisp, function_name);
+	cx->fp->scopeChain, function_name);
   }
   if (fun == NULL)
     return JS_FALSE;


[lsan] disable lsan if wordsize is not 64

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

--- lib/lsan/lsan_common.h
+++ lib/lsan/lsan_common.h
@@ -21,7 +21,7 @@
 #include "sanitizer_common/sanitizer_platform.h"
 #include "sanitizer_common/sanitizer_symbolizer.h"

-#if SANITIZER_LINUX && defined(__x86_64__)
+#if SANITIZER_LINUX && defined(__x86_64__) && (SANITIZER_WORDSIZE == 64)
 #define CAN_SANITIZE_LEAKS 1
 #else
 #define CAN_SANITIZE_LEAKS 0


downgraded from UIKit to Foundation.

downgraded from UIKit to Foundation.

--- Extensions/FURRExtensions.h
+++ Extensions/FURRExtensions.h
@@ -24,7 +24,7 @@
 // WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-#import <UIKit/UIKit.h>
+#import <Foundation/Foundation.h>

 //! Project version number for Extensions.
 FOUNDATION_EXPORT double ExtensionsVersionNumber;


Init model with zero by default

Init model with zero by default

--- lib/macau-cpp/config.h
+++ lib/macau-cpp/config.h
@@ -63,7 +63,7 @@
     std::string restore_prefix = "";
     std::string restore_suffix = ".csv";

-    std::string init_model = "random";
+    std::string init_model = "zero";

     //-- save
     std::string save_prefix = "save";


lib: Fix strict-aliasing of sockaddr

lib: Fix strict-aliasing of sockaddr

This fixes a warning about dereferencing type-punned pointers
potentially breaking strict-aliasing rules.

--- libuhttpmock/uhm-server.c
+++ libuhttpmock/uhm-server.c
@@ -1294,7 +1294,10 @@
 uhm_server_run (UhmServer *self)
 {
 	UhmServerPrivate *priv = self->priv;
-	struct sockaddr_in sock;
+	union {
+		struct sockaddr sock;
+		struct sockaddr_in in;
+	} sock;
 	SoupAddress *addr;
 	GMainContext *thread_context;

@@ -1304,11 +1307,11 @@

 	/* Grab a loopback IP to use. */
 	memset (&sock, 0, sizeof (sock));
-	sock.sin_family = AF_INET;
-	sock.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
-	sock.sin_port = htons (0); /* random port */
-
-	addr = soup_address_new_from_sockaddr ((struct sockaddr *) &sock, sizeof (sock));
+	sock.in.sin_family = AF_INET;
+	sock.in.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
+	sock.in.sin_port = htons (0); /* random port */
+
+	addr = soup_address_new_from_sockaddr (&sock.sock, sizeof (sock));
 	g_assert (addr != NULL);

 	/* Set up the server. If (priv->tls_certificate != NULL) it will be a HTTPS server;


core: Trivial documentation fix

core: Trivial documentation fix

--- libuhttpmock/uhm-server.c
+++ libuhttpmock/uhm-server.c
@@ -31,7 +31,7 @@
  * to expecting the next request in the trace file.
  *
  * The mock server currently only operates on a single network interface, on HTTPS only. This may change in future. A dummy TLS certificate is used
- * to authenticate the server. This certificate is not signed by a CA, so the SoupSession:ssl-strict property must be set to %FALSE in client code
+ * to authenticate the server. This certificate is not signed by a CA, so the #SoupSession:ssl-strict property must be set to %FALSE in client code
  * during (and only during!) testing.
  *
  * The server can operate in three modes: logging, testing, and comparing. These are set by #UhmServer:enable-logging and #UhmServer:enable-online.


go hue

go hue

--- libvips/colour/sRGB2HSV.c
+++ libvips/colour/sRGB2HSV.c
@@ -78,7 +78,7 @@
 				c_max = p[0];
 				c_min = p[2];
 				secondary_diff = p[1] - p[2];
-				//wrap_around_hue = 0f;
+				wrap_around_hue = 0f;
 			} else {
 				c_max = p[1];
 				c_min = VIPS_MIN(p[2], p[0]);


grammar in a comment

grammar in a comment

--- libvips/foreign/gifload.c
+++ libvips/foreign/gifload.c
@@ -257,7 +257,7 @@
 }

 /* Render the current gif frame into an RGBA buffer. GIFs
- * accumulate, so don't clear the buffer first, so that we can paint a
+ * accumulate, so don't clear the buffer first, we need to paint a
  * series of frames on top of each other.
  */
 static int


lib: Update TODOs in comment

lib: Update TODOs in comment

--- libwalbottle/wbl-schema.c
+++ libwalbottle/wbl-schema.c
@@ -24,9 +24,8 @@
  * @include: libwalbottle/wbl-schema.h
  *
  * TODO:
- *  - Schema parsing
- *  - Online validation of JSON values against a schema
- *  - Test case generation from a schema
+ *  - Subschema validation with section 8
+ *  - Retrieving subschemas in the public API
  *
  * Since: UNRELEASED
  */


Purge cache and enable all interrupts

Purge cache and enable all interrupts

--- libyaul/kernel/sys/init.c
+++ libyaul/kernel/sys/init.c
@@ -87,6 +87,9 @@
         dbgio_init();

         user_init();
+
+        cpu_cache_purge();
+        cpu_intc_mask_set(0);
 }

 static void __section(".fini") __used __noreturn


string-set memory pool: Add ASAN support

--- link-grammar/string-set.c
+++ link-grammar/string-set.c
@@ -76,6 +76,7 @@
 	ss->alloc_next = ss->string_pool->block;

 	ss->pool_free_count = pool_size_add - sizeof(str_mem_pool);
+	ASAN_POISON_MEMORY_REGION(ss->string_pool+sizeof(str_mem_pool), ss->pool_free_count);
 }

 static void ss_pool_delete(String_set *ss)
@@ -84,6 +85,7 @@

 	for (m = ss->string_pool; m != NULL; m = m_prev)
 	{
+		ASAN_UNPOISON_MEMORY_REGION(m, m->size);
 		m_prev = m->prev;
 		free(m);
 	}
@@ -98,6 +100,7 @@
 		ss_pool_alloc((str_size&MEM_POOL_INCR) + MEM_POOL_INCR, ss);

 	char *str_address = ss->alloc_next;
+	ASAN_UNPOISON_MEMORY_REGION(str_address, str_size);
 	ss->alloc_next += str_size;
 	ss->alloc_next = (char *)ALIGN((uintptr_t)ss->alloc_next, STR_ALIGNMENT);
 	size_t total_size = str_size + (ss->alloc_next - str_address);


lg_readline.c: Arrange/delete comments

lg_readline.c: Arrange/delete comments

1. More compact comment.
2. Remove duplicated comment in a wrong place.

--- link-parser/lg_readline.c
+++ link-parser/lg_readline.c
@@ -64,9 +64,7 @@
 	const Switch **match;
 	const char *prev;
 	size_t addlen;
-
-	/* Marking for the help facility. */
-	bool is_assignment = false;
+	bool is_assignment = false; /* marking for the help facility */

 	if ((1 < len) && L'=' == input[len-1] && !is_help)
 	{


Fix ENTER detection to allow terminating [\r]\n

This prevent the need to discard \r and \n from input lines.
These characters are considered whitespace anyway.

Also update the list of characters considered whitespace by link-parser.
These includes only 8-bit codes ones. However, no harm happens if a
whitespace line that includes Unicode characters is not detected as the
tokenizer just ignores it due to no tokens.

--- link-parser/link-parser.c
+++ link-parser/link-parser.c
@@ -165,7 +165,7 @@
 #endif /* _WIN32 */
 #endif /* HAVE_EDITLINE */

-	if (NULL == pline) return NULL;                /* EOF */
+	if (NULL == pline) return NULL;      /* EOF */
 	if (('\0' != input_string[MAX_INPUT-2]) &&
 	    ('\n' != input_string[MAX_INPUT-2]))
 	{
@@ -174,9 +174,10 @@
 	}
 	if (check_return)
 	{
-		if ('\0' == pline[0]) return (char *)"\n"; /* Continue linkage display */
+		if (('\0' == pline[0]) || ('\r' == pline[0]) || ('\n' == pline[0]))
+			return (char *)"\n";           /* Continue linkage display */
 		input_pending = true;
-		return (char *)"x";                        /* Stop linkage display */
+		return (char *)"x";               /* Stop linkage display */
 	}

 	return pline;
@@ -828,7 +829,8 @@
 		}

 		/* If the input string is just whitespace, then ignore it. */
-		if (strspn(input_string, " \t\v") == strlen(input_string)) continue;
+		if (strspn(input_string, " \t\v\r\n\xA0") == strlen(input_string))
+			continue;

 		if (special_command(input_string, copts, dict)) continue;


Fixed valgrind leaks

Fixed valgrind leaks

--- linked_list/linked_list.h
+++ linked_list/linked_list.h
@@ -15,13 +15,20 @@
     LinkedList() {}

     //! Destructor
-    ~LinkedList() {}
+    ~LinkedList() {
+        clear();
+    }

     //! Clears the list
     void clear() {
-        while (!empty()) {
-            pop_front();
-        }
+        auto current_node = head;
+
+        for (auto i = 0u; i < size(); ++i) {
+            auto aux = current_node;
+            current_node = current_node->next();
+            delete aux;
+        }
+        size_ = 0;
     }

     //! Inserts an element at size()
@@ -115,16 +122,15 @@
             throw std::out_of_range("Empty!");
         }

+        auto current_node = head;
+        for (auto i = 0u; i < size()-1; ++i) {
+            current_node = current_node->next();
+        }
+
+        current_node->next(nullptr);
         auto end_data = end()->data();
-        auto current_node = head;
-
-        while (current_node->next() != nullptr) {
-            current_node = current_node->next();
-        }
-
-        current_node = nullptr;
+        delete end();
         --size_;
-        delete current_node;
         return end_data;
     }


platform_data: fix the max allowed region size

According to the layout definition, the max allowed region size
for platform data area is up to 128KB.

Signed-off-by: Lans Zhang <e5f62b0189adf41bef2a4f4e0947feed14b85bc6@windriver.com>

--- linux/lib/platform_data.h
+++ linux/lib/platform_data.h
@@ -34,8 +34,7 @@
 /* Refer to 330234-002US for the details */

 #define PLATFORM_DATA_OFFSET			(-0xF0000)
-#define BLOCK_SIZE				0x1000
-#define PLATFORM_DATA_MAX_SIZE			BLOCK_SIZE
+#define PLATFORM_DATA_MAX_SIZE			0x20000

 #pragma pack(1)