From owner-svn-src-all@FreeBSD.ORG Thu Dec 12 08:55:25 2013 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 074F4EB1; Thu, 12 Dec 2013 08:55:25 +0000 (UTC) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id E79A91A35; Thu, 12 Dec 2013 08:55:24 +0000 (UTC) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.7/8.14.7) with ESMTP id rBC8tOa2016420; Thu, 12 Dec 2013 08:55:24 GMT (envelope-from theraven@svn.freebsd.org) Received: (from theraven@localhost) by svn.freebsd.org (8.14.7/8.14.7/Submit) id rBC8tO02016419; Thu, 12 Dec 2013 08:55:24 GMT (envelope-from theraven@svn.freebsd.org) Message-Id: <201312120855.rBC8tO02016419@svn.freebsd.org> From: David Chisnall Date: Thu, 12 Dec 2013 08:55:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r259250 - head/usr.bin/dtc X-SVN-Group: head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.17 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 12 Dec 2013 08:55:25 -0000 Author: theraven Date: Thu Dec 12 08:55:24 2013 New Revision: 259250 URL: http://svnweb.freebsd.org/changeset/base/259250 Log: Some more cleanups and bug fixes in dtc for property printing / parsing. Submitted by: Patrick Wildt Modified: head/usr.bin/dtc/fdt.cc Modified: head/usr.bin/dtc/fdt.cc ============================================================================== --- head/usr.bin/dtc/fdt.cc Thu Dec 12 08:48:45 2013 (r259249) +++ head/usr.bin/dtc/fdt.cc Thu Dec 12 08:55:24 2013 (r259250) @@ -137,7 +137,7 @@ property_value::resolve_type() break; } } - if (is_all_printable && (bytes > nuls)) + if ((is_all_printable && (bytes > nuls)) || bytes == 0) { type = STRING; if (nuls > 0) @@ -204,7 +204,7 @@ property_value::write_as_bytes(FILE *fil putc('[', file); for (byte_buffer::iterator i=byte_data.begin(), e=byte_data.end(); i!=e ; i++) { - fprintf(file, "%hhx", *i); + fprintf(file, "%02hhx", *i); if (i+1 != e) { putc(' ', file); @@ -367,6 +367,11 @@ property::property(input_buffer &structs return; } key = string(name_buffer); + + // If we're empty, do not push anything as value. + if (!length) + return; + // Read the value uint8_t byte; property_value v;