From 1312fe411468d2bf4f64afe8e318d43a195e34a6 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 3 Sep 2014 15:37:19 +0000
Subject: haiku patch


diff --git a/configure.ac b/configure.ac
index 3eff01a..6b14c25 100644
--- a/configure.ac
+++ b/configure.ac
@@ -84,10 +84,12 @@ case $host in
     THREAD_CFLAGS="-I/usr/local/include -D_THREAD_SAFE"
     CFLAGS="$THREAD_CFLAGS $CFLAGS"
     ;;
-  *mingw32* | *cygwin*)
+  *mingw32* | *cygwin* | *haiku*)
     ;;
   *android*)
     ;;
+  *haiku*)
+  	;;
   *)
     AC_CHECK_LIB(pthread, pthread_create,
         [THREAD_LIBS="-lpthread"],
-- 
1.8.3.4


From 89577dcab8e80a283ab361c137565c20009b9da1 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Wed, 3 Sep 2014 19:54:24 +0000
Subject: gcc2 fix


diff --git a/src/searching.c b/src/searching.c
index f6e497e..993b9d0 100644
--- a/src/searching.c
+++ b/src/searching.c
@@ -1147,6 +1147,8 @@ static int32_t dvdnav_find_vobu_by_tmap(dvdnav_t *this, dvd_state_t *state,
   uint64_t seek_offset = 0;
   uint32_t seek_idx = 0;
   int32_t result = 0;
+  uint32_t seek_remainder;
+  uint32_t seek_pct;
   dvdnav_pos_data_t *cell_bgn_lo = NULL;
   dvdnav_pos_data_t *cell_bgn_hi = NULL;
   dvdnav_pos_data_t *jump_lo = NULL;
@@ -1172,8 +1174,8 @@ static int32_t dvdnav_find_vobu_by_tmap(dvdnav_t *this, dvd_state_t *state,
   /* calc time of jump_time relative to cell_bgn_lo */
   seek_offset = jump->time - cell_bgn_lo->time;
   seek_idx = (uint32_t)(seek_offset / args->tmap_interval);
-  uint32_t seek_remainder = seek_offset - (seek_idx * args->tmap_interval);
-  uint32_t seek_pct = (seek_remainder * 1000) / args->tmap_interval;
+  seek_remainder = seek_offset - (seek_idx * args->tmap_interval);
+  seek_pct = (seek_remainder * 1000) / args->tmap_interval;
 
   /* get tmap entries on either side of jump_time */
   jump_lo = &(dvdnav_pos_data_t){0};
@@ -1250,7 +1252,6 @@ static int32_t dvdnav_find_vobu_by_cell_boundaries(
 /* -1: Before. Always jump to a time that is < time_in_pts_ticks */
 dvdnav_status_t dvdnav_jump_to_sector_by_time(dvdnav_t *this,
             uint64_t time_in_pts_ticks, int32_t mode) {
-  if (mode != JUMP_MODE_TIME_DEFAULT) return DVDNAV_STATUS_ERR;
   int32_t result = DVDNAV_STATUS_ERR;
   dvd_state_t *state = NULL;
   uint32_t sector_off = 0;
@@ -1258,6 +1259,8 @@ dvdnav_status_t dvdnav_jump_to_sector_by_time(dvdnav_t *this,
   dvdnav_cell_data_t *cell_data = NULL;
   dvdnav_jump_args_t *args = NULL;
 
+  if (mode != JUMP_MODE_TIME_DEFAULT) return DVDNAV_STATUS_ERR;
+  
   jump = &(dvdnav_pos_data_t){0};
   /* convert time to milliseconds */
   jump->time = time_in_pts_ticks / 90;
diff --git a/src/vm/vm.c b/src/vm/vm.c
index 7e4d594..e4e8995 100644
--- a/src/vm/vm.c
+++ b/src/vm/vm.c
@@ -816,10 +816,12 @@ static int process_command(vm_t *vm, link_t link_values) {
         /* These should never be set in SystemSpace and/or MenuSpace */
         /* vm->state.TTN_REG = rsm_tt; ?? */
         /* vm->state.TT_PGCN_REG = vm->state.rsm_pgcN; ?? */
+        {
         int i;
         for(i = 0; i < 5; i++) {
           vm->state.registers.SPRM[4 + i] = vm->state.rsm_regs[i];
         }
+        }
 
         if(link_values.data1 != 0)
           vm->state.HL_BTNN_REG = link_values.data1 << 10;
-- 
1.8.3.4

