void dataBufferNormalize()
    {
        int i = 0;
        int j = 0;
        int end = dataBufferPos;

        // Skip whitespace at the start.
        while (j < end && isWhitespace(dataBuffer[j])) {
            j++;
        }

        // Skip whitespace at the end.
        while (end > j && isWhitespace(dataBuffer[end - 1])) {
            end--;
        }

        // Start copying to the left.
        while (j < end) {

            char c = dataBuffer[j++];

            // Normalise all other whitespace to
            // a single space.
            if (isWhitespace(c)) {
                while (j < end && isWhitespace(dataBuffer[j++])) {
                }
                dataBuffer[i++] = ' ';
                dataBuffer[i++] = dataBuffer[j - 1];
            } else {
                dataBuffer[i++] = c;
            }
        }

        // The new length is <= the old one.
        dataBufferPos = i;
    }