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
Widen the range of allowed cell broadcast channels #35
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 |
|---|---|---|
|
|
@@ -4593,12 +4593,13 @@ static gboolean next_range(const char *str, int *offset, gint *min, gint *max) | |
| GSList *cbs_optimize_ranges(GSList *ranges) | ||
| { | ||
| struct cbs_topic_range *range; | ||
| unsigned char bitmap[125]; | ||
| int bitmap_len = CBS_MAX_TOPIC / 8 + 1; | ||
| unsigned char (*bitmap)[bitmap_len]; | ||
| GSList *l; | ||
| unsigned short i; | ||
| GSList *ret = NULL; | ||
|
|
||
| memset(bitmap, 0, sizeof(bitmap)); | ||
| bitmap = g_malloc0(bitmap_len); | ||
|
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. then this |
||
|
|
||
| for (l = ranges; l; l = l->next) { | ||
| range = l->data; | ||
|
|
@@ -4607,17 +4608,17 @@ GSList *cbs_optimize_ranges(GSList *ranges) | |
| int byte_offset = i / 8; | ||
| int bit = i % 8; | ||
|
|
||
| bitmap[byte_offset] |= 1 << bit; | ||
| *bitmap[byte_offset] |= 1 << bit; | ||
|
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. and this isn't necessary (besides this extra indirection seems to be wrong) |
||
| } | ||
| } | ||
|
|
||
| range = NULL; | ||
|
|
||
| for (i = 0; i <= 999; i++) { | ||
| for (i = 0; i <= CBS_MAX_TOPIC; i++) { | ||
| int byte_offset = i / 8; | ||
| int bit = i % 8; | ||
|
|
||
| if (is_bit_set(bitmap[byte_offset], bit) == FALSE) { | ||
| if (is_bit_set(*bitmap[byte_offset], bit) == FALSE) { | ||
|
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. and this too is unnecessary |
||
| if (range) { | ||
| ret = g_slist_prepend(ret, range); | ||
| range = NULL; | ||
|
|
@@ -4641,6 +4642,7 @@ GSList *cbs_optimize_ranges(GSList *ranges) | |
|
|
||
| ret = g_slist_reverse(ret); | ||
|
|
||
| g_free(bitmap); | ||
| return ret; | ||
| } | ||
|
|
||
|
|
@@ -4653,10 +4655,10 @@ GSList *cbs_extract_topic_ranges(const char *ranges) | |
| GSList *tmp; | ||
|
|
||
| while (next_range(ranges, &offset, &min, &max) == TRUE) { | ||
| if (min < 0 || min > 999) | ||
| if (min < 0 || min > CBS_MAX_TOPIC) | ||
| return NULL; | ||
|
|
||
| if (max < 0 || max > 999) | ||
| if (max < 0 || max > CBS_MAX_TOPIC) | ||
| return NULL; | ||
|
|
||
| if (max < min) | ||
|
|
||
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.
This can be replaced with just one line: