[segyio] 184/376: Use signed int for segy_write_textheader index

Jørgen Kvalsvik jokva-guest at moszumanska.debian.org
Wed Sep 20 08:04:30 UTC 2017


This is an automated email from the git hooks/post-receive script.

jokva-guest pushed a commit to branch debian
in repository segyio.

commit bfbc94bb80471004d3df225038ddc4a18167d6f6
Author: Jørgen Kvalsvik <jokva at statoil.com>
Date:   Fri Feb 10 12:04:02 2017 +0100

    Use signed int for segy_write_textheader index
---
 lib/include/segyio/segy.h | 2 +-
 lib/src/segy.c            | 4 +++-
 python/segyio/_segyio.c   | 2 +-
 3 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/lib/include/segyio/segy.h b/lib/include/segyio/segy.h
index f4feda5..d0196bf 100644
--- a/lib/include/segyio/segy.h
+++ b/lib/include/segyio/segy.h
@@ -76,7 +76,7 @@ int segy_sample_indexes(segy_file* fp, double* buf, double t0, double dt, size_t
 /* text header operations */
 int segy_read_textheader( segy_file*, char *buf);
 int segy_textheader_size();
-int segy_write_textheader( segy_file*, unsigned int pos, const char* buf );
+int segy_write_textheader( segy_file*, int pos, const char* buf );
 
 /* Read the trace header at `traceno` into `buf`. */
 int segy_traceheader( segy_file*,
diff --git a/lib/src/segy.c b/lib/src/segy.c
index 260803e..172d96e 100644
--- a/lib/src/segy.c
+++ b/lib/src/segy.c
@@ -1342,10 +1342,12 @@ int segy_read_textheader( segy_file* fp, char *buf) { //todo: Missing position/i
     return SEGY_OK;
 }
 
-int segy_write_textheader( segy_file* fp, unsigned int pos, const char* buf ) {
+int segy_write_textheader( segy_file* fp, int pos, const char* buf ) {
     int err;
     char mbuf[ SEGY_TEXT_HEADER_SIZE + 1 ];
 
+    if( pos < 0 ) return SEGY_INVALID_ARGS;
+
     // TODO: reconsider API, allow non-zero terminated strings
     ascii2ebcdic( buf, mbuf );
 
diff --git a/python/segyio/_segyio.c b/python/segyio/_segyio.c
index 66bc602..0c73a37 100644
--- a/python/segyio/_segyio.c
+++ b/python/segyio/_segyio.c
@@ -261,7 +261,7 @@ static PyObject *py_read_texthdr(PyObject *self, PyObject *args) {
 static PyObject *py_write_texthdr(PyObject *self, PyObject *args) {
     errno = 0;
     PyObject *file_capsule = NULL;
-    unsigned int index;
+    int index;
     char *buffer;
     int size;
 

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-science/packages/segyio.git



More information about the debian-science-commits mailing list