summaryrefslogtreecommitdiffstats
path: root/Lib/posixpath.py
Commit message (Expand)AuthorAgeFilesLines
* Issue #5117: Case normalization was needed on ntpath.relpath(). AndHirokazu Yamamoto2010-10-181-2/+2
* Use os.fsencode() to support surrogatesVictor Stinner2010-09-291-1/+1
* Issue #767645: Set os.path.supports_unicode_filenames to True in posixpathVictor Stinner2010-09-171-1/+1
* #5551: symbolic links never can be mount points. Fixes the fix for #1713.Georg Brandl2010-08-011-0/+3
* #9018: os.path.normcase() now raises a TypeError if the argument is not str o...Ezio Melotti2010-06-251-0/+3
* Merged revisions 78018,78035-78040,78042-78043,78046,78048-78052,78054,78059,...Georg Brandl2010-03-141-1/+1
* Merged revisions 70980,71059,71225,71234,71241,71243,71249,71251,71255,71266,...Benjamin Peterson2009-04-111-1/+4
* Merged revisions 68884,68973,68978,69003,69083,69112-69113 via svnmerge fromBenjamin Peterson2009-01-301-2/+2
* Issue #3187: Better support for "undecodable" filenames. Code by VictorGuido van Rossum2008-10-021-43/+128
* #2834: Change re module semantics, so that str and bytes mixing is forbidden,Antoine Pitrou2008-08-191-1/+1
* Remove os.path.walkBenjamin Peterson2008-05-081-39/+1
* Merged revisions 59703-59773 via svnmerge fromChristian Heimes2008-01-061-2/+4
* Merged revisions 57221-57391 via svnmerge fromGuido van Rossum2007-08-241-1/+3
* Merged revisions 53952-54987 via svnmerge fromGuido van Rossum2007-04-271-9/+19
* Four months of trunk changes (including a few releases...)Thomas Wouters2006-12-131-76/+11
* Bug #1266283: lexists() is not exported from os.pathGeorg Brandl2005-08-221-2/+2
* Bug #1213894: os.path.realpath didn't resolve symlinks that were the firstGeorg Brandl2005-06-031-1/+1
* Patch #941486: add os.path.lexists(). Also fix bug #940578 by using lexists i...Johannes Gijsbers2004-08-301-0/+11
* Whitespace normalization.Tim Peters2004-08-201-3/+3
* bug #990669: os.path.realpath() will resolve symlinks before normalizing theJohannes Gijsbers2004-08-141-7/+9
* Use isabs() in conditional, not abspathAndrew M. Kuchling2004-08-021-1/+1
* Whitespace normalization, via reindent.py.Tim Peters2004-07-181-1/+1
* Remove tabs introduced in last commit.Brett Cannon2004-07-111-4/+4
* posixpath.realpath() now detects symlink loops and returns the path just beforeBrett Cannon2004-07-101-6/+30
* Feature request #935915: Add os.path.devnull.Martin v. Löwis2004-06-081-1/+2
* fix various descriptions of "ctime"Fred Drake2004-05-121-1/+1
* SF Patch 681780: Faster commonprefix (OS independent)Raymond Hettinger2003-12-311-10/+7
* SF patch #834015: Remove imports of unused modulesRaymond Hettinger2003-11-021-1/+0
* back out the darwin supports_unicode_filenames patch; it causes deep problems...Just van Rossum2003-07-171-4/+1
* [ 767645 ] correctly set the os.path.supports_unicode_filenames flag for OSXJust van Rossum2003-07-111-1/+5
* Use find() instead of looping over the string in expanduser().Walter Dörwald2003-06-191-4/+4
* Modernize Lib/posixpath.py: Use startswith(), endswith(), rstrip(),Walter Dörwald2003-06-171-15/+16
* Migrate definitions of several platform-dependent path-related variablesSkip Montanaro2003-02-141-0/+10
* Fix SF #659228, 'realpath' function missing from os.pathNeal Norwitz2003-01-031-1/+2
* Patch #658927: Add getctime to os.path.Martin v. Löwis2002-12-311-1/+4
* Patch #536661: Improve performance of splitext. Add test_macpath.Martin v. Löwis2002-12-121-14/+5
* Whitespace normalization.Tim Peters2002-11-091-1/+0
* Add os.path.supports_unicode_filenames for all platforms,Mark Hammond2002-10-081-1/+4
* SF # 555779, import user doesn't work with CGIsNeal Norwitz2002-09-051-2/+4
* Remove another reference to stat.ST_MODENeal Norwitz2002-06-061-1/+1
* Replaced obsolete stat module constants with equivalent attributesRaymond Hettinger2002-06-011-15/+12
* SF 563203. Replaced 'has_key()' with 'in'.Raymond Hettinger2002-06-011-2/+2
* Partial introduction of bools where appropriate.Guido van Rossum2002-04-071-4/+4
* Convert a pile of obvious "yes/no" functions to return bool.Tim Peters2002-04-041-7/+7
* SF bug [#469732] os.path.walk docstring inconsistent.Tim Peters2001-10-101-4/+14
* Whitespace normalization.Tim Peters2001-09-181-1/+1
* SF patch #461781 by Chris Lawrence: os.path.realpath - Resolve symlinks:Guido van Rossum2001-09-171-0/+21
* In walk(), don't die when os.lstat() raises os.error, e.g. because aGuido van Rossum2001-04-161-1/+4
* __all__ for several more modulesSkip Montanaro2001-02-121-0/+5
* Whitespace normalization.Tim Peters2001-02-091-1/+1
ldren; while (ltkey[idx].nkey) H5B_decode_key (f, bt, idx); + if (!bt->key[idx].nkey && H5B_decode_key (f, bt, idx)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); + } memcpy (lt_key, bt->key[idx].nkey, type->sizeof_nkey); /* right key */ - if (!bt->key[idx+1].nkey) H5B_decode_key (f, bt, idx+1); + if (!bt->key[idx+1].nkey && H5B_decode_key (f, bt, idx+1)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); + } memcpy (rt_key, bt->key[idx+1].nkey, type->sizeof_nkey); /* compare */ @@ -936,23 +1099,33 @@ H5B_insert_helper (hdf5_file_t *f, haddr_t addr, const H5B_class_t *type, * function needs them as input. Don't worry about it at higher node * levels because this function uses them for output only. */ - bt = H5AC_find (f, H5AC_BT, addr, type); + if (NULL==(bt=H5AC_find (f, H5AC_BT, addr, type))) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + } if (cmp<0 && idx<=0) { idx = 0; cmp = 0; if (0==bt->level && bt->nchildren) { - if (!bt->key[idx].nkey) H5B_decode_key (f, bt, idx); + if (!bt->key[idx].nkey && H5B_decode_key (f, bt, idx)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); + } memcpy (lt_key, bt->key[idx].nkey, type->sizeof_nkey); - if (!bt->key[idx+1].nkey) H5B_decode_key (f, bt, idx+1); + if (!bt->key[idx+1].nkey && H5B_decode_key (f, bt, idx+1)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); + } memcpy (rt_key, bt->key[idx+1].nkey, type->sizeof_nkey); } } else if (cmp>0 && idx+1>=bt->nchildren) { idx = bt->nchildren-1; cmp = 0; if (0==bt->level && bt->nchildren) { - if (!bt->key[idx].nkey) H5B_decode_key (f, bt, idx); + if (!bt->key[idx].nkey && H5B_decode_key (f, bt, idx)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); + } memcpy (lt_key, bt->key[idx].nkey, type->sizeof_nkey); - if (!bt->key[idx+1].nkey) H5B_decode_key (f, bt, idx+1); + if (!bt->key[idx+1].nkey && H5B_decode_key (f, bt, idx+1)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); + } memcpy (rt_key, bt->key[idx+1].nkey, type->sizeof_nkey); } } @@ -965,9 +1138,12 @@ H5B_insert_helper (hdf5_file_t *f, haddr_t addr, const H5B_class_t *type, * buffers are output values. */ if (0==bt->nchildren) { - child = (type->new)(f, lt_key, udata, rt_key); - if (child<=0) goto error; - bt = H5AC_find (f, H5AC_BT, addr, type); + if ((child = (type->new)(f, lt_key, udata, rt_key))<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTINIT, FAIL); + } + if (NULL==(bt=H5AC_find (f, H5AC_BT, addr, type))) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + } bt->nchildren = 1; bt->dirty += 1; bt->ndirty = 1; @@ -998,8 +1174,10 @@ H5B_insert_helper (hdf5_file_t *f, haddr_t addr, const H5B_class_t *type, md_key, udata, rt_key, rt_key_changed); } - if (child<0) goto error; - bt = H5AC_find (f, H5AC_BT, addr, type); + if (child<0) HRETURN_ERROR (H5E_BTREE, H5E_CANTINSERT, FAIL); + if (NULL==(bt=H5AC_find (f, H5AC_BT, addr, type))) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + } /* * Update the left and right keys. @@ -1032,7 +1210,9 @@ H5B_insert_helper (hdf5_file_t *f, haddr_t addr, const H5B_class_t *type, * and that `idx' is adjusted appropriately. */ if (child && bt->nchildren==2*type->k) { - twin = H5B_split (f, type, addr, anchor); + if ((twin = H5B_split (f, type, addr, anchor))<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTSPLIT, FAIL); + } if (idx<=type->k) { addr = H5B_ANCHOR_LT==anchor ? addr : twin; } else { @@ -1045,7 +1225,9 @@ H5B_insert_helper (hdf5_file_t *f, haddr_t addr, const H5B_class_t *type, * If the child split, then insert the new child. */ if (child) { - H5B_insert_child (f, type, addr, idx, child, anchor, md_key); + if (H5B_insert_child (f, type, addr, idx, child, anchor, md_key)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTINSERT, FAIL); + } } /* @@ -1053,24 +1235,24 @@ H5B_insert_helper (hdf5_file_t *f, haddr_t addr, const H5B_class_t *type, * by the left and right node). */ if (twin) { - bt = H5AC_find (f, H5AC_BT, twin, type); + if (NULL==(bt=H5AC_find (f, H5AC_BT, twin, type))) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + } if (H5B_ANCHOR_LT==anchor) { - if (!bt->key[0].nkey) { - H5B_decode_key (f, bt, 0); + if (!bt->key[0].nkey && H5B_decode_key (f, bt, 0)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); } memcpy (md_key, bt->key[0].nkey, type->sizeof_nkey); } else { - if (!bt->key[bt->nchildren].nkey) { - H5B_decode_key (f, bt, bt->nchildren); + if (!bt->key[bt->nchildren].nkey && + H5B_decode_key (f, bt, bt->nchildren)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTDECODE, FAIL); } memcpy (md_key, bt->key[bt->nchildren].nkey, type->sizeof_nkey); } } - return twin; - -error: - return -1; + FUNC_LEAVE (twin); } @@ -1080,12 +1262,12 @@ error: * Purpose: Calls the list callback for each leaf node of the * B-tree, passing it the UDATA structure. * - * Return: Success: 0 + * Return: Success: SUCCEED * - * Failure: -1 + * Failure: FAIL * * Programmer: Robb Matzke - * robb@maya.nuance.com + * matzke@llnl.gov * Jun 23 1997 * * Modifications: @@ -1098,27 +1280,39 @@ H5B_list (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr, void *udata) H5B_t *bt; haddr_t *child=NULL; haddr_t twin; - intn i, nchildren, status; - herr_t (*list)(hdf5_file_t*,haddr_t,void*); + intn i, nchildren; + herr_t (*list)(hdf5_file_t*,haddr_t,void*) = NULL; + FUNC_ENTER (H5B_list, NULL, FAIL); + + /* + * Check arguments. + */ + assert (f); assert (type); assert (type->list); + assert (addr>=0); + assert (udata); - bt = H5AC_find (f, H5AC_BT, addr, type); - if (!bt) return -1; + if (NULL==(bt = H5AC_find (f, H5AC_BT, addr, type))) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + } if (bt->level>0) { - return H5B_list (f, type, bt->child[0], udata); + if (H5B_list (f, type, bt->child[0], udata)<0) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTLIST, FAIL); + } else { + HRETURN (SUCCEED); + } } else { child = H5MM_xmalloc (2 * type->k * sizeof(haddr_t)); list = type->list; twin = addr; while (twin) { /*for each leaf node*/ - bt = H5AC_find (f, H5AC_BT, twin, type); - if (!bt) { + if (NULL==(bt=H5AC_find (f, H5AC_BT, twin, type))) { H5MM_xfree (child); - return -1; + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); } nchildren = bt->nchildren; twin = bt->right; @@ -1126,16 +1320,16 @@ H5B_list (hdf5_file_t *f, const H5B_class_t *type, haddr_t addr, void *udata) bt = NULL; /*list callback may invalidate the cache*/ for (i=0; i0); + + /* + * Total native key size. + */ if (total_nkey_size) { *total_nkey_size = (2 * type->k + 1) * type->sizeof_nkey; } - return (H5B_SIZEOF_HDR(f) + /*node header */ + /* + * Total node size. + */ + size = (H5B_SIZEOF_HDR(f) + /*node header */ 2 * type->k * H5F_SIZEOF_OFFSET(f) + /*child pointers*/ (2*type->k+1) * sizeof_rkey); /*keys */ + + FUNC_LEAVE (size); } @@ -1181,12 +1394,12 @@ H5B_nodesize (hdf5_file_t *f, const H5B_class_t *type, * * Purpose: Prints debugging info about a B-tree. * - * Return: Success: 0 + * Return: Success: SUCCEED * - * Failure: -1 + * Failure: FAIL * * Programmer: Robb Matzke - * robb@maya.nuance.com + * matzke@llnl.gov * Aug 4 1997 * * Modifications: @@ -1197,10 +1410,30 @@ herr_t H5B_debug (hdf5_file_t *f, haddr_t addr, FILE *stream, intn indent, intn fwidth, const H5B_class_t *type) { - H5B_t *bt = H5AC_find (f, H5AC_BT, addr, type); + H5B_t *bt = NULL; + + FUNC_ENTER (H5B_debug, NULL, FAIL); + + /* + * Check arguments. + */ + assert (f); + assert (addr>=0); + assert (stream); + assert (indent>=0); + assert (fwidth>=0); + assert (type); - if (!bt) return -1; + /* + * Load the tree node. + */ + if (NULL==(bt=H5AC_find (f, H5AC_BT, addr, type))) { + HRETURN_ERROR (H5E_BTREE, H5E_CANTLOAD, FAIL); + } + /* + * Print the values. + */ fprintf (stream, "%*s%-*s %d\n", indent, "", fwidth, "Tree type ID:", (int)(bt->type->id)); @@ -1225,5 +1458,6 @@ H5B_debug (hdf5_file_t *f, haddr_t addr, FILE *stream, intn indent, fprintf (stream, "%*s%-*s %d\n", indent, "", fwidth, "Number of children:", (int)(bt->nchildren)); - return 0; + + FUNC_LEAVE (SUCCEED); } diff --git a/src/H5Bprivate.h b/src/H5Bprivate.h index bb9d95c..4364203 100644 --- a/src/H5Bprivate.h +++ b/src/H5Bprivate.h @@ -52,8 +52,8 @@ typedef struct H5B_class_t { haddr_t (*insert)(hdf5_file_t*,haddr_t,int*,void*,int*,void*,void*, void*,int*); herr_t (*list)(hdf5_file_t*,haddr_t,void*); - void (*decode)(hdf5_file_t*,uint8*,void*); - void (*encode)(hdf5_file_t*,uint8*,void*); + herr_t (*decode)(hdf5_file_t*,uint8*,void*); + herr_t (*encode)(hdf5_file_t*,uint8*,void*); } H5B_class_t; /* diff --git a/src/H5Bproto.h b/src/H5Bproto.h index 3869db4..b1eb82c 100644 --- a/src/H5Bproto.h +++ b/src/H5Bproto.h @@ -6,7 +6,7 @@ * * Created: H5Bproto.h * Jul 10 1997 - * Robb Matzke + * Robb Matzke * * Purpose: Non-API function prototypes for B-link trees. * diff --git a/src/H5Eprivate.h b/src/H5Eprivate.h index d21adde..d36b2a2 100644 --- a/src/H5Eprivate.h +++ b/src/H5Eprivate.h @@ -58,6 +58,10 @@ static const hdf_maj_error_messages_t hdf_maj_error_messages[] = {H5E_FUNC, "Function Entry/Exit"}, {H5E_ATOM, "Object Atom"}, {H5E_CACHE, "Object Cache"}, + {H5E_BTREE, "B-Tree Node"}, + {H5E_SYM, "Symbol Table"}, + {H5E_HEAP, "Heap"}, + {H5E_OHDR, "Object Header"}, }; typedef struct @@ -90,6 +94,16 @@ static const hdf_min_error_messages_t hdf_min_error_messages[] = {H5E_CANTREGISTER, "Can't register new atom"}, {H5E_CANTFLUSH, "Can't flush object from cache"}, {H5E_CANTLOAD, "Can't load object into cache"}, + {H5E_NOTFOUND, "Object not found"}, + {H5E_CANTENCODE, "Can't encode value"}, + {H5E_CANTDECODE, "Can't decode value"}, + {H5E_CANTSPLIT, "Can't split node"}, + {H5E_CANTINSERT, "Can't insert object"}, + {H5E_CANTLIST, "Can't list node"}, + {H5E_LINKCOUNT, "Bad object header link count"}, + {H5E_VERSION, "Wrong version number"}, + {H5E_ALIGNMENT, "Alignment error"}, + {H5E_BADMESG, "Unrecognized message"}, }; /* We use a stack to hold the errors plus we keep track of the function, diff --git a/src/H5Eproto.h b/src/H5Eproto.h index c51ceac..95c198c 100644 --- a/src/H5Eproto.h +++ b/src/H5Eproto.h @@ -77,7 +77,11 @@ typedef enum H5E_IO, /* Low-level I/O */ H5E_FUNC, /* Function Entry/Exit */ H5E_ATOM, /* Object Atom */ - H5E_CACHE /* Object Cache */ + H5E_CACHE, /* Object Cache */ + H5E_BTREE, /* B-Tree Node */ + H5E_SYM, /* Symbol Table */ + H5E_HEAP, /* Heap */ + H5E_OHDR /* Object Header */ } hdf_maj_err_code_t; @@ -118,7 +122,21 @@ typedef enum /* Cache related errors */ H5E_CANTFLUSH, /* Can't flush object from cache */ - H5E_CANTLOAD /* Can't load object into cache */ + H5E_CANTLOAD, /* Can't load object into cache */ + + /* B-tree related errors */ + H5E_NOTFOUND, /* Object not found */ + H5E_CANTENCODE, /* Can't encode value */ + H5E_CANTDECODE, /* Can't decode value */ + H5E_CANTSPLIT, /* Can't split node */ + H5E_CANTINSERT, /* Can't insert object */ + H5E_CANTLIST, /* Can't list node */ + + /* Object header related errors */ + H5E_LINKCOUNT, /* Bad object header link count */ + H5E_VERSION, /* Wrong version number */ + H5E_ALIGNMENT, /* Alignment error */ + H5E_BADMESG /* Unrecognized message */ } hdf_min_err_code_t; diff --git a/src/H5F.c b/src/H5F.c index 3c756c4..145e4a7 100644 --- a/src/H5F.c +++ b/src/H5F.c @@ -32,6 +32,8 @@ static char RcsId[] = "@(#)$Revision$"; H5F_init_interface -- initialize the H5F interface */ +#include + #define HDF5_FILE_MASTER #include "hdf5.h" #undef HDF5_FILE_MASTER @@ -318,7 +320,7 @@ done: * Failure: NULL * * Programmer: Robb Matzke - * robb@maya.nuance.com + * matzke@llnl.gov * Jul 18 1997 * * Modifications: @@ -353,7 +355,7 @@ H5F_new (void) * Failure: NULL * * Programmer: Robb Matzke - * robb@maya.nuance.com + * matzke@llnl.gov * Jul 18 1997 * * Modifications: @@ -495,7 +497,9 @@ hatom_t H5Fcreate(const char *filename, uintn flags, hatom_t create_temp, hatom_ H5F_encode_offset(new_file,p,new_file->smallobj_off); /* Encode offset of global small-object heap */ H5F_encode_offset(new_file,p,new_file->freespace_off); /* Encode offset of global free-space heap */ /* Predict the header length and encode it: */ - H5F_encode_length(new_file,p,(p-temp_buf)+f_create_parms->length_size+H5F_symbol_table_size(new_file)); /* Encode length of boot-block */ + H5F_encode_length(new_file,p,((p-temp_buf) + + H5F_SIZEOF_SIZE(new_file) + + H5G_SIZEOF_ENTRY(new_file))); /* Encode the (bogus) symbol-table entry */ if (H5G_encode (new_file, &p, new_file->root_sym)<0) { @@ -779,7 +783,7 @@ done: * Failure: FAIL * * Programmer: Robb Matzke - * robb@maya.nuance.com + * matzke@llnl.gov * Jul 10 1997 * * Modifications: @@ -789,7 +793,7 @@ done: herr_t H5F_block_read (hdf5_file_