summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordeva <deva>2005-06-30 10:04:35 +0000
committerdeva <deva>2005-06-30 10:04:35 +0000
commit55c83847016699a18006f9f728076ab9cd2d873b (patch)
treef5570084298d4c5ebecddae6cc517eddab899802
parentbc40e65008f32b9b3117d8bb9893df03403a6115 (diff)
*** empty log message ***
-rw-r--r--src/img_encoder.cc23
-rw-r--r--src/mov_encoder_writer.cc5
2 files changed, 25 insertions, 3 deletions
diff --git a/src/img_encoder.cc b/src/img_encoder.cc
index 2412520..aa2ee46 100644
--- a/src/img_encoder.cc
+++ b/src/img_encoder.cc
@@ -39,6 +39,9 @@
/*
* $Log$
+ * Revision 1.11 2005/06/30 10:04:35 deva
+ * *** empty log message ***
+ *
* Revision 1.10 2005/06/19 20:04:43 deva
* ImgEncoder now uses the file class for output, through jpeg_mem_dest.
*
@@ -74,9 +77,10 @@ ImgEncoder::ImgEncoder(const char* cpr, Info *i)
string *server_root;
char birthmonth[3];
char date[32];
+ char encrypted_cpr[32];
// Get server root
- server_root = config->readString("server_root");
+ server_root = config->readString("server_image_root");
// Copy the bytes representing the birth month from the cpr
// [dd][mm][yy]-[nn][nn]
@@ -92,7 +96,22 @@ ImgEncoder::ImgEncoder(const char* cpr, Info *i)
ltime->tm_mon,
ltime->tm_mday);
- sprintf(fname, "%s/%s/%s/%s-%s-", server_root->c_str(), birthmonth, cpr, cpr, date);
+ // Create 'encrypted' cpr, reverse numbers, skip month, and subtract from 9
+ // [d1][d2][m1][m2][y1][y2]-[n1][n2][n3][n4]
+ // =>
+ // [9-n4][9-n3][9-n2][9-n1][9-y2][9-y1][9-d2][9-d1]
+ memset(encrypted_cpr, 0, sizeof(encrypted_cpr));
+ int p = strlen(cpr) - 1;
+ int cnt = 0;
+ while(p) {
+ encrypted_cpr[cnt] = cpr[p];
+ p--;
+ if(p == 2) p--;
+ if(cpr[p] == '-' || p == 3) p--;
+ cnt++;
+ }
+
+ sprintf(fname, "%s/%s/%s/%s-%s-", server_root->c_str(), birthmonth, encrypted_cpr, cpr, date);
file = new File(fname, "jpg", info);
}
diff --git a/src/mov_encoder_writer.cc b/src/mov_encoder_writer.cc
index 1c0fe1b..e1179b9 100644
--- a/src/mov_encoder_writer.cc
+++ b/src/mov_encoder_writer.cc
@@ -31,6 +31,9 @@
/*
* $Log$
+ * Revision 1.8 2005/06/30 10:04:35 deva
+ * *** empty log message ***
+ *
* Revision 1.7 2005/06/19 20:04:43 deva
* ImgEncoder now uses the file class for output, through jpeg_mem_dest.
*
@@ -91,7 +94,7 @@ MovEncoderWriter::MovEncoderWriter(const char* cpr,
char date[32];
// Get server root
- server_root = config->readString("server_root");
+ server_root = config->readString("server_movie_root");
// Copy the bytes representing the birth month from the cpr
// [dd][mm][yy]-[nn][nn]