fix two small bugs in crossvalidate

fix two small bugs in crossvalidate

--- sdm/crossvalidate.hpp
+++ sdm/crossvalidate.hpp
@@ -95,207 +95,207 @@

 namespace detail {

-    // random index < the passed one
-    ptrdiff_t rand_idx(ptrdiff_t i);
-
-    // split a full matrix into testing/training matrices
-    void copy_from_full_to_split(const double *source,
-            double *train, double *test,
-            size_t test_start, size_t num_train, size_t num_test);
-
-    // worker functor class for doing CV
-    template <typename label_type>
-    class cv_worker : boost::noncopyable {
-        protected:
-            typedef std::pair<size_t, size_t> size_pair;
-
-            const double *divs;
-            const size_t num_bags;
-            const std::vector<label_type> &labels;
-            const boost::ptr_vector<Kernel> *kernels;
-            const svm_parameter &svm_params;
-            const std::vector<double> c_vals;
-            const size_t tuning_folds;
-            const bool project_all_data;
-            const npdivs::DivParams &div_params;
-
-            boost::mutex &jobs_mutex;
-            std::queue<size_pair> &jobs;
-            boost::mutex &results_mutex;
-            double &score;
-
-            boost::exception_ptr &error;
-
-        public:
-            cv_worker(
-                    const double *divs,
-                    const size_t num_bags,
-                    const std::vector<label_type> &labels,
-                    const boost::ptr_vector<Kernel> *kernels,
-                    const svm_parameter &svm_params,
-                    const std::vector<double> c_vals,
-                    const size_t tuning_folds,
-                    const bool project_all_data,
-                    const npdivs::DivParams &div_params,
-                    boost::mutex &jobs_mutex,
-                    std::queue<size_pair> &jobs,
-                    boost::mutex &results_mutex,
-                    double &score,
-                    boost::exception_ptr &error)
-                :
-                    divs(divs), num_bags(num_bags), labels(labels),
-                    kernels(kernels), svm_params(svm_params),
-                    c_vals(c_vals), tuning_folds(tuning_folds),
-                    project_all_data(project_all_data), div_params(div_params),
-                    jobs_mutex(jobs_mutex), jobs(jobs),
-                    results_mutex(results_mutex), score(score),
-                    error(error)
-        {}
-
-            void operator()() {
-                size_pair job;
-                double this_score = 0;
-
-                try {
-                    while (true) {
-                        { // get a job
-                            boost::mutex::scoped_lock the_lock(jobs_mutex);
-                            if (jobs.size() == 0)
-                                break;
-                            job = jobs.front();
-                            jobs.pop();
-                        }
-
-                        this_score += do_job(job.first, job.second);
+// random index < the passed one
+ptrdiff_t rand_idx(ptrdiff_t i);
+
+// split a full matrix into testing/training matrices
+void copy_from_full_to_split(const double *source,
+        double *train, double *test,
+        size_t test_start, size_t num_train, size_t num_test);
+
+// worker functor class for doing CV
+template <typename label_type>
+class cv_worker : boost::noncopyable {
+    protected:
+        typedef std::pair<size_t, size_t> size_pair;
+
+        const double *divs;
+        const size_t num_bags;
+        const std::vector<label_type> &labels;
+        const boost::ptr_vector<Kernel> *kernels;
+        const svm_parameter &svm_params;
+        const std::vector<double> c_vals;
+        const size_t tuning_folds;
+        const bool project_all_data;
+        const npdivs::DivParams &div_params;
+
+        boost::mutex &jobs_mutex;
+        std::queue<size_pair> &jobs;
+        boost::mutex &results_mutex;
+        double &score;
+
+        boost::exception_ptr &error;
+
+    public:
+        cv_worker(
+                const double *divs,
+                const size_t num_bags,
+                const std::vector<label_type> &labels,
+                const boost::ptr_vector<Kernel> *kernels,
+                const svm_parameter &svm_params,
+                const std::vector<double> c_vals,
+                const size_t tuning_folds,
+                const bool project_all_data,
+                const npdivs::DivParams &div_params,
+                boost::mutex &jobs_mutex,
+                std::queue<size_pair> &jobs,
+                boost::mutex &results_mutex,
+                double &score,
+                boost::exception_ptr &error)
+            :
+                divs(divs), num_bags(num_bags), labels(labels),
+                kernels(kernels), svm_params(svm_params),
+                c_vals(c_vals), tuning_folds(tuning_folds),
+                project_all_data(project_all_data), div_params(div_params),
+                jobs_mutex(jobs_mutex), jobs(jobs),
+                results_mutex(results_mutex), score(score),
+                error(error)
+    {}
+
+        void operator()() {
+            size_pair job;
+            double this_score = 0;
+
+            try {
+                while (true) {
+                    { // get a job
+                        boost::mutex::scoped_lock the_lock(jobs_mutex);
+                        if (jobs.size() == 0)
+                            break;
+                        job = jobs.front();
+                        jobs.pop();
                     }

-                    { // write the result
-                        boost::mutex::scoped_lock the_lock(results_mutex);
-                        score += this_score;
-                    }
-                } catch (...) {
-                    error = boost::current_exception();
-                    return;
+                    this_score += do_job(job.first, job.second);
                 }
+
+                { // write the result
+                    boost::mutex::scoped_lock the_lock(results_mutex);
+                    score += this_score;
+                }
+            } catch (...) {
+                error = boost::current_exception();
+                return;
             }
-
-            double do_job(size_t test_start, size_t test_end) const {
-                // testing is in [test_start, test_end)
-                size_t num_test = test_end - test_start;
-                size_t num_train = num_bags - num_test;
-
-                // set up training labels
-                std::vector<label_type> train_labels(num_train);
-                std::copy(labels.begin(), labels.begin() + test_start,
-                        train_labels.begin());
-                std::copy(labels.begin() + test_end, labels.end(),
-                        train_labels.begin() + test_start);
-
-                // tune the kernel parameters
-                double *train_km = new double[num_train * num_train];
-                double *test_km = new double[num_test * num_train];
-                copy_from_full_to_split(divs, train_km, test_km,
+        }
+
+        double do_job(size_t test_start, size_t test_end) const {
+            // testing is in [test_start, test_end)
+            size_t num_test = test_end - test_start;
+            size_t num_train = num_bags - num_test;
+
+            // set up training labels
+            std::vector<label_type> train_labels(num_train);
+            std::copy(labels.begin(), labels.begin() + test_start,
+                    train_labels.begin());
+            std::copy(labels.begin() + test_end, labels.end(),
+                    train_labels.begin() + test_start);
+
+            // tune the kernel parameters
+            double *train_km = new double[num_train * num_train];
+            double *test_km = new double[num_test * num_train];
+            copy_from_full_to_split(divs, train_km, test_km,
+                    test_start, num_train, num_test);
+
+            svm_parameter svm_p = svm_params;
+
+            const std::pair<size_t, size_t> &best_config = tune_params(
+                    train_km, num_train, train_labels, *kernels, c_vals,
+                    svm_p, tuning_folds, div_params.num_threads);
+
+            const Kernel &kernel = (*kernels)[best_config.first];
+            svm_p.C = c_vals[best_config.second];
+
+            // project either the whole matrix or just the training
+
+            if (project_all_data) {
+                double *full_km = new double[num_bags * num_bags];
+                std::copy(divs, divs + num_bags * num_bags, full_km);
+
+                kernel.transformDivergences(full_km, num_bags);
+                project_to_symmetric_psd(full_km, num_bags);
+
+                copy_from_full_to_split(full_km, train_km, test_km,
                         test_start, num_train, num_test);

-                svm_parameter svm_p = svm_params;
-
-                const std::pair<size_t, size_t> &best_config = tune_params(
-                        train_km, num_train, train_labels, *kernels, c_vals,
-                        svm_p, tuning_folds, div_params.num_threads);
-
-                const Kernel &kernel = (*kernels)[best_config.first];
-                svm_p.C = c_vals[best_config.second];
-
-                // project either the whole matrix or just the training
-
-                if (project_all_data) {
-                    double *full_km = new double[num_bags * num_bags];
-                    std::copy(divs, divs + num_bags * num_bags, full_km);
-
-                    kernel.transformDivergences(full_km, num_bags);
-                    project_to_symmetric_psd(full_km, num_bags);
-
-                    copy_from_full_to_split(full_km, train_km, test_km,
-                            test_start, num_train, num_test);
-
-                    delete[] full_km;
-
-                } else {
-                    copy_from_full_to_split(
-                            divs, train_km, test_km, test_start, num_train, num_test);
-
-                    kernel.transformDivergences(train_km, num_train);
-                    project_to_symmetric_psd(train_km, num_train);
-
-                    kernel.transformDivergences(test_km, num_test, num_train);
+                delete[] full_km;
+
+            } else {
+                copy_from_full_to_split(
+                    divs, train_km, test_km, test_start, num_train, num_test);
+
+                kernel.transformDivergences(train_km, num_train);
+                project_to_symmetric_psd(train_km, num_train);
+
+                kernel.transformDivergences(test_km, num_test, num_train);
+            }
+
+            // set up svm parameters
+            svm_problem prob;
+            prob.l = num_train;
+            prob.y = new double[num_train];
+            for (size_t i = 0; i < num_train; i++)
+                prob.y[i] = double(train_labels[i]);
+            detail::store_kernel_matrix(prob, train_km, true);
+
+            // check svm params
+            const char* error = svm_check_parameter(&prob, &svm_p);
+            if (error != NULL) {
+                FILE_LOG(logERROR) << "LibSVM parameter error: " << error;
+                BOOST_THROW_EXCEPTION(std::domain_error(error));
+            }
+
+            // train!
+            svm_model *svm = svm_train(&prob, &svm_p);
+
+            npdivs::DivL2 fake_df; // XXX figure out a better way around this
+            SDM<float, label_type> sdm(*svm, prob, fake_df, kernel, div_params,
+                    svm_get_nr_class(svm), NULL, num_train);
+
+            // predict!
+            std::vector<label_type> preds;
+            std::vector< std::vector<double> > vals;
+            sdm.predict_from_kerns(test_km, num_test, preds, vals);
+
+            double score = 0;
+            if (boost::is_same<label_type, int>::value) {
+                // how many did we get right?
+                for (size_t i = 0; i < num_test; i++)
+                    if (preds[i] == labels[test_start + i])
+                        score++;
+
+                FILE_LOG(logINFO) << "CV " <<
+                    test_start << " - " << test_end-1 << ": "
+                    << score << "/" << num_test
+                    << " correct by " << kernel.name() << ", C=" << svm_p.C;
+
+            } else {
+                // get sum squared error
+                for (size_t i = 0; i < num_test; i++) {
+                    double diff = preds[i] - labels[test_start + i];
+                    score += diff * diff;
                 }

-                // set up svm parameters
-                svm_problem prob;
-                prob.l = num_train;
-                prob.y = new double[num_train];
-                for (size_t i = 0; i < num_train; i++)
-                    prob.y[i] = double(train_labels[i]);
-                detail::store_kernel_matrix(prob, train_km, true);
-
-                // check svm params
-                const char* error = svm_check_parameter(&prob, &svm_params);
-                if (error != NULL) {
-                    FILE_LOG(logERROR) << "LibSVM parameter error: " << error;
-                    BOOST_THROW_EXCEPTION(std::domain_error(error));
-                }
-
-                // train!
-                svm_model *svm = svm_train(&prob, &svm_p);
-
-                npdivs::DivL2 fake_df; // XXX figure out a better way around this
-                SDM<float, label_type> sdm(*svm, prob, fake_df, kernel, div_params,
-                        svm_get_nr_class(svm), NULL, num_train);
-
-                // predict!
-                std::vector<label_type> preds;
-                std::vector< std::vector<double> > vals;
-                sdm.predict_from_kerns(test_km, num_test, preds, vals);
-
-                double score = 0;
-                if (boost::is_same<label_type, int>::value) {
-                    // how many did we get right?
-                    for (size_t i = 0; i < num_test; i++)
-                        if (preds[i] == labels[test_start + i])
-                            score++;
-
-                    FILE_LOG(logINFO) << "CV " <<
-                        test_start << " - " << test_end << ": "
-                        << score << "/" << num_test
-                        << " correct by " << kernel.name() << ", C=" << svm_p.C;
-
-                } else {
-                    // get sum squared error
-                    for (size_t i = 0; i < num_test; i++) {
-                        double diff = preds[i] - labels[test_start + i];
-                        score += diff * diff;
-                    }
-
-                    FILE_LOG(logINFO) << "CV " <<
-                        test_start << " - " << test_end << ": "
-                        << std::sqrt(score / num_test)
-                        << " RMSE by " << kernel.name() << ", C=" << svm_p.C;
-                }
-
-
-                // clean up
-                delete[] train_km;
-                delete[] test_km;
-                for (size_t i = 0; i < num_train; i++)
-                    delete[] prob.x[i];
-                delete[] prob.x;
-                delete[] prob.y;
-                svm_free_model_content(svm);
-                delete svm;
-
-                return score;
+                FILE_LOG(logINFO) << "CV " <<
+                    test_start << " - " << test_end << ": "
+                    << std::sqrt(score / num_test)
+                    << " RMSE by " << kernel.name() << ", C=" << svm_p.C;
             }
-    };
+
+
+            // clean up
+            delete[] train_km;
+            delete[] test_km;
+            for (size_t i = 0; i < num_train; i++)
+                delete[] prob.x[i];
+            delete[] prob.x;
+            delete[] prob.y;
+            svm_free_model_content(svm);
+            delete svm;
+
+            return score;
+        }
+};

 } // detail


added startig area for tiles map

added startig area for tiles map

--- seeders/tiles/map.cpp
+++ seeders/tiles/map.cpp
@@ -9,6 +9,10 @@
 static const int halfMapWidth = 100;
 static const int halfMapHeight = 100;

+static ChunkData createStartingAreaBottomLeft(int chunkSize);
+static ChunkData createStartingAreaBottomRight(int chunkSize);
+static ChunkData createStartingAreaTopLeft(int chunkSize);
+static ChunkData createStartingAreaTopRight(int chunkSize);
 static ChunkData createChunk(int x, int y, int chunkSize);

 List<ChunkData> generateMapChunks(int chunkSize)
@@ -17,11 +21,173 @@

 	for(int x = -halfMapWidth; x < halfMapWidth; x += chunkSize) {
 		for(int z = -halfMapHeight; z < halfMapHeight; z += chunkSize) {
-			chunks.emplace_back(createChunk(x, z, chunkSize));
+			if(x == -chunkSize && z == -chunkSize) {
+				chunks.emplace_back(createStartingAreaBottomLeft(chunkSize));
+			} else if(x == 0 && z == -chunkSize) {
+				chunks.emplace_back(createStartingAreaBottomRight(chunkSize));
+			} else if(x == -chunkSize && z == 0) {
+				chunks.emplace_back(createStartingAreaTopLeft(chunkSize));
+			} else if(x == 0 && z == 0) {
+				chunks.emplace_back(createStartingAreaTopRight(chunkSize));
+			} else {
+				chunks.emplace_back(createChunk(x, z, chunkSize));
+			}
 		}
 	}

 	return chunks;
+}
+
+static ChunkData createStartingAreaBottomLeft(int chunkSize)
+{
+	ChunkData chunk;
+	chunk.position = {-chunkSize / 2.0, 0.0, -chunkSize / 2.0};
+
+	for(int i = 0; i < chunkSize; i++) {
+		for(int j = 0; j < chunkSize; j++) {
+			TilemapTilesTile backgroundTile;
+			TilemapTilesTile foregroundTile;
+
+			foregroundTile.set_tileset_column(0);
+			foregroundTile.set_tileset_row(0);
+			foregroundTile.set_tileset_id(0);
+			foregroundTile.set_colliding(false);
+
+			// fill background with grass
+			int grassColumn = rand() % 3;
+			int grassRow = rand() % 2;
+			backgroundTile.set_tileset_column(grassColumn);
+			backgroundTile.set_tileset_row(grassRow);
+			backgroundTile.set_tileset_id(2);
+			foregroundTile.set_colliding(false);
+
+			// place boundary rocks
+			if((i == 0 || j == 0) && i != chunkSize - 1 && j != chunkSize - 1) {
+				backgroundTile.set_tileset_column(5);
+				backgroundTile.set_tileset_row(0);
+				backgroundTile.set_colliding(true);
+			}
+
+			chunk.backgroundTiles.emplace_back(backgroundTile);
+			chunk.foregroundTiles.emplace_back(foregroundTile);
+		}
+	}
+
+	return chunk;
+}
+
+static ChunkData createStartingAreaBottomRight(int chunkSize)
+{
+	ChunkData chunk;
+	chunk.position = {chunkSize / 2.0, 0.0, -chunkSize / 2.0};
+
+	for(int i = 0; i < chunkSize; i++) {
+		for(int j = 0; j < chunkSize; j++) {
+			TilemapTilesTile backgroundTile;
+			TilemapTilesTile foregroundTile;
+
+			foregroundTile.set_tileset_column(0);
+			foregroundTile.set_tileset_row(0);
+			foregroundTile.set_tileset_id(0);
+			foregroundTile.set_colliding(false);
+
+			// fill background with grass
+			int grassColumn = rand() % 3;
+			int grassRow = rand() % 2;
+			backgroundTile.set_tileset_column(grassColumn);
+			backgroundTile.set_tileset_row(grassRow);
+			backgroundTile.set_tileset_id(2);
+			foregroundTile.set_colliding(false);
+
+			// place boundary rocks
+			if((i == 0 || j == chunkSize - 1) && i != chunkSize - 1 && j != 0) {
+				backgroundTile.set_tileset_column(5);
+				backgroundTile.set_tileset_row(0);
+				backgroundTile.set_colliding(true);
+			}
+
+			chunk.backgroundTiles.emplace_back(backgroundTile);
+			chunk.foregroundTiles.emplace_back(foregroundTile);
+		}
+	}
+
+	return chunk;
+}
+
+static ChunkData createStartingAreaTopLeft(int chunkSize)
+{
+	ChunkData chunk;
+	chunk.position = {-chunkSize / 2.0, 0.0, chunkSize / 2.0};
+
+	for(int i = 0; i < chunkSize; i++) {
+		for(int j = 0; j < chunkSize; j++) {
+			TilemapTilesTile backgroundTile;
+			TilemapTilesTile foregroundTile;
+
+			foregroundTile.set_tileset_column(0);
+			foregroundTile.set_tileset_row(0);
+			foregroundTile.set_tileset_id(0);
+			foregroundTile.set_colliding(false);
+
+			// fill background with grass
+			int grassColumn = rand() % 3;
+			int grassRow = rand() % 2;
+			backgroundTile.set_tileset_column(grassColumn);
+			backgroundTile.set_tileset_row(grassRow);
+			backgroundTile.set_tileset_id(2);
+			foregroundTile.set_colliding(false);
+
+			// place boundary rocks
+			if((i == chunkSize - 1 || j == 0) && i != 0 && j != chunkSize - 1) {
+				backgroundTile.set_tileset_column(5);
+				backgroundTile.set_tileset_row(0);
+				backgroundTile.set_colliding(true);
+			}
+
+			chunk.backgroundTiles.emplace_back(backgroundTile);
+			chunk.foregroundTiles.emplace_back(foregroundTile);
+		}
+	}
+
+	return chunk;
+}
+
+static ChunkData createStartingAreaTopRight(int chunkSize)
+{
+	ChunkData chunk;
+	chunk.position = {chunkSize / 2.0, 0.0, chunkSize / 2.0};
+
+	for(int i = 0; i < chunkSize; i++) {
+		for(int j = 0; j < chunkSize; j++) {
+			TilemapTilesTile backgroundTile;
+			TilemapTilesTile foregroundTile;
+
+			foregroundTile.set_tileset_column(0);
+			foregroundTile.set_tileset_row(0);
+			foregroundTile.set_tileset_id(0);
+			foregroundTile.set_colliding(false);
+
+			// fill background with grass
+			int grassColumn = rand() % 3;
+			int grassRow = rand() % 2;
+			backgroundTile.set_tileset_column(grassColumn);
+			backgroundTile.set_tileset_row(grassRow);
+			backgroundTile.set_tileset_id(2);
+			foregroundTile.set_colliding(false);
+
+			// place boundary rocks
+			if((i == chunkSize - 1 || j == chunkSize - 1) && i != 0 && j != 0) {
+				backgroundTile.set_tileset_column(5);
+				backgroundTile.set_tileset_row(0);
+				backgroundTile.set_colliding(true);
+			}
+
+			chunk.backgroundTiles.emplace_back(backgroundTile);
+			chunk.foregroundTiles.emplace_back(foregroundTile);
+		}
+	}
+
+	return chunk;
 }

 static ChunkData createChunk(int x, int z, int chunkSize)


remove unnecessary nvgLineTo (#1333)

remove unnecessary nvgLineTo (#1333)

--- selfdrive/ui/paint.cc
+++ selfdrive/ui/paint.cc
@@ -87,7 +87,6 @@
     nvgMoveTo(s->vg, x+(sz*1.35)+g_xo, y+sz+g_yo);
     nvgLineTo(s->vg, x, y-g_xo);
     nvgLineTo(s->vg, x-(sz*1.35)-g_xo, y+sz+g_yo);
-    nvgLineTo(s->vg, x+(sz*1.35)+g_xo, y+sz+g_yo);
     nvgClosePath(s->vg);
   }
   nvgFillColor(s->vg, glowColor);
@@ -99,7 +98,6 @@
     nvgMoveTo(s->vg, x+(sz*1.25), y+sz);
     nvgLineTo(s->vg, x, y);
     nvgLineTo(s->vg, x-(sz*1.25), y+sz);
-    nvgLineTo(s->vg, x+(sz*1.25), y+sz);
     nvgClosePath(s->vg);
   }
   nvgFillColor(s->vg, fillColor);


fix the lua thread test

fix the lua thread test

--- test/lua.cpp
+++ test/lua.cpp
@@ -37,16 +37,13 @@
 	BOOST_AUTO_TEST_CASE(lua)
 	{
 		auto L = open_lua();
-		// src
-		BOOST_REQUIRE_EQUAL(0, luaL_loadstring(L.get(), "return function (yield) yield(4) end"));
-		// fn
-		if (0 != lua_pcall(L.get(), 0, 1, 0))
+
+		lua_State * const coro = lua_newthread(L.get());
+		BOOST_REQUIRE_EQUAL(0, luaL_loadstring(coro, "return function (yield) yield(4) yield(5) end"));
+		if (0 != lua_pcall(coro, 0, 1, 0))
 		{
 			throw std::runtime_error(lua_tostring(L.get(), -1));
 		}
-
-		lua_State * const coro = lua_newthread(L.get());
-		lua_xmove(L.get(), coro, 1);

 		rx::bridge<int> yielded;
 		// fn &yielded
@@ -61,11 +58,24 @@
 			got = element;
 		});

-		yielded.async_get_one(consumer);
-		if (LUA_YIELD != lua_resume(L.get(), 1))
 		{
-			throw std::runtime_error(lua_tostring(coro, -1));
+			yielded.async_get_one(consumer);
+			int rc = lua_resume(coro, 1);
+			if (LUA_YIELD != rc)
+			{
+				throw std::runtime_error(lua_tostring(coro, -1));
+			}
+			BOOST_CHECK_EQUAL(boost::make_optional(4), got);
 		}
-		BOOST_CHECK_EQUAL(boost::make_optional(4), got);
+
+		{
+			yielded.async_get_one(consumer);
+			int rc = lua_resume(coro, 1);
+			if (LUA_YIELD != rc)
+			{
+				throw std::runtime_error(lua_tostring(coro, -1));
+			}
+			BOOST_CHECK_EQUAL(boost::make_optional(5), got);
+		}
 	}
 }


Add color sets support for input mesh

Add color sets support for input mesh

The "current" color set will mapped to the "Cd" and "Alpha" attributes.
Other color sets will be mapped to attributes that are named after each
color set. For example, the "colorSet2" color set will be mapped to the
"colorSet2" and "colorSet2Alpha" attributes.

--- InputMesh.C
+++ InputMesh.C
@@ -231,6 +231,122 @@
         }
     }

+    // Colors and Alphas
+    {
+        MString currentColorSetName;
+        currentColorSetName = meshFn.currentColorSetName();
+
+        MStringArray colorSetNames;
+        meshFn.getColorSetNames(colorSetNames);
+
+        MColor defaultUnsetColor;
+        MColorArray colors;
+        std::vector<float> buffer;
+        for(unsigned int i = 0; i < colorSetNames.length(); i++)
+        {
+            const MString colorSetName = colorSetNames[i];
+
+            MString colorAttributeName;
+            MString alphaAttributeName;
+            if(colorSetName == currentColorSetName)
+            {
+                colorAttributeName = "Cd";
+                alphaAttributeName = "Alpha";
+            }
+            else
+            {
+                colorAttributeName = colorSetName;
+                alphaAttributeName = colorSetName + "Alpha";
+            }
+
+            bool hasColor = false;
+            bool hasAlpha = false;
+            {
+                MFnMesh::MColorRepresentation colorSetRepresentation =
+                    meshFn.getColorRepresentation(colorSetName);
+
+                switch(colorSetRepresentation)
+                {
+                    case MFnMesh::kAlpha:
+                        hasAlpha = true;
+                        break;
+                    case MFnMesh::kRGB:
+                        hasColor = true;
+                        break;
+                    case MFnMesh::kRGBA:
+                        hasColor = true;
+                        hasAlpha = true;
+                        break;
+                }
+            }
+
+            CHECK_MSTATUS(meshFn.getFaceVertexColors(
+                        colors,
+                        &colorSetName,
+                        &defaultUnsetColor
+                        ));
+
+            // reverse winding order
+            Util::reverseWindingOrder(colors, faceCounts);
+
+            if(hasColor)
+            {
+                buffer.resize(3 * vertexList.length());
+                for(unsigned int j = 0; j < vertexList.length(); j++)
+                {
+                    buffer[j * 3 + 0] = colors[j].r;
+                    buffer[j * 3 + 1] = colors[j].g;
+                    buffer[j * 3 + 2] = colors[j].b;
+                }
+
+                // add and set Cd
+                HAPI_AttributeInfo colorAttributeInfo;
+                colorAttributeInfo.exists = true;
+                colorAttributeInfo.owner = HAPI_ATTROWNER_VERTEX;
+                colorAttributeInfo.storage = HAPI_STORAGETYPE_FLOAT;
+                colorAttributeInfo.count = vertexList.length();
+                colorAttributeInfo.tupleSize = 3;
+                HAPI_AddAttribute(
+                        myInputAssetId, myInputObjectId, myInputGeoId,
+                        colorAttributeName.asChar(), &colorAttributeInfo
+                        );
+
+                HAPI_SetAttributeFloatData(
+                        myInputAssetId, myInputObjectId, myInputGeoId,
+                        colorAttributeName.asChar(), &colorAttributeInfo,
+                        &buffer.front(), 0, vertexList.length()
+                        );
+            }
+
+            if(hasAlpha)
+            {
+                buffer.resize(vertexList.length());
+                for(unsigned int j = 0; j < vertexList.length(); j++)
+                {
+                    buffer[j] = colors[j].a;
+                }
+
+                // add and set Alpha
+                HAPI_AttributeInfo alphaAttributeInfo;
+                alphaAttributeInfo.exists = true;
+                alphaAttributeInfo.owner = HAPI_ATTROWNER_VERTEX;
+                alphaAttributeInfo.storage = HAPI_STORAGETYPE_FLOAT;
+                alphaAttributeInfo.count = vertexList.length();
+                alphaAttributeInfo.tupleSize = 1;
+                HAPI_AddAttribute(
+                        myInputAssetId, myInputObjectId, myInputGeoId,
+                        alphaAttributeName.asChar(), &alphaAttributeInfo
+                        );
+
+                HAPI_SetAttributeFloatData(
+                        myInputAssetId, myInputObjectId, myInputGeoId,
+                        alphaAttributeName.asChar(), &alphaAttributeInfo,
+                        &buffer.front(), 0, vertexList.length()
+                        );
+            }
+        }
+    }
+
     // Commit it
     HAPI_CommitGeo(myInputAssetId, myInputObjectId, myInputGeoId);


fixed issue #19

fixed issue #19

--- InterCode.C
+++ InterCode.C
@@ -541,7 +541,7 @@

         //Node of type EXPR and op[0] = op[1] , op[2] is NULL
         if ((*it)->getOPNType() == InterCode::OPNTYPE::EXPR &&
-                (*it)->getsubCode() == OpNode::OpCode::ASSIGN &&
+               (*it)->getsubCode() == OpNode::OpCode::ASSIGN &&
                 op[1]->exprNodeType() ==  ExprNode::ExprNodeType::VALUE_NODE) {

             //if variable already exists in map
@@ -552,6 +552,7 @@
             }

             cvar_map.insert(pair<string, ExprNode*>(str, (ValueNode *)op[1]));
+            //cout << "\n line 1 debug: str" << op[1]->getRefName();
         }

         switch ((*it)->getOPNType()) {
@@ -594,6 +595,16 @@

                                                      case OpNode::OpCode::BITNOT:
                                                      case OpNode::OpCode::UMINUS:
+                                                         {
+                                                             //TODO: please fix this magic code
+                                                             oprnd[1]->type()->name();
+                                                             if (cvar_map.find(oprnd[1]->getRefName()) != cvar_map.end()) {
+                                                                 oprnd[1] = cvar_map.find(oprnd[1]->getRefName())->second;
+                                                                 flag     =  true;
+                                                             }
+                                                         }
+                                                         break;
+
                                                      case OpNode::OpCode::ASSIGN:
                                                          {
                                                              //TODO: please fix this magic code


MDEV-13167 InnoDB key rotation is not skipping unused pages

In key rotation, we must initialize unallocated but previously
initialized pages, so that if encryption is enabled on a table,
all clear-text data for the page will eventually be overwritten.
But we should not rotate keys on pages that were never allocated
after the data file was created.

According to the latching order rules, after acquiring the
tablespace latch, no page latches of previously allocated user pages
may be acquired. So, key rotation should check the page allocation
status after acquiring the page latch, not before. But, the latching
order rules also prohibit accessing pages that were not allocated first,
and then acquiring the tablespace latch. Such behaviour would indeed
result in a deadlock when running the following tests:
encryption.innodb_encryption-page-compression
encryption.innodb-checksum-algorithm

Because the key rotation is accessing potentially unallocated pages, it
cannot reliably check if these pages were allocated. It can only check
the page header. If the page number is zero, we can assume that the
page is unallocated.

fil_crypt_rotate_pages(): Skip pages that are known to be uninitialized.

fil_crypt_rotate_page(): Detect uninitialized pages by FIL_PAGE_OFFSET.
Page 0 is never encrypted, and on other pages that are initialized,
FIL_PAGE_OFFSET must contain the page number.

fil_crypt_is_page_uninitialized(): Remove. It suffices to check the
page number field in fil_crypt_rotate_page().

--- storage/innobase/fil/fil0crypt.cc
+++ storage/innobase/fil/fil0crypt.cc
@@ -1596,20 +1596,6 @@
 	return found;
 }

-/***********************************************************************
-Check if a page is uninitialized (doesn't need to be rotated)
-@param[in]	frame		Page to check
-@param[in]	page_size	Page size
-@return true if page is uninitialized, false if not. */
-static inline
-bool
-fil_crypt_is_page_uninitialized(
-	const byte	*frame,
-	const page_size_t& page_size)
-{
-	return (buf_page_is_zeroes(frame, page_size));
-}
-
 #define fil_crypt_get_page_throttle(state,offset,mtr,sleeptime_ms) \
 	fil_crypt_get_page_throttle_func(state, offset, mtr, \
 					 sleeptime_ms, __FILE__, __LINE__)
@@ -1770,9 +1756,9 @@
 	ulint offset = state->offset;
 	ulint sleeptime_ms = 0;
 	fil_space_crypt_t *crypt_data = space->crypt_data;
-	const page_size_t page_size = page_size_t(space->flags);

 	ut_ad(space->n_pending_ops > 0);
+	ut_ad(offset > 0);

 	/* In fil_crypt_thread where key rotation is done we have
 	acquired space and checked that this space is not yet
@@ -1787,44 +1773,55 @@
 		return;
 	}

+	ut_d(const bool was_free = fseg_page_is_free(space, offset));
+
 	mtr_t mtr;
 	mtr.start();
 	if (buf_block_t* block = fil_crypt_get_page_throttle(state,
 							     offset, &mtr,
 							     &sleeptime_ms)) {
-		mtr.set_named_space(space);
-
 		bool modified = false;
 		int needs_scrubbing = BTR_SCRUB_SKIP_PAGE;
 		lsn_t block_lsn = block->page.newest_modification;
 		byte* frame = buf_block_get_frame(block);
 		uint kv =  mach_read_from_4(frame+FIL_PAGE_FILE_FLUSH_LSN_OR_KEY_VERSION);

-		/* check if tablespace is closing after reading page */
-		if (!space->is_stopping()) {
-
-			if (kv == 0 &&
-				fil_crypt_is_page_uninitialized(frame, page_size)) {
-				;
-			} else if (fil_crypt_needs_rotation(
-					crypt_data->encryption,
-					kv, key_state->key_version,
-					key_state->rotate_key_age)) {
-
-				modified = true;
-
-				/* force rotation by dummy updating page */
-				mlog_write_ulint(frame +
-					FIL_PAGE_ARCH_LOG_NO_OR_SPACE_ID,
-					space_id, MLOG_4BYTES, &mtr);
-
-				/* statistics */
-				state->crypt_stat.pages_modified++;
-			} else {
-				if (crypt_data->is_encrypted()) {
-					if (kv < state->min_key_version_found) {
-						state->min_key_version_found = kv;
-					}
+		if (space->is_stopping()) {
+			/* The tablespace is closing (in DROP TABLE or
+			TRUNCATE TABLE or similar): avoid further access */
+		} else if (!*reinterpret_cast<uint32_t*>(FIL_PAGE_OFFSET
+							 + frame)) {
+			/* It looks like this page was never
+			allocated. Because key rotation is accessing
+			pages in a pattern that is unlike the normal
+			B-tree and undo log access pattern, we cannot
+			invoke fseg_page_is_free() here, because that
+			could result in a deadlock. If we invoked
+			fseg_page_is_free() and released the
+			tablespace latch before acquiring block->lock,
+			then the fseg_page_is_free() information
+			could be stale already. */
+			ut_ad(was_free);
+			ut_ad(kv == 0);
+			ut_ad(page_get_space_id(frame) == 0);
+		} else if (fil_crypt_needs_rotation(
+				   crypt_data->encryption,
+				   kv, key_state->key_version,
+				   key_state->rotate_key_age)) {
+
+			mtr.set_named_space(space);
+			modified = true;
+
+			/* force rotation by dummy updating page */
+			mlog_write_ulint(frame + FIL_PAGE_SPACE_ID,
+					 space_id, MLOG_4BYTES, &mtr);
+
+			/* statistics */
+			state->crypt_stat.pages_modified++;
+		} else {
+			if (crypt_data->is_encrypted()) {
+				if (kv < state->min_key_version_found) {
+					state->min_key_version_found = kv;
 				}
 			}

@@ -1934,7 +1931,8 @@
 	rotate_thread_t*	state)
 {
 	ulint space = state->space->id;
-	ulint end = state->offset + state->batch;
+	ulint end = std::min(state->offset + state->batch,
+			     state->space->free_limit);

 	ut_ad(state->space->n_pending_ops > 0);


Fix for commands coming in from other clients.

--- digitanks/src/game/digitanks/digitanksgame.cpp
+++ digitanks/src/game/digitanks/digitanksgame.cpp
@@ -1827,10 +1827,10 @@

 CLIENT_COMMAND(WeaponSpecial)
 {
-	if (CNetwork::IsRunningClientFunctions() && (DigitanksGame()->GetCurrentLocalDigitanksTeam()->GetClient() != (int)iClient))
-		return;
-
-	DigitanksGame()->WeaponSpecialCommand(DigitanksGame()->GetCurrentLocalDigitanksTeam());
+	if (CNetwork::IsRunningClientFunctions() && (DigitanksGame()->GetCurrentTeam()->GetClient() != (int)iClient))
+		return;
+
+	DigitanksGame()->WeaponSpecialCommand(DigitanksGame()->GetCurrentTeam());
 }

 void CDigitanksGame::WeaponSpecialCommand(CDigitanksTeam* pTeam)


Add utest for tcp server

Add utest for tcp server

--- trunk/src/utest/srs_utest_app.cpp
+++ trunk/src/utest/srs_utest_app.cpp
@@ -377,3 +377,9 @@
 	}
 }

+#define MOCK_LISTEN_PORT 11935
+
+VOID TEST(TCPServerTest, PingPong)
+{
+}
+


no more getchar() so auto doc generation does not fail.

git-svn-id: acec3fd5b7ea1eb9e79d6329d318e8118ee2e14f@41774 27541ba8-7e3a-0410-8455-c3a389f83636

--- tutorials/fitsio/FITS_tutorial5.C
+++ tutorials/fitsio/FITS_tutorial5.C
@@ -16,8 +16,8 @@
    printf("WARNING: when coding, row and column indices start from 0\n");

    if (!gROOT->IsBatch()) {
-      printf("Press ENTER to start..."); getchar();
-      printf("\n");
+      //printf("Press ENTER to start..."); getchar();
+      //printf("\n");
    }

    //Open the table
@@ -43,7 +43,7 @@

    printf("\nBONUS EXAMPLE: we're gonna dump all rows using\n");
    printf("the function GetTabRealVectorCells()\n");
-   printf("Press ENTER to continue..."); getchar();
+   //printf("Press ENTER to continue..."); getchar();

    TObjArray *vectorCollection = hdu->GetTabRealVectorCells("mag");


Make unsupported codec message a little clearer.

--- be/src/util/codec.cc
+++ be/src/util/codec.cc
@@ -26,17 +26,20 @@
 using namespace boost::assign;
 using namespace impala;

-const char* const Codec::DEFAULT_COMPRESSION =
-     "org.apache.hadoop.io.compress.DefaultCodec";
+const char* const Codec::DEFAULT_COMPRESSION =
+    "org.apache.hadoop.io.compress.DefaultCodec";

 const char* const Codec::GZIP_COMPRESSION =
-     "org.apache.hadoop.io.compress.GzipCodec";
+    "org.apache.hadoop.io.compress.GzipCodec";

 const char* const Codec::BZIP2_COMPRESSION =
-     "org.apache.hadoop.io.compress.BZip2Codec";
+    "org.apache.hadoop.io.compress.BZip2Codec";

 const char* const Codec::SNAPPY_COMPRESSION =
-     "org.apache.hadoop.io.compress.SnappyCodec";
+    "org.apache.hadoop.io.compress.SnappyCodec";
+
+const char* const UNKNOWN_CODEC_ERROR =
+    "This compression codec is currently unsupported: ";

 const Codec::CodecMap Codec::CODEC_MAP = map_list_of
   ("", THdfsCompression::NONE)
@@ -63,7 +66,7 @@

   if (type == CODEC_MAP.end()) {
     stringstream ss;
-    ss << "Unknown Codec: " << codec;
+    ss << UNKNOWN_CODEC_ERROR << codec;
     return Status(ss.str());
   }
   Codec* comp;
@@ -121,7 +124,7 @@

   if (type == CODEC_MAP.end()) {
     stringstream ss;
-    ss << "Unknown Codec: " << codec;
+    ss << UNKNOWN_CODEC_ERROR << codec;
     return Status(ss.str());
   }
   Codec* decom;


INTEGRATION: CWS pchfix02 (1.4.516); FILE MERGED 2006/09/01 17:46:45 kaib 1.4.516.1: #i68856# Added header markers and pch files

--- svx/source/fmcomp/dbaobjectex.cxx
+++ svx/source/fmcomp/dbaobjectex.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: dbaobjectex.cxx,v $
  *
- *  $Revision: 1.4 $
- *
- *  last change: $Author: hr $ $Date: 2005-09-23 11:58:40 $
+ *  $Revision: 1.5 $
+ *
+ *  last change: $Author: obo $ $Date: 2006-09-17 05:00:46 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -32,6 +32,9 @@
  *    MA  02111-1307  USA
  *
  ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_svx.hxx"

 #ifndef SVX_DBAOBJECTEX_HXX
 #include "dbaobjectex.hxx"


INTEGRATION: CWS dr43 (1.23.96); FILE MERGED 2005/10/25 10:20:12 dr 1.23.96.1: #i56383# crash when importing checkboxes

--- svx/source/msfilter/msocximex.cxx
+++ svx/source/msfilter/msocximex.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: msocximex.cxx,v $
  *
- *  $Revision: 1.23 $
+ *  $Revision: 1.24 $
  *
- *  last change: $Author: rt $ $Date: 2005-09-08 23:47:06 $
+ *  last change: $Author: rt $ $Date: 2006-01-13 17:19:24 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -3157,6 +3157,7 @@
     {
         ReadAlign(pS, pS->Tell() - nStart, 4); // NEW
         *pS >> nSpecialEffect;
+        pS->SeekRel( 3 );       // special effect is 32bit, not 8bit
     }
     if (pBlockFlags[3] & 0x08)
     {
@@ -3394,20 +3395,19 @@
     *pS >> nWidth;
     *pS >> nHeight;

+    if (nPicture)
+    {
+        pS->Read(pPictureHeader,20);
+        *pS >> nPictureLen;
+        pPicture = new sal_uInt8[nPictureLen];
+        pS->Read(pPicture,nPictureLen);
+    }
     if (nIcon)
     {
         pS->Read(pIconHeader,20);
         *pS >> nIconLen;
         pIcon = new sal_uInt8[nIconLen];
         pS->Read(pIcon,nIconLen);
-    }
-
-    if (nPicture)
-    {
-        pS->Read(pPictureHeader,20);
-        *pS >> nPictureLen;
-        pPicture = new sal_uInt8[nPictureLen];
-        pS->Read(pPicture,nPictureLen);
     }

     return sal_True;


INTEGRATION: CWS swqbf97 (1.26.68); FILE MERGED 2007/05/25 15:00:01 ama 1.26.68.1: Fix #i70498#: Update DDE links in header/footer

--- sw/source/core/docnode/ndcopy.cxx
+++ sw/source/core/docnode/ndcopy.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: ndcopy.cxx,v $
  *
- *  $Revision: 1.26 $
+ *  $Revision: 1.27 $
  *
- *  last change: $Author: vg $ $Date: 2007-02-28 15:42:15 $
+ *  last change: $Author: hr $ $Date: 2007-06-26 10:41:20 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -396,9 +396,9 @@
     // (see IsUsed). Therefore the inner table gets the same name as the outer table.
     // We have to make sure that the table node of the SwTable is accessible, even
     // without any content in aSortCntBoxes. #i26629#
-    rTbl.SetTableNode( pTblNd );
+    pTblNd->GetTable().SetTableNode( pTblNd );
     rNds._Copy( aRg, aInsPos, FALSE );
-    rTbl.SetTableNode( 0 );
+    pTblNd->GetTable().SetTableNode( 0 );

     // Sonderbehandlung fuer eine einzelne Box
     if( 1 == GetTable().GetTabSortBoxes().Count() )
@@ -417,7 +417,7 @@

     ((SwTable&)GetTable()).GetTabLines().ForEach( &lcl_CopyTblLine, &aPara );

-    if( pDDEType && pDoc->GetRootFrm() )
+    if( pDDEType )
         pDDEType->IncRefCnt();

     CHECK_TABLE( GetTable() );


should changes: don't use IniManager

should changes: don't use IniManager

--- sw/source/core/fields/docufld.cxx
+++ sw/source/core/fields/docufld.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: docufld.cxx,v $
  *
- *  $Revision: 1.2 $
+ *  $Revision: 1.3 $
  *
- *  last change: $Author: jp $ $Date: 2000-10-06 13:07:07 $
+ *  last change: $Author: jp $ $Date: 2000-10-09 10:39:34 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -129,9 +129,6 @@
 #ifndef INCLUDED_SVTOOLS_USEROPTIONS_HXX
 #include <svtools/useroptions.hxx>
 #endif
-#ifndef _SFXINIMGR_HXX //autogen
-#include <svtools/iniman.hxx>
-#endif
 #ifndef _SFXAPP_HXX //autogen
 #include <sfx2/app.hxx>
 #endif
@@ -463,10 +460,7 @@
     String sRet;
     SvtUserOptions aOpt;
     if((nFmt & 0xff) == AF_NAME)
-    {
-        sRet = SFX_APP()->GetIniManager()->GetUserFullName();
-//      ((sRet = aOpt.GetFirstName() ) += ' ' ) += aOpt.GetLastName();
-    }
+        sRet = aOpt.GetFullName();
     else
         sRet = aOpt.GetID();
     return sRet;


INTEGRATION: CWS swnewtable (1.62.14); FILE MERGED 2007/02/09 09:12:19 ama 1.62.14.6: RESYNC: (1.64-1.65); FILE MERGED 2007/01/25 11:22:45 fme 1.62.14.5: #i4032# New tables 2007/01/09 10:47:04 fme 1.62.14.4: RESYNC: (1.62-1.64); FILE MERGED 2006/12/12 15:27:20 fme 1.62.14.3: #i4032# New table concept 2006/11/03 15:15:56 fme 1.62.14.2: #i4032# New table concept 2006/10/31 14:34:18 fme 1.62.14.1: #i4032#: New table concept

--- sw/source/core/layout/flowfrm.cxx
+++ sw/source/core/layout/flowfrm.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: flowfrm.cxx,v $
  *
- *  $Revision: 1.65 $
+ *  $Revision: 1.66 $
  *
- *  last change: $Author: obo $ $Date: 2007-01-22 11:53:11 $
+ *  last change: $Author: vg $ $Date: 2007-02-28 15:47:32 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -599,8 +599,8 @@
     if ( nGrowVal )
     {
         if ( pOldParent && pOldParent->IsBodyFrm() ) //Fuer variable Seitenhoehe beim Browsen
-            pOldParent->Shrink( nGrowVal PHEIGHT );
-        pParent->Grow( nGrowVal PHEIGHT );
+            pOldParent->Shrink( nGrowVal );
+        pParent->Grow( nGrowVal );
     }

     if ( pParent->IsFtnFrm() )
@@ -1935,15 +1935,22 @@
             bNoFwd = !pBoss->IsInSct() || ( !pBoss->Lower()->GetNext() &&
                      !pBoss->GetPrev() );
         }
+
         // Allow the MoveFwd even if we do not have an IndPrev in these cases:
         if ( rThis.IsInTab() &&
             ( !rThis.IsTabFrm() ||
                 ( rThis.GetUpper()->IsInTab() &&
                   rThis.GetUpper()->FindTabFrm()->IsFwdMoveAllowed() ) ) &&
-                ( NULL != rThis.IsInSplitTableRow() ) )
+             0 != const_cast<SwFrm&>(rThis).GetNextCellLeaf( MAKEPAGE_NONE ) )
+/*
+              &&
+            // NEW TABLES
+            // Have a look at our main competitor: We don't move inside row span cells:
+            ( !rThis.GetUpper()->IsCellFrm() || !rThis.GetUpper()->IsLeaveUpperAllowed() ) )*/
         {
             bNoFwd = FALSE;
         }
+
         if( bNoFwd )
         {
             //Fuer PageBreak ist das Moven erlaubt, wenn der Frm nicht


INTEGRATION: CWS swundo01 (1.2.126); FILE MERGED 2004/04/19 10:24:01 hbrinkm 1.2.126.2: RESYNC: (1.2-1.5); FILE MERGED 2004/01/06 15:37:11 hbrinkm 1.2.126.1: #111840#

--- sw/source/core/txtnode/atrfld.cxx
+++ sw/source/core/txtnode/atrfld.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: atrfld.cxx,v $
  *
- *  $Revision: 1.5 $
- *
- *  last change: $Author: obo $ $Date: 2004-03-17 12:16:04 $
+ *  $Revision: 1.6 $
+ *
+ *  last change: $Author: kz $ $Date: 2004-05-18 14:04:55 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -158,6 +158,15 @@
     }
 }

+// #111840#
+void SwFmtFld::SetFld(SwField * _pField)
+{
+    if (NULL != pField)
+        delete pField;
+
+    pField = _pField;
+}
+
 int SwFmtFld::operator==( const SfxPoolItem& rAttr ) const
 {
     ASSERT( SfxPoolItem::operator==( rAttr ), "keine gleichen Attribute" );


INTEGRATION: CWS ooo19126 (1.4.836); FILE MERGED 2005/09/05 13:41:13 rt 1.4.836.1: #i54170# Change license header: remove SISSL

--- sw/source/core/txtnode/atrftn.cxx
+++ sw/source/core/txtnode/atrftn.cxx
@@ -1,61 +1,35 @@
 /*************************************************************************
  *
+ *  OpenOffice.org - a multi-platform office productivity suite
+ *
  *  $RCSfile: atrftn.cxx,v $
  *
- *  $Revision: 1.4 $
- *
- *  last change: $Author: obo $ $Date: 2004-02-16 11:59:08 $
- *
- *  The Contents of this file are made available subject to the terms of
- *  either of the following licenses
- *
- *         - GNU Lesser General Public License Version 2.1
- *         - Sun Industry Standards Source License Version 1.1
- *
- *  Sun Microsystems Inc., October, 2000
- *
- *  GNU Lesser General Public License Version 2.1
- *  =============================================
- *  Copyright 2000 by Sun Microsystems, Inc.
- *  901 San Antonio Road, Palo Alto, CA 94303, USA
- *
- *  This library is free software; you can redistribute it and/or
- *  modify it under the terms of the GNU Lesser General Public
- *  License version 2.1, as published by the Free Software Foundation.
- *
- *  This library is distributed in the hope that it will be useful,
- *  but WITHOUT ANY WARRANTY; without even the implied warranty of
- *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
- *  Lesser General Public License for more details.
- *
- *  You should have received a copy of the GNU Lesser General Public
- *  License along with this library; if not, write to the Free Software
- *  Foundation, Inc., 59 Temple Place, Suite 330, Boston,
- *  MA  02111-1307  USA
- *
- *
- *  Sun Industry Standards Source License Version 1.1
- *  =================================================
- *  The contents of this file are subject to the Sun Industry Standards
- *  Source License Version 1.1 (the "License"); You may not use this file
- *  except in compliance with the License. You may obtain a copy of the
- *  License at http://www.openoffice.org/license.html.
- *
- *  Software provided under this License is provided on an "AS IS" basis,
- *  WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING,
- *  WITHOUT LIMITATION, WARRANTIES THAT THE SOFTWARE IS FREE OF DEFECTS,
- *  MERCHANTABLE, FIT FOR A PARTICULAR PURPOSE, OR NON-INFRINGING.
- *  See the License for the specific provisions governing your rights and
- *  obligations concerning the Software.
- *
- *  The Initial Developer of the Original Code is: Sun Microsystems, Inc.
- *
- *  Copyright: 2000 by Sun Microsystems, Inc.
- *
- *  All Rights Reserved.
- *
- *  Contributor(s): _______________________________________
- *
+ *  $Revision: 1.5 $
+ *
+ *  last change: $Author: rt $ $Date: 2005-09-09 05:10:45 $
+ *
+ *  The Contents of this file are made available subject to
+ *  the terms of GNU Lesser General Public License Version 2.1.
+ *
+ *
+ *    GNU Lesser General Public License Version 2.1
+ *    =============================================
+ *    Copyright 2005 by Sun Microsystems, Inc.
+ *    901 San Antonio Road, Palo Alto, CA 94303, USA
+ *
+ *    This library is free software; you can redistribute it and/or
+ *    modify it under the terms of the GNU Lesser General Public
+ *    License version 2.1, as published by the Free Software Foundation.
+ *
+ *    This library is distributed in the hope that it will be useful,
+ *    but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ *    Lesser General Public License for more details.
+ *
+ *    You should have received a copy of the GNU Lesser General Public
+ *    License along with this library; if not, write to the Free Software
+ *    Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ *    MA  02111-1307  USA
  *
  ************************************************************************/


INTEGRATION: CWS extleading (1.16.38); FILE MERGED 2003/07/04 14:03:36 fme 1.16.38.1: #110641# Feature - External leading

--- sw/source/core/txtnode/fntcap.cxx
+++ sw/source/core/txtnode/fntcap.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: fntcap.cxx,v $
  *
- *  $Revision: 1.16 $
- *
- *  last change: $Author: rt $ $Date: 2003-06-12 07:39:31 $
+ *  $Revision: 1.17 $
+ *
+ *  last change: $Author: kz $ $Date: 2003-10-15 09:58:39 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -185,7 +185,7 @@
     SwDoCapitals ( SwDrawTextInfo &rInfo ) : rInf( rInfo ), pCapInf( 0 ) { }
     virtual void Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont ) = 0;
     virtual void Do() = 0;
-    inline OutputDevice *GetOut() { return rInf.GetpOut(); }
+    inline OutputDevice& GetOut() { return rInf.GetOut(); }
     inline SwDrawTextInfo& GetInf() { return rInf; }
     inline SwCapitalInfo* GetCapInf() const { return pCapInf; }
     inline void SetCapInf( SwCapitalInfo& rNew ) { pCapInf = &rNew; }
@@ -281,13 +281,13 @@
             xub_StrLen nEnd = rInf.GetEnd();
             if( pExtraPos )
             {
-                nBreak = GetOut()->GetTextBreak( rInf.GetText(), nTxtWidth, '-',
+                nBreak = GetOut().GetTextBreak( rInf.GetText(), nTxtWidth, '-',
                      *pExtraPos, rInf.GetIdx(), rInf.GetLen(), rInf.GetKern() );
                 if( *pExtraPos > nEnd )
                     *pExtraPos = nEnd;
             }
             else
-                nBreak = GetOut()->GetTextBreak( rInf.GetText(), nTxtWidth,
+                nBreak = GetOut().GetTextBreak( rInf.GetText(), nTxtWidth,
                                rInf.GetIdx(), rInf.GetLen(), rInf.GetKern() );

             if( nBreak > nEnd )
@@ -315,8 +315,8 @@
  *                    SwFont::GetCapitalBreak()
  *************************************************************************/

-xub_StrLen SwFont::GetCapitalBreak( ViewShell *pSh, const OutputDevice *pOut,
-    const SwScriptInfo* pScript, const XubString &rTxt, long nTextWidth,
+xub_StrLen SwFont::GetCapitalBreak( ViewShell* pSh, const OutputDevice* pOut,
+    const SwScriptInfo* pScript, const XubString& rTxt, long nTextWidth,
     xub_StrLen *pExtra, const xub_StrLen nIdx, const xub_StrLen nLen )
 {
     // Start:
@@ -405,7 +405,7 @@
     if ( nDiff )
     {
         rInf.ApplyAutoColor();
-        GetOut()->DrawStretchText( aPos, nDiff,
+        GetOut().DrawStretchText( aPos, nDiff,
             XubString( sDoubleSpace, RTL_TEXTENCODING_MS_1252 ), 0, 2 );
     }
     rPos.X() = rInf.GetPos().X() + rInf.GetWidth();
@@ -476,7 +476,7 @@
                     rInf.GetLen(), rInf.GetKern(), rInf.GetSpace(),
                     rInf.GetKanaComp() );
 #else
-            SwDrawTextInfo aDrawInf( 0, *rInf.GetpOut(),
+            SwDrawTextInfo aDrawInf( rInf.GetShell(), *rInf.GetpOut(),
                                      rInf.GetScriptInfo(),
                                      rInf.GetText(),
                                      rInf.GetIdx(),
@@ -567,10 +567,10 @@
         // Optimierung:

         if( 1 >= rInf.GetLen() )
-            GetOut()->DrawText( rInf.GetPos(), rInf.GetText(), rInf.GetIdx(),
+            GetOut().DrawText( rInf.GetPos(), rInf.GetText(), rInf.GetIdx(),
                 rInf.GetLen() );
         else
-            GetOut()->DrawStretchText( rInf.GetPos(), nPartWidth,
+            GetOut().DrawStretchText( rInf.GetPos(), nPartWidth,
                                 rInf.GetText(), rInf.GetIdx(), rInf.GetLen() );
     }
     ((Point&)rInf.GetPos()).X() += nPartWidth;
@@ -686,8 +686,8 @@
     rDo.Init( pBigFont, pSmallFont );
     OutputDevice* pOutSize = pSmallFont->GetPrt();
     if( !pOutSize )
-        pOutSize = rDo.GetOut();
-    OutputDevice* pOldOut = rDo.GetOut();
+        pOutSize = &rDo.GetOut();
+    OutputDevice* pOldOut = &rDo.GetOut();

     const LanguageType eLng = LANGUAGE_DONTKNOW == GetLanguage()
                             ? LANGUAGE_SYSTEM : GetLanguage();


INTEGRATION: CWS swqbugfixes12 (1.61.62); FILE MERGED 2005/01/06 14:38:15 fme 1.61.62.1: #118968# Changed SwScanner::NextWord - Skip non-LetterNumeric characters before calling getWordBoundary

--- sw/source/core/txtnode/txtedt.cxx
+++ sw/source/core/txtnode/txtedt.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: txtedt.cxx,v $
  *
- *  $Revision: 1.61 $
- *
- *  last change: $Author: rt $ $Date: 2004-11-26 14:27:19 $
+ *  $Revision: 1.62 $
+ *
+ *  last change: $Author: kz $ $Date: 2005-01-21 10:41:49 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -104,6 +104,9 @@
 #endif
 #ifndef _UNOTOOLS_TRANSLITERATIONWRAPPER_HXX
 #include <unotools/transliterationwrapper.hxx>
+#endif
+#ifndef _UNOTOOLS_CHARCLASS_HXX
+#include <unotools/charclass.hxx>
 #endif

 #ifndef _DLELSTNR_HXX_
@@ -567,42 +570,48 @@
 BOOL SwScanner::NextWord()
 {
     nBegin += nLen;
-
-    // first we have to skip some whitespace characters
     const XubString& rText = rNode.GetTxt();
     Boundary aBound;

+    CharClass& rCC = GetAppCharClass();
+    ::com::sun::star::lang::Locale aOldLocale = rCC.getLocale();
+
     while ( true )
     {
-
-    while ( nBegin < rText.Len() &&
-            lcl_IsSkippableWhiteSpace( rText.GetChar( nBegin ) ) )
-        ++nBegin;
+        // skip non-letter characters:
+        while ( nBegin < rText.Len() )
+        {
+            if ( !lcl_IsSkippableWhiteSpace( rText.GetChar( nBegin ) ) )
+            {
+                const USHORT nNextScript =
+                        pBreakIt->xBreak->getScriptType( rText, nBegin );
+                aCurrLang = rNode.GetLang( nBegin, nNextScript );
+                rCC.setLocale( pBreakIt->GetLocale( aCurrLang ) );
+                if ( rCC.isLetterNumeric( rText.GetChar( nBegin ) ) )
+                    break;
+            }
+            ++nBegin;
+        }

         if ( nBegin >= rText.Len() || nBegin >= nEndPos )
             return FALSE;
-
-        // get next language in order to find next or previous word
-        const USHORT nNextScript =
-                pBreakIt->xBreak->getScriptType( rText, nBegin );
-        aCurrLang = rNode.GetLang( nBegin, nNextScript );

         // get the word boundaries
         aBound = pBreakIt->xBreak->getWordBoundary( rText, nBegin,
                 pBreakIt->GetLocale( aCurrLang ), nWordType, sal_True );
+
         //no word boundaries could be found
         if(aBound.endPos == aBound.startPos)
             return FALSE;
+
         //if a word before is found it has to be searched for the next
         if(aBound.endPos == nBegin)
-        {
             ++nBegin;
-        }
         else
             break;
-
     } // end while( true )

+    rCC.setLocale( aOldLocale );

     // we have to differenciate between these cases:
     if ( aBound.startPos <= nBegin )
@@ -766,24 +775,6 @@
                     }
                 }
             }
-
-            // get next language in order to find next or previous word
-            xub_StrLen nNextBegin;
-            short nInc = 1;
-
-            nNextBegin = aScanner.GetBegin() + rWord.Len();
-
-            // first we have to skip some whitespace characters
-            while ( ( nNextBegin < aText.Len() ) &&
-                    lcl_IsSkippableWhiteSpace( aText.GetChar( nNextBegin ) ) )
-            {
-                nNextBegin += nInc;
-            }
-
-            if ( nNextBegin < aText.Len() )
-                eActLang = GetLang( nNextBegin );
-            else
-                break;
         }
     }

@@ -1006,18 +997,6 @@
                         rACW.InsertWord( rWord, *pDoc );
                 }
             }
-
-            // get next language in order to find next word
-            xub_StrLen nNextBegin = aScanner.GetBegin() + rWord.Len();
-            // first we have to skip some whitespace characters
-            while ( nNextBegin < pNode->aText.Len() &&
-                    lcl_IsSkippableWhiteSpace( pNode->aText.GetChar( nNextBegin ) ) )
-                nNextBegin++;
-
-            if ( nNextBegin < pNode->aText.Len() )
-                eActLang = pNode->GetLang( nNextBegin );
-            else
-                break;
         }
     }
     if( pNode->GetWrong() )


INTEGRATION: CWS os24 (1.53.296.1) Done manually, due to corrupted tags.

--- sw/source/core/unocore/unoidx.cxx
+++ sw/source/core/unocore/unoidx.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: unoidx.cxx,v $
  *
- *  $Revision: 1.53 $
+ *  $Revision: 1.54 $
  *
- *  last change: $Author: vg $ $Date: 2003-04-17 14:43:37 $
+ *  last change: $Author: rt $ $Date: 2004-01-05 15:57:38 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -2756,11 +2756,13 @@
             break;
             case TOKEN_LINK_START   :
             {
-                rCurTokenSeq.realloc( 1 );
+                rCurTokenSeq.realloc( 2 );
                 PropertyValue* pArr = rCurTokenSeq.getArray();

                 pArr[0].Name = C2U("TokenType");
                 pArr[0].Value <<= OUString::createFromAscii("TokenHyperlinkStart");
+                pArr[1].Name = C2U("CharacterStyleName");
+                pArr[1].Value <<= aProgCharStyle;
             }
             break;
             case TOKEN_LINK_END     :


INTEGRATION: CWS custommeta (1.112.44); FILE MERGED 2008/02/01 10:30:06 mst 1.112.44.2: RESYNC: (1.112-1.113); FILE MERGED 2008/01/18 11:00:51 mst 1.112.44.1: - sw/source/core/unocore/unotbl.cxx:   + fix debug-only warning

--- sw/source/core/unocore/unotbl.cxx
+++ sw/source/core/unocore/unotbl.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: unotbl.cxx,v $
  *
- *  $Revision: 1.113 $
+ *  $Revision: 1.114 $
  *
- *  last change: $Author: obo $ $Date: 2008-01-10 12:31:03 $
+ *  last change: $Author: obo $ $Date: 2008-02-26 14:16:20 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -594,14 +594,14 @@
 {
 #if OSL_DEBUG_LEVEL > 1
     {
-        sal_Int32 nCol, nRow;
-        lcl_GetCellPosition( String::CreateFromAscii("z1"), nCol, nRow);
+        sal_Int32 nCol, nRow2;
+        lcl_GetCellPosition( String::CreateFromAscii("z1"), nCol, nRow2);
         DBG_ASSERT( nCol == 51, "lcl_GetCellPosition failed" );
-        lcl_GetCellPosition( String::CreateFromAscii("AA1"), nCol, nRow);
+        lcl_GetCellPosition( String::CreateFromAscii("AA1"), nCol, nRow2);
         DBG_ASSERT( nCol == 52, "lcl_GetCellPosition failed" );
-        lcl_GetCellPosition( String::CreateFromAscii("AB1"), nCol, nRow);
+        lcl_GetCellPosition( String::CreateFromAscii("AB1"), nCol, nRow2);
         DBG_ASSERT( nCol == 53, "lcl_GetCellPosition failed" );
-        lcl_GetCellPosition( String::CreateFromAscii("BB1"), nCol, nRow);
+        lcl_GetCellPosition( String::CreateFromAscii("BB1"), nCol, nRow2);
         DBG_ASSERT( nCol == 105, "lcl_GetCellPosition failed" );
     }
 #endif


INTEGRATION: CWS mullingarfilterteam18 (1.4.278); FILE MERGED 2003/11/19 09:14:55 cmc 1.4.278.1: #i9055# clean warnings from ascii dir

--- sw/source/filter/ascii/ascatr.cxx
+++ sw/source/filter/ascii/ascatr.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: ascatr.cxx,v $
  *
- *  $Revision: 1.4 $
- *
- *  last change: $Author: vg $ $Date: 2003-04-17 14:48:33 $
+ *  $Revision: 1.5 $
+ *
+ *  last change: $Author: obo $ $Date: 2004-01-13 16:36:19 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -58,8 +58,6 @@
  *
  *
  ************************************************************************/
-
-#pragma hdrstop

 #ifndef _HINTIDS_HXX
 #include <hintids.hxx>


INTEGRATION: CWS swwarnings (1.10.222); FILE MERGED 2007/04/03 13:00:41 tl 1.10.222.2: #i69287# warning-free code 2007/03/15 15:52:07 tl 1.10.222.1: #i69287# warning-free code

--- sw/source/filter/html/htmlftn.cxx
+++ sw/source/filter/html/htmlftn.cxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: htmlftn.cxx,v $
  *
- *  $Revision: 1.10 $
- *
- *  last change: $Author: obo $ $Date: 2006-09-16 22:10:36 $
+ *  $Revision: 1.11 $
+ *
+ *  last change: $Author: hr $ $Date: 2007-09-27 09:48:51 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -146,7 +146,7 @@
         switch( nPart )
         {
         case 0:
-            rInfo.aFmt.SetNumberingType(bEndNote ? SVX_NUM_ROMAN_LOWER : SVX_NUM_ARABIC);
+            rInfo.aFmt.SetNumberingType( static_cast< sal_Int16 >(bEndNote ? SVX_NUM_ROMAN_LOWER : SVX_NUM_ARABIC));
             if( aPart.Len() )
                 rInfo.aFmt.SetNumberingType(SwHTMLParser::GetNumType( aPart,
                                                              rInfo.aFmt.GetNumberingType() ));
@@ -287,7 +287,7 @@

 SwNodeIndex *SwHTMLParser::GetFootEndNoteSection( const String& rName )
 {
-    SwNodeIndex *pSttNdIdx = 0;
+    SwNodeIndex *pStartNodeIdx = 0;

     if( pFootEndNoteImpl )
     {
@@ -300,7 +300,7 @@
         {
             if( *pFootEndNoteImpl->aNames[i] == aName )
             {
-                pSttNdIdx = pFootEndNoteImpl->aTxtFtns[i]->GetStartNode();
+                pStartNodeIdx = pFootEndNoteImpl->aTxtFtns[i]->GetStartNode();
                 pFootEndNoteImpl->aNames.DeleteAndDestroy( i, 1 );
                 pFootEndNoteImpl->aTxtFtns.Remove( i, 1 );
                 if( !pFootEndNoteImpl->aNames.Count() )
@@ -314,7 +314,7 @@
         }
     }

-    return pSttNdIdx;
+    return pStartNodeIdx;
 }

 Writer& OutHTML_SwFmtFtn( Writer& rWrt, const SfxPoolItem& rHt )


INTEGRATION: CWS sixtyfour02 (1.13.236); FILE MERGED 2006/03/03 09:15:05 cmc 1.13.236.1: #i62466# consistently use ULONG and sal_uInt32

--- sw/source/filter/html/wrthtml.hxx
+++ sw/source/filter/html/wrthtml.hxx
@@ -4,9 +4,9 @@
  *
  *  $RCSfile: wrthtml.hxx,v $
  *
- *  $Revision: 1.13 $
- *
- *  last change: $Author: rt $ $Date: 2005-09-09 05:48:45 $
+ *  $Revision: 1.14 $
+ *
+ *  last change: $Author: vg $ $Date: 2006-03-16 12:37:37 $
  *
  *  The Contents of this file are made available subject to
  *  the terms of GNU Lesser General Public License Version 2.1.
@@ -234,7 +234,7 @@
     void CollectLinkTargets();

 protected:
-    sal_uInt32 WriteStream();
+    ULONG WriteStream();

 public:
 #if defined(MAC) || defined(UNX)
@@ -366,7 +366,7 @@
     void OutHyperlinkHRefValue( const String& rURL );

     // gebe die evt. an der akt. Position stehenden FlyFrame aus.
-    sal_Bool OutFlyFrm( sal_uInt32 nNdIdx, xub_StrLen nCntntIdx,
+    sal_Bool OutFlyFrm( ULONG nNdIdx, xub_StrLen nCntntIdx,
                         sal_uInt8 nPos, HTMLOutContext *pContext = 0 );
     void OutFrmFmt( sal_uInt8 nType, const SwFrmFmt& rFmt,
                     const SdrObject *pSdrObj );
@@ -562,7 +562,7 @@
     sal_Bool bOldOutFlyFrame : 1;
     const SwFlyFrmFmt* pOldFlyFmt;

-    HTMLSaveData( SwHTMLWriter&, sal_uInt32 nStt, sal_uInt32 nEnd,
+    HTMLSaveData( SwHTMLWriter&, ULONG nStt, ULONG nEnd,
                   sal_Bool bSaveNum=sal_True,
                      const SwFrmFmt *pFrmFmt=0  );
     ~HTMLSaveData();


INTEGRATION: CWS redlinefilterteam24 (1.42.16); FILE MERGED 2004/09/13 10:02:15 mmaher 1.42.16.2: #i15212# Fix some import problems and export problems found after the first checkin 2004/08/27 16:52:06 mmaher 1.42.16.1: #i15212# Added support for reading and writing redlines

--- sw/source/filter/rtf/swparrtf.cxx
+++ sw/source/filter/rtf/swparrtf.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: swparrtf.cxx,v $
  *
- *  $Revision: 1.44 $
+ *  $Revision: 1.45 $
  *
- *  last change: $Author: rt $ $Date: 2004-08-20 11:49:17 $
+ *  last change: $Author: rt $ $Date: 2004-09-20 15:18:32 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -307,11 +307,12 @@
     : SvxRTFParser(pD->GetAttrPool(), rIn, bReadNewDoc),
     maParaStyleMapper(*pD), maCharStyleMapper(*pD), maSegments(*this),
     maInsertedTables(*pD),
-    aMergeBoxes(0, 5), aTblFmts(0, 10), mpBookmarkStart(0), pGrfAttrSet(0),
-    pTableNode(0), pOldTblNd(0), pSttNdIdx(0), pRegionEndIdx(0), pDoc(pD),
+    aMergeBoxes(0, 5), aTblFmts(0, 10), mpBookmarkStart(0), mpRedlineStack(0),
+    pRedlineInsert(0), pRedlineDelete(0),
+    pGrfAttrSet(0), pTableNode(0), pOldTblNd(0), pSttNdIdx(0), pRegionEndIdx(0), pDoc(pD),
     pRelNumRule(new SwRelNumRuleSpaces(*pD, bReadNewDoc)), nAktPageDesc(0),
     nAktFirstPageDesc(0), nAktBox(0), nInsTblRow(USHRT_MAX),
-    nNewNumSectDef(USHRT_MAX), nRowsToRepeat(0)
+    nNewNumSectDef(USHRT_MAX), nRowsToRepeat(0), pAuthorInfos(0)
 {
     mbIsFootnote = mbReadNoTbl = bReadSwFly = bSwPageDesc = bStyleTabValid =
     bInPgDscTbl = bNewNumList = false;
@@ -342,6 +343,8 @@

     rInput.Seek(STREAM_SEEK_TO_BEGIN);
     rInput.ResetError();
+
+    mpRedlineStack = new sw::util::RedlineStack(*pDoc);

     return SvxRTFParser::CallParser();
 }
@@ -1182,6 +1185,8 @@
 SwRTFParser::~SwRTFParser()
 {
     maInsertedTables.DelAndMakeTblFrms();
+    mpRedlineStack->closeall(*pPam->GetPoint());
+    delete mpRedlineStack;

     delete pSttNdIdx;
     delete pRegionEndIdx;
@@ -1193,6 +1198,8 @@

     if (pGrfAttrSet)
         DELETEZ( pGrfAttrSet );
+
+    DELETEZ( pAuthorInfos );
 }

 //i19718
@@ -1216,6 +1223,56 @@
 extern void sw3io_ConvertFromOldField( SwDoc& rDoc, USHORT& rWhich,
                                 USHORT& rSubType, ULONG &rFmt,
                                 USHORT nVersion );
+
+USHORT SwRTFParser::ReadRevTbl()
+{
+    // rStr.Erase( 0 );
+    int nOpenBrakets = 1, nToken;       // die erste wurde schon vorher erkannt !!
+    bool bFirstAuthor = true;
+    USHORT nAuthorTableIndex = 0;
+
+    while( nOpenBrakets && IsParserWorking() )
+    {
+        switch( nToken = GetNextToken() )
+        {
+        case '}':       --nOpenBrakets; break;
+        case '{':
+            {
+                if( RTF_IGNOREFLAG != GetNextToken() )
+                    nToken = SkipToken( -1 );
+                else if( RTF_UNKNOWNCONTROL != GetNextToken() )
+                    nToken = SkipToken( -2 );
+                else
+                {
+                    ReadUnknownData();
+                    nToken = GetNextToken();
+                    if( '}' != nToken )
+                        eState = SVPAR_ERROR;
+                    break;
+                }
+                ++nOpenBrakets;
+            }
+            break;
+
+        case RTF_TEXTTOKEN:
+            aToken.EraseTrailingChars(';');
+
+            USHORT nSWId = pDoc->InsertRedlineAuthor(aToken);
+            // Store matchpair
+            if( !pAuthorInfos )
+                pAuthorInfos = new sw::util::AuthorInfos;
+            sw::util::AuthorInfo* pAutorInfo = new sw::util::AuthorInfo( nAuthorTableIndex, nSWId );
+            if( 0 == pAuthorInfos->Insert( pAutorInfo ) )
+                delete pAutorInfo;
+
+            aRevTbl.push_back(aToken);
+            nAuthorTableIndex++;
+            break;
+        }
+    }
+    SkipToken( -1 );
+    return nAuthorTableIndex;
+}

 void SwRTFParser::NextToken( int nToken )
 {
@@ -1411,6 +1468,63 @@
         }
         break;

+    case RTF_REVTBL:
+        ReadRevTbl();
+        break;
+
+    case RTF_REVISED:
+        pRedlineInsert = new SwFltRedline(REDLINE_INSERT, 0, DateTime(Date( 0 ), Time( 0 )));
+        break;
+
+    case RTF_DELETED:
+        pRedlineDelete = new SwFltRedline(REDLINE_DELETE, 0, DateTime(Date( 0 ), Time( 0 )));
+        break;
+
+    case RTF_REVAUTH:
+        {
+            sw::util::AuthorInfo aEntry(nTokenValue);
+            USHORT nPos;
+
+            if(pRedlineInsert)
+            {
+                if (pAuthorInfos && pAuthorInfos->Seek_Entry(&aEntry, &nPos))
+                {
+                    if (const sw::util::AuthorInfo* pAuthor = pAuthorInfos->GetObject(nPos))
+                    {
+                        pRedlineInsert->nAutorNo = pAuthor->nOurId;
+                    }
+                }
+            }
+        }
+        break;
+
+    case RTF_REVAUTHDEL:
+        {
+            sw::util::AuthorInfo aEntry(nTokenValue);
+            USHORT nPos;
+
+            if(pRedlineDelete)
+            {
+                if (pAuthorInfos && pAuthorInfos->Seek_Entry(&aEntry, &nPos))
+                {
+                    if (const sw::util::AuthorInfo* pAuthor = pAuthorInfos->GetObject(nPos))
+                    {
+                        pRedlineDelete->nAutorNo = pAuthor->nOurId;
+                    }
+                }
+            }
+        }
+        break;
+
+    case RTF_REVDTTM:
+        pRedlineInsert->aStamp = sw::ms::DTTM2DateTime(nTokenValue);
+        break;
+
+    case RTF_REVDTTMDEL:
+        pRedlineDelete->aStamp = sw::ms::DTTM2DateTime(nTokenValue);
+        break;
+
+
     case RTF_FLY_INPARA:
             // \pard  und plain ueberlesen !
         if( '}' != GetNextToken() && '}' != GetNextToken() )
@@ -1510,11 +1624,6 @@
         }
         break;

-//  case RTF_REVDTTM:
-//      UnknownAttrToken( nToken, &GetAttrSet() );
-//      break;
-
-
 // RTF_SUBENTRYINDEX

     default:
@@ -1554,13 +1663,32 @@
 }

+
 void SwRTFParser::InsertText()
 {
     bContainsPara = false;
     // dann fuege den String ein, ohne das Attribute am Ende
     // aufgespannt werden.
     CheckInsNewTblLine();
+
+    if(pRedlineInsert)
+        mpRedlineStack->open(*pPam->GetPoint(), *pRedlineInsert);
+    if(pRedlineDelete)
+        mpRedlineStack->open(*pPam->GetPoint(), *pRedlineDelete);
+
     pDoc->Insert( *pPam, aToken );
+
+    if(pRedlineDelete)
+    {
+        mpRedlineStack->close(*pPam->GetPoint(), pRedlineDelete->eType);
+    }
+
+    if(pRedlineInsert)
+    {
+        mpRedlineStack->close(*pPam->GetPoint(), pRedlineInsert->eType);
+    }
+
+
 }

@@ -2624,6 +2752,27 @@
     SkipToken(-1);
 }

+void SwRTFParser::EnterEnvironment()
+{
+}
+
+
+void SwRTFParser::LeaveEnvironment()
+{
+    if(pRedlineDelete)
+    {
+        delete pRedlineDelete;
+        pRedlineDelete = 0;
+    }
+
+    if(pRedlineInsert)
+    {
+        delete pRedlineInsert;
+        pRedlineInsert = 0;
+    }
+}
+
+
 void SwRTFParser::ReadPageDescTbl()
 {
     if( !IsNewDoc() )
@@ -3697,29 +3846,6 @@
     case RTF_KEEPN:
 */

-
-    // Revision Time Stamp
-/*  case RTF_REVDTTM:
-        {
-            USHORT nMin, nHour, nDay, nMon, nYear, nDayOfWeek;
-// long wird gelesen, wird haben aber nur einen short!!!
-            ULONG nDtm = aToken.Copy( 7 );
-            //  3         2         1         0
-            // 10987654321098765432109876543210
-            // DOW|   Y    | M | D  | H  | Min
-            //
-            nMin       = 0x3F & ( nDtm >>= 0 );
-            nHour      = 0x1f & ( nDtm >>= 6 );
-            nDay       = 0x1f & ( nDtm >>= 5 );
-            nMon       = 0x0F & ( nDtm >>= 5 );
-            nYear      =(0x7F & ( nDtm >>= 4 )) + 1900;
-            nDayOfWeek = 0x07 & ( nDtm >>= 7 );
-
-            Time aTime( nHour, nMin );
-            Date aDate( nDay, nMon, nYear );
-        }
-        break;
-*/
     }
 }


AddWmf, AddGraphic had been removed from EscherEx, UniqueId from GraphicObject is now used to get the GraphicId

--- sw/source/filter/ww8/wrtw8esh.cxx
+++ sw/source/filter/ww8/wrtw8esh.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: wrtw8esh.cxx,v $
  *
- *  $Revision: 1.5 $
+ *  $Revision: 1.6 $
  *
- *  last change: $Author: sj $ $Date: 2000-12-11 14:31:03 $
+ *  last change: $Author: sj $ $Date: 2000-12-13 14:13:35 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -73,7 +73,9 @@
 #ifndef _COM_SUN_STAR_DRAWING_XSHAPE_HPP_
 #include <com/sun/star/drawing/XShape.hpp>
 #endif
-
+#ifndef _SV_SVAPP_HXX
+#include <vcl/svapp.hxx>
+#endif
 #ifndef _SVSTOR_HXX
 #include <so3/svstor.hxx>
 #endif
@@ -219,6 +221,9 @@
 #endif
 #ifndef _ERRHDL_HXX
 #include <errhdl.hxx>
+#endif
+#ifndef _GRFMGR_HXX
+#include <goodies/grfmgr.hxx>
 #endif

 using namespace ::com::sun::star;
@@ -1808,8 +1813,30 @@
     else
     {
         rGrfNd.SwapIn( TRUE );
-        aPropOpt.AddOpt( ESCHER_Prop_pib, AddGraphic( *QueryPicStream(),
-                                            rGrfNd.GetGrf() ), TRUE );
+
+        Graphic         aGraphic( rGrfNd.GetGrf() );
+        GraphicObject   aGraphicObject( aGraphic );
+        ByteString      aUniqueId = aGraphicObject.GetUniqueID();
+
+        if ( aUniqueId.Len() )
+        {
+             const  MapMode aMap100mm( MAP_100TH_MM );
+            Size    aSize( aGraphic.GetPrefSize() );
+
+            if ( MAP_PIXEL == aGraphic.GetPrefMapMode().GetMapUnit() )
+                aSize = Application::GetDefaultDevice()->PixelToLogic( aSize, aMap100mm );
+            else
+                aSize = OutputDevice::LogicToLogic( aSize, aGraphic.GetPrefMapMode(), aMap100mm );
+
+            Rectangle aRect( Point(), aSize );
+
+            sal_uInt32 nBlibId = GetBlibID( *QueryPicStream(), aUniqueId, aRect, NULL );
+            if ( nBlibId )
+            {
+                aPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
+                aPropOpt.AddOpt( ESCHER_Prop_pib, nBlibId, sal_True );
+            }
+        }
     }
     aPropOpt.AddOpt( ESCHER_Prop_pibFlags, nFlags );
     WriteFlyFrameAttr( rFmt, aPropOpt );
@@ -1875,7 +1902,9 @@

         AddShape( ESCHER_ShpInst_PictureFrame, 0xa10, nShapeId );
         EscherPropertyContainer aPropOpt;
+        if ( pMtf )
         {
+/*
             SvMemoryStream aGrfStrm;
             WriteWindowMetafile( aGrfStrm, *pMtf );
             const BYTE* pMem = (BYTE*)aGrfStrm.GetData();
@@ -1884,8 +1913,26 @@
             aSz.Width() = DrawModelToEmu( aSz.Width() );
             aSz.Height() = DrawModelToEmu( aSz.Height() );
             Rectangle aRect( Point(0,0), aSz );
-            aPropOpt.AddOpt( ESCHER_Prop_pib, AddWMF( *QueryPicStream(),
-                                    pMem + 22, nLen - 22, aRect ), TRUE );
+*/
+            Graphic         aGraphic( *pMtf );
+            GraphicObject   aGraphicObject( aGraphic );
+            ByteString      aUniqueId = aGraphicObject.GetUniqueID();
+            if ( aUniqueId.Len() )
+            {
+                Size aSz( rOLENd.GetTwipSize() );
+                aSz.Width() = DrawModelToEmu( aSz.Width() );
+                aSz.Height() = DrawModelToEmu( aSz.Height() );
+                Rectangle aRect( Point(0,0), aSz );
+
+                sal_uInt32 nBlibId = GetBlibID( *QueryPicStream(), aUniqueId, aRect, NULL );
+                if ( nBlibId )
+                {
+                    aPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
+                    aPropOpt.AddOpt( ESCHER_Prop_pib, nBlibId, sal_True );
+                }
+            }
+//          aPropOpt.AddOpt( ESCHER_Prop_pib, AddWMF( *QueryPicStream(),
+//                                  pMem + 22, nLen - 22, aRect ), TRUE );
         }
         pTxtBxs->Append( *pSdrObj, nShapeId );
         UINT32 nPicId = pTxtBxs->Count();
@@ -2034,9 +2081,31 @@
             else
 */
             {
-                rPropOpt.AddOpt( ESCHER_Prop_fillBlip, AddGraphic( *QueryPicStream(),
-                                    *((SvxBrushItem*)pItem)->GetGraphic() ),
-                                    TRUE );
+//              rPropOpt.AddOpt( ESCHER_Prop_fillBlip, AddGraphic( *QueryPicStream(),
+//                                  *((SvxBrushItem*)pItem)->GetGraphic() ),
+//                                  TRUE );
+
+                Graphic         aGraphic( *((SvxBrushItem*)pItem)->GetGraphic() );
+                GraphicObject   aGraphicObject( aGraphic );
+                ByteString      aUniqueId = aGraphicObject.GetUniqueID();
+
+                if ( aUniqueId.Len() )
+                {
+                     const  MapMode aMap100mm( MAP_100TH_MM );
+                    Size    aSize( aGraphic.GetPrefSize() );
+
+                    if ( MAP_PIXEL == aGraphic.GetPrefMapMode().GetMapUnit() )
+                        aSize = Application::GetDefaultDevice()->PixelToLogic( aSize, aMap100mm );
+                    else
+                        aSize = OutputDevice::LogicToLogic( aSize, aGraphic.GetPrefMapMode(), aMap100mm );
+
+                    Rectangle aRect( Point(), aSize );
+
+                    sal_uInt32 nBlibId = GetBlibID( *QueryPicStream(), aUniqueId, aRect, NULL );
+                    if ( nBlibId )
+                        rPropOpt.AddOpt( ESCHER_Prop_fillBlip, nBlibId, sal_True );
+                }
+
             }
             rPropOpt.AddOpt( ESCHER_Prop_fillType, ESCHER_FillPicture );
             rPropOpt.AddOpt( ESCHER_Prop_fNoFillHitTest, 0x140014 );
@@ -2233,11 +2302,14 @@

       Source Code Control System - Header

-      $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/wrtw8esh.cxx,v 1.5 2000-12-11 14:31:03 sj Exp $
+      $Header: /zpool/svn/migration/cvs_rep_09_09_08/code/sw/source/filter/ww8/wrtw8esh.cxx,v 1.6 2000-12-13 14:13:35 sj Exp $

       Source Code Control System - Update

       $Log: not supported by cvs2svn $
+      Revision 1.5  2000/12/11 14:31:03  sj
+      now using EscherPropertyContainer to create the ESCHER_OPT atom
+
       Revision 1.4  2000/11/13 10:11:28  khz
       export extended WW9-Frame-Alignment (write Escher record 0xF122)


INTEGRATION: CWS kilkennyfilterteam14 (1.26.18); FILE MERGED 2003/10/07 12:53:10 cmc 1.26.18.4: RESYNC: (1.26-1.27); FILE MERGED 2003/09/24 15:17:09 cmc 1.26.18.3: #i14509 Increase barrier to exporting follow page styles as first page different flag 2003/09/19 15:31:39 cmc 1.26.18.2: #i10538# more shared (and documented!!!) methods between word and rtf filters 2003/09/16 15:04:41 cmc 1.26.18.1: #i19652# implement import and export of the fact that a section is protected (not the password itself though)

--- sw/source/filter/ww8/wrtw8sty.cxx
+++ sw/source/filter/ww8/wrtw8sty.cxx
@@ -2,9 +2,9 @@
  *
  *  $RCSfile: wrtw8sty.cxx,v $
  *
- *  $Revision: 1.27 $
+ *  $Revision: 1.28 $
  *
- *  last change: $Author: rt $ $Date: 2003-09-25 07:42:42 $
+ *  last change: $Author: hr $ $Date: 2003-11-05 14:16:22 $
  *
  *  The Contents of this file are made available subject to the terms of
  *  either of the following licenses
@@ -112,6 +112,9 @@
 #ifndef _SVX_LRSPITEM_HXX
 #include <svx/lrspitem.hxx>
 #endif
+#ifndef _SVX_ULSPITEM_HXX
+#include <svx/ulspitem.hxx>
+#endif

 #ifndef _WRTWW8_HXX
 #include <wrtww8.hxx>
@@ -180,6 +183,9 @@
 #include <lineinfo.hxx>
 #endif

+#ifndef SW_MS_MSFILTER_HXX
+#include <msfilter.hxx>
+#endif
 #ifndef SW_WRITERHELPER
 #include "writerhelper.hxx"
 #endif
@@ -744,10 +750,7 @@

     ShortToSVBT16( 400, &maWW8_FFN[2] );        // weiss ich nicht besser
                                                 // 400 == FW_NORMAL (windows.h)
-    if (RTL_TEXTENCODING_SYMBOL == eChrSet)
-        maWW8_FFN[4] = 2;
-    else
-        maWW8_FFN[4] = rtl_getBestWindowsCharsetFromTextEncoding(eChrSet);
+    maWW8_FFN[4] = sw::types::rtl_TextEncodingToWinCharset(eChrSet);

     if (mbAlt)
         maWW8_FFN[5] = msFamilyNm.Len()+1;
@@ -922,7 +925,9 @@
 //      behandelt auch Header und Footer
 //------------------------------------------------------------------------------

-WW8_WrPlcSepx::WW8_WrPlcSepx() : aSects(4, 4), aCps(4, 4), pAttrs(0), pTxtPos(0)
+WW8_WrPlcSepx::WW8_WrPlcSepx() :
+    mbDocumentIsProtected(false), aSects(4, 4), aCps(4, 4), pAttrs(0),
+    pTxtPos(0)
 {
 }

@@ -968,24 +973,24 @@
     return rColumns.Count();
 }

-void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp,
-                               const SwPageDesc* pPd,
-                               const SwSectionFmt* pSectionFmt,
-                               ULONG nLnNumRestartNo )
-{
-    aCps.Insert( nStartCp, aCps.Count() );
-    aSects.Insert( WW8_SepInfo( pPd, pSectionFmt, nLnNumRestartNo ),
-                   aSects.Count() );
+void WW8_WrPlcSepx::AppendSep(WW8_CP nStartCp, const SwPageDesc* pPd,
+    const SwSectionFmt* pSectionFmt, ULONG nLnNumRestartNo)
+{
+    aCps.Insert(nStartCp, aCps.Count());
+    aSects.Insert(WW8_SepInfo(pPd, pSectionFmt, nLnNumRestartNo),
+        aSects.Count());
+    NeedsDocumentProtected(aSects[aSects.Count()-1]);
 }

 void WW8_WrPlcSepx::AppendSep( WW8_CP nStartCp, const SwFmtPageDesc& rPD,
     const SwNode& rNd, const SwSectionFmt* pSectionFmt, ULONG nLnNumRestartNo )
 {
-    aCps.Insert( nStartCp, aCps.Count() );
-    WW8_SepInfo aI( rPD.GetPageDesc(), pSectionFmt, nLnNumRestartNo );
+    aCps.Insert(nStartCp, aCps.Count());
+    WW8_SepInfo aI(rPD.GetPageDesc(), pSectionFmt, nLnNumRestartNo);
     aI.nPgRestartNo = rPD.GetNumOffset();
     aI.pPDNd = &rNd;
-    aSects.Insert( aI, aSects.Count() );
+    aSects.Insert(aI, aSects.Count());
+    NeedsDocumentProtected(aI);
 }

 // WW8_WrPlcSepx::SetNum() setzt in jeder Section beim 1. Aufruf den
@@ -1125,6 +1130,30 @@
     else if( rWrt.bWrtWW8 )
         pTxtPos->Append( rCpPos );
 }
+
+void WW8_WrPlcSepx::NeedsDocumentProtected(const WW8_SepInfo &rInfo)
+{
+    if (rInfo.IsProtected())
+        mbDocumentIsProtected = true;
+}
+
+bool WW8_SepInfo::IsProtected() const
+{
+    bool bRet = false;
+    if (
+         pSectionFmt &&
+         ((SwSectionFmt*)0xFFFFFFFF != pSectionFmt)
+       )
+    {
+        const SwSection *pSection = pSectionFmt->GetSection();
+        if (pSection && pSection->IsProtect())
+        {
+            bRet = true;
+        }
+    }
+    return bRet;
+}
+

 void WW8_WrPlcSepx::CheckForFacinPg( SwWW8Writer& rWrt ) const
 {
@@ -1246,6 +1275,16 @@
         pO->Remove( 0, pO->Count() );       // leeren
         rWrt.bOutPageDescs = true;

+        //If the document is to be exported as protected, then if a segment
+        //is not protected, set the unlocked flag
+        if (mbDocumentIsProtected && !rSepInfo.IsProtected())
+        {
+            if (rWrt.bWrtWW8)
+                SwWW8Writer::InsUInt16(*pO, 0x3006);
+            else
+                pO->Insert(139, pO->Count());
+            pO->Insert(1 , pO->Count());
+        }

         if( aLineNum.Count() )
         {
@@ -1368,13 +1407,14 @@
                )
             {
                 /*
-                For #i4320# I am going to try this, nothing will ever be
-                perfect with the mismatch from title page of winword sections
-                vs our system. But I am relying on the natural inclination of
-                users to treat title pages as special and to generally always
-                have a manual page break inside them that we can convert to a
-                section break in the test in our page break exporter to see if
-                the page break will cause a new page descriptor to follow
+                For #i4320# & #i14509# I am going to try this, nothing will
+                ever be perfect with the mismatch from title page of winword
+                sections vs our system. But I am relying on the natural
+                inclination of users to treat title pages as special and to
+                generally always have a manual page break inside them that we
+                can convert to a section break in the test in our page break
+                exporter to see if the page break will cause a new page
+                descriptor to follow
                 */

                 bool bPlausableTitlePage = true;
@@ -1395,8 +1435,29 @@
                 const SwColumns& rFirstColumns = rFirstCols.GetColumns();
                 const SwColumns& rFollowColumns = rFollowCols.GetColumns();

-                if (rFirstColumns.Count() != rFollowColumns.Count())
+                if ((rFirstColumns.Count() != rFollowColumns.Count()))
+                {
+                    //e.g. #i4320#
                     bPlausableTitlePage = false;
+                }
+                else
+                {
+                    //e.g. #i14509#
+                    const SvxULSpaceItem &rOneUL = pPdFmt->GetULSpace();
+                    const SvxULSpaceItem &rTwoUL= rFollowFmt.GetULSpace();
+                    const SvxLRSpaceItem &rOneLR = pPdFmt->GetLRSpace();
+                    const SvxLRSpaceItem &rTwoLR= rFollowFmt.GetLRSpace();
+
+                    if (
+                         (rOneUL.GetUpper() != rTwoUL.GetUpper()) ||
+                         (rOneUL.GetLower() != rTwoUL.GetLower()) ||
+                         (rOneLR.GetLeft() != rTwoLR.GetLeft()) ||
+                         (rOneLR.GetRight() != rTwoLR.GetRight())
+                       )
+                    {
+                        bPlausableTitlePage = false;
+                    }
+                }

                 if (bPlausableTitlePage)
                 {


INTEGRATION: CWS hr50 (1.24.100); FILE MERGED 2008/04/11 15:54:06 hr 1.24.100.1: #i86574#: fix warning (gcc-4.2.3)

--- sw/source/ui/uno/unomailmerge.cxx
+++ sw/source/ui/uno/unomailmerge.cxx
@@ -7,7 +7,7 @@
  * OpenOffice.org - a multi-platform office productivity suite
  *
  * $RCSfile: unomailmerge.cxx,v $
- * $Revision: 1.25 $
+ * $Revision: 1.26 $
  *
  * This file is part of OpenOffice.org.
  *
@@ -265,8 +265,9 @@
                 // successfully added -> keep ourself alive
                 acquire();
             }
-            else
+            else {
                 DBG_ERROR( "DelayedFileDeletion::DelayedFileDeletion: model is no component!" );
+            }
         }
         catch( const Exception& )
         {
@@ -1026,8 +1027,9 @@
                 bOK = rValue >>= sInServerPassword;
             else if(pData == &sOutServerPassword)
                 bOK = rValue >>= sInServerPassword;
-            else
+            else {
                 DBG_ERROR( "invalid pointer" );
+            }
             DBG_ASSERT( bOK, "set value failed" );
             bChanged = sal_True;
         }


coverity#1078448 Unchecked return value

coverity#1078448 Unchecked return value

Change-Id: Icbdd0b6b19a91a3339c8635c112729b46232069e

--- sw/source/uibase/utlui/navipi.cxx
+++ sw/source/uibase/utlui/navipi.cxx
@@ -1153,7 +1153,9 @@
     else if( rData.HasFormat( nFmt = FORMAT_STRING ) ||
               rData.HasFormat( nFmt = FORMAT_FILE ) ||
              rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILENAME ))
-        rData.GetString( nFmt, sFileName );
+    {
+        (void)rData.GetString(nFmt, sFileName);
+    }
     else if( rData.HasFormat( nFmt = SOT_FORMATSTR_ID_SOLK ) ||
                 rData.HasFormat( nFmt = SOT_FORMATSTR_ID_NETSCAPE_BOOKMARK )||
                 rData.HasFormat( nFmt = SOT_FORMATSTR_ID_FILECONTENT ) ||


Add FreeBSD support to the address sanitizer's null_deref.cc test case
Differential Revision: http://reviews.llvm.org/D4421

git-svn-id: c199f293c43da69278bea8e88f92242bf3aa95f7@213130 91177308-0d34-0410-b5e6-96231b3b80d8

--- test/asan/TestCases/null_deref.cc
+++ test/asan/TestCases/null_deref.cc
@@ -1,16 +1,16 @@
-// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
-// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
-// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
-// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s --check-prefix=CHECK-%os --check-prefix=CHECK
+// RUN: %clangxx_asan -O0 %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O1 %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O2 %s -o %t && not %run %t 2>&1 | FileCheck %s
+// RUN: %clangxx_asan -O3 %s -o %t && not %run %t 2>&1 | FileCheck %s

 __attribute__((noinline))
 static void NullDeref(int *ptr) {
   // CHECK: ERROR: AddressSanitizer: SEGV on unknown address
   // CHECK:   {{0x0*000.. .*pc 0x.*}}
   ptr[10]++;  // BOOM
-  // atos on Mac cannot extract the symbol name correctly.
-  // CHECK-Linux: {{    #0 0x.* in NullDeref.*null_deref.cc:}}[[@LINE-2]]
-  // CHECK-Darwin: {{    #0 0x.* in .*NullDeref.*null_deref.cc:}}[[@LINE-3]]
+  // atos on Mac cannot extract the symbol name correctly. Also, on FreeBSD 9.2
+  // the demangling function rejects local names with 'L' in front of them.
+  // CHECK: {{    #0 0x.* in .*NullDeref.*null_deref.cc:}}[[@LINE-3]]
 }
 int main() {
   NullDeref((int*)0);


Change to malloc

Change to malloc

--- test/core/iomgr/mpmcqueue_test.cc
+++ test/core/iomgr/mpmcqueue_test.cc
@@ -41,7 +41,7 @@
       : start_index_(start_index), num_items_(num_items), queue_(queue) {
     items_ = nullptr;
     thd_ = grpc_core::Thread(
-        "mpmcq_test_mt_put_thd",
+        "mpmcq_test_put_thd",
         [](void* th) { static_cast<ProducerThread*>(th)->Run(); }, this);
   }
   ~ProducerThread() {
@@ -57,7 +57,8 @@

  private:
   void Run() {
-    items_ = static_cast<WorkItem**>(gpr_zalloc(num_items_));
+    items_ =
+        static_cast<WorkItem**>(gpr_malloc(num_items_ * sizeof(WorkItem*)));
     for (int i = 0; i < num_items_; ++i) {
       items_[i] = grpc_core::New<WorkItem>(start_index_ + i);
       queue_->Put(items_[i]);
@@ -101,8 +102,8 @@
     thds[i].Start();
   }

-  WorkItem** items =
-      static_cast<WorkItem**>(gpr_zalloc(THREAD_LARGE_ITERATION));
+  WorkItem** items = static_cast<WorkItem**>(
+      gpr_malloc(THREAD_LARGE_ITERATION * sizeof(WorkItem*)));
   for (int i = 0; i < THREAD_LARGE_ITERATION; ++i) {
     items[i] = grpc_core::New<WorkItem>(i);
     queue.Put(static_cast<void*>(items[i]));
@@ -143,8 +144,8 @@
   const int num_work_thd = 10;
   const int num_get_thd = 20;
   grpc_core::InfLenFIFOQueue queue;
-  ProducerThread** work_thds =
-      static_cast<ProducerThread**>(gpr_zalloc(num_work_thd));
+  ProducerThread** work_thds = static_cast<ProducerThread**>(
+      gpr_malloc(num_work_thd * sizeof(ProducerThread*)));
   grpc_core::Thread get_thds[num_get_thd];

   gpr_log(GPR_DEBUG, "Fork ProducerThread...");


UT RC check logic keep the same with encoder side

--- test/encoder/EncUT_EncoderExt.cpp
+++ test/encoder/EncUT_EncoderExt.cpp
@@ -220,7 +220,7 @@
   sInfo.iLayer = SPATIAL_LAYER_0;
   iResult = pPtrEnc->SetOption (eOptionId, &sInfo);
   pPtrEnc->GetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, pParamExt);
-  if (sInfo.iBitrate <= 0 || pParamExt->sSpatialLayers[sInfo.iLayer].iSpatialBitrate <= (int) (fFrameRate + 0.5f))
+  if (sInfo.iBitrate <= 0 || (static_cast<float> (pParamExt->sSpatialLayers[sInfo.iLayer].iSpatialBitrate) <= fFrameRate))
     EXPECT_EQ (iResult, static_cast<int> (cmInitParaError));
   else if (pParamExt->sSpatialLayers[sInfo.iLayer].iSpatialBitrate >
            pParamExt->sSpatialLayers[sInfo.iLayer].iMaxSpatialBitrate) {
@@ -242,7 +242,7 @@
   sInfo.iLayer = SPATIAL_LAYER_0;
   iResult = pPtrEnc->SetOption (eOptionId, &sInfo);
   pPtrEnc->GetOption (ENCODER_OPTION_SVC_ENCODE_PARAM_EXT, pParamExt);
-  if (sInfo.iBitrate <= 0 || pParamExt->sSpatialLayers[sInfo.iLayer].iSpatialBitrate <= (int) (fFrameRate + 0.5f))
+  if (sInfo.iBitrate <= 0 || (static_cast<float> (pParamExt->sSpatialLayers[sInfo.iLayer].iSpatialBitrate) <= fFrameRate))
     EXPECT_EQ (iResult, static_cast<int> (cmInitParaError));
   else if (pParamExt->sSpatialLayers[sInfo.iLayer].iSpatialBitrate >
            pParamExt->sSpatialLayers[sInfo.iLayer].iMaxSpatialBitrate) {


replaced hardcoded supply cost with savingMinerals check

--- ai/vs/Source/ai.cpp
+++ ai/vs/Source/ai.cpp
@@ -95,7 +95,7 @@
             // Handle insufficient supply by building Pylon or building Supply Depot.
             if(playerRace != Races::Zerg
               && supplyNeeded
-              && minerals >= 100
+              && minerals >= savingMinerals
               && supplyChecked + supplyCheckTimer < frameCount){
                 supplyChecked = frameCount;

@@ -148,7 +148,7 @@
                 if(playerRace == Races::Zerg
                   && supplyNeeded
                   && playerRace == Races::Zerg
-                  && minerals >= 100
+                  && minerals >= savingMinerals
                   && supplyChecked + supplyCheckTimer < frameCount){
                     supplyChecked = frameCount;


improved formatting

improved formatting

--- ai/vs/Source/ai.cpp
+++ ai/vs/Source/ai.cpp
@@ -30,22 +30,26 @@

         // Handle workers.
         if(u->getType().isWorker()){
-            if(u->isIdle()){
-                if(u->isCarryingMinerals()
-                  || u->isCarryingGas()){
-                    u->returnCargo();
+            if(!u->isIdle()){
+                continue;
+            }

-                }else{
-                    u->gather(u->getClosestUnit(IsMineralField || IsRefinery));
-                }
+            if(u->isCarryingMinerals()
+              || u->isCarryingGas()){
+                u->returnCargo();
+
+            }else{
+                u->gather(u->getClosestUnit(IsMineralField || IsRefinery));
             }

         // Handle Command Centers, Hatcheries, and Nexuses.
         }else if(u->getType().isResourceDepot()){
+            if(!u->isIdle()){
+                continue
+            }
+
             // Build workers.
-            if(u->isIdle()){
-                u->train(u->getType().getRace().getWorker());
-            }
+            u->train(u->getType().getRace().getWorker());
         }
     }
 }


Fix capture of corpus descriptions in integration tests

--- test/helpers/read_test_entries.cc
+++ test/helpers/read_test_entries.cc
@@ -33,7 +33,7 @@
     if (!regex_search(content, matches, header_pattern) || matches.empty())
       break;

-    string description = matches[1].str();
+    string description = matches[2].str();
     descriptions.push_back(description);

     if (!bodies.empty())


C++11

--- tests/ChunkBuffer/Coordinates.cpp
+++ tests/ChunkBuffer/Coordinates.cpp
@@ -125,9 +125,17 @@
 		cChunkBuffer buffer;
 		buffer.SetBlock(0,0,0,0x42);
 		cChunkBuffer copy;
+		#if __cplusplus < 201103L
+		copy = buffer;
+		#else
 		copy = std::move(buffer);
+		#endif
 		testassert(copy.GetBlock(0,0,0) == 0x42);
+		#if __cplusplus < 201103L
+		copy = copy;
+		#else
 		copy = std::move(copy);
+		#endif
 		testassert(copy.GetBlock(0,0,0) == 0x42);
 	}


Use SkToBool to fix a warning.

Use SkToBool to fix a warning.

NOTRY=true
TBR=djsollen@google.com

Author: scroggo@google.com

Review URL: https://codereview.chromium.org/159333002

git-svn-id: e8541e15acce502a64c929015570ad1648e548cd@13389 2bbb7eff-a529-9590-31e7-b0007b416f81

--- tests/FrontBufferedStreamTest.cpp
+++ tests/FrontBufferedStreamTest.cpp
@@ -195,7 +195,7 @@
 static void test_length_combos(skiatest::Reporter* reporter, size_t bufferSize) {
     for (int hasLen = 0; hasLen <= 1; hasLen++) {
         for (int hasPos = 0; hasPos <= 1; hasPos++) {
-            LengthOptionalStream stream((bool) hasLen, (bool) hasPos);
+            LengthOptionalStream stream(SkToBool(hasLen), SkToBool(hasPos));
             SkAutoTUnref<SkStream> buffered(SkFrontBufferedStream::Create(&stream, bufferSize));
             test_hasLength(reporter, *buffered.get(), stream);
         }


Refine Problem 60. Permutation Sequence

Refine Problem 60. Permutation Sequence

--- tests/PermutationSequenceTest.cpp
+++ tests/PermutationSequenceTest.cpp
@@ -2,9 +2,7 @@

 #include "PermutationSequence.hpp"

-using namespace std;
-
-TEST_CASE("Permutation Sequence") {
+TEST_CASE("Permutation Sequence") {Permutation Sequence
     PermutationSequence s;
     SECTION("Sample tests") {
         vector<string> expected{"123", "132", "213", "231", "312", "321"};