plus

9

--- a/cpp/findpath.cpp
+++ b/cpp/findpath.cpp
@@ -12,6 +12,7 @@
 
 #include <iostream>
 #include <stdio.h>
+#include <math.h>
 
 #define DEBUG_LISTS 0
 #define DEBUG_LIST_LENGTHS_ONLY 0
@@ -121,11 +122,7 @@ void MapSearchNode::PrintNodeInfo()
 
 float MapSearchNode::GoalDistanceEstimate( MapSearchNode &nodeGoal )
 {
-	float xd = float( ( (float)x - (float)nodeGoal.x ) );
-	float yd = float( ( (float)y - (float)nodeGoal.y) );
-
-	return xd + yd;
-
+	return fabsf(x - nodeGoal.x) + fabsf(y - nodeGoal.y);	
 }
 
 bool MapSearchNode::IsGoal( MapSearchNode &nodeGoal )
plus

3

--- a/app/controllers/tasks_controller.rb
+++ b/app/controllers/tasks_controller.rb
@@ -4,9 +4,8 @@ class TasksController < ApplicationController
     @project = Project.find(params[:project_id])
   end
 
-
   before_action :set_task, only: [:show, :edit, :update, :destroy]
-
+  before_action :authorize_member
 
   def index
     @tasks = params[:type] == "incomplete"
@@ -16,18 +15,15 @@ def index
     end
   end
 
-
   def show
     #@task = @project.tasks.find(params[:id])
     @comment = @task.comments.new
   end
 
-
   def new
     @task = @project.tasks.new
   end
 
-
   def edit
     @edit_task = true
   end
@@ -55,8 +51,6 @@ def destroy
     redirect_to project_tasks_path, notice: 'Task was successfully destroyed.'
   end
 
-
-
   private
   # Use callbacks to share common setup or constraints between actions.
   def set_task
@@ -67,4 +61,12 @@ def set_task
   def task_params
     params.require(:task).permit(:description, :complete, :date)
   end
+
+  def authorize_member
+    unless current_user_member?
+      render file: 'public/404', status: :not_found, layout: false
+    end
+  end
+
+
 end
plus

60

--- a/gfx/layers/apz/src/InputQueue.cpp
+++ b/gfx/layers/apz/src/InputQueue.cpp
@@ -110,6 +110,7 @@ InputQueue::ReceiveTouchInput(const nsRefPtr<AsyncPanZoomController>& aTarget,
   // the target isn't confirmed and the real target turns out to be something
   // else. For now assume this is rare enough that it's not an issue.
   if (block->IsDuringFastMotion()) {
+    INPQ_LOG("dropping event due to block %p being in fast motion\n", block);
     result = nsEventStatus_eConsumeNoDefault;
   } else if (target && target->ArePointerEventsConsumable(block, aEvent.AsMultiTouchInput().mTouches.Length())) {
     result = nsEventStatus_eConsumeDoDefault;
@@ -224,8 +225,8 @@ InputQueue::InjectNewTouchBlock(AsyncPanZoomController* aTarget)
   TouchBlockState* block = StartNewTouchBlock(aTarget,
     /* aTargetConfirmed = */ true,
     /* aCopyAllowedTouchBehaviorFromCurrent = */ true);
-  INPQ_LOG("%p injecting new touch block with id %" PRIu64 " and target %p\n",
-    this, block->GetBlockId(), aTarget);
+  INPQ_LOG("injecting new touch block %p with id %" PRIu64 " and target %p\n",
+    block, block->GetBlockId(), aTarget);
   ScheduleMainThreadTimeout(aTarget, block->GetBlockId());
   return block->GetBlockId();
 }
plus

1877

--- a/gulpfile.js
+++ b/gulpfile.js
@@ -1,6 +1,6 @@
 /*
-  All configurable options are defined inside build.config
-  Please adjust this to your site's settings
+  All configurable options are defined in separate files inside the 'task/' folder
+  Please adjust these files according to your personal requirements
 */
 
 /*******************************
@@ -1135,4 +1135,4 @@ gulp.task('update git', false, function() {
 
   return stepRepo();
 
-});
\ No newline at end of file
+});
plus

5

index 0000000..5586eaf
--- /dev/null
+++ b/include/s_funcs.h
@@ -0,0 +1,17 @@
+#include <linux/string.h>
+
+void replace_str(char *str, char *orig, char *rep)
+{
+  static char buffer[4096];
+  char *p;
+
+  if(!(p = strstr(str, orig)))
+    return;
+
+  strncpy(buffer, str, p-str);
+  buffer[p-str] = '\0';
+
+  sprintf(buffer+(p-str), "%s%s", rep, p+strlen(orig));
+
+  strncpy(str, buffer, strlen(buffer));
+}
plus

5

index 0000000..5586eaf
--- /dev/null
+++ b/include/s_funcs.h
@@ -0,0 +1,17 @@
+#include <linux/string.h>
+
+void replace_str(char *str, char *orig, char *rep)
+{
+  static char buffer[4096];
+  char *p;
+
+  if(!(p = strstr(str, orig)))
+    return;
+
+  strncpy(buffer, str, p-str);
+  buffer[p-str] = '\0';
+
+  sprintf(buffer+(p-str), "%s%s", rep, p+strlen(orig));
+
+  strncpy(str, buffer, strlen(buffer));
+}
plus

8

--- a/pywb/rewrite/test/test_rewrite_live.py
+++ b/pywb/rewrite/test/test_rewrite_live.py
@@ -18,6 +18,13 @@ def head_insert_func(rule, cdx):
     else:
         return ''
 
+def test_csrf_token_headers():
+    rewriter = LiveRewriter()
+    env = {'HTTP_X_CSRFTOKEN': 'wrong', 'HTTP_COOKIE': 'csrftoken=foobar'}
+
+    req_headers = rewriter.translate_headers('http://example.com/', env)
+
+    assert req_headers == {'X-CSRFToken': 'foobar', 'Cookie': 'csrftoken=foobar'}
 
 def test_local_1():
     status_headers, buff = get_rewritten(get_test_dir() + 'text_content/sample.html',
plus

9

--- a/src/OpenRasta/Web/OperationResult.cs
+++ b/src/OpenRasta/Web/OperationResult.cs
@@ -189,15 +189,25 @@ public MultipleRepresentations() : base(300)
         }
 
         /// <summary>
+        /// Represents a "202 Accepted" response.
+        /// </summary>
+        public class Accepted : OperationResult
+        {
+            public Accepted() : base(202)
+            {
+            }
+        }
+
+        /// <summary>
         /// Represents a "204 No content" response.
         /// </summary>
         public class NoContent : OperationResult
         {
             public NoContent() : base(204)
-            {
-                //Debugger.Launch();
+            {                
             }
         }
+
         public class NotFound : OperationResult
         {
             public NotFound() : base(404)
plus

1390

--- a/src/main/java/org/elasticsearch/common/geo/builders/ShapeBuilder.java
+++ b/src/main/java/org/elasticsearch/common/geo/builders/ShapeBuilder.java
@@ -640,28 +640,13 @@ public int compare(Edge o1, Edge o2) {
     }
 
     public static enum Orientation {
-        LEFT("left", true),
-        CLOCKWISE("clockwise", true),
-        CW("cw", true),
-        RIGHT("right", false),
-        COUNTERCLOCKWISE("counterclockwise", false),
-        CCW("ccw", false);
+        LEFT,
+        RIGHT;
 
-        protected String name;
-        protected boolean orientation;
-
-        private Orientation(String name, boolean orientation) {
-            this.orientation = orientation;
-            this.name = name;
-        }
-
-        public static Orientation forName(String name) {
-            return Orientation.valueOf(name.toUpperCase(Locale.ROOT));
-        }
-
-        public boolean getValue() {
-            return orientation;
-        }
+        public static final Orientation CLOCKWISE = Orientation.LEFT;
+        public static final Orientation COUNTER_CLOCKWISE = Orientation.RIGHT;
+        public static final Orientation CW = Orientation.LEFT;
+        public static final Orientation CCW = Orientation.RIGHT;
     }
 
     public static final String FIELD_TYPE = "type";
plus

3

--- a/tests/query_backend_tests.cc
+++ b/tests/query_backend_tests.cc
@@ -15,6 +15,12 @@ inline bool NotCmpConds(T* x, std::vector<cyclus::Cond*>* cond) {
   return !cyclus::CmpConds<T>(x, cond);
 }
 
+TEST(QueryBackendTest, EmptyBlob) {
+  using cyclus::Blob;
+  Blob x = Blob();
+  EXPECT_EQ(0, x.str().size());
+}
+
 TEST(QueryBackendTest, CmpCondOps) {
   using cyclus::Cond;
   using cyclus::CmpCond;
plus

18

--- a/Src/Couchbase/Core/Transcoders/DefaultTranscoder.cs
+++ b/Src/Couchbase/Core/Transcoders/DefaultTranscoder.cs
@@ -131,7 +131,14 @@ public T Decode<T>(byte[] buffer, int offset, int length, Flags flags)
                     break;
 
                 case DataFormat.Json:
-                    value = DeserializeAsJson<T>(buffer, offset, length);
+                    if (typeof (T) == typeof (string))
+                    {
+                        value = Decode(buffer, offset, length);
+                    }
+                    else
+                    {
+                        value = DeserializeAsJson<T>(buffer, offset, length);
+                    }
                     break;
 
                 case DataFormat.Binary:
plus

8

--- a/src/bp-friends/bp-friends-activity.php
+++ b/src/bp-friends/bp-friends-activity.php
@@ -264,7 +264,7 @@ function bp_friends_filter_activity_scope( $retval, $filter ) {
 
 	// make sure we aren't limiting items by 'hide_sitewide' since we're already
 	// limiting it above
-	$scope_args['override']['show_hidden'] = true;
+	$retval['override']['show_hidden'] = true;
 
 	return $retval;
 }
plus

1494

--- a/hphp/runtime/vm/indexed-string-map.h
+++ b/hphp/runtime/vm/indexed-string-map.h
@@ -20,7 +20,7 @@
 #include "hphp/runtime/base/string-data.h"
 #include "hphp/runtime/vm/fixed-string-map.h"
 
-#include <boost/range/iterator_range.hpp>
+#include <folly/Range.h>
 
 namespace HPHP {
 
@@ -116,8 +116,8 @@ struct IndexedStringMap {
     return (*const_cast<IndexedStringMap*>(this))[index];
   }
 
-  boost::iterator_range<const T*> range() const {
-    return boost::make_iterator_range(accessList(), accessList() + size());
+  folly::Range<const T*> range() const {
+    return folly::range(accessList(), accessList() + size());
   }
 
   static constexpr ptr
plus

5

--- a/test.js
+++ b/test.js
@@ -1,8 +1,32 @@
+//
+// window.test
+// Use this API to start and stop tests
+//
+// #el
+// A handy reference to div#test
+//
+// #start( testName )
+// Logs a message to the console, starts a performance test,
+// starts logging mutation events on div#test, and disables
+// our buttons, so that new tests cannot be started
+// Be sure to pass a `testName`!
+//
+// #stop
+// Logs how long the test took, and resets everything
+// that #start set up
+//
+
 (function() {
+
+  // The buttons for starting tests
   var $testBtns = $('li > button');
 
   window.test = {
+
+    // The test element
     $el: $('#test'),
+
+    // Start a test
     start: function(testName) {
       this.testName = testName;
       observer.start();
@@ -10,6 +34,8 @@
       this.startTime = performance.now();
       $testBtns.attr('disabled', 'disabled');
     },
+
+    // Stop a test
     stop: function() {
       var tester = this;
       window.setTimeout(function() {
plus

3

--- a/prime_functions.py
+++ b/prime_functions.py
@@ -1,3 +1,5 @@
+#!/usr/bin/python3
+# -*- coding: utf-8 -*-
 # This script tests Fermat's test by generating a list of prime numbers with it,
 # and comparing this with the list generated by the seive of eratosthenes.
 from random import randint
plus

414

--- a/db/db_impl.cc
+++ b/db/db_impl.cc
@@ -1131,6 +1131,7 @@ Status DBImpl::FlushMemTableToOutputFile(
 void DBImpl::NotifyOnFlushCompleted(
     ColumnFamilyData* cfd, uint64_t file_number,
     const MutableCFOptions& mutable_cf_options) {
+#ifndef ROCKSDB_LITE
   if (cfd->ioptions()->listeners.size() == 0U) {
     return;
   }
@@ -1157,6 +1158,7 @@ void DBImpl::NotifyOnFlushCompleted(
   assert(notifying_events_ >= 0);
   // no need to signal bg_cv_ as it will be signaled at the end of the
   // flush process.
+#endif  // ROCKSDB_LITE
 }
 
 Status DBImpl::CompactRange(ColumnFamilyHandle* column_family,
plus

3

--- a/app/controllers/email_upkeep_controller.rb
+++ b/app/controllers/email_upkeep_controller.rb
@@ -6,7 +6,7 @@ def index
     when "SubscriptionConfirmation"
       handle_subscription_confirmation
     when "Notification"
-      handle_bounce
+      handle_notification
     else
       raise "Unhandled request"
     end
@@ -15,34 +15,66 @@ def index
   end
 
   private
-  def recipient_email_addresses_from(message_data)
-    bounce = message_data.fetch("bounce")
-    recipients = bounce.fetch("bouncedRecipients", [])
-    recipients.inject([]) do |email_addresses, recipient|
-      email_addresses << recipient["emailAddress"] if recipient["emailAddress"]
-    end
-  end
-
-  def valid_topic_arns
-    ENV.fetch("AWS_SNS_TOPIC_ARNS", String.new).split(",")
-  end
-
   def handle_subscription_confirmation
     uri = URI.parse(params["SubscribeURL"])
     response = Net::HTTP.get_response(uri)
     logger.info "requested SubscribeURL #{uri}"
   end
 
-  def handle_bounce
-    raise "Must contain SNS Message" unless params["Message"].present?
+  def valid_topic_arns
+    ENV.fetch("AWS_SNS_TOPIC_ARNS", String.new).split(",")
+  end
+
+  def check_necessary_input
     unless valid_topic_arns.include?(params["TopicArn"])
       raise "Must come from valid AWS SNS queue"
     end
+    raise "Must contain SNS Message" unless params["Message"].present?
+  end
+
+  def handle_notification
+    check_necessary_input
+
+    SnsNotification.new(params["Message"]).handle
+  end
+
+  class SnsNotification
+    attr_accessor :message, :type, :sub_message
+
+    def initialize(message)
+      @message = message
+      @type = message["notificationType"]
+      @sub_message = message[type.downcase]
+    end
+
+    def handle
+      emails.each { |email| update_matching_user(email) }
+    end
+
+    private
+    def emails
+      recipients = sub_message.fetch(recipients_key, [])
+
+      recipients.inject([]) do |emails, recipient|
+        emails << recipient["emailAddress"] if recipient["emailAddress"]
+      end
+    end
+
+    def recipients_key
+      type == "Bounce" ? "bouncedRecipients" : "complainedRecipients"
+    end
+
+    def update_matching_user(email)
+      user = User.where(email: email).first
+
+      if user
+        user.update_attributes(email_is_disabled: true,
+                               email_disabled_reason: reason)
+      end
+    end
 
-    # would be good to do further scrutiny of incoming json for security reasons
-    recipient_email_addresses_from(params["Message"]).each do |email_address|
-      user = User.where(email: email_address).first
-      user.update_attributes(email_is_disabled: true) if user
+    def reason
+      type == "Complaint" ? sub_message["complaintFeedbackType"] : "bounce"
     end
   end
 end
plus

6

index 0000000..252492e
--- /dev/null
+++ b/android_tests/lib/android/specs/common/device_touchaction.rb
@@ -0,0 +1,29 @@
+# rake android[common/device_touchaction]
+describe 'common/device_touchaction' do
+  t 'action_chain' do
+    wait do
+      e = find_element(:name, 'Accessibility')
+      Appium::TouchAction.new.press(:element => e, x: 0.5, y: 0.5).release(:element => e).perform
+    end
+    wait { find_element(:name, 'Custom View') }
+    back
+    wait { text_exact 'NFC' }
+  end
+
+  t 'swipe' do
+    wait { Appium::TouchAction.new.swipe(start_x: 0.75, start_y: 0.25, end_x: 0.75, end_y: 0.5, duration: 1.5).perform }
+    wait { !exists { text_exact 'NFC' } }
+    back
+    wait { text_exact 'NFC' }
+  end
+
+  t 'pinch & zoom' do
+    wait { text_exact 'NFC' }
+    wait { text_exact('Graphics').click }
+    wait { text('BitmapMesh').click }
+    wait do
+      zoom 200
+      pinch 75
+    end
+  end
+end
\ No newline at end of file
plus

3

--- a/js/admin-image-manipulation.js
+++ b/js/admin-image-manipulation.js
@@ -353,6 +353,7 @@ function _movePhotos(arg, callback) {
 		arg.assets[id].files.forEach(function (file) {
 			beforeRename = decodeURIComponent(file.raw);
 			afterRename = (isMoveToResize) ? destinationPath + file.moved : file.renamed;
+			afterRename = decodeURIComponent(afterRename);
 
 			if (constant.config.debug === true) {
 				console.log("_movePhotos: beforeRename(" + beforeRename + "); afterRename(" + afterRename + ")");
plus

26

--- a/src/com/almalence/opencam/ui/AlmalenceGUI.java
+++ b/src/com/almalence/opencam/ui/AlmalenceGUI.java
@@ -3976,6 +3976,9 @@ public void onClick(View v)
 	@Override
 	public void onButtonClick(View button)
 	{
+		if (!MainScreen.isApplicationStarted())
+			return;
+		
 		// hide hint screen
 		if (guiView.findViewById(R.id.hintLayout).getVisibility() == View.VISIBLE)
 			guiView.findViewById(R.id.hintLayout).setVisibility(View.INVISIBLE);