if (errno != 0 || value < 0) {
return 0;
}
+#if defined(HAVE_WIN32)
+ /* work around microsofts non handling of uint64 to double cvt*/
+ *rtn_value = (uint64_t)(value * (__int64)mult[i]);
+ Dmsg2(400, "Full value = %lf %" lld "\n", value * (__int64)mult[i],
+ (uint64_t)(value * (__int64)mult[i]));
+#else
*rtn_value = (uint64_t)(value * mult[i]);
Dmsg2(400, "Full value = %lf %" lld "\n", value * mult[i],
(uint64_t)(value * mult[i]));
+#endif
return 1;
}
return digit_seen && *n==0;
}
+/*
+ * Check if Bacula Resoure Name is valid
+ */
+/*
+ * Check if the Volume name has legal characters
+ * If ua is non-NULL send the message
+ */
+bool is_name_valid(char *name, POOLMEM **msg)
+{
+ int len;
+ char *p;
+ /* Special characters to accept */
+ const char *accept = ":.-_ ";
+
+ /* Restrict the characters permitted in the Volume name */
+ for (p=name; *p; p++) {
+ if (B_ISALPHA(*p) || B_ISDIGIT(*p) || strchr(accept, (int)(*p))) {
+ continue;
+ }
+ if (msg) {
+ Mmsg(msg, _("Illegal character \"%c\" in name.\n"), *p);
+ }
+ return false;
+ }
+ len = strlen(name);
+ if (len >= MAX_NAME_LENGTH) {
+ if (msg) {
+ Mmsg(msg, _("Name too long.\n"));
+ }
+ return false;
+ }
+ if (len == 0) {
+ if (msg) {
+ Mmsg(msg, _("Volume name must be at least one character long.\n"));
+ }
+ return false;
+ }
+ return true;
+}
+
+
+
/*
* Add commas to a string, which is presumably
* a number.