mirror of
https://git.tartarus.org/simon/putty.git
synced 2025-03-22 14:39:24 -05:00
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:
parent
1e1f06b2ec
commit
66b776ae6e
@ -377,6 +377,7 @@ static void gprefs_from_str(const char *str,
|
|||||||
*/
|
*/
|
||||||
while (n < nvals) {
|
while (n < nvals) {
|
||||||
for (i = 0; i < nvals; i++) {
|
for (i = 0; i < nvals; i++) {
|
||||||
|
assert(mapping[i].v >= 0);
|
||||||
assert(mapping[i].v < 32);
|
assert(mapping[i].v < 32);
|
||||||
|
|
||||||
if (!(seen & (1 << mapping[i].v))) {
|
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;
|
for (i = HASH(c) & (ctx->n - 1); ctx->h[i] != HASH_UNUSED;
|
||||||
i = (i + 1) & (ctx->n - 1)) {
|
i = (i + 1) & (ctx->n - 1)) {
|
||||||
if (ctx->h[i] == HASH_IV) {
|
if (ctx->h[i] == HASH_IV) {
|
||||||
|
assert(IV); /* or we wouldn't have stored HASH_IV above */
|
||||||
if (!CMP(c, IV)) {
|
if (!CMP(c, IV)) {
|
||||||
if (check_crc(c, buf, len, IV))
|
if (check_crc(c, buf, len, IV))
|
||||||
return true; /* attack detected */
|
return true; /* attack detected */
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
* gtkcols.c - implementation of the `Columns' GTK layout container.
|
* gtkcols.c - implementation of the `Columns' GTK layout container.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <assert.h>
|
||||||
#include <gtk/gtk.h>
|
#include <gtk/gtk.h>
|
||||||
#include "defs.h"
|
#include "defs.h"
|
||||||
#include "gtkcompat.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);
|
childwidth = get_width(child);
|
||||||
colspan = child->colspan ? child->colspan : ncols-child->colstart;
|
colspan = child->colspan ? child->colspan : ncols-child->colstart;
|
||||||
|
assert(colspan > 0);
|
||||||
|
|
||||||
#ifdef COLUMNS_WIDTH_DIAGNOSTICS
|
#ifdef COLUMNS_WIDTH_DIAGNOSTICS
|
||||||
printf("compute_width(%p): ", cols);
|
printf("compute_width(%p): ", cols);
|
||||||
|
@ -1850,8 +1850,9 @@ GtkWidget *layout_ctrls(struct dlgparam *dp, struct Shortcuts *scs,
|
|||||||
GtkWidget *ret;
|
GtkWidget *ret;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
if (!s->boxname && s->boxtitle) {
|
if (!s->boxname) {
|
||||||
/* This controlset is a panel title. */
|
/* This controlset is a panel title. */
|
||||||
|
assert(s->boxtitle);
|
||||||
return gtk_label_new(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;
|
draw_layout = pango_cairo_draw_layout;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
assert(draw_layout);
|
||||||
|
|
||||||
if (wide)
|
if (wide)
|
||||||
cellwidth *= 2;
|
cellwidth *= 2;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user