Browse Source

String encoding fix.

tags/2021-05-28
Julian Storer 14 years ago
parent
commit
9f6e8f8e00
9 changed files with 59 additions and 87 deletions
  1. +11
    -32
      juce_amalgamated.cpp
  2. +18
    -11
      juce_amalgamated.h
  3. +5
    -2
      src/containers/juce_Array.h
  4. +5
    -3
      src/containers/juce_OwnedArray.h
  5. +8
    -6
      src/containers/juce_ReferenceCountedArray.h
  6. +1
    -1
      src/core/juce_StandardHeader.h
  7. +9
    -26
      src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp
  8. +0
    -2
      src/native/windows/juce_win32_Windowing.cpp
  9. +2
    -4
      src/text/juce_String.cpp

+ 11
- 32
juce_amalgamated.cpp View File

@@ -13454,10 +13454,8 @@ const String String::createStringFromData (const void* const data_, const int si
{
return charToString ((char) data[0]);
}
else if ((data[0] == (uint8) CharPointer_UTF16::byteOrderMarkBE1
&& data[1] == (uint8) CharPointer_UTF16::byteOrderMarkBE2)
|| (data[0] == (uint8) CharPointer_UTF16::byteOrderMarkLE1
&& data[1] == (uint8) CharPointer_UTF16::byteOrderMarkLE1))
else if ((data[0] == (uint8) CharPointer_UTF16::byteOrderMarkBE1 && data[1] == (uint8) CharPointer_UTF16::byteOrderMarkBE2)
|| (data[0] == (uint8) CharPointer_UTF16::byteOrderMarkLE1 && data[1] == (uint8) CharPointer_UTF16::byteOrderMarkLE2))
{
const bool bigEndian = (data[0] == (uint8) CharPointer_UTF16::byteOrderMarkBE1);
const int numChars = size / 2 - 1;
@@ -85124,7 +85122,6 @@ public:
ClipRegion_EdgeTable (const RectangleList& r) : edgeTable (r) {}
ClipRegion_EdgeTable (const Rectangle<int>& bounds, const Path& p, const AffineTransform& t) : edgeTable (bounds, p, t) {}
ClipRegion_EdgeTable (const ClipRegion_EdgeTable& other) : edgeTable (other.edgeTable) {}
~ClipRegion_EdgeTable() {}

const Ptr clone() const
{
@@ -85328,7 +85325,6 @@ public:
ClipRegion_RectangleList (const Rectangle<int>& r) : clip (r) {}
ClipRegion_RectangleList (const RectangleList& r) : clip (r) {}
ClipRegion_RectangleList (const ClipRegion_RectangleList& other) : clip (other.clip) {}
~ClipRegion_RectangleList() {}

const Ptr clone() const
{
@@ -85625,14 +85621,9 @@ private:
{
r.setEdgeTableYPos (totalTop);

if (doLeftAlpha)
r.handleEdgeTablePixel (totalLeft, (leftAlpha * topAlpha) >> 8);

if (clippedWidth > 0)
r.handleEdgeTableLine (clippedLeft, clippedWidth, topAlpha);

if (doRightAlpha)
r.handleEdgeTablePixel (right, (rightAlpha * topAlpha) >> 8);
if (doLeftAlpha) r.handleEdgeTablePixel (totalLeft, (leftAlpha * topAlpha) >> 8);
if (clippedWidth > 0) r.handleEdgeTableLine (clippedLeft, clippedWidth, topAlpha);
if (doRightAlpha) r.handleEdgeTablePixel (right, (rightAlpha * topAlpha) >> 8);
}

const int endY = jmin (bottom, clipBottom);
@@ -85640,28 +85631,18 @@ private:
{
r.setEdgeTableYPos (y);

if (doLeftAlpha)
r.handleEdgeTablePixel (totalLeft, leftAlpha);

if (clippedWidth > 0)
r.handleEdgeTableLineFull (clippedLeft, clippedWidth);

if (doRightAlpha)
r.handleEdgeTablePixel (right, rightAlpha);
if (doLeftAlpha) r.handleEdgeTablePixel (totalLeft, leftAlpha);
if (clippedWidth > 0) r.handleEdgeTableLineFull (clippedLeft, clippedWidth);
if (doRightAlpha) r.handleEdgeTablePixel (right, rightAlpha);
}

if (bottomAlpha != 0 && bottom < clipBottom)
{
r.setEdgeTableYPos (bottom);

if (doLeftAlpha)
r.handleEdgeTablePixel (totalLeft, (leftAlpha * bottomAlpha) >> 8);

if (clippedWidth > 0)
r.handleEdgeTableLine (clippedLeft, clippedWidth, bottomAlpha);

if (doRightAlpha)
r.handleEdgeTablePixel (right, (rightAlpha * bottomAlpha) >> 8);
if (doLeftAlpha) r.handleEdgeTablePixel (totalLeft, (leftAlpha * bottomAlpha) >> 8);
if (clippedWidth > 0) r.handleEdgeTableLine (clippedLeft, clippedWidth, bottomAlpha);
if (doRightAlpha) r.handleEdgeTablePixel (right, (rightAlpha * bottomAlpha) >> 8);
}
}
}
@@ -248422,9 +248403,7 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis
static BOOL CALLBACK enumMonitorsProc (HMONITOR, HDC, LPRECT r, LPARAM userInfo)
{
Array <Rectangle<int> >* const monitorCoords = (Array <Rectangle<int> >*) userInfo;

monitorCoords->add (Rectangle<int> (r->left, r->top, r->right - r->left, r->bottom - r->top));

return TRUE;
}



+ 18
- 11
juce_amalgamated.h View File

@@ -73,7 +73,7 @@ namespace JuceDummyNamespace {}
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 53
#define JUCE_BUILDNUMBER 51
#define JUCE_BUILDNUMBER 52

/** Current Juce version number.

@@ -7113,13 +7113,16 @@ public:
@param comparator the comparator to use to compare the elements - see the sort()
method for details about the form this object should take
@param newElement the new element to insert to the array
@returns the index at which the new item was added
@see addUsingDefaultSort, add, sort
*/
template <class ElementComparator>
void addSorted (ElementComparator& comparator, ParameterType newElement)
int addSorted (ElementComparator& comparator, ParameterType newElement)
{
const ScopedLockType lock (getLock());
insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed), newElement);
const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed);
insert (index, newElement);
return index;
}

/** Inserts a new element into the array, assuming that the array is sorted.
@@ -9697,16 +9700,18 @@ public:
@param comparator the comparator to use to compare the elements - see the sort method
for details about this object's structure
@param newObject the new object to insert to the array
@returns the index at which the new object was added
@see add, sort, indexOfSorted
*/
template <class ElementComparator>
void addSorted (ElementComparator& comparator,
ObjectClass* const newObject) throw()
int addSorted (ElementComparator& comparator, ObjectClass* const newObject) throw()
{
(void) comparator; // if you pass in an object with a static compareElements() method, this
// avoids getting warning messages about the parameter being unused
const ScopedLockType lock (getLock());
insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
insert (index, newObject);
return index;
}

/** Finds the index of an object in the array, assuming that the array is sorted.
@@ -13302,17 +13307,19 @@ public:
should go. If the array isn't sorted, the behaviour of this
method will be unpredictable.

@param comparator the comparator object to use to compare the elements - see the
sort() method for details about this object's form
@param comparator the comparator object to use to compare the elements - see the
sort() method for details about this object's form
@param newObject the new object to insert to the array
@returns the index at which the new object was added
@see add, sort
*/
template <class ElementComparator>
void addSorted (ElementComparator& comparator,
ObjectClass* newObject) throw()
int addSorted (ElementComparator& comparator, ObjectClass* newObject) throw()
{
const ScopedLockType lock (getLock());
insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
insert (index, newObject);
return index;
}

/** Inserts or replaces an object in the array, assuming it is sorted.


+ 5
- 2
src/containers/juce_Array.h View File

@@ -589,13 +589,16 @@ public:
@param comparator the comparator to use to compare the elements - see the sort()
method for details about the form this object should take
@param newElement the new element to insert to the array
@returns the index at which the new item was added
@see addUsingDefaultSort, add, sort
*/
template <class ElementComparator>
void addSorted (ElementComparator& comparator, ParameterType newElement)
int addSorted (ElementComparator& comparator, ParameterType newElement)
{
const ScopedLockType lock (getLock());
insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed), newElement);
const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newElement, 0, numUsed);
insert (index, newElement);
return index;
}
/** Inserts a new element into the array, assuming that the array is sorted.


+ 5
- 3
src/containers/juce_OwnedArray.h View File

@@ -411,16 +411,18 @@ public:
@param comparator the comparator to use to compare the elements - see the sort method
for details about this object's structure
@param newObject the new object to insert to the array
@returns the index at which the new object was added
@see add, sort, indexOfSorted
*/
template <class ElementComparator>
void addSorted (ElementComparator& comparator,
ObjectClass* const newObject) throw()
int addSorted (ElementComparator& comparator, ObjectClass* const newObject) throw()
{
(void) comparator; // if you pass in an object with a static compareElements() method, this
// avoids getting warning messages about the parameter being unused
const ScopedLockType lock (getLock());
insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
insert (index, newObject);
return index;
}
/** Finds the index of an object in the array, assuming that the array is sorted.


+ 8
- 6
src/containers/juce_ReferenceCountedArray.h View File

@@ -371,17 +371,19 @@ public:
should go. If the array isn't sorted, the behaviour of this
method will be unpredictable.
@param comparator the comparator object to use to compare the elements - see the
sort() method for details about this object's form
@param newObject the new object to insert to the array
@param comparator the comparator object to use to compare the elements - see the
sort() method for details about this object's form
@param newObject the new object to insert to the array
@returns the index at which the new object was added
@see add, sort
*/
template <class ElementComparator>
void addSorted (ElementComparator& comparator,
ObjectClass* newObject) throw()
int addSorted (ElementComparator& comparator, ObjectClass* newObject) throw()
{
const ScopedLockType lock (getLock());
insert (findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed), newObject);
const int index = findInsertIndexInSortedArray (comparator, data.elements.getData(), newObject, 0, numUsed);
insert (index, newObject);
return index;
}
/** Inserts or replaces an object in the array, assuming it is sorted.


+ 1
- 1
src/core/juce_StandardHeader.h View File

@@ -33,7 +33,7 @@
*/
#define JUCE_MAJOR_VERSION 1
#define JUCE_MINOR_VERSION 53
#define JUCE_BUILDNUMBER 51
#define JUCE_BUILDNUMBER 52
/** Current Juce version number.


+ 9
- 26
src/gui/graphics/contexts/juce_LowLevelGraphicsSoftwareRenderer.cpp View File

@@ -1225,7 +1225,6 @@ public:
ClipRegion_EdgeTable (const RectangleList& r) : edgeTable (r) {}
ClipRegion_EdgeTable (const Rectangle<int>& bounds, const Path& p, const AffineTransform& t) : edgeTable (bounds, p, t) {}
ClipRegion_EdgeTable (const ClipRegion_EdgeTable& other) : edgeTable (other.edgeTable) {}
~ClipRegion_EdgeTable() {}
const Ptr clone() const
{
@@ -1431,7 +1430,6 @@ public:
ClipRegion_RectangleList (const Rectangle<int>& r) : clip (r) {}
ClipRegion_RectangleList (const RectangleList& r) : clip (r) {}
ClipRegion_RectangleList (const ClipRegion_RectangleList& other) : clip (other.clip) {}
~ClipRegion_RectangleList() {}
const Ptr clone() const
{
@@ -1730,14 +1728,9 @@ private:
{
r.setEdgeTableYPos (totalTop);
if (doLeftAlpha)
r.handleEdgeTablePixel (totalLeft, (leftAlpha * topAlpha) >> 8);
if (clippedWidth > 0)
r.handleEdgeTableLine (clippedLeft, clippedWidth, topAlpha);
if (doRightAlpha)
r.handleEdgeTablePixel (right, (rightAlpha * topAlpha) >> 8);
if (doLeftAlpha) r.handleEdgeTablePixel (totalLeft, (leftAlpha * topAlpha) >> 8);
if (clippedWidth > 0) r.handleEdgeTableLine (clippedLeft, clippedWidth, topAlpha);
if (doRightAlpha) r.handleEdgeTablePixel (right, (rightAlpha * topAlpha) >> 8);
}
const int endY = jmin (bottom, clipBottom);
@@ -1745,28 +1738,18 @@ private:
{
r.setEdgeTableYPos (y);
if (doLeftAlpha)
r.handleEdgeTablePixel (totalLeft, leftAlpha);
if (clippedWidth > 0)
r.handleEdgeTableLineFull (clippedLeft, clippedWidth);
if (doRightAlpha)
r.handleEdgeTablePixel (right, rightAlpha);
if (doLeftAlpha) r.handleEdgeTablePixel (totalLeft, leftAlpha);
if (clippedWidth > 0) r.handleEdgeTableLineFull (clippedLeft, clippedWidth);
if (doRightAlpha) r.handleEdgeTablePixel (right, rightAlpha);
}
if (bottomAlpha != 0 && bottom < clipBottom)
{
r.setEdgeTableYPos (bottom);
if (doLeftAlpha)
r.handleEdgeTablePixel (totalLeft, (leftAlpha * bottomAlpha) >> 8);
if (clippedWidth > 0)
r.handleEdgeTableLine (clippedLeft, clippedWidth, bottomAlpha);
if (doRightAlpha)
r.handleEdgeTablePixel (right, (rightAlpha * bottomAlpha) >> 8);
if (doLeftAlpha) r.handleEdgeTablePixel (totalLeft, (leftAlpha * bottomAlpha) >> 8);
if (clippedWidth > 0) r.handleEdgeTableLine (clippedLeft, clippedWidth, bottomAlpha);
if (doRightAlpha) r.handleEdgeTablePixel (right, (rightAlpha * bottomAlpha) >> 8);
}
}
}


+ 0
- 2
src/native/windows/juce_win32_Windowing.cpp View File

@@ -2536,9 +2536,7 @@ void Desktop::setKioskComponent (Component* kioskModeComponent, bool enableOrDis
static BOOL CALLBACK enumMonitorsProc (HMONITOR, HDC, LPRECT r, LPARAM userInfo)
{
Array <Rectangle<int> >* const monitorCoords = (Array <Rectangle<int> >*) userInfo;
monitorCoords->add (Rectangle<int> (r->left, r->top, r->right - r->left, r->bottom - r->top));
return TRUE;
}


+ 2
- 4
src/text/juce_String.cpp View File

@@ -2005,10 +2005,8 @@ const String String::createStringFromData (const void* const data_, const int si
{
return charToString ((char) data[0]);
}
else if ((data[0] == (uint8) CharPointer_UTF16::byteOrderMarkBE1
&& data[1] == (uint8) CharPointer_UTF16::byteOrderMarkBE2)
|| (data[0] == (uint8) CharPointer_UTF16::byteOrderMarkLE1
&& data[1] == (uint8) CharPointer_UTF16::byteOrderMarkLE1))
else if ((data[0] == (uint8) CharPointer_UTF16::byteOrderMarkBE1 && data[1] == (uint8) CharPointer_UTF16::byteOrderMarkBE2)
|| (data[0] == (uint8) CharPointer_UTF16::byteOrderMarkLE1 && data[1] == (uint8) CharPointer_UTF16::byteOrderMarkLE2))
{
const bool bigEndian = (data[0] == (uint8) CharPointer_UTF16::byteOrderMarkBE1);
const int numChars = size / 2 - 1;


Loading…
Cancel
Save