port_proxy.cc (14009:a4b36ce75361) | port_proxy.cc (14012:1bdf42ed6add) |
---|---|
1/* 2 * Copyright (c) 2012, 2018 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 96 unchanged lines hidden (view full) --- 105 uint8_t c; 106 if (!tryReadBlob(addr++, &c, 1)) 107 return false; 108 if (!c) 109 return true; 110 str += c; 111 } 112} | 1/* 2 * Copyright (c) 2012, 2018 ARM Limited 3 * All rights reserved 4 * 5 * The license below extends only to copyright in the software and shall 6 * not be construed as granting a license to any other intellectual 7 * property including but not limited to intellectual property relating 8 * to a hardware implementation of the functionality of the software --- 96 unchanged lines hidden (view full) --- 105 uint8_t c; 106 if (!tryReadBlob(addr++, &c, 1)) 107 return false; 108 if (!c) 109 return true; 110 str += c; 111 } 112} |
113 114bool 115PortProxy::tryReadString(char *str, Addr addr, size_t maxlen) const 116{ 117 assert(maxlen); 118 while (maxlen--) { 119 if (!tryReadBlob(addr++, str, 1)) 120 return false; 121 if (!*str++) 122 return true; 123 } 124 // We ran out of room, so back up and add a terminator. 125 *--str = '\0'; 126 return true; 127} |
|