Skip to content
Browse files

Merge pull request #1725 from dmcdougall/fix_compiler_warnings

Fix compiler warnings
  • Loading branch information...
2 parents 433da1a + e1e771f commit 091c14949e50997d1f55f136435b11c157e87580 @mdboom mdboom committed Feb 20, 2013
Showing with 30 additions and 10 deletions.
  1. +1 −1 setupext.py
  2. +13 −2 src/_backend_agg.cpp
  3. +0 −4 src/_image.cpp
  4. +16 −3 src/_png.cpp
View
2 setupext.py
@@ -1030,7 +1030,7 @@ def add_tk_flags(module):
if not exists(join(F, fw + '.framework')):
break
else:
- # ok, F is now directory with both frameworks. Continure
+ # ok, F is now directory with both frameworks. Continue
# building
tk_framework_found = 1
break
View
15 src/_backend_agg.cpp
@@ -39,6 +39,13 @@
#include "numpy/arrayobject.h"
#include "agg_py_transforms.h"
+
+// This C function resides in npy_3kcompat.h and is unused by
+// matplotlib. This is here so that the compiler doesn't complain
+// that it is unused.
+extern "C" {
+__attribute__((unused)) static void simple_capsule_dtor(void *ptr);
+}
@mdboom
Matplotlib Developers member
mdboom added a note Feb 21, 2013

Given #1772, I'm going to remove this for now until we can find a way to make this work everywhere.

@dmcdougall
Matplotlib Developers member
dmcdougall added a note Feb 21, 2013

Sounds good. Sorry for the breakage.

@mdboom
Matplotlib Developers member
mdboom added a note Feb 21, 2013

No problem. This stuff is the very definition of subtle...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
#include "file_compat.h"
#ifndef M_PI
@@ -2048,7 +2055,9 @@ RendererAgg::write_rgba(const Py::Tuple& args)
{
if (fwrite(pixBuffer, 1, NUMBYTES, fp) != NUMBYTES)
{
- npy_PyFile_DupClose(py_file, fp);
+ if (npy_PyFile_DupClose(py_file, fp)) {
+ throw Py::RuntimeError("Error closing dupe file handle");
+ }
if (close_file) {
npy_PyFile_CloseFile(py_file);
@@ -2058,7 +2067,9 @@ RendererAgg::write_rgba(const Py::Tuple& args)
throw Py::RuntimeError("Error writing to file");
}
- npy_PyFile_DupClose(py_file, fp);
+ if (npy_PyFile_DupClose(py_file, fp)) {
+ throw Py::RuntimeError("Error closing dupe file handle");
+ }
if (close_file) {
npy_PyFile_CloseFile(py_file);
View
4 src/_image.cpp
@@ -406,10 +406,6 @@ Image::resize(const Py::Tuple& args, const Py::Dict& kwargs)
typedef agg::span_allocator<agg::rgba8> span_alloc_type;
span_alloc_type sa;
- agg::rgba8 background(agg::rgba8(int(255*bg.r),
- int(255*bg.g),
- int(255*bg.b),
- int(255*bg.a)));
// the image path
agg::path_storage path;
View
19 src/_png.cpp
@@ -27,6 +27,13 @@
#include "CXX/Extensions.hxx"
#include "numpy/arrayobject.h"
#include "mplutils.h"
+
+// This C function resides in npy_3kcompat.h and is unused by
+// matplotlib. This is here so that the compiler doesn't complain
+// that it is unused.
+extern "C" {
+__attribute__((unused)) static void simple_capsule_dtor(void *ptr);
+}
#include "file_compat.h"
// As reported in [3082058] build _png.so on aix
@@ -239,7 +246,9 @@ Py::Object _png_module::write_png(const Py::Tuple& args)
if (close_dup_file)
{
- npy_PyFile_DupClose(py_file, fp);
+ if (npy_PyFile_DupClose(py_file, fp)) {
+ throw Py::RuntimeError("Error closing dupe file handle");
+ }
}
if (close_file)
@@ -258,7 +267,9 @@ Py::Object _png_module::write_png(const Py::Tuple& args)
delete [] row_pointers;
if (close_dup_file)
{
- npy_PyFile_DupClose(py_file, fp);
+ if (npy_PyFile_DupClose(py_file, fp)) {
+ throw Py::RuntimeError("Error closing dupe file handle");
+ }
}
if (close_file)
@@ -569,7 +580,9 @@ _png_module::_read_png(const Py::Object& py_fileobj, const bool float_result,
#endif
if (close_dup_file)
{
- npy_PyFile_DupClose(py_file, fp);
+ if (npy_PyFile_DupClose(py_file, fp)) {
+ throw Py::RuntimeError("Error closing dupe file handle");
+ }
}
if (close_file)

0 comments on commit 091c149

Please sign in to comment.
Something went wrong with that request. Please try again.