bool Value::CZString::operator==( const CZString &other ) const { if ( cstr_ ) return wstrcmp( cstr_, other.cstr_ ) == 0; return index_ == other.index_; }
static struct nlist *lookup(char *s) { struct nlist *np; for (np = hashtab[hash(s)]; np != NULL; np = np->next) if (wstrcmp(s, np->name) == 0) return np; return NULL; }
static Dict *lookup(char *s) { Dict *np; for (np = hashtab[hash(s)]; np != null; np = np->next) if (wstrcmp(s, np->name) == 0) return np; return null; }
void HelloMessage(FILE *errout, char *date, char *filename) { currentFile = filename; /* for use with Gnu Emacs */ if (wstrcmp(filename, "stdin") == 0) tidy_out(errout, "\nTidy (vers %s) Parsing console input (stdin)\n", date); else tidy_out(errout, "\nTidy (vers %s) Parsing \"%s\"\n", date, filename); }
bool Value::operator ==( const Value &other ) const { //if ( type_ != other.type_ ) // GCC 2.95.3 says: // attempt to take address of bit-field structure member `Json::Value::type_' // Beats me, but a temp solves the problem. int temp = other.type_; if ( type_ != temp ) return false; switch ( type_ ) { case nullValue: return true; case intValue: return value_.int_ == other.value_.int_; case uintValue: return value_.uint_ == other.value_.uint_; case realValue: return value_.real_ == other.value_.real_; case booleanValue: return value_.bool_ == other.value_.bool_; case stringValue: return ( value_.string_ == other.value_.string_ ) || ( other.value_.string_ && value_.string_ && wstrcmp( value_.string_, other.value_.string_ ) == 0 ); #ifndef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: case objectValue: return value_.map_->size() == other.value_.map_->size() && (*value_.map_) == (*other.value_.map_); #else case arrayValue: return value_.array_->compare( *(other.value_.array_) ) == 0; case objectValue: return value_.map_->compare( *(other.value_.map_) ) == 0; #endif default: JSON_ASSERT_UNREACHABLE; } return 0; // unreachable }
bool Value::operator <( const Value &other ) const { int typeDelta = type_ - other.type_; if ( typeDelta ) return typeDelta < 0 ? true : false; switch ( type_ ) { case nullValue: return false; case intValue: return value_.int_ < other.value_.int_; case uintValue: return value_.uint_ < other.value_.uint_; case realValue: return value_.real_ < other.value_.real_; case booleanValue: return value_.bool_ < other.value_.bool_; case stringValue: return ( value_.string_ == 0 && other.value_.string_ ) || ( other.value_.string_ && value_.string_ && wstrcmp( value_.string_, other.value_.string_ ) < 0 ); #ifndef JSON_VALUE_USE_INTERNAL_MAP case arrayValue: case objectValue: { int delta = int( value_.map_->size() - other.value_.map_->size() ); if ( delta ) return delta < 0; return (*value_.map_) < (*other.value_.map_); } #else case arrayValue: return value_.array_->compare( *(other.value_.array_) ) < 0; case objectValue: return value_.map_->compare( *(other.value_.map_) ) < 0; #endif default: JSON_ASSERT_UNREACHABLE; } return 0; // unreachable }
EXPORT char * __WJEStringN(WJElement container, const char *path, WJEAction action, WJElement *last, const char *value, size_t len, const char *file, const int line) { _WJElement *e; /* Find an element that is appropriate for the given action, creating new elements as needed. */ e = _WJESearch(container, path, &action, last ? *last : NULL, file, line); if (e) { switch (e->pub.type) { case WJR_TYPE_UNKNOWN: /* A new object was created, and the changes count has already been updated. */ e->pub.type = WJR_TYPE_STRING; break; case WJR_TYPE_STRING: if (!e->value.string && !value) { break; } if (e->value.string && value && !wstrcmp(e->value.string, value, action)) { break; } /* fallthrough */ default: if (WJE_GET != (action & WJE_ACTION_MASK)) { _WJEChanged(e); } break; } } if (last) *last = (WJElement) e; switch ((action & WJE_ACTION_MASK)) { default: case WJE_GET: if (!e) return((char *) value); switch (e->pub.type) { case WJR_TYPE_STRING: if (e->value.string) { return(e->value.string); } else { break; } case WJR_TYPE_BOOL: case WJR_TYPE_TRUE: case WJR_TYPE_FALSE: if (e->value.boolean) { return("true"); } else { return("false"); } default: case WJR_TYPE_NUMBER: #ifdef WJE_DISTINGUISH_INTEGER_TYPE case WJR_TYPE_INTEGER: #endif case WJR_TYPE_UNKNOWN: case WJR_TYPE_NULL: case WJR_TYPE_OBJECT: case WJR_TYPE_ARRAY: break; } return((char *) value); case WJE_SET: case WJE_NEW: case WJE_PUT: if ((e = _WJEReset(e, WJR_TYPE_STRING))) { if (!value) { return((e->value.string = NULL)); } else { e->value.string = MemMallocWait(len + 1); strncpy(e->value.string, value, len); e->value.string[len] = '\0'; MemUpdateOwner(e->value.string, file, line); e->pub.length = len; return(e->value.string); } } else { return(NULL); } } }