static BUF* buf_new(void)
{
BUF *p;
-
- if ((p = malloc(sizeof(BUF))) == NULL)
- return NULL;
+ p = malloc(sizeof(BUF));
+ if (!p) return NULL;
p->size = 0;
p->max_size = BUFSIZE;
- if ((p->data = malloc(BUFSIZE)) == NULL)
+ p->data = malloc(BUFSIZE);
+ if (!p->data)
{
free(p);
return NULL;
}
+
return p;
}
+
/*!
* @brief 転送用バッファの解放
* @param b 解放するバッファの参照ポインタ
free(b);
}
+
/*!
* @brief 転送用バッファにデータを追加する
* @param buf 追加先バッファの参照ポインタ
return buf->size;
}
+
/*!
* @brief 転送用バッファにフォーマット指定した文字列データを追加する
* @param buf 追加先バッファの参照ポインタ
}
#endif
+
/*!
* @brief HTTPによるダンプ内容伝送
* @param sd ソケットID
return strncmp(response_buf, HTTP_RESPONSE_CODE_OK, strlen(HTTP_RESPONSE_CODE_OK)) == 0;
}
+
/*!
* @brief キャラクタダンプを作って BUFに保存
* @param creature_ptr プレーヤーへの参照ポインタ
return (0);
}
+
/*!
* @brief スクリーンダンプを作成する/ Make screen dump to buffer
* @return 作成したスクリーンダンプの参照ポインタ
*/
concptr make_screen_dump(player_type *creature_ptr)
{
- BUF *screen_buf;
- int y, x, i;
- concptr ret;
-
- TERM_COLOR a = 0, old_a = 0;
- SYMBOL_CODE c = ' ';
-
static concptr html_head[] = {
"<html>\n<body text=\"#ffffff\" bgcolor=\"#000000\">\n",
"<pre>",
0,
};
- bool old_use_graphics = use_graphics;
-
int wid, hgt;
-
Term_get_size(&wid, &hgt);
/* Alloc buffer */
+ BUF *screen_buf;
screen_buf = buf_new();
if (screen_buf == NULL) return (NULL);
+ bool old_use_graphics = use_graphics;
if (old_use_graphics)
{
/* Clear -more- prompt first */
handle_stuff();
}
- for (i = 0; html_head[i]; i++)
+ for (int i = 0; html_head[i]; i++)
buf_sprintf(screen_buf, html_head[i]);
/* Dump the screen */
- for (y = 0; y < hgt; y++)
+ for (int y = 0; y < hgt; y++)
{
/* Start the row */
if (y != 0)
buf_sprintf(screen_buf, "\n");
/* Dump each row */
- for (x = 0; x < wid - 1; x++)
+ TERM_COLOR a = 0, old_a = 0;
+ SYMBOL_CODE c = ' ';
+ for (int x = 0; x < wid - 1; x++)
{
int rv, gv, bv;
concptr cc = NULL;
((y == 0 && x == 0) ? "" : "</font>"), rv, gv, bv);
old_a = a;
}
+
if (cc)
buf_sprintf(screen_buf, "%s", cc);
else
buf_sprintf(screen_buf, "%c", c);
}
}
+
buf_sprintf(screen_buf, "</font>");
- for (i = 0; html_foot[i]; i++)
+ for (int i = 0; html_foot[i]; i++)
buf_sprintf(screen_buf, html_foot[i]);
/* Screen dump size is too big ? */
+ concptr ret;
if (screen_buf->size + 1> SCREEN_BUF_MAX_SIZE)
{
ret = NULL;
return ret;
}
+
/*!
+ * todo メッセージは言語選択の関数マクロで何とかならんか?
* @brief スコア転送処理のメインルーチン
* @param creature_ptr プレーヤーへの参照ポインタ
* @return エラーコード
#endif
BUF *score;
- int sd;
- char seikakutmp[128];
-
score = buf_new();
+ char seikakutmp[128];
#ifdef JP
sprintf(seikakutmp, "%s%s", ap_ptr->title, (ap_ptr->no ? "の" : ""));
#else
Term_clear();
- while (1)
+ int sd;
+ while (TRUE)
{
char buff[160];
#ifdef JP