-
-
Notifications
You must be signed in to change notification settings - Fork 440
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
LLVM 19 related updates #1513
base: main
Are you sure you want to change the base?
LLVM 19 related updates #1513
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
|
@@ -311,7 +311,7 @@ static MaskItem* AffinityPanel_addObject(AffinityPanel* this, hwloc_obj_t obj, u | |||||
} | ||||||
|
||||||
/* "[x] " + "|- " * depth + ("- ")?(if root node) + name */ | ||||||
unsigned width = 4 + 3 * depth + (2 * !depth) + strlen(buf); | ||||||
unsigned width = 4 + 3 * depth + (2 * !depth) + (unsigned)strlen(buf); | ||||||
if (width > this->width) { | ||||||
this->width = width; | ||||||
} | ||||||
|
@@ -389,7 +389,7 @@ Panel* AffinityPanel_new(Machine* host, const Affinity* affinity, int* width) { | |||||
|
||||||
char number[16]; | ||||||
xSnprintf(number, 9, "CPU %d", Settings_cpuId(host->settings, i)); | ||||||
unsigned cpu_width = 4 + strlen(number); | ||||||
unsigned cpu_width = 4 + (unsigned) strlen(number); | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if (cpu_width > this->width) { | ||||||
this->width = cpu_width; | ||||||
} | ||||||
|
Original file line number | Diff line number | Diff line change | ||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
@@ -12,6 +12,7 @@ in the source distribution for its full text. | |||||||||
|
||||||||||
#include <assert.h> | ||||||||||
#include <ctype.h> | ||||||||||
#include <errno.h> | ||||||||||
#include <getopt.h> | ||||||||||
#include <locale.h> | ||||||||||
#include <stdbool.h> | ||||||||||
|
@@ -204,12 +205,15 @@ static CommandLineStatus parseArguments(int argc, char** argv, CommandLineSettin | |||||||||
if (!username) { | ||||||||||
flags->userId = geteuid(); | ||||||||||
} else if (!Action_setUserOnly(username, &(flags->userId))) { | ||||||||||
for (const char* itr = username; *itr; ++itr) | ||||||||||
if (!isdigit((unsigned char)*itr)) { | ||||||||||
fprintf(stderr, "Error: invalid user \"%s\".\n", username); | ||||||||||
return STATUS_ERROR_EXIT; | ||||||||||
} | ||||||||||
flags->userId = atol(username); | ||||||||||
char *endptr; | ||||||||||
errno = 0; | ||||||||||
unsigned long res = strtoul(username, &endptr, 10); | ||||||||||
unsigned castRes = (unsigned) res; | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||
if (*endptr != '\0' || res == ULONG_MAX || errno != 0 || castRes != res) { | ||||||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
or
Suggested change
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @BenBE I would say There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That's something the current version didn't check for … There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Before I can suggest a better code for this, I need one behavior clarified: |
||||||||||
fprintf(stderr, "Error: invalid user \"%s\".\n", username); | ||||||||||
return STATUS_ERROR_EXIT; | ||||||||||
} | ||||||||||
flags->userId = castRes; | ||||||||||
} | ||||||||||
break; | ||||||||||
} | ||||||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -112,7 +112,7 @@ struct Meter_ { | |
unsigned int param; | ||
GraphData drawData; | ||
int h; | ||
int columnWidthCount; /**< only used internally by the Header */ | ||
size_t columnWidthCount; /**< only used internally by the Header */ | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can't understand the reason why expanding the bit width of this |
||
uint8_t curItems; | ||
const int* curAttributes; | ||
char txtBuffer[METER_TXTBUFFER_LEN]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think for this algorithm, it's better for
s
to be insize_t
, and use(size_t)x
(upcast) for comparisons below. I think I would submit my propsed change in a separate PR.