| @@ -491,7 +491,7 @@ private: | |||||
| const String extraFlags (replacePreprocessorTokens (config, getExtraCompilerFlags().toString()).trim()); | const String extraFlags (replacePreprocessorTokens (config, getExtraCompilerFlags().toString()).trim()); | ||||
| if (extraFlags.isNotEmpty()) | if (extraFlags.isNotEmpty()) | ||||
| s.add ("OTHER_CPLUSPLUSFLAGS = " + extraFlags); | |||||
| s.add ("OTHER_CPLUSPLUSFLAGS = \"" + extraFlags + "\""); | |||||
| if (xcodeProductInstallPath.isNotEmpty()) | if (xcodeProductInstallPath.isNotEmpty()) | ||||
| s.add ("INSTALL_PATH = \"" + xcodeProductInstallPath + "\""); | s.add ("INSTALL_PATH = \"" + xcodeProductInstallPath + "\""); | ||||
| @@ -958,7 +958,7 @@ public: | |||||
| if (pipe (pipeHandles) == 0) | if (pipe (pipeHandles) == 0) | ||||
| { | { | ||||
| const int result = fork(); | |||||
| const pid_t result = fork(); | |||||
| if (result < 0) | if (result < 0) | ||||
| { | { | ||||
| @@ -970,6 +970,7 @@ public: | |||||
| // we're the child process.. | // we're the child process.. | ||||
| close (pipeHandles[0]); // close the read handle | close (pipeHandles[0]); // close the read handle | ||||
| dup2 (pipeHandles[1], 1); // turns the pipe into stdout | dup2 (pipeHandles[1], 1); // turns the pipe into stdout | ||||
| close (pipeHandles[1]); | |||||
| Array<char*> argv; | Array<char*> argv; | ||||
| for (int i = 0; i < arguments.size(); ++i) | for (int i = 0; i < arguments.size(); ++i) | ||||
| @@ -70,6 +70,8 @@ public: | |||||
| void runTest() | void runTest() | ||||
| { | { | ||||
| beginTest ("Child Processes"); | |||||
| #if JUCE_WINDOWS || JUCE_MAC || JUCE_LINUX | #if JUCE_WINDOWS || JUCE_MAC || JUCE_LINUX | ||||
| ChildProcess p; | ChildProcess p; | ||||
| @@ -23,18 +23,6 @@ | |||||
| ============================================================================== | ============================================================================== | ||||
| */ | */ | ||||
| namespace zlibNamespace | |||||
| { | |||||
| #if JUCE_INCLUDE_ZLIB_CODE | |||||
| #undef OS_CODE | |||||
| #undef fdopen | |||||
| #include "zlib/zlib.h" | |||||
| #undef OS_CODE | |||||
| #else | |||||
| #include JUCE_ZLIB_INCLUDE_PATH | |||||
| #endif | |||||
| } | |||||
| BEGIN_JUCE_NAMESPACE | BEGIN_JUCE_NAMESPACE | ||||
| //============================================================================== | //============================================================================== | ||||
| @@ -42,9 +30,7 @@ class GZIPCompressorOutputStream::GZIPCompressorHelper | |||||
| { | { | ||||
| public: | public: | ||||
| GZIPCompressorHelper (const int compressionLevel, const int windowBits) | GZIPCompressorHelper (const int compressionLevel, const int windowBits) | ||||
| : buffer ((size_t) gzipCompBufferSize), | |||||
| compLevel (compressionLevel), | |||||
| strategy (0), | |||||
| : compLevel ((compressionLevel < 1 || compressionLevel > 9) ? -1 : compressionLevel), | |||||
| isFirstDeflate (true), | isFirstDeflate (true), | ||||
| streamIsValid (false), | streamIsValid (false), | ||||
| finished (false) | finished (false) | ||||
| @@ -86,12 +72,12 @@ public: | |||||
| } | } | ||||
| private: | private: | ||||
| enum { gzipCompBufferSize = 32768 }; | |||||
| enum { strategy = 0 }; | |||||
| HeapBlock <zlibNamespace::Bytef> buffer; | |||||
| zlibNamespace::z_stream stream; | zlibNamespace::z_stream stream; | ||||
| int compLevel, strategy; | |||||
| const int compLevel; | |||||
| bool isFirstDeflate, streamIsValid, finished; | bool isFirstDeflate, streamIsValid, finished; | ||||
| zlibNamespace::Bytef buffer[32768]; | |||||
| bool doNextBlock (const uint8*& data, int& dataSize, OutputStream& destStream, const int flushMode) | bool doNextBlock (const uint8*& data, int& dataSize, OutputStream& destStream, const int flushMode) | ||||
| { | { | ||||
| @@ -101,7 +87,7 @@ private: | |||||
| stream.next_in = const_cast <uint8*> (data); | stream.next_in = const_cast <uint8*> (data); | ||||
| stream.next_out = buffer; | stream.next_out = buffer; | ||||
| stream.avail_in = (z_uInt) dataSize; | stream.avail_in = (z_uInt) dataSize; | ||||
| stream.avail_out = (z_uInt) gzipCompBufferSize; | |||||
| stream.avail_out = (z_uInt) sizeof (buffer); | |||||
| const int result = isFirstDeflate ? deflateParams (&stream, compLevel, strategy) | const int result = isFirstDeflate ? deflateParams (&stream, compLevel, strategy) | ||||
| : deflate (&stream, flushMode); | : deflate (&stream, flushMode); | ||||
| @@ -116,7 +102,7 @@ private: | |||||
| { | { | ||||
| data += dataSize - stream.avail_in; | data += dataSize - stream.avail_in; | ||||
| dataSize = (int) stream.avail_in; | dataSize = (int) stream.avail_in; | ||||
| const int bytesDone = (int) (gzipCompBufferSize - stream.avail_out); | |||||
| const int bytesDone = ((int) sizeof (buffer)) - (int) stream.avail_out; | |||||
| return bytesDone <= 0 || destStream.write (buffer, bytesDone); | return bytesDone <= 0 || destStream.write (buffer, bytesDone); | ||||
| } | } | ||||
| @@ -127,21 +113,19 @@ private: | |||||
| return false; | return false; | ||||
| } | } | ||||
| JUCE_DECLARE_NON_COPYABLE (GZIPCompressorHelper); | |||||
| }; | }; | ||||
| //============================================================================== | //============================================================================== | ||||
| GZIPCompressorOutputStream::GZIPCompressorOutputStream (OutputStream* const destStream_, | GZIPCompressorOutputStream::GZIPCompressorOutputStream (OutputStream* const destStream_, | ||||
| int compressionLevel, | |||||
| const int compressionLevel, | |||||
| const bool deleteDestStream, | const bool deleteDestStream, | ||||
| const int windowBits) | const int windowBits) | ||||
| : destStream (destStream_, deleteDestStream) | |||||
| : destStream (destStream_, deleteDestStream), | |||||
| helper (new GZIPCompressorHelper (compressionLevel, windowBits)) | |||||
| { | { | ||||
| jassert (destStream_ != nullptr); | jassert (destStream_ != nullptr); | ||||
| if (compressionLevel < 1 || compressionLevel > 9) | |||||
| compressionLevel = -1; | |||||
| helper = new GZIPCompressorHelper (compressionLevel, windowBits); | |||||
| } | } | ||||
| GZIPCompressorOutputStream::~GZIPCompressorOutputStream() | GZIPCompressorOutputStream::~GZIPCompressorOutputStream() | ||||
| @@ -303,6 +303,7 @@ namespace TextLayoutHelpers | |||||
| TextLayout::Line* glyphLine = new TextLayout::Line(); | TextLayout::Line* glyphLine = new TextLayout::Line(); | ||||
| TextLayout::Run* glyphRun = new TextLayout::Run(); | TextLayout::Run* glyphRun = new TextLayout::Run(); | ||||
| bool needToSetLineOrigin = true; | |||||
| for (int i = 0; i < tokens.size(); ++i) | for (int i = 0; i < tokens.size(); ++i) | ||||
| { | { | ||||
| @@ -317,8 +318,11 @@ namespace TextLayoutHelpers | |||||
| for (int j = 0; j < newGlyphs.size(); ++j) | for (int j = 0; j < newGlyphs.size(); ++j) | ||||
| { | { | ||||
| if (charPosition == lineStartPosition) | |||||
| if (needToSetLineOrigin) | |||||
| { | |||||
| needToSetLineOrigin = false; | |||||
| glyphLine->lineOrigin = tokenPos.translated (0, t->font.getAscent()); | glyphLine->lineOrigin = tokenPos.translated (0, t->font.getAscent()); | ||||
| } | |||||
| const float x = xOffsets.getUnchecked (j); | const float x = xOffsets.getUnchecked (j); | ||||
| glyphRun->glyphs.add (TextLayout::Glyph (newGlyphs.getUnchecked(j), | glyphRun->glyphs.add (TextLayout::Glyph (newGlyphs.getUnchecked(j), | ||||
| @@ -357,6 +361,7 @@ namespace TextLayoutHelpers | |||||
| lineStartPosition = charPosition; | lineStartPosition = charPosition; | ||||
| glyphLine = new TextLayout::Line(); | glyphLine = new TextLayout::Line(); | ||||
| glyphRun = new TextLayout::Run(); | glyphRun = new TextLayout::Run(); | ||||
| needToSetLineOrigin = true; | |||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| @@ -393,10 +398,18 @@ namespace TextLayoutHelpers | |||||
| glyphLine->runs.add (glyphRun); | glyphLine->runs.add (glyphRun); | ||||
| } | } | ||||
| static int getCharacterType (const juce_wchar c) noexcept | |||||
| { | |||||
| if (c == '\r' || c == '\n') | |||||
| return 0; | |||||
| return CharacterFunctions::isWhitespace (c) ? 2 : 1; | |||||
| } | |||||
| void appendText (const AttributedString& text, const Range<int>& stringRange, | void appendText (const AttributedString& text, const Range<int>& stringRange, | ||||
| const Font& font, const Colour& colour) | const Font& font, const Colour& colour) | ||||
| { | { | ||||
| String stringText (text.getText().substring (stringRange.getStart(), stringRange.getEnd())); | |||||
| const String stringText (text.getText().substring (stringRange.getStart(), stringRange.getEnd())); | |||||
| String::CharPointerType t (stringText.getCharPointer()); | String::CharPointerType t (stringText.getCharPointer()); | ||||
| String currentString; | String currentString; | ||||
| int lastCharType = 0; | int lastCharType = 0; | ||||
| @@ -407,13 +420,7 @@ namespace TextLayoutHelpers | |||||
| if (c == 0) | if (c == 0) | ||||
| break; | break; | ||||
| int charType; | |||||
| if (c == '\r' || c == '\n') | |||||
| charType = 0; | |||||
| else if (CharacterFunctions::isWhitespace (c)) | |||||
| charType = 2; | |||||
| else | |||||
| charType = 1; | |||||
| const int charType = getCharacterType (c); | |||||
| if (charType == 0 || charType != lastCharType) | if (charType == 0 || charType != lastCharType) | ||||
| { | { | ||||
| @@ -451,9 +458,9 @@ namespace TextLayoutHelpers | |||||
| x += t->area.getWidth(); | x += t->area.getWidth(); | ||||
| h = jmax (h, t->area.getHeight()); | h = jmax (h, t->area.getHeight()); | ||||
| const Token* nextTok = tokens[i + 1]; | |||||
| const Token* const nextTok = tokens[i + 1]; | |||||
| if (nextTok == 0) | |||||
| if (nextTok == nullptr) | |||||
| break; | break; | ||||
| if (t->isNewLine || ((! nextTok->isWhitespace) && x + nextTok->area.getWidth() > maxWidth)) | if (t->isNewLine || ((! nextTok->isWhitespace) && x + nextTok->area.getWidth() > maxWidth)) | ||||
| @@ -1436,7 +1436,9 @@ private: | |||||
| static bool isCurrentEventFromTouchScreen() noexcept | static bool isCurrentEventFromTouchScreen() noexcept | ||||
| { | { | ||||
| return (GetMessageExtraInfo() & 0xffffff00 /* SIGNATURE_MASK */) == 0xff515700; /* MI_WP_SIGNATURE */ | |||||
| const LPARAM flags = GetMessageExtraInfo(); | |||||
| return (flags & 0xffffff00 /* SIGNATURE_MASK */) == 0xff515700 /* MI_WP_SIGNATURE */ | |||||
| && (flags & 0x80) != 0; // (bit 7 = 0 for pen events, 1 for touch) | |||||
| } | } | ||||
| void doMouseMove (const Point<int>& position) | void doMouseMove (const Point<int>& position) | ||||