| @@ -491,7 +491,7 @@ private: | |||
| const String extraFlags (replacePreprocessorTokens (config, getExtraCompilerFlags().toString()).trim()); | |||
| if (extraFlags.isNotEmpty()) | |||
| s.add ("OTHER_CPLUSPLUSFLAGS = " + extraFlags); | |||
| s.add ("OTHER_CPLUSPLUSFLAGS = \"" + extraFlags + "\""); | |||
| if (xcodeProductInstallPath.isNotEmpty()) | |||
| s.add ("INSTALL_PATH = \"" + xcodeProductInstallPath + "\""); | |||
| @@ -958,7 +958,7 @@ public: | |||
| if (pipe (pipeHandles) == 0) | |||
| { | |||
| const int result = fork(); | |||
| const pid_t result = fork(); | |||
| if (result < 0) | |||
| { | |||
| @@ -970,6 +970,7 @@ public: | |||
| // we're the child process.. | |||
| close (pipeHandles[0]); // close the read handle | |||
| dup2 (pipeHandles[1], 1); // turns the pipe into stdout | |||
| close (pipeHandles[1]); | |||
| Array<char*> argv; | |||
| for (int i = 0; i < arguments.size(); ++i) | |||
| @@ -70,6 +70,8 @@ public: | |||
| void runTest() | |||
| { | |||
| beginTest ("Child Processes"); | |||
| #if JUCE_WINDOWS || JUCE_MAC || JUCE_LINUX | |||
| 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 | |||
| //============================================================================== | |||
| @@ -42,9 +30,7 @@ class GZIPCompressorOutputStream::GZIPCompressorHelper | |||
| { | |||
| public: | |||
| GZIPCompressorHelper (const int compressionLevel, const int windowBits) | |||
| : buffer ((size_t) gzipCompBufferSize), | |||
| compLevel (compressionLevel), | |||
| strategy (0), | |||
| : compLevel ((compressionLevel < 1 || compressionLevel > 9) ? -1 : compressionLevel), | |||
| isFirstDeflate (true), | |||
| streamIsValid (false), | |||
| finished (false) | |||
| @@ -86,12 +72,12 @@ public: | |||
| } | |||
| private: | |||
| enum { gzipCompBufferSize = 32768 }; | |||
| enum { strategy = 0 }; | |||
| HeapBlock <zlibNamespace::Bytef> buffer; | |||
| zlibNamespace::z_stream stream; | |||
| int compLevel, strategy; | |||
| const int compLevel; | |||
| bool isFirstDeflate, streamIsValid, finished; | |||
| zlibNamespace::Bytef buffer[32768]; | |||
| 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_out = buffer; | |||
| 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) | |||
| : deflate (&stream, flushMode); | |||
| @@ -116,7 +102,7 @@ private: | |||
| { | |||
| data += dataSize - 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); | |||
| } | |||
| @@ -127,21 +113,19 @@ private: | |||
| return false; | |||
| } | |||
| JUCE_DECLARE_NON_COPYABLE (GZIPCompressorHelper); | |||
| }; | |||
| //============================================================================== | |||
| GZIPCompressorOutputStream::GZIPCompressorOutputStream (OutputStream* const destStream_, | |||
| int compressionLevel, | |||
| const int compressionLevel, | |||
| const bool deleteDestStream, | |||
| const int windowBits) | |||
| : destStream (destStream_, deleteDestStream) | |||
| : destStream (destStream_, deleteDestStream), | |||
| helper (new GZIPCompressorHelper (compressionLevel, windowBits)) | |||
| { | |||
| jassert (destStream_ != nullptr); | |||
| if (compressionLevel < 1 || compressionLevel > 9) | |||
| compressionLevel = -1; | |||
| helper = new GZIPCompressorHelper (compressionLevel, windowBits); | |||
| } | |||
| GZIPCompressorOutputStream::~GZIPCompressorOutputStream() | |||
| @@ -303,6 +303,7 @@ namespace TextLayoutHelpers | |||
| TextLayout::Line* glyphLine = new TextLayout::Line(); | |||
| TextLayout::Run* glyphRun = new TextLayout::Run(); | |||
| bool needToSetLineOrigin = true; | |||
| for (int i = 0; i < tokens.size(); ++i) | |||
| { | |||
| @@ -317,8 +318,11 @@ namespace TextLayoutHelpers | |||
| for (int j = 0; j < newGlyphs.size(); ++j) | |||
| { | |||
| if (charPosition == lineStartPosition) | |||
| if (needToSetLineOrigin) | |||
| { | |||
| needToSetLineOrigin = false; | |||
| glyphLine->lineOrigin = tokenPos.translated (0, t->font.getAscent()); | |||
| } | |||
| const float x = xOffsets.getUnchecked (j); | |||
| glyphRun->glyphs.add (TextLayout::Glyph (newGlyphs.getUnchecked(j), | |||
| @@ -357,6 +361,7 @@ namespace TextLayoutHelpers | |||
| lineStartPosition = charPosition; | |||
| glyphLine = new TextLayout::Line(); | |||
| glyphRun = new TextLayout::Run(); | |||
| needToSetLineOrigin = true; | |||
| } | |||
| } | |||
| } | |||
| @@ -393,10 +398,18 @@ namespace TextLayoutHelpers | |||
| 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, | |||
| 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 currentString; | |||
| int lastCharType = 0; | |||
| @@ -407,13 +420,7 @@ namespace TextLayoutHelpers | |||
| if (c == 0) | |||
| 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) | |||
| { | |||
| @@ -451,9 +458,9 @@ namespace TextLayoutHelpers | |||
| x += t->area.getWidth(); | |||
| 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; | |||
| if (t->isNewLine || ((! nextTok->isWhitespace) && x + nextTok->area.getWidth() > maxWidth)) | |||
| @@ -1436,7 +1436,9 @@ private: | |||
| 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) | |||