зеркало из https://github.com/github/putty.git
Add some more miscellaneous asserts.
These clarify matters for static checkers (not to mention humans), and seem inexpensive enough not to worry about adding.
This commit is contained in:
Родитель
1e1f06b2ec
Коммит
66b776ae6e
|
@ -377,6 +377,7 @@ static void gprefs_from_str(const char *str,
|
|||
*/
|
||||
while (n < nvals) {
|
||||
for (i = 0; i < nvals; i++) {
|
||||
assert(mapping[i].v >= 0);
|
||||
assert(mapping[i].v < 32);
|
||||
|
||||
if (!(seen & (1 << mapping[i].v))) {
|
||||
|
|
|
@ -149,6 +149,7 @@ bool detect_attack(
|
|||
for (i = HASH(c) & (ctx->n - 1); ctx->h[i] != HASH_UNUSED;
|
||||
i = (i + 1) & (ctx->n - 1)) {
|
||||
if (ctx->h[i] == HASH_IV) {
|
||||
assert(IV); /* or we wouldn't have stored HASH_IV above */
|
||||
if (!CMP(c, IV)) {
|
||||
if (check_crc(c, buf, len, IV))
|
||||
return true; /* attack detected */
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
* gtkcols.c - implementation of the `Columns' GTK layout container.
|
||||
*/
|
||||
|
||||
#include <assert.h>
|
||||
#include <gtk/gtk.h>
|
||||
#include "defs.h"
|
||||
#include "gtkcompat.h"
|
||||
|
@ -662,6 +663,7 @@ static gint columns_compute_width(Columns *cols, widget_dim_fn_t get_width)
|
|||
|
||||
childwidth = get_width(child);
|
||||
colspan = child->colspan ? child->colspan : ncols-child->colstart;
|
||||
assert(colspan > 0);
|
||||
|
||||
#ifdef COLUMNS_WIDTH_DIAGNOSTICS
|
||||
printf("compute_width(%p): ", cols);
|
||||
|
|
|
@ -1850,8 +1850,9 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
|
|||
GtkWidget *ret;
|
||||
int i;
|
||||
|
||||
if (!s->boxname && s->boxtitle) {
|
||||
if (!s->boxname) {
|
||||
/* This controlset is a panel title. */
|
||||
assert(s->boxtitle);
|
||||
return gtk_label_new(s->boxtitle);
|
||||
}
|
||||
|
||||
|
|
|
@ -1614,6 +1614,7 @@ static void pangofont_draw_internal(unifont_drawctx *ctx, unifont *font,
|
|||
draw_layout = pango_cairo_draw_layout;
|
||||
}
|
||||
#endif
|
||||
assert(draw_layout);
|
||||
|
||||
if (wide)
|
||||
cellwidth *= 2;
|
||||
|
|
Загрузка…
Ссылка в новой задаче