fix Descriptor.c
Merge pull request #2258 from QuentinPerez/fix-descriptor-firmware

fix Descriptor.c
Remove unneeded check in String::remove(unsigned int)

This check already happens in the remove(unsigned int, unsigned int)
method that is caled, so there is no need to also check this here.
Fix bounds check in String::remove()

Previously, if you passed in a very big index and/or count, the
`index + count` could overflow, making the count be used as-is instead
of being truncated (causing the string to be updated wrongly and
potentially writing to arbitrary memory locations).

We can rewrite the comparison to use `len - index` instead. Since we
know that index < len, we are sure this subtraction does not overflow,
regardless of what values of index and count we pass in.

As an added bonus, the `len - index` value already needed be calculated
inside the if, so this saves a few instructions in the generated code.

To illustrate this problem, consider this code:

String foo = "foo";
Serial.println(foo.length()); // Prints 3
foo.remove(1, 65535); // Should remove all but first character
Serial.println(foo.length()); // Prints 4 without this patch

Not shown in this is example is that some arbitrary memory is written
as well.
Simplify String::remove(unsigned int)

Previously, this method calculated the length of the string from the
given index onwards. However, the other remove() method called already
contains code for this calculation, which is used when the count passed
in is too big. This means we can just pass in a very big count that is
guaranteed to point past the end of the string, shrinking the remove
method by a few bytes.
Fix off-by-one in String::substring

When checking the `left` argument, it previously allowed having
left == len. However, this means the substring starts one past the last
character in the string and should return the empty string. In practice,
this already worked correctly, because buffer[len] contains the trailing
nul, so it would (re)assign the empty string to `out`.

However, fixing this check makes it a bit more logical, and prevents a
fairly unlikely out-of-buffer write (to address 0x0) when calling
substring on an invalidated String:

	String bar = (char*)NULL;
	bar.substring(0, 0);
Fix indent and small cosmetic changes
[sam] SPI library: added SPI_HAS_EXTENDED_CS_PIN_HANDLING flag

This allows to check if SPI provides extended API to allow automatic
CS pin handling.
[sam] Simplified formula for SPI speed
[sam] Implementation of SPI multibyte transfer
Merge pull request #1937 from matthijskooijman/stringindex

String index fixes and cleanups
Ported #1397 to SAM.
Added license to USBAPI.h

Close #1847
Merge pull request #2299 from cmaglie/ide-1.5.x-spi-updates

Missing SPI Transaction API methods on Due (SAM3X)
Fixed trivial include error introduced in previous commit 2e3e539b... oops...
Removed todo.txt (leftover) and updated build.xml accordingly
Updated revision log. Version upped to 1.0.6.
Merge branch 'master' into ide-1.5.x

Conflicts:
	app/src/processing/app/Base.java
	build/build.xml
	todo.txt
Fixed attribution rights for SAM delayMicroseconds function
update revision log