- Timestamp:
- 09/04/17 03:24:01 (7 years ago)
- Location:
- cpp
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
cpp/common/Convert.h
r286 r691 15 15 typedef XY<double> Pt2D; 16 16 17 #ifdef LINUX 18 #define UINT64_FORMAT "%llu" //we want to avoid this and ambiguous "long long", but gcc does not seem to support I64u (yet?) 19 #else 20 #define UINT64_FORMAT "%I64u" 21 #endif 17 22 18 23 struct Convert -
cpp/frams/util/sstringutils.cpp
r529 r691 7 7 #include <common/log.h> 8 8 #include <common/nonstd.h> 9 #include <common/Convert.h> 9 10 10 11 int loadSString(const char* filename, SString& s, const char* framsgmodule, const char* error, bool remove_cr) … … 19 20 } 20 21 else if (framsgmodule) 21 logPrintf(framsgmodule, "loadSString", LOG_WARN, error ? error : " can't open file \"%s\"", filename);22 logPrintf(framsgmodule, "loadSString", LOG_WARN, error ? error : "Can't open file \"%s\"", filename); 22 23 return ret; 23 24 } … … 323 324 } 324 325 326 SString getUIDString(uint64_t uid, char prefix) 327 { 328 return SString::sprintf("%c" UINT64_FORMAT, prefix, uid); 329 } 330 331 bool parseUIDString(const char* str, char prefix, uint64_t &uid, bool err) 332 { 333 if ((str[0] == prefix) && (isdigit(str[1]))) 334 { 335 char* end; 336 uid = strtoull(str + 1, &end, 10); 337 if (end == (str + 1 + strlen(str + 1))) 338 return true; 339 } 340 if (err) 341 logPrintf("SString", "parseUIDString", LOG_ERROR, "Invalid uid: '%s'", str); 342 return false; 343 } -
cpp/frams/util/sstringutils.h
r529 r691 10 10 11 11 /// return: 1=ok 0=error 12 int loadSString(const char* filename, SString& s, const char* framsgmodule = 0, const char* error = 0, bool remove_cr =true);13 void loadSString(VirtFILE *f, SString& s, bool remove_cr =true);12 int loadSString(const char* filename, SString& s, const char* framsgmodule = 0, const char* error = 0, bool remove_cr = true); 13 void loadSString(VirtFILE *f, SString& s, bool remove_cr = true); 14 14 bool loadSStringLine(VirtFILE* f, SString &s); 15 15 … … 30 30 bool matchWildcard(const SString& word, const SString& pattern);///< '*' in pattern matches any substring 31 31 bool matchWildcardList(const SString& word, const SString& patterns);///< patterns is a list of patterns (separated by ',') 32 SString getUIDString(uint64_t uid, char prefix); 33 bool parseUIDString(const char* str, char prefix, uint64_t &uid, bool err); 32 34 33 35 #endif
Note: See TracChangeset
for help on using the changeset viewer.