Commit b4f16b8c authored by David King's avatar David King
Browse files

Change some uses of long to more appropriate types

* glom/libglom/python_embed/py_glom_record.[cc|h]:
* glom/libglom/python_embed/py_glom_related.[cc|h]:
* glom/libglom/python_embed/py_glom_relatedrecord.[cc|h]:
* glom/libglom/utils.cc:
* glom/utility_widgets/db_addel/glom_db_treemodel.cc:
* glom/utils_ui.cc: Use other types than long where appropriate.
parent 5d9839eb
2010-10-11 David King <davidk@openismus.com>
Change some uses of long to more appropriate types
* glom/libglom/python_embed/py_glom_record.[cc|h]:
* glom/libglom/python_embed/py_glom_related.[cc|h]:
* glom/libglom/python_embed/py_glom_relatedrecord.[cc|h]:
* glom/libglom/utils.cc:
* glom/utility_widgets/db_addel/glom_db_treemodel.cc:
* glom/utils_ui.cc: Use other types than long where appropriate.
2010-10-11 David King <davidk@openismus.com>
Use array notation where appropriate
......
......@@ -102,7 +102,7 @@ boost::python::object PyGlomRecord::get_related()
return m_related;
}
long PyGlomRecord::len() const
PyGlomRecord::type_map_field_values::size_type PyGlomRecord::len() const
{
return m_map_field_values.size();
}
......
......@@ -52,14 +52,14 @@ public:
boost::python::object get_related();
//Available, for instance, in python via record["name_first"]
typedef std::map<Glib::ustring, Gnome::Gda::Value> type_map_field_values;
//[] notation:
long len() const;
type_map_field_values::size_type len() const;
boost::python::object getitem(const boost::python::object& item);
void setitem(const boost::python::object& /* key */, const boost::python::object& /* value */);
//Available, for instance, in python via record["name_first"]
typedef std::map<Glib::ustring, Gnome::Gda::Value> type_map_field_values;
void set_fields(const PyGlomRecord::type_map_field_values& field_values,
Document* document,
const Glib::ustring& table_name,
......
......@@ -39,7 +39,7 @@ PyGlomRelated::~PyGlomRelated()
}
long PyGlomRelated::len() const
PyGlomRelated::type_map_relationships::size_type PyGlomRelated::len() const
{
return m_map_relationships.size();
}
......
......@@ -41,7 +41,7 @@ public:
//[] notation:
long len() const;
type_map_relationships::size_type len() const;
boost::python::object getitem(const boost::python::object& item);
friend class PyGlomRecord;
......
......@@ -47,7 +47,7 @@ static void RelatedRecord_HandlePythonError()
PyErr_Print();
}
long PyGlomRelatedRecord::len() const
PyGlomRelatedRecord::type_map_field_values::size_type PyGlomRelatedRecord::len() const
{
return m_map_field_values.size();
}
......
......@@ -45,8 +45,11 @@ public:
boost::python::object min(const std::string& field_name) const;
boost::python::object max(const std::string& field_name) const;
//Available, for instance, in python via record["name_first"]
typedef std::map<Glib::ustring, Gnome::Gda::Value> type_map_field_values;
//[] notation:
long len() const;
type_map_field_values::size_type len() const;
boost::python::object getitem(const boost::python::object& item);
private:
......@@ -60,8 +63,6 @@ private:
sharedptr<const Relationship> m_relationship;
Gnome::Gda::Value m_from_key_value;
//Available, for instance, in python via record["name_first"]
typedef std::map<Glib::ustring, Gnome::Gda::Value> type_map_field_values;
mutable type_map_field_values m_map_field_values; //A cache.
};
......
......@@ -670,7 +670,7 @@ Glib::ustring Utils::create_local_image_uri(const Gnome::Gda::Value& value)
if(value.get_value_type() == GDA_TYPE_BINARY)
{
glong size = 0;
std::streamsize size = 0;
gconstpointer pData = value.get_binary(size);
if(size && pData)
{
......
......@@ -968,7 +968,8 @@ void DbTreeModel::get_record_counts(gulong& total, gulong& found) const
if(datamodel->get_n_rows())
{
Gnome::Gda::Value value = datamodel->get_value_at(0, 0);
total = (gulong)value.get_int64(); //I discovered that it's a int64 by trying it.
// This will probably fail on Windows, where a long is only 32 bits wide.
total = static_cast<gulong>(value.get_int64()); //I discovered that it's a int64 by trying it.
}
}
}
......
......@@ -280,7 +280,7 @@ Glib::RefPtr<Gdk::Pixbuf> Utils::get_pixbuf_for_gda_value(const Gnome::Gda::Valu
guint8* puiData = (guint8*)buffer_binary;
try
{
refPixbufLoader->write(puiData, (glong)buffer_binary_length);
refPixbufLoader->write(puiData, static_cast<gsize>(buffer_binary_length));
result = refPixbufLoader->get_pixbuf();
refPixbufLoader->close(); //This throws if write() threw, so it must be inside the try block.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment